{"remainingRequest":"D:\\jenkins\\workspace\\bbsl-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bbsl-fvue\\src\\views\\resIns\\components\\commonForm-dialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bbsl-fvue\\src\\views\\resIns\\components\\commonForm-dialog.vue","mtime":1684458239449},{"path":"D:\\jenkins\\workspace\\bbsl-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bbsl-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bbsl-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport dsmInsPosition from '@/api/resIns/dsmInsPosition.js'\r\nimport req from '@/request.js'\r\nexport default {\r\n name: 'deviceForm-dialog',\r\n props: {\r\n CommonFormDia: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n pId: {\r\n type: String,\r\n default: '',\r\n },\r\n },\r\n data() {\r\n return {\r\n //数据\r\n informations: {\r\n sel: null, //是否选中行\r\n\r\n rowData: [\r\n //一行的数据\r\n {field: 'content', title: '巡检对象结果异常描述'},\r\n ],\r\n data: [], //添加数据后展示的地\r\n },\r\n isSet: false, //切换状态\r\n total: 0,\r\n multipleSelection: [], //id\r\n rules: {\r\n content: [\r\n {\r\n required: true,\r\n message: '请输入巡检对象结果常用描述',\r\n trigger: 'blur',\r\n },\r\n ],\r\n },\r\n }\r\n },\r\n created() {\r\n // this.getDetailInfo()\r\n // this.getList()\r\n // this.getSysDict()\r\n this.getDeviant()\r\n },\r\n methods: {\r\n //获取数据\r\n getDeviant() {\r\n dsmInsPosition.deviant({positionId: this.pId}, (res) => {\r\n this.informations.data = res.value\r\n this.total = res.value.length\r\n this.informations.data.forEach((item) => {\r\n item.isSet = false\r\n })\r\n })\r\n },\r\n //读取表格数据\r\n readMasterUser() {\r\n //根据实际情况,自己改下啊\r\n this.informations.rowData.map((i) => {\r\n i.id = this.multipleSelection\r\n i.isSet = false //给后台返回数据添加`isSet`标识\r\n return i\r\n })\r\n },\r\n //添加\r\n addAcount() {\r\n //当我们第二次点击的时候,会判断是否为真,如果为真,表示没有填数据,弹出框\r\n //第一次点击的时候,data为空数据,是不会循环,直接跳过的。\r\n for (let i of this.informations.data) {\r\n //查找该数据,是否保存,如果没保存,就弹出框提示\r\n // console.log(this.informations.data)\r\n if (i.isSet) return this.$message.warning('请先保存当前编辑项')\r\n }\r\n this.conuntNum++\r\n let j = {\r\n content: '',\r\n // sn: 0,\r\n isSet: true,\r\n positionId: this.pId,\r\n }\r\n this.informations.data.push(j)\r\n this.informations.sel = JSON.parse(JSON.stringify(j))\r\n },\r\n //保存\r\n //点击保存或者修改\r\n pwdChange(row, index, cg) {\r\n // 点击修改 判断是否已经保存所有操作\r\n for (let i of this.informations.data) {\r\n if (i.isSet && i.id != row.id) {\r\n this.$message.warning('请先保存当前编辑项')\r\n return false\r\n }\r\n }\r\n //提交数据\r\n if (row.isSet) {\r\n if (!row.id) {\r\n console.log('新数据')\r\n let data = JSON.parse(JSON.stringify(this.informations.sel))\r\n console.log(this.informations.sel['content'])\r\n // data.sn = index + 1\r\n //上传数据\r\n dsmInsPosition.addAbnormal(data, (response) => {\r\n if (response.state) {\r\n this.$message({\r\n type: 'success',\r\n message: '新增成功',\r\n duration: 2000,\r\n })\r\n this.$emit('refList')\r\n this.$set(this.informations.data)\r\n row.isSet = false\r\n this.getDeviant()\r\n }\r\n })\r\n } else {\r\n console.log('更新数据')\r\n //修改数据\r\n let data = JSON.parse(JSON.stringify(this.informations.sel))\r\n dsmInsPosition.Revise(data, (response) => {\r\n if (response.state) {\r\n console.log('更新成功', data, this.informations.data)\r\n this.$set(this.informations.data)\r\n row.isSet = false\r\n this.getDeviant()\r\n }\r\n })\r\n }\r\n //然后这边重新读取表格数据\r\n // this.readMasterUser()\r\n } else {\r\n row.isSet = false\r\n this.informations.sel = JSON.parse(JSON.stringify(row))\r\n this.informations.data[index].isSet = true\r\n this.$set(this.informations.data)\r\n row.isSet = true\r\n // row.isSet = true\r\n // this.informations.data[index].isSet = true\r\n }\r\n },\r\n //关闭\r\n // closeFormDiao() {\r\n // this.showFormDia = false\r\n // this.getDeviant()\r\n // },\r\n //删除\r\n deletAcount() {\r\n let multipleSelection = []\r\n\r\n this.multipleSelection.forEach((item) => {\r\n if (item.content) {\r\n multipleSelection.push(item.id)\r\n } else {\r\n this.$confirm('是否取消操作?', '提示', {\r\n confirmButtonText: '确 定',\r\n cancelButtonText: '取 消',\r\n type: 'warning',\r\n }).then(() => {\r\n this.informations.data.pop();\r\n // this.getDeviant()\r\n })\r\n\r\n multipleSelection = []\r\n }\r\n })\r\n if (multipleSelection.length) {\r\n this.$confirm('确定删除选中数据?', '提示', {\r\n confirmButtonText: '确 定',\r\n cancelButtonText: '取 消',\r\n type: 'warning',\r\n })\r\n .then(() => {\r\n dsmInsPosition\r\n .removeAbn(multipleSelection, (res) => {\r\n if (res.state) {\r\n this.$notify({\r\n type: 'success',\r\n message: '删除成功',\r\n duration: 2000,\r\n })\r\n this.$refs.multipleSelection.clearSelection()\r\n this.getDeviant()\r\n }\r\n })\r\n .catch((res) => {\r\n this.$notify({\r\n type: 'error',\r\n message: res.message,\r\n duration: 2000,\r\n offset: 80,\r\n })\r\n this.getDeviant()\r\n })\r\n })\r\n .catch(() => {})\r\n }\r\n },\r\n arrayRepeat(array1, array2) {\r\n var result = []\r\n for (var i = 0; i < array2.length; i++) {\r\n var obj = array2[i]\r\n var num = obj.ident\r\n var isExist = false\r\n for (var j = 0; j < array1.length; j++) {\r\n var aj = array1[j]\r\n var n = aj.ident\r\n if (n === num) {\r\n isExist = true\r\n break\r\n }\r\n }\r\n if (!isExist) {\r\n result.push(obj)\r\n }\r\n }\r\n return result\r\n },\r\n //指定一个key标识这一行的数据\r\n getRowKey(row) {\r\n return row.id\r\n },\r\n handleChanges(val) {\r\n this.multipleSelection = val.map((item, index) => {\r\n return item\r\n })\r\n },\r\n\r\n handleClose() {\r\n this.params = {\r\n content: null,\r\n }\r\n this.$emit('closeFormDiao')\r\n },\r\n // goInfo(e) {\r\n // dsmInsPosition.addAbnormal(\r\n // {...this.informations.data[sn]},\r\n // (response) => {\r\n // if (response.state) {\r\n // this.$notify({\r\n // type: 'success',\r\n // message: '新增成功',\r\n // duration: 2000,\r\n // // offset: 80\r\n // })\r\n // this.$emit('closeFormDiao')\r\n // this.$emit('refList')\r\n // } else {\r\n // }\r\n // }\r\n // )\r\n\r\n // if (this.title === '修改') {\r\n // dsmInsPosition.upData(this.params, (response) => {\r\n // if (response.state) {\r\n // this.$notify({\r\n // type: 'success',\r\n // message: '修改成功',\r\n // duration: 2000,\r\n // // offset: 80\r\n // })\r\n // this.$emit('closeFormDiao')\r\n // this.$emit('refList')\r\n // } else {\r\n // }\r\n // })\r\n // },\r\n // } else {\r\n // return false\r\n // }\r\n },\r\n}\r\n",null]}