From fc31bda418c337ba9d3650186b8f1547ba9c5ad0 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期六, 25 五月 2024 22:39:58 +0800
Subject: [PATCH] 表格错行

---
 Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue |  345 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 240 insertions(+), 105 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
index 0f83ebf..bfa9643 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -1,6 +1,7 @@
 <template>
   <div>
-    <div v-if="this.crudArrayFlag" class="app" style="display: flex;flex-wrap: wrap; display: inline-block">
+    <div v-if="this.crudArrayFlag" class="app"
+         style="display: flex;flex-wrap: wrap; display: inline-block;height: 80px">
       <el-button-group>
         <!--鏂板-->
         <span v-if="permissionList.busineStatus">
@@ -276,8 +277,8 @@
       </el-dialog>
       <!--        鍏ㄥ睆缂栬緫-->
       <el-dialog :before-close="escEdit" :visible.sync="attrEditVisible" append-to-body fullscreen="true">
-        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :crudArrayFlag="this.crudArrayFlag"
-                  :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag"
+        <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :btnAuthList="btnAuthList"
+                  :crudArrayFlag="this.crudArrayFlag" :editOpenFlag="editOpenFlag" :editStyleFlag="editStyleFlag"
                   @editCloseChildren="editClose"></attrCrud>
       </el-dialog>
       <!--      缁勫悎瑙勫垯-->
@@ -318,89 +319,111 @@
         :referConfigOption="referConfigOption"
         @setReferConfigValue="setReferConfigValue"
       ></refer-config-dialog>
+      <!--杩戜箟璇嶆煡璇㈣鍒�      -->
+      <el-dialog :visible.sync="synonymVisible" append-to-body title="杩戜箟璇嶆煡璇㈣鍒�">
+        <avue-crud v-loading="sysonymLoading" :data="synonymData" :option="synonymOption" @selection-change="sysChange">
+          <template slot="lcStatus" slot-scope="{row}">
+            <el-tag v-if="row.lcStatus === 'Released'" type="success">鍚敤</el-tag>
+            <el-tag v-else type="danger">鍋滅敤</el-tag>
+          </template>
+        </avue-crud>
+        <div slot="footer" class="dialog-footer">
+          <el-button type="info" @click="sysClear">娓呯┖</el-button>
+          <el-button type="primary" @click="sysnonymSubmit">纭畾</el-button>
+          <el-button @click="sysnonymCancel">鍙栨秷</el-button>
+        </div>
+      </el-dialog>
 
     </div>
 
-      <el-table v-if="this.crudArrayFlag"
-                ref="referAttrCrud"
-                v-loading="loading"
-                :data="ProData"
-                :height="this.tableHeight"
-                :header-cell-style="{background:'#FAFAFA',color:'#505050'}"
-                border
-                style="width: 100%"
-                @select="selectHandle"
-                @cell-click="handleCellClicks"
-                @selection-change="selectionChange"
-                @row-click="rowClick"
+    <el-table v-if="this.crudArrayFlag"
+              ref="referAttrCrud"
+              v-loading="loading"
+              :data="ProData"
+              :header-cell-style="{background:'#FAFAFA',color:'#505050'}"
+              :height="this.tableHeight"
+              border
+              style="width: 100%"
+              @select="selectHandle"
+              @cell-click="handleCellClicks"
+              @selection-change="selectionChange"
+              @row-click="rowClick"
+    >
+      <el-table-column
+        :fixed="!editStyleFlag ? 'left' : undefined"
+        type="selection" width="55">
+      </el-table-column>
+      <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>-->
+      <el-table-column v-for="(item,index) in this.option.column" v-if="item.edit !='referName'"
+                       :key="item.id"
+                       :fixed="!editStyleFlag ? item.fixed : undefined"
+                       :formatter="formAttr"
+                       :label="item.label"
+                       :prop="item.prop"
+                       :show-overflow-tooltip="true"
+                       :sortable="item.sortable"
+                       :width="item.width||(item.label.length >=4 ?'160':item.label.length==3 ?'130':'100')"
+                       align="center"
       >
-        <el-table-column
-          :fixed="!editStyleFlag ? 'left' : undefined"
-          type="selection" width="55">
-        </el-table-column>
-        <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>-->
-        <el-table-column v-for="(item,index) in this.option.column" v-if="item.edit !='referName'"
-                         :key="item.id"
-                         :fixed="!editStyleFlag ? item.fixed : undefined"
-                         :formatter="formAttr"
-                         :label="item.label"
-                         :prop="item.prop"
-                         :show-overflow-tooltip="true"
-                         :sortable="item.sortable"
-                         :width="item.width||(item.label.length >=4 ?'160':item.label.length==3 ?'130':'100')"
-                         align="center"
-        >
-          <template slot-scope="{ row }">
-            <el-input
-              v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )"
-              v-show="!AddCellFlag"
-              :ref="'input' + row.oid"
-              v-model="row[item.prop]"
-              @blur="saveRows(row)"
-            ></el-input>
-            <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'"
-                             v-show="!AddCellFlag"
-                             v-model="row[item.prop]"
-                             :style="{width:(item.width-10)+'px'}"
-                             controls-position="right"
-                             size="small" @blur="saveRows"></el-input-number>
-            <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " slot="prepend" :clearable="true"
-                       v-model="row[item.prop]" allow-create default-first-option
-                       filterable v-show="!AddCellFlag"
-                       @blur="selectChangeHandler(item.editConfig,index)">
-              <el-option
-                v-for="optionItem in item.data"
-                :key="optionItem.dictValue"
-                :label="optionItem.dictValue"
-                :value="optionItem.dictValue">
-              </el-option>
-            </el-select>
-            <el-switch
-              v-if="item.edit === 'switch'" v-model="row[item.prop]" :disabled="!editOpenFlag" active-value="true"
-              inactive-value="false">
-            </el-switch>
-            <span v-else>{{ row[item.prop] }}</span>
-          </template>
-        </el-table-column>
-        <el-table-column
-          fixed="right"
-          label="鎿嶄綔"
-          width="70">
-          <template slot-scope="scope">
-            <el-button
-              size="small"
-              type="text"
-              @click.native.prevent="CrudRowDel(scope.$index)">
-              绉婚櫎
-            </el-button>
-          </template>
-        </el-table-column>
-      </el-table>
-    </div>
+        <template slot-scope="{ row }">
+          <el-input
+            v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )"
+            v-show="!AddCellFlag"
+            :ref="'input' + row.oid"
+            v-model="row[item.prop]"
+            @blur="saveRows(row)"
+          ></el-input>
+          <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'"
+                           v-show="!AddCellFlag"
+                           v-model="row[item.prop]"
+                           :style="{width:(item.width-10)+'px'}"
+                           controls-position="right"
+                           size="small" @blur="saveRows"></el-input-number>
+          <el-select v-if="editingRows === row && editShows== item.prop && item.edit == 'select' " v-show="!AddCellFlag"
+                     slot="prepend"
+                     v-model="row[item.prop]" :clearable="true" allow-create
+                     default-first-option filterable
+                     @blur="selectChangeHandler(item.editConfig,index)">
+            <el-option
+              v-for="optionItem in item.data"
+              :key="optionItem.dictValue"
+              :label="optionItem.dictValue"
+              :value="optionItem.dictValue">
+            </el-option>
+          </el-select>
+          <el-switch
+            v-if="item.edit === 'switch'" v-model="row[item.prop]" :disabled="!editOpenFlag" active-value="true"
+            inactive-value="false">
+          </el-switch>
+          <span v-else>{{ row[item.prop] }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        fixed="right"
+        label="鎿嶄綔"
+        width="70">
+        <template slot-scope="scope">
+          <el-button
+            size="small"
+            type="text"
+            @click.native.prevent="CrudRowDel(scope.$index)">
+            绉婚櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </div>
 </template>
 
 <script>
-import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag} from '@/api/template/templateAttr'
+import {
+  AttrByBtm,
+  gridCodeClassifyTemplateAttr,
+  batchAddSave,
+  copyto,
+  listByFlag,
+  codeSynonym
+} from '@/api/template/templateAttr'
 import {getList} from "@/api/refer/table";
 import func from "@/util/func";
 import {getCurrentInstance} from "vue";
@@ -451,6 +474,9 @@
       type: Boolean,
       default: false
     },
+    btnAuthList: {
+      type: Array
+    }
   },
   watch: {
     crudOid: {
@@ -515,6 +541,48 @@
   },
   data() {
     return {
+      sysSelectData: [],
+      sysonymLoading: false,
+      synonymOption: {
+        addBtn: false,
+        editBtn: false,
+        delBtn: false,
+        refreshBtn: false,
+        columnBtn: false,
+        menu: false,
+        selection: true,
+        column: [
+          {
+            label: '缂栫爜',
+            prop: 'id',
+            align: 'center'
+          },
+          {
+            label: '鍚嶇О',
+            prop: 'name',
+            align: 'center'
+          },
+          {
+            label: '婧愬��',
+            prop: 'sourceValue',
+            align: 'center'
+          },
+          {
+            label: '鍚屼箟璇�',
+            prop: 'synonymValue',
+            align: 'center'
+          },
+          {
+            label: '鍚仠鐘舵��',
+            prop: 'lcStatus',
+            align: 'center',
+            slot: true
+          },
+        ]
+      },
+      synonymData: [],
+      //杩戜箟璇嶆煡璇㈣鍒�
+      synonymVisible: false,
       //琛ㄦ牸楂樺害
       dynamicHeight: '',
       // 淇濆瓨鍗曞厓鏍肩姸鎬�
@@ -808,7 +876,7 @@
           },
           {
             label: "鍙",
-            prop: "readonlyFlag",
+            prop: "readOnlyFlag",
           },
           {
             label: "鍒楄〃鎺掑簭",
@@ -1107,8 +1175,10 @@
         indexClassName: "搴忓彿",
         indexLabelClassName: '搴忓彿',
         index: true,
-        indexFixed:false,
-        selectionFixed:false,
+        indexFixed: false,
+        selectionFixed: false,
+        columnBtn: false,
+        refreshBtn: false,
         border: true,
         addBtn: false,
         menu: false,
@@ -1284,6 +1354,12 @@
             edit: "switch"
           },
           {
+            label: '杩戜箟璇嶆煡璇㈣鍒�',
+            prop: 'sysonymRuleOidsText',
+            cell: false,
+            edit: 'refer'
+          },
+          {
             label: "鐩镐技鏌ラ噸灞炴��",
             prop: "sameRepeatAttrFlag",
             width: 110,
@@ -1310,7 +1386,7 @@
           },
           {
             label: "鍙",
-            prop: "readonlyFlag",
+            prop: "readOnlyFlag",
             cell: false,
             edit: "switch"
           },
@@ -1322,7 +1398,7 @@
           },
           {
             label: "澶氳鏂囨湰",
-            prop: "textareaFlag",
+            prop: "textAreaFlag",
             cell: false,
             edit: "switch"
           },
@@ -1537,13 +1613,13 @@
         value: 'tableDisplayFlag',
         label: '鍒楄〃鏄剧ず'
       }, {
-        value: 'readonlyFlag',
+        value: 'readOnlyFlag',
         label: '鍙'
       }, {
         value: 'sortAttrFlag',
         label: '鍒楄〃鎺掑簭'
       }, {
-        value: 'textareaFlag',
+        value: 'textAreaFlag',
         label: '澶氳鏂囨湰'
       }, {
         value: 'imageFlag',
@@ -1558,20 +1634,20 @@
     ...mapGetters(["permission"]),
     permissionList() {
       return {
-        busineStatus: this.vaildData(this.permission.classifyTree.attr_add, false),
-        fullscreenStatus: this.vaildData(this.permission.classifyTree.attr_view_edit, false),
-        ruleStatus: this.vaildData(this.permission.classifyTree.attr_rule, false),
-        attrStatus: this.vaildData(this.permission.classifyTree.attr_group, false),
-        saveStatus: this.vaildData(this.permission.classifyTree.attr_save, false),
-        resetStatus: this.vaildData(this.permission.classifyTree.attr_reset, false),
-        injectStatus: this.vaildData(this.permission.classifyTree.attr_inject, false),
-        isShowStatus: this.vaildData(this.permission.classifyTree.attr_formrule, false),
-        enumStatus: this.vaildData(this.permission.classifyTree.attr_enum, false),
-        cascadStatus: this.vaildData(this.permission.classifyTree.attr_parentcode, false),
-        syncStatus: this.vaildData(this.permission.classifyTree.attr_sync, false),
-        applicationStatus: this.vaildData(this.permission.classifyTree.attr_application, false),
-        orderStatus: this.vaildData(this.permission.classifyTree.attr_sort, false),
-        removeStatus: this.vaildData(this.permission.classifyTree.attr_delete, false),
+        busineStatus: this.vaildData(this.btnAuthList.attr_add, false),
+        fullscreenStatus: this.vaildData(this.btnAuthList.attr_view_edit, false),
+        ruleStatus: this.vaildData(this.btnAuthList.attr_rule, false),
+        attrStatus: this.vaildData(this.btnAuthList.attr_group, false),
+        saveStatus: this.vaildData(this.btnAuthList.attr_save, false),
+        resetStatus: this.vaildData(this.btnAuthList.attr_reset, false),
+        injectStatus: this.vaildData(this.btnAuthList.attr_inject, false),
+        isShowStatus: this.vaildData(this.btnAuthList.attr_formrule, false),
+        enumStatus: this.vaildData(this.btnAuthList.attr_enum, false),
+        cascadStatus: this.vaildData(this.btnAuthList.attr_parentcode, false),
+        syncStatus: this.vaildData(this.btnAuthList.attr_sync, false),
+        applicationStatus: this.vaildData(this.btnAuthList.attr_application, false),
+        orderStatus: this.vaildData(this.btnAuthList.attr_sort, false),
+        removeStatus: this.vaildData(this.btnAuthList.attr_delete, false),
       }
     },
     attrOids() {
@@ -1592,7 +1668,7 @@
       if (this.editStyleFlag) {
         return '800px'
       } else {
-        return 'calc(100vh - 595px)'
+        return 'calc(100vh - 602px)'
       }
     }
   },
@@ -1606,6 +1682,35 @@
     })
   },
   methods: {
+    //杩戜箟璇嶆煡璇㈣鍒欏彇娑�
+    sysnonymCancel() {
+      this.synonymVisible = false;
+    },
+    //杩戜箟璇嶆煡璇㈣鍒欑‘瀹�
+    sysnonymSubmit() {
+      if (this.sysSelectData.length <= 0) {
+        this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
+      } else {
+        const newArray = this.sysSelectData.map(obj => obj.oid);
+        const newString = newArray.join(',');
+        const newArrayName = this.sysSelectData.map(obj => obj.name);
+        const newStringName = newArrayName.join(',')
+        this.$set(this.CurrentCell, 'sysonymRuleOids', newString)
+        //text
+        this.$set(this.CurrentCell, 'sysonymRuleOidsText', newStringName)
+        this.$set(this.CurrentCell, 'sysonymRuleOidsData', this.sysSelectData)
+        this.AddCellFlag = true;
+        this.synonymVisible = false;
+      }
+    },
+    sysClear(){
+      this.CurrentCell.sysonymRuleOidsText = "";
+      this.CurrentCell.sysonymRuleOidsData = "";
+      this.AddCellFlag = true;
+    },
+    sysChange(row) {
+      this.sysSelectData = row;
+    },
     //鏂板鎼滅储
     AddFindHandler() {
       if (this.SelectValue == 'id') {
@@ -1718,7 +1823,10 @@
             attrTableWidth: 120,
             ts: ""
           })
-          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
+          // 灏嗚嫳鏂囩紪鍙疯浆鎹负灏忓啓
+          let {id, ...res} = this.busineAddList;
+          this.busineAddList = {id: id.toLowerCase(), ...res};
+          this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)));
         }
       })
       this.addVisible = false;
@@ -1867,6 +1975,7 @@
     //琛ㄦ牸琛岀紪杈�
     handleCellClicks(row, column) {
       if (this.editOpenFlag) {
+        this.AddCellFlag = false;
         this.editingRows = row;
         this.editShows = column.property;
         this.rowOid = row.oid;
@@ -1932,6 +2041,17 @@
             if (this.CurrentCell.attributeGroup !== '') {
               this.attrModel = this.CurrentCell.attributeGroup
             }
+          },
+          sysonymRuleOidsText: () => {
+            this.sysonymLoading = true
+            codeSynonym('1', '-1', 'Released').then(res => {
+              this.synonymData = res.data.data.records;
+              this.sysonymLoading = false;
+            }).catch(() => {
+              this.$message.error('璇锋鏌ユ帶鍒跺彴閿欒淇℃伅锛�')
+            })
+
+            this.synonymVisible = true;
           }
         };
 
@@ -2064,16 +2184,24 @@
       const regex = new RegExp(this.rulesData.ruleRowBds);
       if (regex.test(this.RulesForm.TestContent)) {
         this.$message.success('鏍¢獙鎴愬姛')
+      } else {
+        this.$message.error('鏍¢獙澶辫触')
       }
     },
     //鐐瑰嚮鍒嗙被娉ㄥ叆鎸夐挳
     injectBtn() {
       if (this.attrSelectList.length > 1) {
         this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉挎暟鎹�')
-      } else if (this.attrSelectList.length < 1) {
+        return;
+      }
+      if (this.attrSelectList.length < 1) {
         this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉挎暟鎹�')
-      } else if (this.attrSelectList.length === 1) {
+        return;
+        ;
+      }
+      if (this.attrSelectList.length === 1) {
         this.injectVisible = true;
+        return;
       }
     },
     //鍒嗙被娉ㄥ叆淇濆瓨
@@ -2227,9 +2355,16 @@
 </script>
 
 <style lang="scss" scoped>
+
+/deep/ .el-table__fixed-body-wrapper {
+  .el-table__body {
+    padding-bottom: 15px;
+  }
+}
+
 //鍥哄畾鍒楅珮搴�
 /deep/ .el-table__fixed {
-  height: calc(100vh - 612px) !important;
+  height: calc(100vh - 618px) !important;
 }
 
 ///deep/ .el-table__fixed[v-if='editStyleFlag'] {

--
Gitblit v1.9.3