¶Ô±ÈÐÂÎļþ |
| | |
| | | <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="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥ä¸çº§è®¾å¤åç±»ç¼å·'" |
| | | v-decorator="['parentNum', validatorRules.parentNum ]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | label="ä¸çº§è®¾å¤åç±»åç§°" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allow-clear |
| | | :disabled="true" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥ä¸çº§è®¾å¤åç±»åç§°'" |
| | | v-decorator="['parentName', validatorRules.parentName ]" |
| | | /> |
| | | </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 |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥è®¾å¤åç±»ç¼å·'" |
| | | v-decorator="['num', validatorRules.num ]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="12" v-if="parentId!='-1'"> |
| | | <a-form-item |
| | | label="设å¤åç±»åç§°" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-input |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥è®¾å¤åç±»åç§°'" |
| | | v-decorator="['name', validatorRules.name ]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="12" v-if="parentId=='-1'"> |
| | | <a-form-item |
| | | label="设å¤åç±»åç§°" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'è¯·éæ©åç±»åç§°'" |
| | | :triggerChange="true" |
| | | dictCode="sys_dict_item,item_text,item_text,dict_id ='1695985281980776449'" |
| | | 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="åç±»æ è¯" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'è¯·éæ©åç±»æ è¯'" |
| | | :triggerChange="true" |
| | | dictCode="equipment_category" |
| | | v-decorator="['equipmentCategoryUda1', validatorRules.equipmentCategoryUda1]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | label="ææ¯ç¶æé´å®å¨æ" |
| | | > |
| | | <j-dict-select-tag |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'è¯·éæ©ææ¯ç¶æé´å®å¨æ'" |
| | | :triggerChange="true" |
| | | dictCode="appraisal_cycle" |
| | | v-decorator="['equipmentCategoryUda2', validatorRules.equipmentCategoryUda2]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row :gutter="24"> |
| | | <a-col :span="12"> |
| | | <a-form-item |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | label="夿³¨" |
| | | > |
| | | <a-textarea |
| | | allow-clear |
| | | :disabled="disableSubmit" |
| | | :placeholder="disableSubmit?'':'请è¾å
¥å¤æ³¨'" |
| | | v-decorator="['remark', validatorRules.remark]" |
| | | /> |
| | | </a-form-item> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | <a-divider v-if="title!='æ°å¢'" orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> éæ©å设å¤å类使å
¶è·éç¶è®¾å¤åç±»å±æ§ </a-divider> |
| | | <a-tabs |
| | | type="card" |
| | | defaultActiveKey="1" |
| | | v-if="title!='æ°å¢'" |
| | | > |
| | | <a-tab-pane |
| | | tab='å设å¤åç±»' |
| | | key='1' |
| | | |
| | | > |
| | | <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
| | | <i class="anticon anticon-info-circle ant-alert-icon"></i> 已鿩 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
| | | <a style="margin-left: 24px" @click="onClearSelected">æ¸
空</a> |
| | | </div> |
| | | <a-table |
| | | ref="table" |
| | | bordered |
| | | size="middle" |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | :loading="loading" |
| | | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
| | | @change="handleTableChange" |
| | | :scroll="{ x: true}" |
| | | > |
| | | <template slot="num" slot-scope="text" > |
| | | <a-tooltip placement="top" :title="text" trigger="hover"> |
| | | <div> |
| | | <template slot="title"> </template> |
| | | <p style="cusor:pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; width: 130px;">{{ text }}</p> |
| | | </div> |
| | | </a-tooltip> |
| | | </template> |
| | | |
| | | </a-table> |
| | | |
| | | |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | |
| | | </a-spin> |
| | | |
| | | <template slot="footer"> |
| | | <a-button |
| | | :style="{marginRight: '8px'}" |
| | | @click="handleCancel" |
| | | > |
| | | å
³é |
| | | </a-button> |
| | | <!-- <a-button |
| | | v-if="!this.model.id" |
| | | :disabled="disableSubmit || confirmLoading" |
| | | :loading="confirmLoading" |
| | | @click="handleOkAndAdd" |
| | | type="primary" |
| | | >ä¿åå¹¶ç»§ç»æ°å¢</a-button>--> |
| | | <a-button |
| | | :disabled="disableSubmit || confirmLoading" |
| | | :loading="confirmLoading" |
| | | @click="handleOk" |
| | | type="primary" |
| | | >ç¡®å®</a-button> |
| | | <!-- icon="save" --> |
| | | </template> |
| | | |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import pick from 'lodash.pick' |
| | | import { postAction, requestPut } from '@/api/manage' |
| | | import { duplicateCheck } from '@/api/api' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | |
| | | |
| | | export default { |
| | | name: 'EquipmentCategoryModel', |
| | | mixins:[JeecgListMixin], |
| | | props:{ |
| | | mainId:{ |
| | | type:String, |
| | | default:'', |
| | | required:false |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | title: "æä½", |
| | | visible: false, |
| | | codeDisable: true, |
| | | disableSubmit: false, |
| | | parentId: '', |
| | | model: {}, |
| | | labelCol: { |
| | | span:7 |
| | | }, |
| | | wrapperCol: { |
| | | span:17 |
| | | }, |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this), |
| | | validatorRules: { |
| | | num: { |
| | | rules: [ |
| | | { required: true, message: '请è¾å
¥è®¾å¤åç±»ç¼å·!' }, |
| | | { min: 2, max: 30, message: 'é¿åº¦å¨ 2 å° 30 个å符', trigger: 'blur' }, |
| | | { validator: this.validateNum }, |
| | | ] |
| | | }, |
| | | name: { |
| | | rules: [ |
| | | { required: true, message: '请è¾å
¥è®¾å¤åç±»åç§°!' }, |
| | | { min: 2, max: 30, message: 'é¿åº¦å¨ 2 å° 30 个å符', trigger: 'blur' }, |
| | | { validator: this.validateName }, |
| | | ] |
| | | }, |
| | | equipmentCategoryUda1:{ |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©ç±»å«æ è¯!' }, |
| | | ] |
| | | }, |
| | | remark: { |
| | | rules: [ |
| | | { min: 0, max: 100, message: 'é¿åº¦ä¸è¶
è¿ 100 个å符', trigger: 'blur' }, |
| | | ] |
| | | }, |
| | | equipmentCategoryUda2:{ |
| | | rules: [ |
| | | { required: true, message: 'è¯·éæ©ææ¯ç¶æé´å®å¨æ!' }, |
| | | ] |
| | | } |
| | | }, |
| | | url: { |
| | | add: "/eam/equipmentCategory/add", |
| | | edit: "/eam/equipmentCategory/edit", |
| | | list:"/eam/equipmentCategory/getAllChildren" |
| | | }, |
| | | columns: [ |
| | | { |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | align: 'center', |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1 |
| | | }, |
| | | width: 50, |
| | | }, |
| | | /* { |
| | | title: 'ä¸çº§è®¾å¤åç±»ç¼ç ', |
| | | align: "center", |
| | | dataIndex: 'parentNum', |
| | | customRender:function(text, record){ |
| | | return record.parentName+text; |
| | | } |
| | | }, |
| | | |
| | | { |
| | | title: 'ä¸çº§è®¾å¤åç±»åç§°', |
| | | align: "center", |
| | | dataIndex: 'parentName', |
| | | }, */ |
| | | { |
| | | title: 'åç±»ç¼ç ', |
| | | align: "center", |
| | | dataIndex: 'num', |
| | | scopedSlots: { customRender: 'num' }, |
| | | width: 100, |
| | | ellipsis: true, |
| | | // scopedSlots: { |
| | | // customRender: 'num', |
| | | // }, |
| | | // sorter: true, |
| | | }, |
| | | { |
| | | title: 'åç±»åç§°', |
| | | |
| | | align: "center", |
| | | dataIndex: 'name', |
| | | |
| | | // scopedSlots: { |
| | | // customRender: 'name', |
| | | // }, |
| | | // sorter: true, |
| | | }, |
| | | { |
| | | title: 'åç±»æ è¯', |
| | | |
| | | align: "center", |
| | | dataIndex: 'equipmentCategoryUda1_dictText', |
| | | // scopedSlots: { |
| | | // customRender: 'name', |
| | | // }, |
| | | // sorter: true, |
| | | |
| | | }, |
| | | { |
| | | title: 'å建人', |
| | | align: "center", |
| | | dataIndex: 'createBy', |
| | | |
| | | }, |
| | | { |
| | | title: 'ä¿®æ¹äºº', |
| | | align: "center", |
| | | dataIndex: 'updateBy', |
| | | |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | align: "center", |
| | | dataIndex: 'createTime', |
| | | |
| | | }, |
| | | |
| | | { |
| | | title: 'ä¿®æ¹æ¶é´', |
| | | align: "center", |
| | | dataIndex: 'updateTime', |
| | | |
| | | }, |
| | | ], |
| | | //æ°å¢ãç¼è¾ãå é¤ãæ¹éå 餿使¹åæ°æ®åå·æ°å
³èçç»ä»¶ççå¬å±æ§ |
| | | alterFlag: "" |
| | | } |
| | | }, |
| | | created() { |
| | | }, |
| | | methods: { |
| | | |
| | | add(record) { |
| | | this.edit(record); |
| | | }, |
| | | |
| | | edit(record) { |
| | | this.form.resetFields(); |
| | | this.model = Object.assign({}, record); |
| | | this.visible = true; |
| | | this.disableSubmit = false; |
| | | this.$nextTick(() => { |
| | | this.form.setFieldsValue(pick(this.model, 'parentNum','equipmentCategoryUda1','equipmentCategoryUda2', 'parentName', 'num', 'name', 'remark')) |
| | | }); |
| | | if (record.id) { |
| | | this.codeDisable = true; |
| | | } else { |
| | | this.codeDisable = false; |
| | | } |
| | | }, |
| | | |
| | | close() { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | this.onClearSelected(); |
| | | }, |
| | | onSelectChange(selectedRowKeys, selectionRows) { |
| | | this.selectedRowKeys = selectedRowKeys; |
| | | this.selectionRows = selectionRows; |
| | | }, |
| | | onClearSelected() { |
| | | this.selectedRowKeys = []; |
| | | this.selectionRows = []; |
| | | }, |
| | | |
| | | //ä¿åå¹¶æ°å¢æé®è§¦å |
| | | handleOkAndAdd() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true; |
| | | let formData = Object.assign(this.model, values); |
| | | formData.parentId = this.parentId |
| | | postAction(this.url.add, formData).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message); |
| | | that.$emit('ok'); |
| | | that.alterFlag = new Date(); |
| | | } else { |
| | | that.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | this.confirmLoading = false |
| | | this.form.setFieldsValue(pick(this.model, 'parentNum', 'parentName')) |
| | | this.form.setFieldsValue({ "num": null, "name": null, "remark": null }) |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleOk() { |
| | | const that = this; |
| | | // 触å表åéªè¯ |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true; |
| | | let formData = Object.assign(this.model, values); |
| | | let obj; |
| | | if (!this.model.id) { |
| | | formData.parentId = this.parentId |
| | | obj = postAction(this.url.add, formData); |
| | | } else { |
| | | formData.equipmentCategoryDtlList = this.selectionRows; |
| | | obj = requestPut(this.url.edit, formData, { id: this.model.id }); |
| | | } |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message); |
| | | that.$emit('ok'); |
| | | that.alterFlag = new Date(); |
| | | } else { |
| | | that.$message.warning(res.message); |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false; |
| | | that.$bus.$emit('loadData') |
| | | that.close(); |
| | | that.onClearSelected(); |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | handleCancel() { |
| | | this.close() |
| | | }, |
| | | |
| | | //éªè¯ ç¼å· |
| | | validateNum(rule, value, callback) { |
| | | var params = { |
| | | tableName: 'mom_eam_equipment_category', |
| | | fieldName: 'num', |
| | | fieldVal: value, |
| | | dataId: this.model.id, |
| | | //æ°æ®åºä¸åå¨å段del_flag并使ç¨è¯¥å段ä½ä¸ºæªå é¤çç¥ï¼çå é¤ï¼false åå é¤ï¼true |
| | | delFlag: 'true', |
| | | }; |
| | | duplicateCheck(params).then((res) => { |
| | | if (res.success) { |
| | | callback(); |
| | | } else { |
| | | callback("ç¼å·å·²åå¨!"); |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //éªè¯ åç§° |
| | | validateName(rule, value, callback) { |
| | | var params = { |
| | | tableName: 'mom_eam_equipment_category', |
| | | fieldName: 'name', |
| | | fieldVal: value, |
| | | dataId: this.model.id, |
| | | //æ°æ®åºä¸åå¨å段del_flag并使ç¨è¯¥å段ä½ä¸ºæªå é¤çç¥ï¼çå é¤ï¼false åå é¤ï¼true |
| | | delFlag: 'true', |
| | | }; |
| | | duplicateCheck(params).then((res) => { |
| | | if (res.success) { |
| | | callback(); |
| | | } else { |
| | | callback("åç§°å·²åå¨!"); |
| | | } |
| | | }) |
| | | }, |
| | | clearList(){ |
| | | this.dataSource=[] |
| | | this.selectedRowKeys=[] |
| | | this.ipagination.current = 1 |
| | | } |
| | | |
| | | }, |
| | | watch: { |
| | | alterFlag() { |
| | | this.$bus.$emit('queryTreeData'); |
| | | }, |
| | | mainId:{ |
| | | immediate:true, |
| | | handler(val) { |
| | | if(!this.mainId){ |
| | | this.clearList() |
| | | }else{ |
| | | this.queryParam['parentId'] = val |
| | | this.loadData(1); |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </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> |