¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal |
| | | :title="title" |
| | | :width="1250" |
| | | :visible="visible" |
| | | :maskClosable="false" |
| | | @ok="handleOk" |
| | | cancelText="å
³é" |
| | | @cancel="handleCancel" |
| | | :confirmLoading="confirmLoading" |
| | | > |
| | | |
| | | <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="codeDisable" |
| | | :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-input-search |
| | | :disabled="disableSubmit" |
| | | placeholder="è¯·éæ©è®¾å¤" |
| | | enter-button |
| | | @search="onEquipmentList()" |
| | | :read-only="true" |
| | | v-decorator="['equipmentName', validatorRules.equipmentName]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allowClear |
| | | :disabled="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥çæ¬å·'" |
| | | v-decorator="[ 'version', validatorRules.version]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col |
| | | v-if="this.isRevise == true" |
| | | :span="12" |
| | | > |
| | | <a-form-item |
| | | label="åå²çæ¬" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allowClear |
| | | :disabled="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥åå²çæ¬å·'" |
| | | v-decorator="[ 'historyVersion', validatorRules.historyVersion]" |
| | | /> |
| | | </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?'':'请è¾å
¥è®¾å¤ç¼ç /åç§°/åå·'" |
| | | v-decorator="['equipmentId', validatorRules.equipmentId ]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-item |
| | | label="夿³¨" |
| | | :labelCol="{span:3}" |
| | | :wrapperCol="{span:21}" |
| | | > |
| | | <a-textarea |
| | | allowClear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥å¤æ³¨'" |
| | | 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" |
| | | > |
| | | <template |
| | | v-for="col in columns" |
| | | :slot="col.dataIndex" |
| | | slot-scope='text, record, index' |
| | | > |
| | | <div :key="col.dataIndex"> |
| | | <a-select |
| | | v-if="col.dataIndex == 'inspectionCycleId'" |
| | | :value="text" |
| | | :options="record.inspectionCycles" |
| | | @change="(e) => handleChange(e, record.key, col, index)" |
| | | style="width: 100%" |
| | | :disabled="false" |
| | | /> |
| | | <j-image-upload |
| | | :value="text" |
| | | v-if="col.dataIndex == 'photo'" |
| | | :isMultiple="false" |
| | | auto-size |
| | | placeholder="请ä¸ä¼ å¾ç" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | > |
| | | </j-image-upload> |
| | | <a-input |
| | | :value="text" |
| | | v-if="col.dataIndex == 'location'" |
| | | :maxLength="32" |
| | | auto-size |
| | | placeholder="请è¾å
¥é¨ä½" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <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> |
| | | <j-select-specialtylnspection-standard-modal ref="inspectionStandardModalForm"></j-select-specialtylnspection-standard-modal> |
| | | |
| | | <equipment-list |
| | | ref="EquipmentList" |
| | | @sendEquipmentRecord='sendEquipmentRecord' |
| | | ></equipment-list> |
| | | </a-modal> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction, postAction, requestPut } from '@/api/manage' |
| | | import pick from 'lodash.pick' |
| | | import JMultiSelectTag from '@/components/dict/JMultiSelectTag' |
| | | import { duplicateCheck } from '@/api/api' |
| | | import Tooltip from 'ant-design-vue/es/tooltip' |
| | | import JSelectSpecialtylnspectionStandardModal from './JSelectSpecialtylnspectionStandardModal' |
| | | import EquipmentList from './EquipmentList' |
| | | |
| | | export default { |
| | | name: "SpecialtylnspectionStandardModal", |
| | | components: { |
| | | JMultiSelectTag, |
| | | Tooltip, |
| | | JSelectSpecialtylnspectionStandardModal, |
| | | EquipmentList |
| | | }, |
| | | data() { |
| | | return { |
| | | columns: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | align: 'center', |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1 |
| | | }, |
| | | width: 50, |
| | | }, |
| | | { |
| | | title: 'ç¹æ£é¡¹ç®', |
| | | align: 'center', |
| | | dataIndex: 'name' |
| | | }, |
| | | { |
| | | title: 'æ£æµæ å', |
| | | align: 'center', |
| | | dataIndex: 'detectionStandard' |
| | | }, |
| | | { |
| | | title: 'åæ ¼èå´', |
| | | align: 'center', |
| | | dataIndex: 'acceptabilityLimit' |
| | | }, |
| | | { |
| | | title: 'æ¹æ³', |
| | | align: 'center', |
| | | dataIndex: 'inspectionMethodName' |
| | | }, |
| | | { |
| | | title: 'å·¥å
·', |
| | | align: 'center', |
| | | dataIndex: 'inspectionTool' |
| | | }, |
| | | { |
| | | title: '卿', |
| | | align: 'center', |
| | | dataIndex: 'inspectionCycleId', |
| | | scopedSlots: { customRender: 'inspectionCycleId' }, |
| | | width: 170, |
| | | }, |
| | | { |
| | | title: 'é¨ä½', |
| | | align: 'center', |
| | | dataIndex: 'location', |
| | | scopedSlots: { customRender: 'location' }, |
| | | width: 170, |
| | | }, |
| | | { |
| | | title: '示æå¾', |
| | | align: "center", |
| | | dataIndex: 'photo', |
| | | scopedSlots: { customRender: 'photo' }, |
| | | width: 170, |
| | | }, |
| | | { |
| | | title: 'æä½', |
| | | align: 'center', |
| | | dataIndex: 'action', |
| | | scopedSlots: { |
| | | customRender: 'action' |
| | | }, |
| | | } |
| | | ], |
| | | title: "æä½", |
| | | visible: false, |
| | | visible4Confirm: false, |
| | | disableSubmit: false, |
| | | codeDisable: true, |
| | | model: {}, |
| | | inspectionCycles: {}, |
| | | isRevise: false, |
| | | isCopy:false, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 6 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 18 }, |
| | | }, |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this), |
| | | validatorRules: { |
| | | // num: { |
| | | // rules: [ |
| | | // { required: true, message: '请è¾å
¥ç¹æ£æ åç¼ç !' }, |
| | | // ] |
| | | // }, |
| | | equipmentName: { |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©è®¾å¤!' }, |
| | | ] |
| | | }, |
| | | |
| | | version: { |
| | | rules: [ |
| | | { required: true, message: '请è¾å
¥çæ¬!' }, |
| | | ] |
| | | }, |
| | | // historyVersion: { |
| | | // rules: [ |
| | | // { required: true, message: '请è¾å
¥åå²çæ¬!' }, |
| | | // ] |
| | | // }, |
| | | }, |
| | | url: { |
| | | add: "/eam/specialtyStandard/add", |
| | | edit: "/eam/specialtyStandard/edit", |
| | | getInspectionCycle: "/eam/inspectionStandardDetail/getInspectionCycle", |
| | | revise: '/eam/specialtyStandard/revise', |
| | | getReviseVersion: "/eam/specialtyStandard/getReviseVersion", |
| | | getNum: '/eam/sysIdentity/getNumNew', |
| | | getCopy: "/eam/specialtyStandard/getCopy", |
| | | }, |
| | | |
| | | dataSource: [], |
| | | } |
| | | }, |
| | | |
| | | |
| | | mounted() { |
| | | this.$bus.$on('selectionRows', (data) => { |
| | | for (let i = 0; i < data.length; i++) { |
| | | this.dataSource.push({ |
| | | id: data[i].id, |
| | | inspectionProjectId: data[i].id, |
| | | name: data[i].name, |
| | | detectionStandard: data[i].detectionStandard, |
| | | acceptabilityLimit: data[i].acceptabilityLimit, |
| | | inspectionMethodName: data[i].inspectionMethod_dictText, |
| | | inspectionTool: data[i].inspectionTool, |
| | | inspectionCycles: this.inspectionCycles, |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | |
| | | methods: { |
| | | |
| | | //éæ©ç¹æ£é¡¹ç® |
| | | selectInspectionProjects: function () { |
| | | let ids = []; |
| | | for (let i = 0; i < this.dataSource.length; i++) { |
| | | ids.push(this.dataSource[i].inspectionProjectId); |
| | | } |
| | | this.$refs.inspectionStandardModalForm.showModals(ids); |
| | | this.$refs.inspectionStandardModalForm.title = 'éæ©ç¹æ£é¡¹ç®'; |
| | | this.$refs.inspectionStandardModalForm.disableSubmit = false; |
| | | }, |
| | | |
| | | add() { |
| | | this.edit({ specialtyInspectionStandardDetaillist: [] }) |
| | | }, |
| | | |
| | | edit(record) { |
| | | let that = this; |
| | | this.getInspectionCycle() |
| | | that.dataSource = []; |
| | | this.form.resetFields(); |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | if (record.specialtyInspectionStandardDetaillist != undefined) { |
| | | const temp = [...record.specialtyInspectionStandardDetaillist]; |
| | | that.dataSource = temp; |
| | | } |
| | | that.$nextTick(() => { |
| | | that.form.setFieldsValue(pick(that.model, 'num', 'equipmentId', 'equipmentName', 'version', 'remark')); |
| | | }); |
| | | if (record.id) { |
| | | that.codeDisable = true; |
| | | that.$nextTick(() => { |
| | | if (that.isRevise) { |
| | | requestPut(that.url.getReviseVersion, record).then((res) => { |
| | | if (res.success) { |
| | | that.form.setFieldsValue({ version: res.result, historyVersion: record.version }) |
| | | } |
| | | }) |
| | | } |
| | | }, 200); |
| | | } else { |
| | | that.codeDisable = false; |
| | | that.$nextTick(() => { |
| | | that.form.setFieldsValue({ "version": "1.0", }) |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | onEquipmentList() { |
| | | this.$refs.EquipmentList.list(); |
| | | this.$refs.EquipmentList.title = "éæ©è®¾å¤ä¿¡æ¯"; |
| | | }, |
| | | sendEquipmentRecord(data) { |
| | | this.dataSource = []; |
| | | let record = data.record; |
| | | this.form.setFieldsValue({ equipmentId: record.id, equipmentName: record.num + "/" + record.name + "/" + record.model }); |
| | | }, |
| | | |
| | | close() { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | |
| | | handleCancel() { |
| | | this.close(); |
| | | }, |
| | | |
| | | handleOk() { |
| | | const that = this; |
| | | this.form.validateFields(async (err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true; |
| | | let formData = Object.assign(this.model, values); |
| | | formData.specialtyInspectionStandardDetaillist = that.dataSource; |
| | | let obj; |
| | | if (!this.model.id) { |
| | | if(!formData.num){ |
| | | await getAction(this.url.getNum, { type: 'SpecialtyInspectionStandard', length: '4' }).then((res) => { |
| | | if (res.success) { |
| | | formData.num = res.message; |
| | | } |
| | | }); |
| | | } |
| | | formData.versionStatus = '1' |
| | | obj = postAction(this.url.add, formData); |
| | | } else { |
| | | if (this.isRevise) { |
| | | formData.versionStatus = '1' |
| | | obj = postAction(this.url.revise, formData); |
| | | } else if(this.isCopy){ |
| | | obj = postAction(this.url.getCopy, formData); |
| | | }else { |
| | | obj = requestPut(this.url.edit, formData, { id: this.model.id }); |
| | | } |
| | | } |
| | | obj.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(); |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleDelete(text, record, index) { |
| | | this.dataSource.splice(index, 1); |
| | | }, |
| | | |
| | | getInspectionCycle() { |
| | | getAction(this.url.getInspectionCycle).then((res) => { |
| | | if (res.success) { |
| | | this.inspectionCycles = res.result |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleChange(value, key, column, index) { |
| | | let that = this; |
| | | const temp = [...that.dataSource]; |
| | | const target = temp.filter(item => key === item.key)[index]; |
| | | if (target) { |
| | | if (column.dataIndex == 'inspectionCycleId') { |
| | | target[column.dataIndex] = value; |
| | | } |
| | | if ('photo' == column.dataIndex) { |
| | | target['photo'] = value; |
| | | } |
| | | if ('location' == column.dataIndex) { |
| | | target['location'] = value.target.value; |
| | | } |
| | | //æ¾ç¤ºå¸¦è¿æ¥çæ°æ® |
| | | that.dataSource = temp; |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | /deep/ .frozenRowClass { |
| | | color: #c9c9c9; |
| | | } |
| | | .fontweight { |
| | | font-weight: bold; |
| | | } |
| | | .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> |