//author:jxx //此处是对表单的方法,组件,权限操作按钮等进行任意扩展(方法扩展可参照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.pagination.order = "asc"; this.columns.forEach(row => { if (row.field == "stationCode") { row.sort = true; } else if (row.field == "lastInTime") { row.sort = true; } if (row.field == "getStatus") { row.getColor = (row, column) => { if (row.getStatus == -1) { return "info"; } else if (row.getStatus == 0) { return "success"; } else if (row.getStatus == 1) { return "waring"; } } } else if (row.field == "enable") { row.getColor = (row, column) => { if (row.enable == 1) { return "success"; } else { return "error"; } } } }) this.buttons.splice(1, 0, { name: "取消禁用", icon: 'md-refresh', type: 'primary', onClick: function () { let rows = this.$refs.table.getSelected(); if (rows.length == 0) return this.$error("请选择要取消禁用的数据"); this.$confirm('确认要取消禁用吗?', '警告', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', center: true }).then(() => { let data = []; let parm = { "data": data, "type": "1" } rows.forEach(t => data.push(t.id)) this.http.post("/api/dt_stationinfo/SetStationEnable", parm, "取消禁用中...").then(x => { if (x.status) { this.$Message.success("取消禁用成功!"); this.refresh(); } else { this.$Message.error(x.message); } }) }); } }) this.buttons.splice(1, 0, { name: "禁用", icon: 'md-refresh', type: 'danger', onClick: function () { let rows = this.$refs.table.getSelected(); if (rows.length == 0) return this.$error("请选择要禁用的数据"); this.$confirm('确认要禁用吗?', '警告', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning', center: true }).then(() => { let data = []; let parm = { "data": data, "type": "0" } rows.forEach(t => data.push(t.id)) this.http.post("/api/dt_stationinfo/SetStationEnable", parm, "锁定中...").then(x => { if (x.status) { this.$Message.success("禁用成功!"); this.refresh(); } else { this.$Message.error(x.message); } }) }); } }) } } }; export default extension;