¶Ô±ÈÐÂÎļþ |
| | |
| | | <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="责任çç»" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'è¯·éæ©è´£ä»»é¨é¨'" |
| | | :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?'':'请è¾å
¥å¯¹è±¡é¨é¨id'" |
| | | 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: 'è¯·éæ©è´£ä»»çç»!' }, |
| | | ] |
| | | }, |
| | | 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> |