| | |
| | | <span style="width: 80px">A仪器名称:</span> |
| | | <el-select v-model="form.adeviceId" :disabled="currentStep !== 0" class="table_input" clearable filterable |
| | | placeholder="设备名称" size="small" style="width:200px" @change="(val) => changeMachineName(val, 'A')"> |
| | | <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> |
| | | <el-option v-for="item in equipOptions" :key="item.id" :label="item.label" :value="item.id"> |
| | | {{ item.label + '-' + item.value }} |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <span style="width: 80px">B仪器名称:</span> |
| | | <el-select v-model="form.bdeviceId" :disabled="currentStep !== 0" class="table_input" clearable filterable |
| | | placeholder="设备名称" size="small" style="width:200px" @change="(val) => changeMachineName(val, 'B')"> |
| | | <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> |
| | | <el-option v-for="item in equipOptions" :key="item.id" :label="item.label" :value="item.id"> |
| | | {{ item.label + '-' + item.value }} |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <span style="width: 80px">C仪器名称:</span> |
| | | <el-select v-model="form.cdeviceId" :disabled="currentStep !== 0" class="table_input" clearable filterable |
| | | placeholder="设备名称" size="small" style="width:200px" @change="(val) => changeMachineName(val, 'C')"> |
| | | <el-option v-for="item in equipOptions" :key="item.value" :label="item.label" :value="item.id"> |
| | | <el-option v-for="item in equipOptions" :key="item.id" :label="item.label" :value="item.id"> |
| | | {{ item.label + '-' + item.value }} |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <el-button v-if="currentStep === 0" size="small" type="primary" @click="addTableRow">添加</el-button> |
| | | </div> |
| | | <div style="margin: 10px 0"> |
| | | <el-table ref="yearTable" :data="recordContrastDetailsList" height="300px" style="width: 100% ;" |
| | | <el-table ref="yearTable" :data="form.recordContrastDetailsList" height="300px" style="width: 100% ;" |
| | | border> |
| | | <el-table-column align="center" header-align="center" label="序号" type="index" width="60"></el-table-column> |
| | | <el-table-column label="核查项目" min-width="170" prop="checkItems"> |
| | |
| | | </div> |
| | | </div> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="resetForm">取 消</el-button> |
| | | <el-button @click="handleCancel">取 消</el-button> |
| | | <el-button v-if="currentStep === 0 && userId == checkChargerUserId" :loading="submitFormLoading" type="primary" @click="submitCheck">确 |
| | | 定</el-button> |
| | | <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" @click="examine(0)">不通过</el-button> |
| | |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | import { selectUserCondition } from "@/api/business/inspectionTask"; |
| | | import {mapGetters} from "@/utils/store-compat"; |
| | | import draftSave from '@/mixins/draftSave' |
| | | export default { |
| | | name: "equipment-check", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {}, |
| | | mixins: [draftSave], |
| | | data() { |
| | | // 这里存放数据 |
| | | return { |
| | |
| | | planDetailsId: '', |
| | | }, |
| | | equipOptions: [], |
| | | recordContrastDetailsList: [], |
| | | userList: [], |
| | | checkChargerUserId: '', |
| | | reviewUserId: '' |
| | |
| | | this.searchInfo() |
| | | }, |
| | | searchInfo() { |
| | | getExamineRecordContrast({ planDetailsId: this.form.planDetailsId }).then(res => { |
| | | const planDetailsId = this.form.planDetailsId |
| | | getExamineRecordContrast({ planDetailsId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.form = { ...res.data } |
| | | this.recordContrastDetailsList = this.form.recordContrastDetailsList || [] |
| | | // 无历史记录时接口可能返回空,planDetailsId 必须保留,否则无法提交 |
| | | this.form = { ...(res.data || {}), planDetailsId } |
| | | this.form.recordContrastDetailsList = this.form.recordContrastDetailsList || [] |
| | | if (!this.form.reviewUserId) { |
| | | this.currentStep = 0 |
| | | } else { |
| | |
| | | this.currentStep = 2 |
| | | } |
| | | this.reviewUserId = this.form.reviewUserId |
| | | if (this.currentStep === 0) { |
| | | this.draftRestore('equipmentCheck', 'form', this.form.planDetailsId, 'dialogVisible') |
| | | } |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | |
| | | }, |
| | | // 赋值仪器编号 |
| | | changeMachineName(value, type) { |
| | | const index = this.equipOptions.findIndex(item => item.id === value) |
| | | if (index > -1) { |
| | | if (type === 'A') { |
| | | this.form['adeviceNumber'] = this.equipOptions[index].value |
| | | } |
| | | if (type === 'B') { |
| | | this.form['bdeviceNumber'] = this.equipOptions[index].value |
| | | } |
| | | if (type === 'C') { |
| | | this.form['cdeviceNumber'] = this.equipOptions[index].value |
| | | } |
| | | const item = this.equipOptions.find(device => device.id === value) |
| | | if (type === 'A') { |
| | | this.form['adeviceNumber'] = item ? item.value : '' |
| | | } |
| | | if (type === 'B') { |
| | | this.form['bdeviceNumber'] = item ? item.value : '' |
| | | } |
| | | if (type === 'C') { |
| | | this.form['cdeviceNumber'] = item ? item.value : '' |
| | | } |
| | | }, |
| | | // 添加表格数据 |
| | | addTableRow() { |
| | | this.recordContrastDetailsList.push({ checkItems: '' }) |
| | | if (!this.form.recordContrastDetailsList) { |
| | | this.form.recordContrastDetailsList = [] |
| | | } |
| | | this.form.recordContrastDetailsList.push({ checkItems: '' }) |
| | | }, |
| | | submitCheck() { |
| | | this.form.recordContrastDetailsList = this.HaveJson(this.recordContrastDetailsList) |
| | | const deviceIds = [this.form.adeviceId, this.form.bdeviceId, this.form.cdeviceId].filter(Boolean) |
| | | if (new Set(deviceIds).size !== deviceIds.length) { |
| | | this.$message.error('A/B/C 仪器不能选择同一台设备') |
| | | return |
| | | } |
| | | this.form.recordContrastDetailsList = this.HaveJson(this.form.recordContrastDetailsList || []) |
| | | this.submitFormLoading = true |
| | | addExamineRecordContrast(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('新增成功') |
| | | this.draftClear('equipmentCheck') |
| | | this.resetForm() |
| | | } |
| | | this.submitFormLoading = false |
| | |
| | | reviewExamineRecordContrast(params).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('审核成功') |
| | | this.draftClear('equipmentCheck') |
| | | this.resetForm() |
| | | } |
| | | this.submitFormLoading = false |
| | |
| | | this.submitFormLoading = false |
| | | }) |
| | | }, |
| | | // 取消按钮:确认后整体清空本次草稿;右上角关闭/意外退出则保留草稿 |
| | | handleCancel() { |
| | | if (this.currentStep !== 0) { |
| | | this.resetForm() |
| | | return |
| | | } |
| | | this.$confirm('取消后本次填写的数据将被清空,且无法恢复,是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '继续填写', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.draftClear('equipmentCheck') |
| | | this.resetForm() |
| | | }).catch(() => {}) |
| | | }, |
| | | resetForm() { |
| | | this.draftStop('equipmentCheck') |
| | | this.dialogVisible = false |
| | | this.$emit('closeDialog') |
| | | }, |