| | |
| | | methods: { |
| | | //下面这些方法可以保留也可以删除 |
| | | onInit() { |
| | | |
| | | this.columns.forEach(x => { |
| | | if (x.field == "errorMessage") { |
| | | x.cellStyle = (row, rowIndex, columnIndex) => { |
| | | if (row.errorMessage == null||row.errorMessage=="") { |
| | | return { background: "White", color: "Black" } |
| | | } |
| | | else{ |
| | | return { background: "#FF4500", color: "Black" } |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | |
| | | //框架初始化配置前, |
| | | //示例:在按钮的最前面添加一个按钮 |
| | | this.buttons.unshift({ |
| | | //也可以用push或者splice方法来修改buttons数组 |
| | | name: '任务完成', //按钮名称 |
| | | icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon,vue3版本见element ui文档icon(注意不是element puls文档) |
| | | type: 'primary', //按钮样式vue2版本见iview文档button,vue3版本见element ui文档button |
| | | onClick: function () { |
| | | // this.$Message.success('点击了按钮'); |
| | | let TaskHandCompleteBtn=this.buttons.find(x=>x.value=='TaskHandComplete'); |
| | | if(TaskHandCompleteBtn){ |
| | | TaskHandCompleteBtn.onClick=function(){ |
| | | let row = this.$refs.table.getSelected() //获取选中的行 |
| | | if (row <= 0) { |
| | | //如果没有选中行 |
| | | this.$Message.error('请选择一行数据') |
| | | return |
| | | } |
| | | debugger; |
| | | let taskNum = row[0].taskNum |
| | | this.http.get(`/api/Task/CompleteTaskAsync?taskNum=${taskNum}`, {}).then((res) => { |
| | | this.http.get(`/api/Task/CompleteTaskAsync?taskNum=${taskNum}`, {}, "正在完成任务").then((res) => { |
| | | //示例:调用后台接口 |
| | | if (res.data.code === 200) { |
| | | this.$Message.success('任务完成') |
| | | if (res.status) { |
| | | this.$Message.success('任务完成'); |
| | | this.refresh(); |
| | | } else { |
| | | this.$Message.error(res.data.msg) //错误提示 |
| | | this.$Message.error(res.message) //错误提示 |
| | | this.refresh(); |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | //示例:在按钮的最前面添加一个按钮 |
| | | // this.buttons.unshift({ |
| | | // //也可以用push或者splice方法来修改buttons数组 |
| | | // name: '任务完成', //按钮名称 |
| | | // icon: 'el-icon-document', //按钮图标vue2版本见iview文档icon,vue3版本见element ui文档icon(注意不是element puls文档) |
| | | // type: 'primary', //按钮样式vue2版本见iview文档button,vue3版本见element ui文档button |
| | | // onClick: function () { |
| | | // // this.$Message.success('点击了按钮'); |
| | | // let row = this.$refs.table.getSelected() //获取选中的行 |
| | | // if (row <= 0) { |
| | | // //如果没有选中行 |
| | | // this.$Message.error('请选择一行数据') |
| | | // return |
| | | // } |
| | | // let taskNum = row[0].taskNum |
| | | // this.http.get(`/api/Task/CompleteTaskAsync?taskNum=${taskNum}`, {}, "正在完成任务").then((res) => { |
| | | // //示例:调用后台接口 |
| | | // if (res.status) { |
| | | // this.$Message.success('任务完成') |
| | | // } else { |
| | | // this.$Message.error(res.message) //错误提示 |
| | | // } |
| | | // }) |
| | | // } |
| | | // }) |
| | | |
| | | //示例:设置修改新建、编辑弹出框字段标签的长度 |
| | | this.boxOptions.labelWidth = 150 |
| | |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | //查询界面点击行事件 |
| | | this.$refs.table.$refs.table.toggleRowSelection(row) //单击行时选中当前行; |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row) //单击行时选中当前行; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | //点击编辑、新建按钮弹出框后,可以在此处写逻辑,如,从后台获取数据 |