/*****************************************************************************************
|
** Author:jxx 2022
|
** QQ:283591387
|
**完整文档见:http://v2.volcore.xyz/document/api 【代码生成页面ViewGrid】
|
**常用示例见:http://v2.volcore.xyz/document/vueDev
|
**后台操作见:http://v2.volcore.xyz/document/netCoreDev
|
*****************************************************************************************/
|
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
|
|
// import gridHeader from "./demo_Product/Dt_BillGroupStockDetail.vue";
|
// import gridHeader from './extend/printView.vue'
|
import gridBody from './extend/Remark.vue'
|
let extension = {
|
components: {
|
//查询界面扩展组件
|
gridHeader: '',
|
gridBody: gridBody,
|
gridFooter: '',
|
//新建、编辑弹出框扩展组件
|
modelHeader: '',
|
modelBody: '',
|
modelFooter: ''
|
},
|
tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写)
|
buttons: { view: [], box: [], detail: [] }, //扩展的按钮
|
methods: {
|
//下面这些方法可以保留也可以删除
|
onInit() {
|
// this.detailOptions.buttons.unshift({
|
// name: '其他出库', //按钮名称
|
// icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon,vue3版本见element ui文档icon(注意不是element puls文档)
|
// type: 'primary',
|
// onClick: function () {
|
// this.$confirm('是否其他出库', "警告你正在使用其他出库", {
|
// confirmButtonText: '确定',
|
// cancelButtonText: '取消',
|
// type: 'warning',
|
// center: true
|
// }).then(() => {
|
// this.http.post(`/api/Task/OtherOutBoundTaskAsync`, row, "正在完成任务").then((res) => {
|
// //示例:调用后台接口
|
// if (res.status) {
|
// this.$Message.success('任务完成')
|
// } else {
|
// this.$Message.error(res.message) //错误提示
|
// }
|
// })
|
// })
|
// }
|
// });
|
var DoubleTrayBtn = this.buttons.find(x => x.value == "DoubleTray");
|
if (DoubleTrayBtn != null) {
|
DoubleTrayBtn.onClick = () => {
|
let rows = this.$refs.table.getSelected();
|
if (rows.length == 0) return this.$error("请选择数据!");
|
if (rows.length > 1) return this.$error("请选择数据!");
|
this.http.post(`/api/Task/OutBoundTaskAsync?palletCode=${rows[0].palletCode}&remark=${""}&doubleTray=${1}`, {}, '数据处理中...')
|
.then((x) => {
|
if (x.status) {
|
this.$Message.success('成功.');
|
this.refresh();
|
} else {
|
return this.$error(x.message);
|
}
|
});
|
}
|
}
|
|
this.boxButtons.push({
|
name: '确定出库', //按钮名称
|
type: 'danger',
|
icon: 'el-icon-check',
|
disabled: false,
|
plain: true,
|
onClick: function () {
|
if (this.editFormFields.remark == '其他出库') {
|
this.$confirm('是否其他出库', '警告', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
center: true,
|
customClass: 'large-text-confirm'
|
}).then(() => {
|
this.http
|
.post(
|
`/api/Task/OtherOutBoundTaskAsync`,
|
this.$refs.detail.rowData,
|
'正在生成出库任务'
|
)
|
.then((res) => {
|
if (res.status) {
|
this.$Message.success(res.message)
|
this.boxModel = false
|
this.refresh()
|
} else {
|
this.$Message.error(res.message) //错误提示
|
}
|
})
|
})
|
} else {
|
this.$confirm('是否调拨出库', '警告', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
center: true,
|
customClass: 'large-text-confirm'
|
}).then(() => {
|
this.http
|
.post(
|
`/api/Task/HandAllocateOutBoundTaskAsync`,
|
this.$refs.detail.rowData,
|
'正在生成出库任务'
|
)
|
.then((res) => {
|
if (res.status) {
|
this.$Message.success(res.message)
|
this.boxModel = false
|
this.refresh()
|
} else {
|
this.$Message.error(res.message) //错误提示
|
}
|
})
|
})
|
}
|
}
|
})
|
this.boxButtons.push({
|
name: '打印二维码', //按钮名称
|
type: 'primary',
|
icon: 'el-icon-check',
|
disabled: false,
|
plain: true,
|
onClick: function () {
|
let rows = this.$refs.detail.getSelected()
|
if (rows.length == 0) return this.$error("请选择数据!");
|
let orderNos = rows.map(x => {
|
return x.orderNo
|
})
|
this.$confirm('是否打印单据', '警告', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
center: true,
|
customClass: 'large-text-confirm'
|
}).then(() => {
|
this.http
|
.post(
|
`/api/StockInfo/PrintOrder`,
|
orderNos,
|
'正在打印'
|
)
|
.then((res) => {
|
if (res.status) {
|
this.$Message.success(res.message)
|
this.boxModel = false
|
this.refresh()
|
} else {
|
this.$Message.error(res.message) //错误提示
|
}
|
})
|
})
|
}
|
})
|
this.columns.push({
|
title: '操作',
|
field: '操作',
|
width: 250,
|
align: 'center', // 'center',
|
render: (h, { row, column, index }) => {
|
return (
|
<div>
|
<el-button
|
onClick={($e) => {
|
; (row.remark = '其他出库'), this.linkDataNew(row, '其他出库')
|
}}
|
type="primary"
|
>
|
其他出库
|
</el-button>
|
|
<el-button
|
onClick={($e) => {
|
; (row.remark = '调拨出库'), this.linkDataNew(row, '调拨出库')
|
}}
|
type="success"
|
>
|
调拨出库
|
</el-button>
|
|
<el-button
|
onClick={($e) => {
|
this.$refs.gridBody.open(row.palletCode)
|
}}
|
type="warning"
|
>
|
盘点出库
|
</el-button>
|
</div>
|
)
|
}
|
})
|
//示例:设置修改新建、编辑弹出框字段标签的长度
|
this.boxOptions.labelWidth = 150
|
this.buttons.forEach((btn) => {
|
if (btn.name == '编辑') {
|
btn.hidden = true
|
}
|
})
|
this.boxButtons.forEach((btn) => {
|
if (btn.name == '保 存') {
|
btn.hidden = true
|
}
|
})
|
this.columns.forEach((column) => {
|
if (column.field == 'floor') {
|
const floorMap = {
|
'1F': '一楼',
|
'2F': '二楼'
|
}
|
column.formatter = (row) => {
|
return floorMap[row?.locationInfo?.floor] || ''
|
}
|
}
|
if (column.field == 'areaId') {
|
const floorMap = {
|
1: '一楼堆垛机区域',
|
2: '一楼AGV出库缓存区',
|
3: '一楼AGV立库缓存区',
|
4: '一楼AGV入库缓存区',
|
5: '二楼B4-G4缓存区',
|
6: '二楼B5-G5缓存区'
|
}
|
column.formatter = (row) => {
|
return floorMap[row?.locationInfo?.areaId] || ''
|
}
|
}
|
if (column.field == 'locationStatus') {
|
const statusMap = {
|
0: '空闲',
|
1: '锁定',
|
2: '有货',
|
3: '有货禁用',
|
4: '无货禁用'
|
}
|
column.formatter = (row) => {
|
return statusMap[row?.locationInfo?.locationStatus] || ''
|
}
|
}
|
})
|
},
|
onInited() {
|
//框架初始化配置后
|
//如果要配置明细表,在此方法操作
|
this.detailOptions.columns.forEach((column) => { })
|
},
|
searchBefore(param) {
|
//界面查询前,可以给param.wheres添加查询参数
|
//返回false,则不会执行查询
|
return true
|
},
|
searchAfter(result) {
|
return true
|
},
|
addBefore(formData) {
|
//新建保存前formData为对象,包括明细表,可以给给表单设置值,自己输出看formData的值
|
return true
|
},
|
updateBefore(formData) {
|
//编辑保存前formData为对象,包括明细表、删除行的Id
|
return true
|
},
|
rowClick({ row, column, event }) {
|
//查询界面点击行事件
|
//this.$refs.table.$refs.table.toggleRowSelection(row) //单击行时选中当前行;
|
},
|
modelOpenAfter(row) {
|
const isAdd = this.currentAction == 'Add' //判断是否为新建操作
|
//隐藏明细表按钮
|
// boxButtons
|
this.detailOptions.buttons.forEach((btn) => {
|
if (btn.name == '添加行') {
|
btn.hidden = true
|
//或者设置只读
|
//btn.readonly=true;
|
}
|
})
|
|
const isDel = this.currentAction == 'Add' //判断是否为新建操作
|
//隐藏明细表按钮
|
this.detailOptions.buttons.forEach((btn) => {
|
if (btn.name == '删除行') {
|
btn.hidden = true
|
//或者设置只读
|
//btn.readonly=true;
|
}
|
})
|
this.detailOptions.buttons.forEach((btn) => {
|
if (btn.name == '导入') {
|
btn.hidden = true
|
//或者设置只读
|
//btn.readonly=true;
|
}
|
})
|
this.detailOptions.buttons.forEach((btn) => {
|
if (btn.name == '导出') {
|
btn.hidden = true
|
//或者设置只读
|
//btn.readonly=true;
|
}
|
})
|
//点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据
|
//(1)判断是编辑还是新建操作: this.currentAction=='Add';
|
//(2)给弹出框设置默认值
|
//(3)this.editFormFields.字段='xxx';
|
//如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值
|
//看不懂就把输出看:console.log(this.editFormOptions)
|
}
|
}
|
}
|
export default extension
|