| | |
| | | :close-on-click-modal="false" |
| | | top="8vh" |
| | | @closed="handleClose" |
| | | @close="handleClose" |
| | | > |
| | | <!-- @close="handleClose"--> |
| | | <div> |
| | | <i class="el-icon-s-operation" style="color:#42b983;margin: -20px 10px 20px 0" />设备点检标准信息 |
| | | </div> |
| | |
| | | import { getCookie } from '@/utils/auth' |
| | | import ImportPicker from '@/components/ImportPicker' |
| | | import { |
| | | AddUpdateDeviceCheckStandArd, |
| | | AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned, |
| | | DeviceCheckItemSelect, |
| | | DeviceCheckStandArdSearch, |
| | | ViewDeviceCheckStanedSearch |
| | |
| | | ] |
| | | }, |
| | | tableDataDialog: [], // 表格数据 |
| | | tableDataDialogSelected: [], // 已选code |
| | | // tableDataDialogSelected: [], // 已选code |
| | | checkItemSelectArr: [], |
| | | |
| | | checkItemIsCancel: true, |
| | | dialogVisibleEqp: false, |
| | | |
| | | dialogFormEqp: { |
| | |
| | | mounted() { |
| | | window.addEventListener('resize', this.getHeight) |
| | | this.getHeight() |
| | | |
| | | this.getDeviceCheckItemSelect() |
| | | }, |
| | | methods: { |
| | | async getDeviceCheckStandArdSearch() { |
| | |
| | | }, |
| | | // 重置 |
| | | reset() { |
| | | this.form.OrgCode = '' |
| | | this.form.OrgName = '' |
| | | this.form.OrgType = '' |
| | | this.form.UserName = '' |
| | | this.form.checkstandcode = '' |
| | | this.form.checkstandname = '' |
| | | this.form.checkcontr = '' |
| | | this.getDeviceCheckStandArdSearch() |
| | | }, |
| | | |
| | |
| | | add(operation) { |
| | | this.operation = operation |
| | | this.dialogVisible = true |
| | | this.getDeviceCheckItemSelect() |
| | | // this.getDeviceCheckItemSelect() |
| | | this.$nextTick(() => { |
| | | this.$refs.tableDataDialogRef.doLayout() |
| | | }) |
| | | }, |
| | | // 修改按钮 |
| | | edit(operation, row) { |
| | | // this.getDeviceCheckItemSelect() |
| | | this.operation = operation |
| | | this.getViewDeviceCheckStanedSearch(row.code) |
| | | this.dialogVisible = true |
| | | this.getDeviceCheckItemSelect() |
| | | |
| | | this.$nextTick(() => { |
| | | this.$refs.tableDataDialogRef.doLayout() |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.dialogForm.code = row.code |
| | | this.dialogForm.name = row.name |
| | | this.dialogForm.enable = row.enable |
| | | this.dialogForm.description = row.description |
| | | // this.$nextTick(() => { |
| | | // this.dialogForm.code = row.code |
| | | // this.dialogForm.name = row.name |
| | | // this.dialogForm.enable = row.enable |
| | | // this.dialogForm.description = row.description |
| | | // }) |
| | | }, |
| | | // 修改前请求接口 |
| | | async getViewDeviceCheckStanedSearch(checkstand_code) { |
| | | const { data: res } = await ViewDeviceCheckStanedSearch({ checkstand_code }) |
| | | this.tableDataDialog = res.Data |
| | | |
| | | this.dialogForm.code = res.code |
| | | this.dialogForm.name = res.name |
| | | this.dialogForm.enable = res.enable |
| | | this.dialogForm.description = res.description |
| | | |
| | | this.tableDataDialog.forEach(item => { |
| | | item.isVisible = 0 |
| | | item.checkitem_code = item.code |
| | | item.checkitem_name = item.name |
| | | item.checkitem_descr = item.chkdesc |
| | | }) |
| | | |
| | | this.checkItemSelectArr = [...this.checkItemSelectArr].filter(x => [...this.tableDataDialog].every(y => y.checkitem_code !== x.code)) |
| | | }, |
| | | // 删除按钮 |
| | | async del(row) { |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | DeleteOrganization({ orgid: row.code }).then(res => { |
| | | DeleteDeviceCheckStaned({ checkstand_code: row.code }).then(res => { |
| | | if (res.code === '200') { |
| | | this.$message.success('删除成功!') |
| | | this.getDeviceCheckStandArdSearch() |
| | |
| | | this.$message.info('已取消删除') |
| | | }) |
| | | }, |
| | | // 修改前请求接口 |
| | | // async getViewDeviceCheckStanedSearch(checkstand_code) { |
| | | // const { data: res } = await ViewDeviceCheckStanedSearch() |
| | | // }, |
| | | |
| | | // 对话框关闭事件 |
| | | handleClose() { |
| | | this.dialogForm.code = '' |
| | |
| | | this.dialogForm.enable = 'Y' |
| | | this.dialogForm.description = '' |
| | | this.tableDataDialog = [] |
| | | this.getDeviceCheckItemSelect() |
| | | this.$refs.dialogForm.clearValidate() |
| | | }, |
| | | // 对话框取消 |
| | |
| | | dialogVisibleConfirm() { |
| | | this.$refs.dialogForm.validate(valid => { |
| | | if (valid) { |
| | | // this.tableDataDialog.forEach((item, index) => { // 去掉正在编辑且是空checkitem_code |
| | | // if (item.isVisible === 1 && item.checkitem_code === '') { |
| | | // this.tableDataDialog.splice(index, 1) |
| | | // } |
| | | // }) |
| | | |
| | | this.tableDataDialog.filter(item => item.checkitem_code !== '') |
| | | |
| | | let Data = [] |
| | | // 数组中对象相同的去重 |
| | | Data = this.tableDataDialog.filter((currentValue, currentIndex, selfArr) => { |
| | |
| | | row.checkitem_descr = res.description |
| | | row.checkitem_code = res.code |
| | | row.checkitem_name = res.name |
| | | // row.checkitem_descr = this.checkItemSelectArr.find(item => { |
| | | // return item.code === val || item.name === val |
| | | // }).description |
| | | // |
| | | // row.checkitem_code = this.checkItemSelectArr.find(item => { |
| | | // return item.code === val || item.name === val |
| | | // }).code |
| | | // row.checkitem_name = this.checkItemSelectArr.find(item => { |
| | | // return item.code === val || item.name === val |
| | | // }).name |
| | | }, |
| | | // 新增行 |
| | | addRow() { |
| | |
| | | cycle: 'D', |
| | | isVisible: 1 |
| | | }) |
| | | |
| | | this.checkItemIsCancel = false |
| | | }, |
| | | editRow(row) { |
| | | this.tableDataDialogSelected.forEach((item, index) => { |
| | | if (item === row.checkitem_code) { |
| | | this.tableDataDialogSelected.splice(index, 1) |
| | | let flag = false |
| | | this.tableDataDialog.forEach((item, index) => { |
| | | if (item.isVisible === 1) { |
| | | flag = true |
| | | } |
| | | }) |
| | | if (flag) { |
| | | return this.$message.info('请先确认或取消其它行!') |
| | | } |
| | | |
| | | this.checkItemIsCancel = false |
| | | this.checkItemSelectArr.splice(0, 0, { |
| | | code: row.checkitem_code, |
| | | name: row.checkitem_name, |
| | | description: row.checkitem_descr |
| | | }) |
| | | |
| | | this.tableDataDialog.forEach((item, index) => { |
| | |
| | | }) |
| | | }, |
| | | delRow(row) { |
| | | console.log(row) |
| | | this.checkItemSelectArr.splice(0, 0, { |
| | | code: row.checkitem_code, |
| | | name: row.checkitem_name, |
| | | description: row.checkitem_descr |
| | | }) |
| | | this.tableDataDialog.forEach((item, index) => { |
| | | if (item.checkitem_code === row.checkitem_code) { |
| | | this.tableDataDialog.splice(index, 1) |
| | | } |
| | | }) |
| | | |
| | | this.tableDataDialogSelected.forEach((item, index) => { |
| | | if (item === row.checkitem_code) { |
| | | this.tableDataDialogSelected.splice(index, 1) |
| | | }, |
| | | saveRow(row) { |
| | | if (row.checkitem_code === '' && row.checkitem_name === '') { |
| | | return this.$message.info('点检部位不能为空!') |
| | | } |
| | | row.isVisible = 0 |
| | | this.checkItemSelectArr.forEach((item, index) => { |
| | | if (item.code === row.checkitem_code) { |
| | | this.checkItemSelectArr.splice(index, 1) |
| | | } |
| | | }) |
| | | }, |
| | | saveRow(row) { |
| | | if (this.tableDataDialogSelected.includes(row.checkitem_code)) { |
| | | return this.$message.info('点检部位不能选择相同!') |
| | | } |
| | | this.tableDataDialogSelected.push(row.checkitem_code) |
| | | row.isVisible = 0 |
| | | console.log(this.tableDataDialog) |
| | | }, |
| | | cancelRow(row) { |
| | | // this.checkItemSelectArr.forEach((item, index) => { |
| | | // if (item.code === row.checkitem_code) { |
| | | if (this.checkItemIsCancel) { |
| | | this.checkItemSelectArr.splice(0, 0, { |
| | | code: row.checkitem_code, |
| | | name: row.checkitem_name, |
| | | description: row.checkitem_descr |
| | | }) |
| | | } |
| | | this.JYIsCancel = true |
| | | // } |
| | | // }) |
| | | |
| | | this.tableDataDialog.forEach((item, index) => { |
| | | if (item.checkitem_code === row.checkitem_code && item.isVisible === 1) { |
| | | console.log(item) |
| | | row.isVisible = 0 |
| | | this.tableDataDialog.splice(index, 1) |
| | | } |