¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-modal |
| | | :title="title" |
| | | :width="700" |
| | | @cancel="close" |
| | | :visible="visible" |
| | | :footer="null" |
| | | style="height: 100%;overflow: auto;padding-bottom: 53px;"> |
| | | |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form-model ref="form" :form="form" :model="model" :rules="validatorRules" :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol"> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="车é´åé
" prop="productionId"> |
| | | <a-select v-model="model.productionId" placeholder="è¯·éæ©è½¦é´" @change="handleSelectChange" |
| | | :disabled="disabledEdit"> |
| | | <a-select-option v-for="item in workshopTreeData" :key="item.id"> |
| | | {{ item.productionName }} |
| | | </a-select-option> |
| | | </a-select> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="è½´æ°" prop="deviceManagementCode"> |
| | | <a-input allow-clear placeholder="请è¾å
¥è½´æ°" :readOnly="disabledEdit" |
| | | v-model="model.deviceManagementCode"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-model-item label="æ°æ§ç³»ç»ç±»å«" prop="deviceManagementName"> |
| | | <a-input allow-clear placeholder="请è¾å
¥æ°æ§ç³»ç»ç±»å«" :readOnly="disabledEdit" |
| | | v-model="model.deviceManagementName"/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | <a-row :gutter="24"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="设å¤ç»ç¼å·" :labelCol="labelColLong" :wrapperCol="wrapperColLong" |
| | | prop="equipmentIds"> |
| | | <a-input-search v-model="model.equipmentIds" readOnly :disabled="!model.productionId" @search="deviceSearch" |
| | | enter-button :placeholder='!model.productionId?"è¯·éæ©è½¦é´":"è¯·éæ©è®¾å¤ç»ç¼å·"'/> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </a-spin> |
| | | |
| | | |
| | | <div class="drawer-bottom-button"> |
| | | <a-space> |
| | | <a-button @click="close">åæ¶</a-button> |
| | | <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">æäº¤</a-button> |
| | | </a-space> |
| | | </div> |
| | | |
| | | <workshop-device-list-modal :productionId="model.productionId" ref="deviceListModel" |
| | | @sendSelectedRowKeys="getDeviceRowKeys"/> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction } from '@/api/manage' |
| | | import WorkshopDeviceListModal from '@views/dnc/base/modules/DeviceCustomTypeManagement/WorkshopDeviceListModal.vue' |
| | | |
| | | export default { |
| | | name: 'DeviceCustomTypeManagementModal', |
| | | components: { WorkshopDeviceListModal }, |
| | | props: { |
| | | workshopTreeData: { |
| | | type: Array |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | title: '', |
| | | form: this.$form.createForm(this), |
| | | validatorRules: { |
| | | productionId: [ |
| | | { |
| | | required: true, message: 'è¯·éæ©è½¦é´!' |
| | | } |
| | | ], |
| | | deviceManagementCode: [ |
| | | { |
| | | required: true, message: '请è¾å
¥è½´æ°!' |
| | | } |
| | | ], |
| | | deviceManagementName: [ |
| | | { |
| | | required: true, message: '请è¾å
¥æ°æ§ç³»ç»ç±»å«!' |
| | | } |
| | | ], |
| | | equipmentIds: [ |
| | | { |
| | | required: true, message: 'è¯·éæ©è®¾å¤ç¼å·!',trigger:'change' |
| | | } |
| | | ] |
| | | }, |
| | | visible: false, |
| | | disabledEdit: false, |
| | | model: {}, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 14 } |
| | | }, |
| | | labelColLong: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 4 } |
| | | }, |
| | | wrapperColLong: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 19 } |
| | | }, |
| | | confirmLoading: false, |
| | | url: { |
| | | add: '/nc/deviceManagement/add', |
| | | edit: '/nc/deviceManagement/edit' |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // 车é´éæ©å¨å¼åçæ¹åæ¶è§¦åæ¸
ç©ºå·²éæ©ç设å¤ç¼å·ç» |
| | | handleSelectChange() { |
| | | if (this.model.equipmentIds) delete this.model.equipmentIds |
| | | }, |
| | | |
| | | /** |
| | | * å½è®¾å¤éæ©å®æåæäº¤å°å·²éæ©ç设å¤ç¼å·å表以éå·é弿åå°åæ°ä¸ |
| | | * @param selectedRowKeys |
| | | */ |
| | | getDeviceRowKeys(selectedRowKeys) { |
| | | if (selectedRowKeys.length === 0) return |
| | | this.$set(this.model, 'equipmentIds', selectedRowKeys.join(',')) |
| | | this.$refs.form.clearValidate() |
| | | }, |
| | | |
| | | deviceSearch() { |
| | | this.$refs.deviceListModel.openPage() |
| | | this.$refs.deviceListModel.title = 'éæ©è®¾å¤' |
| | | this.$refs.deviceListModel.disableSubmit = false |
| | | }, |
| | | |
| | | add() { |
| | | this.edit({}) |
| | | }, |
| | | |
| | | edit(record) { |
| | | this.visible = true |
| | | this.model = Object.assign({}, record) |
| | | }, |
| | | |
| | | handleSubmit() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let apiUrl, method |
| | | if (!this.model.id) { |
| | | apiUrl = this.url.add |
| | | method = 'post' |
| | | } else { |
| | | apiUrl = this.url.edit |
| | | method = 'put' |
| | | } |
| | | httpAction(apiUrl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$notification.success({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | that.$emit('ok') |
| | | that.close() |
| | | } else { |
| | | that.$notification.warning({ |
| | | message: 'æ¶æ¯', |
| | | description: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | close() { |
| | | this.$emit('close') |
| | | this.visible = false |
| | | this.$refs.form.clearValidate() |
| | | } |
| | | } |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .drawer-bottom-button { |
| | | position: absolute; |
| | | bottom: -40px; |
| | | width: 100%; |
| | | border-top: 1px solid #e8e8e8; |
| | | padding: 10px 16px; |
| | | text-align: right; |
| | | left: 0; |
| | | background: #fff; |
| | | border-radius: 0 0 2px 2px; |
| | | } |
| | | </style> |