From eab984ba7deca1b653195b10627d5289e0503b3b Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 29 八月 2023 17:54:13 +0800
Subject: [PATCH] 1.计量单位完成80%

---
 src/views/systemSetting/encodingRules.vue |  249 ++++++++++++++++---------------------------------
 1 files changed, 84 insertions(+), 165 deletions(-)

diff --git a/src/views/systemSetting/encodingRules.vue b/src/views/systemSetting/encodingRules.vue
index 1a7f313..7efcb65 100644
--- a/src/views/systemSetting/encodingRules.vue
+++ b/src/views/systemSetting/encodingRules.vue
@@ -1,8 +1,14 @@
 <template>
   <div>
     <div class="body" :style="{height:mainHeight+'px'}">
-      <div class="bodyTopButtonGroup" style="justify-content: space-between">
-        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+      <div class="bodyTopButtonGroup">
+        <el-button
+          v-waves
+          :style="{visibility:$buttoncode.includes('Add')?'':'hidden'}"
+          type="primary"
+          icon="el-icon-circle-plus-outline"
+          @click="add('add')"
+        >鏂板</el-button>
       </div>
 
       <div class="bodyTopFormGroup">
@@ -14,7 +20,7 @@
           style="display: flex;"
         >
           <div class="elForm">
-            <el-form-item label="缂栫爜鍚嶇О" style=" display: flex;">
+            <el-form-item label="鑿滃崟鍚嶇О" style=" display: flex;">
               <el-input v-model="form.rightname" placeholder="璇疯緭鍏�" style="width: 200px" />
             </el-form-item>
             <el-form-item label="鍥哄畾瀛楃" style=" display: flex;">
@@ -22,13 +28,17 @@
             </el-form-item>
 
           </div>
-          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
-            <el-button v-waves type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
+          <div
+            class="bodySearchReset"
+            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
+          >
+            <el-button v-waves type="primary" icon="el-icon-search" @click="getEncodingRules">鏌ヨ</el-button>
             <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
           </div>
         </el-form>
         <div
           class="bodyTopFormExpand"
+          style="height:5px"
         >
           <!--          <svg-icon-->
           <!--            v-show="mouseHoverType==='mouseout'"-->
@@ -47,7 +57,6 @@
       </div>
 
       <div class="elTableDiv">
-        <!--        :row-class-name="tableRowClassName"-->
 
         <el-table
           ref="tableDataRef"
@@ -55,6 +64,7 @@
           :data="tableData"
           :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
           border
+          row-class-name="custom-row"
           :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
@@ -62,43 +72,49 @@
           @sort-change="sortChange"
         >
           <el-table-column
-            prop="RowNum"
+            prop="rowNum"
             width="50"
             fixed
             label="搴忓彿"
           />
           <el-table-column
-            prop="org_code"
-            label="缂栫爜"
+            prop="menucode"
+            label="鑿滃崟缂栫爜"
             sortable="custom"
           />
           <el-table-column
-            prop="org_name"
-            label="缂栫爜鍚嶇О"
+            prop="menuname"
+            label="鑿滃崟鍚嶇О"
             sortable="custom"
           />
           <el-table-column
-            prop="description"
-            label="绫诲瀷"
+            prop="type"
+            label="鑿滃崟绫诲瀷"
             sortable="custom"
           />
           <el-table-column
-            prop="parentorg_name"
+            prop="prefix"
             label="鍥哄畾瀛楃"
             sortable="custom"
           />
           <el-table-column
-            prop="lm_user"
+            prop="filingdate"
             label="缂栫爜鏍煎紡"
             sortable="custom"
           />
           <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
+            prop="incbit"
+            label="鑷浣嶆暟"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="value"
+            label="娴佹按鍙�"
             width="160"
             sortable="custom"
           />
           <el-table-column
+            v-if="$buttoncode.toString().length"
             label="鎿嶄綔"
             width="120"
             fixed="right"
@@ -106,10 +122,18 @@
             <template slot-scope="{row}">
               <div class="operationClass">
                 <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
-                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
+                  <i
+                    class="el-icon-edit-outline"
+                    :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Update')?'':'none'}"
+                    @click="edit('edit',row)"
+                  />
                 </el-tooltip>
                 <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
-                  <i class="el-icon-delete" @click="del(row)" />
+                  <i
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme,display:$buttoncode.includes('Delete')?'':'none'}"
+                    @click="del(row)"
+                  />
                 </el-tooltip>
               </div>
             </template>
@@ -181,7 +205,7 @@
         </el-form-item>
 
         <el-form-item label="鑷浣嶆暟" prop="incbit" required>
-          <el-input v-model="dialogForm.incbit" style="width: 200px" />
+          <el-input v-model="dialogForm.incbit" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
         </el-form-item>
 
         <el-form-item label="缂栫爜棰勮">
@@ -192,7 +216,13 @@
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
           <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button v-waves type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+          <el-button
+            v-waves
+            type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            @click="dialogVisibleConfirm"
+          >纭� 瀹�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -202,13 +232,11 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/basicSettings'
 import { getCookie } from '@/utils/auth'
 import { validateCode } from '@/utils/global'
 import elDragDialog from '@/directive/el-drag-dialog'
 import waves from '@/directive/waves'
-import { LoginMenu } from '@/api/user'
-import { CodeMenuSelect, EncodingRules, SaveEncodingRules } from '@/api/systemSetting'
+import { CodeMenuSelect, DeleteEncodingRules, EncodingRules, SaveEncodingRules } from '@/api/systemSetting'
 import arrayToTree from 'array-to-tree'
 
 export default {
@@ -219,7 +247,6 @@
   directives: { elDragDialog, waves },
   data() {
     return {
-      mouseHoverType: 'mouseout',
       isExpandForm: false,
       mainHeight: 0,
       tableHeight: 0,
@@ -244,9 +271,9 @@
       },
       encodingPre: '', // 缂栫爜棰勮
       dateType: [
-        { name: '骞存湀鏃�', code: 'YMD' },
-        { name: '骞存湀', code: 'YM' },
-        { name: '骞�', code: 'Y' }
+        { name: '骞存湀鏃�', code: '骞存湀鏃�' },
+        { name: '骞存湀', code: '骞存湀' },
+        { name: '骞�', code: '骞�' }
       ],
       menuOptionsAll: [],
       menuOptions: [],
@@ -278,11 +305,11 @@
       handler(newValue, oldValue) {
         const date = new Date()
         let newDate = ''
-        if (newValue.filingdate === 'YMD') {
+        if (newValue.filingdate === '骞存湀鏃�') {
           newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0') + '' + (date.getDate() + '').padStart(2, '0')
-        } else if (newValue.filingdate === 'YM') {
+        } else if (newValue.filingdate === '骞存湀') {
           newDate = date.getFullYear().toString().substring(2, 4) + '' + (date.getMonth() + 1 + '').padStart(2, '0')
-        } else if (newValue.filingdate === 'Y') {
+        } else if (newValue.filingdate === '骞�') {
           newDate = date.getFullYear().toString().substring(2, 4) + ''
         }
         this.encodingPre = newValue.prefix + '' + newDate + '' + (1 + '').padStart(newValue.incbit, '0')
@@ -309,7 +336,6 @@
         childrenProperty: 'children'
       })
       this.menuOptions = this.menuOptionsAll.filter(i => i.type === this.dialogForm.type)
-      console.log(this.menuOptions, 2)
     },
     radioChange() {
       this.menuOptions = this.menuOptionsAll.filter(i => i.type === this.dialogForm.type)
@@ -332,17 +358,12 @@
       this.form.prop = prop
       this.getEncodingRules()
     },
-    // 鏌ヨ
-    search() {
-      this.getEncodingRules()
-    },
     // 閲嶇疆
     reset() {
       this.form.rightname = ''
       this.form.prefix = ''
       this.getEncodingRules()
     },
-
     // 鏂板鎸夐挳
     add(operation) {
       this.operation = operation
@@ -354,9 +375,24 @@
       this.dialogVisible = true
 
       this.$nextTick(() => {
-        this.dialogForm.OrgCode = row.org_code
-        this.dialogForm.OrgName = row.org_name
-        this.dialogForm.SupUnit = row.parent_id
+        this.dialogForm.type = row.type
+
+        let parentCode = ''
+        this.menuOptions.forEach(item => {
+          if (item.children && item.children.length) {
+            item.children.forEach(it => {
+              if (it.menucode === row.menucode) {
+                parentCode = it.parent_id
+              }
+            })
+          }
+        })
+
+        this.$refs.cascader.checkedValue = [parentCode, row.menucode]
+        this.dialogForm.rightcode = row.menucode
+        this.dialogForm.incbit = row.incbit
+        this.dialogForm.filingdate = row.filingdate
+        this.dialogForm.prefix = row.prefix
       })
     },
     // 鍒犻櫎鎸夐挳
@@ -366,9 +402,9 @@
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteOrganization({ orgid: row.code }).then(res => {
+        DeleteEncodingRules({ menucode: row.menucode }).then(res => {
           if (res.code === '200') {
-            this.$message.success('鍒犻櫎鎴愬姛!')
+            this.$notify.success('鍒犻櫎鎴愬姛!')
             if (this.form.page > 1 && this.tableData.length === 1) {
               this.form.page--
             }
@@ -376,7 +412,7 @@
           }
         })
       }).catch(() => {
-        this.$message.info('宸插彇娑堝垹闄�')
+        this.$notify.info('宸插彇娑堝垹闄�')
       })
     },
     // 瀵硅瘽妗嗗叧闂簨浠�
@@ -397,16 +433,18 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
-          const rightcode = this.$refs.cascader.checkedValue[ this.$refs.cascader.checkedValue.length - 1]
+          this.$store.state.app.buttonIsDisabled = true
+          const rightcode = this.$refs.cascader.checkedValue[this.$refs.cascader.checkedValue.length - 1]
           this.dialogForm.rightcode = rightcode
           this.dialogForm.rightname = this.menuOptions[this.menuOptions.findIndex(i => i.menucode === this.$refs.cascader.checkedValue[0])].children.find(i => i.menucode === rightcode).menuname
-
           SaveEncodingRules(this.dialogForm).then(res => {
             if (res.code === '200') {
               this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false
+              this.$store.state.app.buttonIsDisabled = false
               this.getEncodingRules()
             } else {
+              this.$store.state.app.buttonIsDisabled = false
               this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
             }
           })
@@ -417,129 +455,10 @@
     getHeight() {
       this.$nextTick(() => {
         this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 255
+        this.tableHeight = this.mainHeight - 240
         this.$refs.tableDataRef.doLayout()
       })
     }
-    // tableRowClassName({ row, rowIndex }) {
-    //   return 'custom-row'
-    // }
   }
 }
 </script>
-
-<!--鍏叡椤甸潰鏍峰紡-->
-<!--<style lang="scss" scoped>-->
-<!--$main_color: #42b983;-->
-<!--::v-deep .el-button&#45;&#45;text{-->
-<!--  font-size: 14px ;-->
-<!--  cursor: pointer ;-->
-<!--}-->
-<!--.el-icon-share ,.el-icon-delete,.el-icon-edit-outline{-->
-<!--  color: $main_color;-->
-<!--  cursor: pointer;-->
-<!--}-->
-<!--.el-icon-edit-outline{-->
-<!--  margin-right: 15px;-->
-<!--}-->
-
-<!--::v-deep .el-button&#45;&#45;primary, .el-button&#45;&#45;default, .el-button&#45;&#45;info {-->
-<!--  height: 34px;-->
-<!--  display: flex;-->
-<!--  align-items: center;-->
-<!--  padding: 0 15px;-->
-<!--}-->
-
-<!--::v-deep .el-button&#45;&#45;primary {-->
-<!--  //background-color: $main_color !important;-->
-<!--}-->
-
-<!--::v-deep .el-button&#45;&#45;default {-->
-<!--  background-color: #f8f8fa;-->
-<!--  border: none;-->
-<!--}-->
-
-<!--::v-deep .el-input__inner {-->
-<!--  height: 34px;-->
-<!--  line-height: 34px;-->
-<!--  //color: #a7a7a7;-->
-<!--}-->
-
-<!--::v-deep .el-dialog__body {-->
-<!--  padding: 20px 100px !important;-->
-<!--}-->
-
-<!--::v-deep .dialogVisibleRoles .el-dialog__body {-->
-<!--  padding: 20px 20px !important;-->
-<!--}-->
-
-<!--::v-deep .importPickerClass .el-dialog__body {-->
-<!--  padding: 20px 20px !important;-->
-<!--}-->
-
-<!--::v-deep .el-dialog__footer {-->
-<!--  display: flex;-->
-<!--  justify-content: flex-end;-->
-<!--}-->
-
-<!--::v-deep .el-table .caret-wrapper {-->
-<!--  transform: scale(0.8);-->
-<!--}-->
-
-<!--::v-deep .cell {-->
-<!--  display: flex;-->
-<!--  align-items: center;-->
-<!--  justify-content: space-between;-->
-<!--}-->
-
-<!--::v-deep .el-table::before {-->
-<!--  height: 0;-->
-<!--}-->
-
-<!--::v-deep .el-table__body-wrapper {-->
-<!--  background-color: #f8f8fa;-->
-<!--}-->
-
-<!--::v-deep .el-table__body .el-table__row.hover-row td{-->
-<!--  background-color: #eaecef ;-->
-<!--}-->
-
-<!--::v-deep .el-form&#45;&#45;inline .el-form-item__label {-->
-<!--  color: #a7a7a7;-->
-<!--}-->
-
-<!--.body ::v-deep .el-divider {-->
-<!--  border: 1px solid #eee;-->
-<!--  width: 99%;-->
-<!--  margin: 10px auto;-->
-<!--}-->
-
-<!--.body ::v-deep .el-form-item {-->
-<!--  margin-bottom: 0;-->
-<!--}-->
-
-<!--.userDialogVisible ::v-deep .el-form-item {-->
-<!--  margin-bottom: 0;-->
-<!--}-->
-
-<!--::v-deep .el-select__caret{-->
-<!--  display: flex;-->
-<!--  align-items: center;-->
-<!--  justify-content: center;-->
-<!--}-->
-
-<!--.tableFixed{-->
-<!--  ::v-deep .el-table__fixed-right{-->
-<!--    height: 100% !important;-->
-<!--  }-->
-<!--  ::v-deep .el-table__fixed{-->
-<!--    height: 100% !important;-->
-<!--  }-->
-<!--}-->
-<!--</style>-->
-<!--<style>-->
-
-<!--.el-table .custom-row {-->
-<!--  background: #f8f8fa;-->
-<!--}-->
-<!--</style>-->

--
Gitblit v1.9.3