wyh 1 рік тому
батько
коміт
bdae3821aa

+ 25 - 4
src/views/module_ems/tpmEquipmentDefine/TpmEquipmentDefineList.vue

@@ -4,6 +4,27 @@
     <div class="table-page-search-wrapper">
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="设备分类名称">
+              <!-- <a-input placeholder="请输入设备分类名称" v-model="queryParam.name"></a-input> -->
+              <j-tree-select
+                ref="treeSelect"
+                placeholder="请选择设备分类"
+                v-model="queryParam.name"
+                dict="ems_tpm_equipment_define,name,name"
+                pidField="parentid"
+                pidValue="0"
+                hasChildField="has_child"
+                >
+              </j-tree-select>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
+            </span>
+          </a-col>
         </a-row>
       </a-form>
     </div>
@@ -12,18 +33,18 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
-      <a-button type="primary" icon="download" @click="handleExportXls('设备树定义')">导出</a-button>
+      <!-- <a-button type="primary" icon="download" @click="handleExportXls('设备树定义')">导出</a-button>
       <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
-      </a-upload>
+      </a-upload> -->
       <!-- 高级查询区域 -->
-      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
+      <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
       <a-dropdown v-if="selectedRowKeys.length > 0">
         <a-menu slot="overlay">
           <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
         </a-menu>
         <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
-      </a-dropdown>
+      </a-dropdown> -->
     </div>
 
     <!-- table区域-begin -->

+ 26 - 2
src/views/module_ems/tpmEquipmentDefine/modules/TpmEquipmentDefineModal.vue

@@ -13,10 +13,10 @@
         <a-form-model-item label="设备分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
           <a-input v-model="model.name" placeholder="请输入设备分类名称" ></a-input>
         </a-form-model-item>
-        <a-form-model-item label="上级ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parentid">
+        <a-form-model-item label="选择上级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parentid">
           <j-tree-select
             ref="treeSelect"
-            placeholder="请选择上级ID"
+            placeholder="请选择上级"
             v-model="model.parentid"
             dict="ems_tpm_equipment_define,name,id"
             pidField="parentid"
@@ -34,6 +34,7 @@
 <script>
 
   import { httpAction } from '@/api/manage'
+  import { duplicateCheck } from '@/api/api'
   import { validateDuplicateValue } from '@/utils/util'
   export default {
     name: "TpmEquipmentDefineModal",
@@ -57,6 +58,13 @@
 
         confirmLoading: false,
         validatorRules: {
+          name: [
+            { required: true, message: '请输入设备分类名称!'},
+            { validator: this.validateTemplateCode}
+          ],
+          parentid: [
+            { required: true, message: '请选择上级!'},
+          ],
         },
         url: {
           add: "/tpmEquipmentDefine/tpmEquipmentDefine/add",
@@ -72,6 +80,22 @@
        this.modelDefault = JSON.parse(JSON.stringify(this.model));
     },
     methods: {
+      validateTemplateCode(rule, value, callback){
+        var params = {
+          tableName: "ems_tpm_equipment_define",
+          fieldName: "name",
+          fieldVal: value,
+          dataId: this.model.name
+        }
+        duplicateCheck(params).then((res)=>{
+          if(res.success){
+            callback();
+          }else{
+            callback("设备分类名称已存在,请重新输入");
+          }
+        })
+
+      },
       add (obj) {
         this.modelDefault.parentid=''
         this.edit(Object.assign(this.modelDefault , obj));