//此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js) let extension = { components: {//动态扩充组件或组件路径 //表单header、content、footer对应位置扩充的组件 gridHeader: '',//{ template: "
扩展组xx件
" }, gridBody: '', gridFooter: '', //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件 modelHeader: '', modelBody: '', modelFooter: '' }, buttons: { view: [], box: [], detail: [] },//扩展的按钮 methods: {//事件扩展 onInit() { // this.columns.push({ field: "操作", title: "操作", align: "center", width: 120, render: this.getRender() }) this.buttons.splice(2, 0, { name: "锁定", icon: 'md-lock', hidden: false, type: 'success', onClick: function () { let rows = this.$refs.table.getSelected(); if (rows.length == 0) return this.$Message.error("请选择要锁定的行!"); let delKeys = rows.map(x => { return x[this.table.key]; }); if (!delKeys || delKeys.length == 0) return this.$Message.error("没有获取要锁定的行数据!"); // console.log(delKeys); // console.log(rows); let tigger = false; this.$confirm("确认要锁定选择的货位吗?", "锁定警告!", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", center: true, }).then(() => { let params = { MainData: null, DetailData: null, DelKeys: delKeys, Extra: true } this.http.post("/api/dt_locationinfo/DoLocationLockOperate", params, "正在锁定数据....").then(x => { if (!x.status) return this.$Message.error(x.message); this.$Message.success("锁定成功!"); this.refresh(); }); }); } }); this.buttons.splice(3, 0, { name: "取消锁定", icon: 'md-unlock', hidden: false, type: 'warning', onClick: function () { let rows = this.$refs.table.getSelected(); if (rows.length == 0) return this.$error("请选择要取消锁定的行!"); let delKeys = rows.map(x => { return x[this.table.key]; }); if (!delKeys || delKeys.length == 0) return this.$error("没有获取要取消锁定的行数据!"); // console.log(delKeys); // console.log(rows); let tigger = false; this.$confirm("确认要取消锁定选择的货位吗?", "取消锁定警告!", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", center: true, }).then(() => { let params = { MainData: null, DetailData: null, DelKeys: delKeys, Extra: false } this.http.post("/api/dt_locationinfo/DoLocationLockOperate", params, "正在取消锁定数据....").then(x => { if (!x.status) return this.$Message.error(x.message); this.$Message.success("取消锁定成功!"); this.refresh(); }); }); } }); }, getRender() {//生成最后一列操作列 return (h, { row, column, index }) => { return h("div", { style: { color: '#0c83ff', 'font-size': '13px', cursor: 'pointer' } }, [ h( "a", { props: {}, style: { "margin-left": "9px", "border-bottom": "1px solid" }, onClick: (e) => { e.stopPropagation(); this.$refs.table.$refs.table.clearSelection(); //设置当前后选中 this.$refs.table.$refs.table.toggleRowSelection(row); let title = row["location_islocked"] == '0' ? '锁定' : '解锁'; this.$confirm("确认要" + title + "选择的数据吗?", "警告", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning", center: true, }).then(() => { let param = { MainData: row, DetailData: null, DelKeys: null }; this.http.post("/api/Dt_locationinfo/UpdateState", row, '状态修改中...').then(data => { if (data.status) { this.$Message.success((row["location_islocked"] == '0' ? '锁定' : '解锁') + '成功!'); this.refresh(); } else { this.$Message.error((row["location_islocked"] == '0' ? '锁定' : '解锁') + '成功!'); } }); }); } }, "锁定/解锁" ) ]); }; }, } }; export default extension;