//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码 import gridBody from './extend/LocationStatus.vue' let extension = { components: { //查询界面扩展组件 gridHeader: '', gridBody: gridBody, gridFooter: '', //新建、编辑弹出框扩展组件 modelHeader: '', modelBody: '', modelFooter: '' }, tableAction: '', //指定某张表的权限(这里填写表名,默认不用填写) buttons: { view: [], box: [], detail: [] }, //扩展的按钮 methods: { //下面这些方法可以保留也可以删除 onInit() { //第二个按钮后面添加按钮组 // this.buttons.splice(2, 1, { // name: '禁用状态', // type: 'primary', // value:"", // plain: true, // data: [ // { // name: '正常', // icon: 'el-icon-plus', // onClick: () => { // this.$message.info('正常'); // } // }, // { // name: '只入', // icon: 'el-icon-zoom-out', // onClick: () => { // this.$message.info('只入'); // } // } // ] // }); let params = { // MethodName: null, // Remark: null, Extra: null, DelKeys: null } let enableStatusBtn = this.buttons.find(x => x.value == 'enableStatus'); if (enableStatusBtn) { enableStatusBtn.data = [ { name: '正常', icon: 'el-icon-circle-check', onClick: () => { // this.$message.info('正常'); // params.Remark = "正常"; params.Extra = 0 // this.$message.info(params.Remark); this.enableStatus(params, "正常") } }, { name: '只入', icon: 'el-icon-circle-plus-outline', onClick: () => { // let params = { // MethodName: "LocationDisableStatus", // Remark: "禁用", // } // this.enableStatus(params) params.Extra = 1 this.enableStatus(params, "只入") } }, { name: '只出', icon: 'el-icon-remove-outline', onClick:()=>{ this.$message.info('只出'); params.Extra = 2 this.enableStatus(params, "只出") } }, { name: '禁用', icon: 'el-icon-circle-close', onClick:()=>{ params.Extra = 3 this.enableStatus(params, "禁用") } } ] } let enableBtn = this.buttons.find(x => x.value == 'Enable'); if (enableBtn) { enableBtn.onClick = function () { this.$message.success('自定义按钮点击事件'); // let params = { // MethodName: "LocationEnableStatus", // Remark: "启用", // keys: null // } // this.enableStatus(params) } } let disableBtn = this.buttons.find(x => x.value == 'Disable'); if (disableBtn) { disableBtn.onClick = function () { // let params = { // MethodName: "LocationDisableStatus", // Remark: "禁用", // keys: null // } // this.enableStatus(params) } } this.columns.push({ field: '操作', title: '操作', width: 90, fixed: 'right', align: 'center', formatter: (row) => { return ( '查看明细' ); }, click: (row) => { // this.$message.success('自定义按钮点击事件'); this.$refs.gridBody.open(row); } }); }, enableStatus(params, Remark) { let rows = this.$refs.table.getSelected(); if (rows.length == 0) return this.$error("请选择货位!"); params.DelKeys = rows.map(x => { return x[this.table.key]; }); if (!params.DelKeys || params.DelKeys.Length == 0) return this.$error("未获取到货位信息!"); this.$confirm("是否确认要将货位【禁用状态】设置为" + Remark + "?", "提示", { // iconClass:"el-icon-success",//el-icon-remove自定义图标样式 confirmButtonText: "确认",//确认按钮文字更换 cancelButtonText: "取消",//取消按钮文字更换 // cancelBtn:"取消",//取消按钮文字更换 showClose: true,//是否显示右上角关闭按钮 type: "warning",//提示类型 success:成功/info:信息/warning:警告/error:报错 }).then(() => { this.http.post("api/LocationInfo/UpdateEnableStatus", params, "正在设置货位....").then(x => { if (!x.status) return this.$error(x.message); this.$success("货位【禁用状态】设置为" + Remark + "成功!"); this.refresh(); }); }) }, onInited() { //框架初始化配置后 //如果要配置明细表,在此方法操作 //this.detailOptions.columns.forEach(column=>{ }); }, searchBefore(param) { //界面查询前,可以给param.wheres添加查询参数 //返回false,则不会执行查询 return true; }, searchAfter(result) { //查询后,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) { //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据 //(1)判断是编辑还是新建操作: this.currentAction=='Add'; //(2)给弹出框设置默认值 //(3)this.editFormFields.字段='xxx'; //如果需要给下拉框设置默认值,请遍历this.editFormOptions找到字段配置对应data属性的key值 //看不懂就把输出看:console.log(this.editFormOptions) } } }; export default extension;