From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期一, 18 九月 2023 13:24:30 +0800 Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430 --- src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue | 649 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 649 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue b/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue new file mode 100644 index 0000000..f22b2d8 --- /dev/null +++ b/src/views/eam/modules/specialtyInspectionPlan/SpecialtyInspectionPlanModal.vue @@ -0,0 +1,649 @@ +<template> + <a-modal + :title="title" + :width="1250" + :visible="visible" + :maskClosable="false" + :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + > + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + label="鐐规鏂规缂栫爜" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-input + allow-clear + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇疯緭鍏ョ偣妫�鏂规缂栫爜'" + v-decorator="['num', validatorRules.num ]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + label="瀵硅薄閮ㄩ棬" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <!-- <a-select + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇烽�夋嫨瀵硅薄閮ㄩ棬'" + :options="this.departs" + style="width: 100%" + v-decorator="['departId', validatorRules.departId]" + @change="(e)=>handle2Change(e)" + /> --> + <a-input-search + :disabled="disableSubmit" + placeholder="璇烽�夋嫨瀵硅薄閮ㄩ棬" + enter-button + @search="onDepartList()" + :read-only="true" + v-decorator="['useDepartName', validatorRules.useDepartName]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + label="鐐规鍛ㄦ湡" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <!-- <j-dict-select-tag + allow-clear + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇风偣妫�鍛ㄦ湡'" + :triggerChange="true" + dictCode="mom_eam_inspection_cycle,name,id, del_flag!='1'" + v-decorator="['inspectionCycleId', validatorRules.inspectionCycleId]" + @change="(e)=>handle2Change(e)" + /> --> + <a-select + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇风偣妫�鍛ㄦ湡'" + :options="this.inspectionCycles" + style="width: 100%" + v-decorator="['inspectionCycleId', validatorRules.inspectionCycleId]" + @change="(e)=>handle2Change(e)" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + label="璐d换鐝粍" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <j-dict-select-tag + allow-clear + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇烽�夋嫨璐d换閮ㄩ棬'" + :triggerChange="true" + dictCode="mom_base_team,name,id,status = '1' and del_flag!='1'" + v-decorator="['teamId', validatorRules.teamId]" + /> + <!-- <a-input + allow-clear + :disabled="true" + :placeholder="disableSubmit?'':'璇疯緭鍏ヨ矗浠荤彮缁勭紪鐮�'" + v-decorator="['teamName', validatorRules.teamName ]" + /> --> + </a-form-item> + </a-col> + </a-row> + <a-row + hidden + :gutter="24" + > + <a-col :span="12"> + <a-form-item + label="瀵硅薄閮ㄩ棬Id" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-input + allow-clear + :disabled="true" + :placeholder="disableSubmit?'':'璇疯緭鍏ュ璞¢儴闂╥d'" + v-decorator="['departId', validatorRules.departId ]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + label="娲惧伐鏂瑰紡" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <j-dict-select-tag + allow-clear + :disabled="disableSubmit" + :placeholder="disableSubmit?'':'璇烽�夋嫨娲惧伐鏂瑰紡'" + :triggerChange="true" + dictCode="assign_mode" + v-decorator="['assignMode', validatorRules.assignMode]" + /> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鍥剧墖鍚嶇О" + > + <!-- :labelCol="{span:3}" + :wrapperCol="{span:21}" --> + <a-input + :disabled=true + placeholder="璇疯緭鍏ュ浘鐗囧悕绉�" + v-decorator="['name', validatorRules.name ]" + /> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item + :labelCol="labelCol" + :wrapperCol="wrapperCol" + label="鐐规璺嚎鍥�" + > + <!-- :labelCol="{span:3}" + :wrapperCol="{span:21}" --> + <a-upload-dragger + name="file" + :customRequest="customRequest" + @change="handleChange" + :file-list="fileList" + :multiple="false" + > + <p class="ant-upload-drag-icon"> + <a-icon type="inbox" /> + </p> + <p class="ant-upload-text"> + 鐐瑰嚮涓婁紶鎴栨嫋鎷藉浘鐗囪嚦璇ュ尯鍩熻繘琛屼笂浼� + </p> + <p class="ant-upload-hint"> + 浠呮敮鎸佸崟鍥剧墖涓婁紶 + </p> + </a-upload-dragger> + </a-form-item> + </a-col> + + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item + :labelCol="{span:3}" + :wrapperCol="{span:21}" + label="澶囨敞" + > + <a-textarea + :disabled="disableSubmit" + placeholder="璇疯緭鍏ュ娉�" + allow-clear + v-decorator="['remark', validatorRules.remark]" + /> + </a-form-item> + </a-col> + </a-row> + </a-form> + </a-spin> + <a-button + type="primary" + :style="{ marginRight: '8px',marginBottom:'8px' }" + :loading="confirmLoading" + @click="selectInspectionProjects()" + >涓撲笟鐐规鏍囧噯</a-button> + <a-table + ref="table" + bordered + size="middle" + rowKey='id' + :columns="columns" + :dataSource="dataSource" + > + + <span + slot="action" + slot-scope="text, record, index" + > + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(text,record, index)" + > + <a>鍒犻櫎</a> + </a-popconfirm> + </span> + </a-table> + <template slot="footer"> + <a-button + :style="{marginRight: '8px'}" + @click="handleCancel()" + > + 鍏抽棴 + </a-button> + + <a-button + @click="handleOk()" + type="primary" + :loading="confirmLoading" + >纭畾</a-button> + </template> + + <depart-list + ref="DepartList" + @sendDepartRecord='sendDepartRecord' + ></depart-list> + + <j-select-specialtylnspection-standard-modal ref="specialtyInspectionStandardModalForm"></j-select-specialtylnspection-standard-modal> + </a-modal> +</template> + +<script> +import { getAction, postAction, postFileAction } from '@/api/manage' +import Vue from 'vue' +import JInput from '@/components/jeecg/JInput' +import Tooltip from 'ant-design-vue/es/tooltip' +import JEllipsis from "@/components/jeecg/JEllipsis"; +import { ajaxGetDictItems } from '@/api/api' +import { ACCESS_TOKEN, TENANT_ID } from "@/store/mutation-types" +import pick from 'lodash.pick' +import DepartList from './DepartList' +import JSelectSpecialtylnspectionStandardModal from './JSelectSpecialtylnspectionStandardModal' + +export default { + name: "SpecialtyInspectionPlanModal", + components: { + JInput, + Tooltip, + JEllipsis, + JSelectSpecialtylnspectionStandardModal, + DepartList + }, + data() { + return { + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + align: 'center', + customRender: function (t, r, index) { + return parseInt(index) + 1 + }, + width: 50, + }, + { + title: '涓撲笟鐐规鏍囧噯', + align: 'center', + dataIndex: 'num' + }, + { + title: '鐗堟湰', + align: 'center', + dataIndex: 'version', + }, + { + title: '璁惧缂栫爜', + align: 'center', + dataIndex: 'equipmentNum' + }, + { + title: '璁惧鍚嶇О', + align: 'center', + dataIndex: 'equipmentName' + }, + { + title: '璁惧瑙勬牸', + align: 'center', + dataIndex: 'equipmentModel' + }, + { + title: '鎿嶄綔', + align: 'center', + dataIndex: 'action', + scopedSlots: { + customRender: 'action' + }, + } + ], + title: "鎿嶄綔", + visible: false, + disableSubmit: false, + codeDisable: true, + model: {}, + // departs: [], + inspectionCycles: [], + labelCol: { + xs: { span: 24 }, + sm: { span: 6 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 }, + }, + confirmLoading: false, + form: this.$form.createForm(this), + headers: {}, + validatorRules: { + // num: { + // rules: [ + // { required: true, message: '璇疯緭鍏ョ偣妫�璁″垝缂栫爜!' }, + // ] + // }, + inspectionCycleId: { + rules: [ + { required: true, message: '璇烽�夋嫨鐐规鍛ㄦ湡!' }, + ] + }, + useDepartName: { + rules: [ + { required: true, message: '璇烽�夋嫨瀵硅薄閮ㄩ棬!' }, + ] + }, + assignMode: { + rules: [ + { required: true, message: '璇烽�夋嫨娲惧伐鏂瑰紡!' }, + ] + }, + + teamId: { + rules: [ + { required: true, message: '璇烽�夋嫨璐d换鐝粍!' }, + ] + }, + name: { + rules: [ + { required: true, message: '璇疯緭鍏ユ枃浠跺悕绉帮紒' }, + { min: 0, max: 150, message: '鏈�闀� 30 涓瓧绗�', trigger: 'blur' }, + ] + }, + description: { + rules: [ + { min: 0, max: 100, message: '鏈�闀� 100 涓瓧绗�', trigger: 'blur' }, + ] + }, + }, + url: { + add: "/eam/specialtyInspectionPlan/add", + edit: "/eam/specialtyInspectionPlan/edit", + listByBusIdAndBusType: "/system/sysUploadRela/listByBusIdAndBusType", + getInspectionCycle: "/eam/inspectionStandardDetail/getInspectionCycle", + // getSysDeparts: "/eam/specialtyInspectionPlan/getSysDeparts", + getNum: '/eam/sysIdentity/getNumNew', + }, + dataSource: [], + //鐢ㄤ簬灞曠ず鏂囦欢 + fileList: [], + fileObject: {}, + //鐢ㄤ簬鍒ゆ柇闄勪欢鐨勭姸鎬� add锛氭柊澧為〉闈㈢殑闄勪欢 edit锛氱紪杈戦〉闈㈢殑闄勪欢涓鸿淇敼i editUpdate锛氱紪杈戦〉闈㈢殑闄勪欢琚慨鏀� + isFileChange: false, + uploadId: '', + + } + }, + + mounted() { + this.$bus.$on('selectionRows', (data) => { + for (let i = 0; i < data.length; i++) { + this.dataSource.push({ + id: data[i].id, + specialtyInspectionStandardId: data[i].specialtyInspectionStandardId, + num: data[i].num, + version: data[i].version, + equipmentId: data[i].equipmentId, + equipmentNum: data[i].equipmentNum, + equipmentName: data[i].equipmentName, + equipmentModel: data[i].equipmentModel, + }) + } + }) + }, + + methods: { + + //涓撲笟鐐规鏍囧噯 + selectInspectionProjects: function () { + let dataDepartId = this.form.getFieldsValue(['departId']); + if (dataDepartId.departId == "" || dataDepartId.departId == null || dataDepartId.departId == undefined) { + this.$message.warning("璇烽�夋嫨瀵硅薄閮ㄩ棬锛�"); + return + } + let data = this.form.getFieldsValue(['inspectionCycleId']); + if (data.inspectionCycleId == "" || data.inspectionCycleId == null || data.inspectionCycleId == undefined) { + this.$message.warning("璇烽�夋嫨鐐规鍛ㄦ湡锛�"); + return + } + let ids = []; + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].specialtyInspectionStandardId); + } + let departId = dataDepartId.departId; + let inspectionCycleId = data.inspectionCycleId; + this.$refs.specialtyInspectionStandardModalForm.showModals(ids, departId, inspectionCycleId); + this.$refs.specialtyInspectionStandardModalForm.title = '閫夋嫨鐐规椤圭洰'; + this.$refs.specialtyInspectionStandardModalForm.disableSubmit = false; + }, + + customRequest(val) { + if (this.fileList.length == 0) { + this.fileObject = val; + } + }, + + handleChange(info) { + //榛樿缁欓檮浠剁姸鎬侊紝浠呮帶鍒舵牱寮� + let file = info.file; + //鏂囦欢鏇存敼锛屾爣璁版洿鏂� + if (this.model.id) { + this.isFileChange = true; + } + //鍒犻櫎 + if (file.status == "removed") { + this.fileList = []; + this.fileObject.file = {}; + this.form.setFieldsValue({ name: '' }); + return false; + } + //鍗曟枃浠舵帶鍒� + if (this.fileList.length > 0) { + this.$message.warning("褰撳墠浠呭厑璁镐笂浼犱竴涓枃浠讹紒"); + return false; + } + file.status = 'done'; + //椤甸潰灞曠ず涓婁紶鏂囦欢 + this.fileList.push(file); + this.form.setFieldsValue({ name: file.name }); + }, + + add() { + this.edit({ specialtyInspectionPlanDetailList: [] }) + }, + + edit(record) { + let that = this; + // that.getSysDeparts() + that.getInspectionCycle() + that.visible = true; + that.isFileChange = false; + that.model = Object.assign({}, record); + that.$nextTick(() => { + that.form.setFieldsValue(pick(that.model, 'num', 'assignMode', 'departId', 'useDepartName', 'inspectionCycleId', 'teamId', 'remark')) + }); + that.fileList = []; + that.form.resetFields(); + that.uploadId = '' + if (record.specialtyInspectionPlanDetailList != undefined) { + const temp = [...record.specialtyInspectionPlanDetailList]; + that.dataSource = temp; + } + if (record.isNoPhotoFlag) { + //鑾峰彇褰撳墠鏂囦欢瀵瑰簲闄勪欢 + getAction(that.url.listByBusIdAndBusType, { busId: record.id, busType: 'inspection_path_photo' }).then((res) => { + if (res.success) { + for (let i = 0; i < res.result.length; i++) { + that.fileList.push({ + uid: res.result[i].upload.id, + name: res.result[i].upload.name, + status: "done", + }) + that.$nextTick(() => { + that.form.setFieldsValue({ name: res.result[i].upload.name }); + }); + } + } + }) + } + if (record.id) { + this.codeDisable = true; + } else { + this.codeDisable = false; + } + }, + + close() { + this.$emit('close'); + this.visible = false; + }, + + handleOk() { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + that.form.validateFields(async (err, values) => { + if (JSON.stringify(that.fileObject.file) == '{}' && that.uploadId == '' && that.fileList.length == 0) { + that.$message.warning("璇蜂笂浼犳枃浠�"); + return false + } + if (that.dataSource.length == 0) { + that.$message.warning("璇烽�夋嫨涓撲笟鐐规鏍囧噯锛�"); + return false + } + if (!err) { + that.confirmLoading = true; + let httpurl = '' + let method = '' + if (!that.model.id) { + httpurl += that.url.add; + method = 'post'; + } else { + httpurl += that.url.edit; + method = 'put'; + } + let formData = Object.assign(that.model, values); + if(!formData.num){ + await getAction(this.url.getNum, { type: 'SpecialtyInspectionPlan', length: '4' }).then((res) => { + if (res.success) { + formData.num = res.message; + } + }); + } + formData.type = "inspection_path_photo"; + formData.uploadId = that.uploadId; + formData.fileType = "7";//鏂囦欢绫诲瀷 7锛氬浘鐗� + var saveDate = new FormData(); + + formData.isFileChange = that.isFileChange; + formData.specialtyInspectionPlanDetails = that.dataSource; + saveDate.append("file", that.fileObject.file); + saveDate.append('data', JSON.stringify(formData)); + + postFileAction(httpurl, saveDate, this.headers).then((res) => { + if (res.success) { + that.$message.success(res.message); + that.$emit('ok'); + } else { + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + } + }).catch((e) => { }) + }, + + handleDelete(text, record, index) { + this.dataSource.splice(index, 1); + }, + + handleCancel() { + this.close(); + }, + + handle2Change(val) { + this.dataSource = []; + }, + + onDepartList() { + this.$refs.DepartList.list(); + this.$refs.DepartList.title = "閫夋嫨瀵硅薄閮ㄩ棬"; + }, + sendDepartRecord(data) { + this.dataSource = []; + let record = data.record; + this.form.setFieldsValue({ departId: record.id, useDepartName: record.orgCode + "/" + record.departName }); + }, + + getInspectionCycle() { + getAction(this.url.getInspectionCycle).then((res) => { + if (res.success) { + this.inspectionCycles = res.result + } + }) + }, + + // getSysDeparts() { + // getAction(this.url.getSysDeparts).then((res) => { + // if (res.success) { + // this.departs = res.result + // } + // }) + // }, + + }, + + created() { + const token = Vue.ls.get(ACCESS_TOKEN); + const tenantid = Vue.ls.get(TENANT_ID) + this.headers = { + 'Content-Type': 'multipart/form-data', + "X-Access-Token": token, + 'X-Access-Tenant': tenantid + }; + }, +} +</script> +<style scoped> +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3