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/equipmentCategory/EquipmentCategoryModel.vue |  558 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 558 insertions(+), 0 deletions(-)

diff --git a/src/views/eam/modules/equipmentCategory/EquipmentCategoryModel.vue b/src/views/eam/modules/equipmentCategory/EquipmentCategoryModel.vue
new file mode 100644
index 0000000..c559867
--- /dev/null
+++ b/src/views/eam/modules/equipmentCategory/EquipmentCategoryModel.vue
@@ -0,0 +1,558 @@
+<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>
\ No newline at end of file

--
Gitblit v1.9.3