From 2146654ce466348808bd11218d5a71756d03abc4 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 13 三月 2025 16:46:05 +0800
Subject: [PATCH] 1.打印模板修改2.新增打印次数字段

---
 src/views/basicSettings/roleList.vue |  967 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 487 insertions(+), 480 deletions(-)

diff --git a/src/views/basicSettings/roleList.vue b/src/views/basicSettings/roleList.vue
index d5bc41a..d5c9dbe 100644
--- a/src/views/basicSettings/roleList.vue
+++ b/src/views/basicSettings/roleList.vue
@@ -1,480 +1,487 @@
-<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>
-        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=4')">瀵煎叆</el-button>
-      </div>
-
-      <div class="bodyTopFormGroup">
-        <el-form
-          ref="form"
-          :model="form"
-          label-width="100px"
-          inline
-          style="display: flex;"
-        >
-          <div class="elForm">
-            <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;">
-              <el-input v-model="form.role_code" placeholder="璇疯緭鍏�" style="width: 200px" />
-            </el-form-item>
-            <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.role_name" placeholder="璇疯緭鍏�" style="width: 200px" />
-            </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="getRoleData">鏌ヨ</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'"-->
-          <!--            style="cursor: pointer"-->
-          <!--            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
-          <!--            @mouseenter="mouseHoverType=$event.type"-->
-          <!--          />-->
-          <!--          <svg-icon-->
-          <!--            v-show="mouseHoverType==='mouseenter'"-->
-          <!--            style="cursor: pointer"-->
-          <!--            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
-          <!--            @click="isExpandForm=!isExpandForm"-->
-          <!--            @mouseout="mouseHoverType=$event.type"-->
-          <!--          />-->
-        </div>
-      </div>
-
-      <div class="elTableDiv">
-        <el-table
-          ref="tableDataRef"
-          class="tableFixed"
-          :data="tableData"
-          :height="tableHeight+'px'"
-          border
-          row-class-name="custom-row"
-          :style="{width: 100+'%',height:tableHeight+'px',}"
-          highlight-current-row
-          :header-cell-style="this.$headerCellStyle"
-          :cell-style="this.$cellStyle"
-          @sort-change="sortChange"
-        >
-          <el-table-column
-            prop="rowNum"
-            width="120"
-            fixed
-            label="搴忓彿"
-          />
-          <el-table-column
-            prop="rolecode"
-            label="瑙掕壊缂栫爜"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="rolename"
-            label="瑙掕壊鍚嶇О"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="status"
-            label="鐘舵��"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag>
-              <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag>
-            </template>
-          </el-table-column>
-          <!--          <el-table-column-->
-          <!--            prop="dataname"-->
-          <!--            label="鏉冮檺鑼冨洿"-->
-          <!--            sortable="custom"-->
-          <!--          />-->
-          <el-table-column
-            prop="description"
-            label="澶囨敞"
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              {{ row.description?row.description:'/' }}
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="username"
-            label="鍒涘缓浜哄憳"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="lm_date"
-            label="鍒涘缓鏃堕棿"
-            width="160"
-            sortable="custom"
-          />
-          <el-table-column
-            label="鎿嶄綔"
-            width="160"
-            fixed="right"
-          >
-            <template slot-scope="{row}">
-              <div class="operationClass">
-                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
-                  <i
-                    class="el-icon-edit-outline"
-                    :style="{color:$store.state.settings.theme}"
-                    @click="edit('edit',row)"
-                  />
-                </el-tooltip>
-                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
-                  <i
-                    class="el-icon-delete"
-                    :style="{color:$store.state.settings.theme}"
-                    @click="del(row)"
-                  />
-                </el-tooltip>
-
-                <el-dropdown placement="bottom" @command="command=>handleCommand(command,row)">
-                  <div
-                    class="el-dropdown-link"
-                    style="display: flex;align-content: center;
-                    justify-content: center;
-                    cursor: pointer;"
-                    :style="{color:$store.state.settings.theme}"
-                  >
-                    <div>鏇村</div>
-                    <div>
-                      <i class="el-icon-arrow-down el-icon--right" />
-                    </div>
-                  </div>
-                  <el-dropdown-menu slot="dropdown">
-                    <el-dropdown-item icon="el-icon-circle-check" command="menuPower">鑿滃崟鏉冮檺</el-dropdown-item>
-                    <el-dropdown-item icon="el-icon-user" command="divideUser">鍒嗛厤鐢ㄦ埛</el-dropdown-item>
-                    <!--                    <el-dropdown-item icon="el-icon-download" command="downloadMenu">瀵煎嚭鑿滃崟</el-dropdown-item>-->
-                  </el-dropdown-menu>
-                </el-dropdown>
-              </div>
-            </template>
-          </el-table-column>
-        </el-table>
-      </div>
-      <!--鍒嗛〉-->
-      <pagination
-        :total="total"
-        :page.sync="form.page"
-        :limit.sync="form.rows"
-        align="right"
-        layout="total,prev, pager, next,sizes,jumper"
-        popper-class="select_bottom"
-        @pagination="getRoleData"
-      />
-    </div>
-
-    <el-dialog
-      v-el-drag-dialog
-      :title="operation==='add'?'鏂板':'缂栬緫'"
-      :visible.sync="dialogVisible"
-      width="800px"
-      :close-on-click-modal="false"
-      top="15vh"
-      @closed="handleClose"
-      @close="handleClose"
-    >
-      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
-        <!--        <el-form-item label="瑙掕壊缂栫爜" prop="rolecode">-->
-        <!--          <el-input v-model="dialogForm.rolecode" :disabled="operation!=='add'" style="width: 200px" />-->
-        <!--        </el-form-item>-->
-        <el-form-item label="瑙掕壊鍚嶇О" prop="rolename">
-          <el-input v-model="dialogForm.rolename" style="width: 200px" />
-        </el-form-item>
-
-        <!--        <el-form-item required label="鏁版嵁鑼冨洿">-->
-        <!--          <el-select-->
-        <!--            v-model="dialogForm.datacode"-->
-        <!--            style="width:200px"-->
-        <!--            placeholder="璇烽�夋嫨"-->
-        <!--            :popper-append-to-body="false"-->
-        <!--          >-->
-        <!--            <el-option-->
-        <!--              v-for="item in datacodeArr"-->
-        <!--              :key="item.datacode"-->
-        <!--              :label="item.dataname"-->
-        <!--              :value="item.datacode"-->
-        <!--            />-->
-        <!--          </el-select>-->
-        <!--        </el-form-item>-->
-        <el-form-item required label="鐘舵��">
-          <el-radio-group v-model="dialogForm.status" style="width: 200px">
-            <el-radio label="Y">姝e父</el-radio>
-            <el-radio label="N">鍋滅敤</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <!--        <el-form-item v-if="dialogForm.datacode==='CUSTOM'" label="鏁版嵁鏉冮檺" style="margin: 0">-->
-        <!--          <el-checkbox-group v-model="checkboxGroupSelected" @change="checkboxGroupChange">-->
-        <!--            <el-checkbox v-for="item in checkboxGroup" :key="item" :label="item">-->
-        <!--              {{ item }}-->
-        <!--              <el-tooltip class="item" effect="dark" content="鍕鹃�夌埗鑺傜偣鏄惁鍚屾椂閫変腑瀛愯妭鐐�" placement="top">-->
-        <!--                <i v-if="item==='鐖跺瓙鑱斿姩'" class="el-icon-question" />-->
-        <!--              </el-tooltip>-->
-        <!--            </el-checkbox>-->
-        <!--          </el-checkbox-group>-->
-        <!--        </el-form-item>-->
-        <!--        <el-card-->
-        <!--          v-if="dialogForm.datacode==='CUSTOM'"-->
-        <!--          class="box-card"-->
-        <!--          shadow="never"-->
-        <!--          style="margin-bottom: 30px;width: 78%;margin-left: 12%;"-->
-        <!--        >-->
-
-        <!--          <el-tree-->
-        <!--            ref="tree"-->
-        <!--            :key="checkboxGroupSelected.toString()"-->
-        <!--            :data="treeData"-->
-        <!--            show-checkbox-->
-        <!--            :check-strictly="!checkboxGroupSelected.includes('鐖跺瓙鑱斿姩')"-->
-        <!--            :default-expand-all="checkboxGroupSelected.includes('灞曞紑/鎶樺彔')"-->
-        <!--            node-key="torg_code"-->
-        <!--            :props="defaultProps"-->
-        <!--          />-->
-        <!--        </el-card>-->
-
-        <el-form-item label="澶囨敞">
-          <el-input v-model="dialogForm.description" type="textarea" style="width:500px" />
-        </el-form-item>
-
-      </el-form>
-      <span slot="footer" class="dialog-footer">
-        <div class="footerButton">
-          <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</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>
-
-  </div>
-</template>
-
-<script>
-import Pagination from '@/components/Pagination'
-import {
-  AddUpdateGroup,
-  DeleteGroup, RoleAddUpdateSava,
-  RoleData, RoleDeleteSava
-} from '@/api/basicSettings'
-import { validateCode } from '@/utils/global'
-import elDragDialog from '@/directive/el-drag-dialog'
-import waves from '@/directive/waves'
-import { DataPermissions, PrentOrganization } from '@/api/GeneralBasicData'
-import arrayToTree from 'array-to-tree'
-
-export default {
-  name: 'RoleList',
-  components: {
-    Pagination
-  },
-  directives: { elDragDialog, waves },
-  data() {
-    return {
-      mainHeight: 0,
-      tableHeight: 0,
-      form: {
-        role_code: '',
-        role_name: '',
-        prop: 'lm_date', // 鎺掑簭瀛楁
-        order: 'desc', // 鎺掑簭瀛楁
-        page: 1, // 绗嚑椤�
-        rows: 20 // 姣忛〉澶氬皯鏉�
-      },
-      total: 10,
-      tableData: [],
-      dialogVisible: false,
-      dialogForm: {
-        rolecode: '', //
-        rolename: '', //
-        datacode: 'ALL',
-        description: '',
-        datapermissions: '', // 鏁版嵁鏉冮檺
-        status: 'Y'// 鐘舵��
-      },
-      datacodeArr: [],
-      checkboxGroupSelected: ['灞曞紑/鎶樺彔', '鐖跺瓙鑱斿姩'],
-      checkboxGroup: ['灞曞紑/鎶樺彔', '鍏ㄩ��/鍏ㄤ笉閫�', '鐖跺瓙鑱斿姩'],
-      operation: '',
-      dialogFormRules: {
-        rolecode: [
-          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
-        ],
-        rolename: [
-          { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] }
-        ]
-      },
-      defaultProps: {
-        children: 'children',
-        label: 'torg_name'
-      },
-      treeData: []
-
-    }
-  },
-  activated() {
  window.addEventListener('resize', this.getHeight)
  this.getHeight()
},
created() {
-    this.getRoleData()
-  },
-  mounted() {
-    window.addEventListener('resize', this.getHeight)
-    this.getHeight()
-
-    this.getPrentOrganization()
-    this.getDataPermissions()
-  },
-  methods: {
-    async getRoleData() {
-      const res = await RoleData(this.form)
-      this.tableData = res.data
-      this.total = res.count
-    },
-    async getDataPermissions() {
-      const { data: res } = await DataPermissions()
-      this.datacodeArr = res
-    },
-    // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣�
-    async getPrentOrganization() {
-      const { data: res } = await PrentOrganization()
-      this.treeData = arrayToTree(res, {
-        parentProperty: 'parent_id',
-        customID: 'torg_code',
-        childrenProperty: 'children'
-      })
-    },
-    // 鎺掑簭鏀瑰彉鏃�
-    sortChange({ column, prop, order }) {
-      if (order === 'descending') {
-        order = 'desc'
-      } else if (order === 'ascending') {
-        order = 'asc'
-      } else {
-        order = 'desc'
-      }
-      this.form.order = order
-      this.form.prop = prop
-      this.getRoleData()
-    },
-    // 閲嶇疆
-    reset() {
-      this.form.role_code = ''
-      this.form.role_name = ''
-      this.getRoleData()
-    },
-    // 鏂板鎸夐挳
-    add(operation) {
-      this.operation = operation
-      this.dialogVisible = true
-      this.dialogForm.OperType = 'Add'
-    },
-    // 淇敼鎸夐挳
-    async edit(operation, row) {
-      this.operation = operation
-      this.dialogVisible = true
-      this.dialogForm.OperType = 'Update'
-      this.$nextTick(() => {
-        this.dialogForm.rolecode = row.rolecode
-        this.dialogForm.rolename = row.rolename
-        this.dialogForm.datacode = row.datacode
-        this.dialogForm.status = row.status
-        this.dialogForm.description = row.description
-        if (this.dialogForm.datacode === 'CUSTOM') {
-          setTimeout(() => {
-            this.$refs.tree.setCheckedKeys(row.datapermissionscode.split(','))
-          })
-        }
-      })
-    },
-    // 鍒犻櫎鎸夐挳
-    async del(row) {
-      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
-        confirmButtonText: '纭畾',
-        cancelButtonText: '鍙栨秷',
-        type: 'warning'
-      }).then(() => {
-        RoleDeleteSava({ rolecode: row.rolecode }).then(res => {
-          if (res.code === '200') {
-            this.$notify.success('鍒犻櫎鎴愬姛!')
-            if (this.form.page > 1 && this.tableData.length === 1) {
-              this.form.page--
-            }
-            this.getRoleData()
-          }
-        })
-      }).catch(() => {
-        this.$notify.info('宸插彇娑堝垹闄�')
-      })
-    },
-    checkboxGroupChange(val) {
-      if (val.includes('鍏ㄩ��/鍏ㄤ笉閫�')) {
-        this.$refs.tree.setCheckedKeys([this.treeData[0].torg_code])
-      }
-    },
-    // 瀵硅瘽妗嗗叧闂簨浠�
-    handleClose() {
-      this.dialogForm.rolecode = ''
-      this.dialogForm.rolename = ''
-      this.dialogForm.description = ''
-      this.dialogForm.datapermissions = ''
-      this.dialogForm.datacode = 'ALL'
-      this.dialogForm.status = 'Y'
-      this.$refs.dialogForm.clearValidate()
-    },
-    // 瀵硅瘽妗嗗彇娑�
-    dialogVisibleCancel() {
-      this.dialogVisible = false
-    },
-    // 瀵硅瘽妗嗙‘璁�
-    dialogVisibleConfirm() {
-      this.$refs.dialogForm.validate(valid => {
-        if (valid) {
-          this.$store.state.app.buttonIsDisabled = true
-          if (this.$refs.tree) {
-            this.dialogForm.datapermissions = this.$refs.tree.getCheckedKeys().join(',')
-          }
-          RoleAddUpdateSava(this.dialogForm).then(res => {
-            if (res.code === '200') {
-              this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
-              this.dialogVisible = false
-              this.$store.state.app.buttonIsDisabled = false
-              this.getRoleData()
-            } else {
-              this.$store.state.app.buttonIsDisabled = false
-              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
-            }
-          })
-        }
-      })
-    },
-    handleCommand(command, row) {
-      console.log(command, row)
-      if (command === 'menuPower') {
-        this.$router.push('./powerDivider?rolecode=' + row.rolecode)
-      }
-      if (command === 'divideUser') {
-        this.$router.push('./roleDivider?rolecode=' + row.rolecode)
-      }
-    },
-    // 鑾峰彇椤甸潰楂樺害
-    getHeight() {
-      this.$nextTick(() => {
-        this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 200
-        this.$refs.tableDataRef.doLayout()
-      })
-    }
-  }
-}
-</script>
+<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>
+        <el-button v-waves type="success" icon="el-icon-download" @click="$router.push('./../systemSetting/dataImport?fileCode=4')">瀵煎叆</el-button>
+      </div>
+
+      <div class="bodyTopFormGroup">
+        <el-form
+          ref="form"
+          :model="form"
+          label-width="100px"
+          inline
+          style="display: flex;"
+        >
+          <div class="elForm">
+            <el-form-item label="瑙掕壊缂栫爜" style=" display: flex;">
+              <el-input v-model="form.role_code" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="瑙掕壊鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.role_name" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </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="getRoleData">鏌ヨ</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'"-->
+          <!--            style="cursor: pointer"-->
+          <!--            :icon-class="!isExpandForm?'doubleDown3':'doubleUp3'"-->
+          <!--            @mouseenter="mouseHoverType=$event.type"-->
+          <!--          />-->
+          <!--          <svg-icon-->
+          <!--            v-show="mouseHoverType==='mouseenter'"-->
+          <!--            style="cursor: pointer"-->
+          <!--            :icon-class="!isExpandForm?'doubleDown':'doubleUp'"-->
+          <!--            @click="isExpandForm=!isExpandForm"-->
+          <!--            @mouseout="mouseHoverType=$event.type"-->
+          <!--          />-->
+        </div>
+      </div>
+
+      <div class="elTableDiv">
+        <el-table
+          ref="tableDataRef"
+          class="tableFixed"
+          :data="tableData"
+          :height="tableHeight+'px'"
+          border
+          row-class-name="custom-row"
+          :style="{width: 100+'%',height:tableHeight+'px',}"
+          highlight-current-row
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+          @sort-change="sortChange"
+        >
+          <el-table-column
+            prop="rowNum"
+            width="120"
+            fixed
+            label="搴忓彿"
+          />
+          <el-table-column
+            prop="rolecode"
+            label="瑙掕壊缂栫爜"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="rolename"
+            label="瑙掕壊鍚嶇О"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="status"
+            label="鐘舵��"
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              <el-tag v-if="row.status==='Y'" size="small" type="success">姝e父</el-tag>
+              <el-tag v-if="row.status==='N'" size="small" type="danger">鍋滅敤</el-tag>
+            </template>
+          </el-table-column>
+          <!--          <el-table-column-->
+          <!--            prop="dataname"-->
+          <!--            label="鏉冮檺鑼冨洿"-->
+          <!--            sortable="custom"-->
+          <!--          />-->
+          <el-table-column
+            prop="description"
+            label="澶囨敞"
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              {{ row.description?row.description:'/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="username"
+            label="鍒涘缓浜哄憳"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="lm_date"
+            label="鍒涘缓鏃堕棿"
+            width="160"
+            sortable="custom"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            width="160"
+            fixed="right"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <el-tooltip class="item" effect="dark" content="缂栬緫" placement="top">
+                  <i
+                    class="el-icon-edit-outline"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="edit('edit',row)"
+                  />
+                </el-tooltip>
+                <el-tooltip v-del-tab-index class="item" effect="dark" content="鍒犻櫎" placement="top">
+                  <i
+                    class="el-icon-delete"
+                    :style="{color:$store.state.settings.theme}"
+                    @click="del(row)"
+                  />
+                </el-tooltip>
+
+                <el-dropdown placement="bottom" @command="command=>handleCommand(command,row)">
+                  <div
+                    class="el-dropdown-link"
+                    style="display: flex;align-content: center;
+                    justify-content: center;
+                    cursor: pointer;"
+                    :style="{color:$store.state.settings.theme}"
+                  >
+                    <div>鏇村</div>
+                    <div>
+                      <i class="el-icon-arrow-down el-icon--right" />
+                    </div>
+                  </div>
+                  <el-dropdown-menu slot="dropdown">
+                    <el-dropdown-item icon="el-icon-circle-check" command="menuPower">鑿滃崟鏉冮檺</el-dropdown-item>
+                    <el-dropdown-item icon="el-icon-user" command="divideUser">鍒嗛厤鐢ㄦ埛</el-dropdown-item>
+                    <!--                    <el-dropdown-item icon="el-icon-download" command="downloadMenu">瀵煎嚭鑿滃崟</el-dropdown-item>-->
+                  </el-dropdown-menu>
+                </el-dropdown>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <!--鍒嗛〉-->
+      <pagination
+        :total="total"
+        :page.sync="form.page"
+        :limit.sync="form.rows"
+        align="right"
+        layout="total,prev, pager, next,sizes,jumper"
+        popper-class="select_bottom"
+        @pagination="getRoleData"
+      />
+    </div>
+
+    <el-dialog
+      v-el-drag-dialog
+      :title="operation==='add'?'鏂板':'缂栬緫'"
+      :visible.sync="dialogVisible"
+      width="800px"
+      :close-on-click-modal="false"
+      top="15vh"
+      @closed="handleClose"
+      @close="handleClose"
+    >
+      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
+        <!--        <el-form-item label="瑙掕壊缂栫爜" prop="rolecode">-->
+        <!--          <el-input v-model="dialogForm.rolecode" :disabled="operation!=='add'" style="width: 200px" />-->
+        <!--        </el-form-item>-->
+        <el-form-item label="瑙掕壊鍚嶇О" prop="rolename">
+          <el-input v-model="dialogForm.rolename" style="width: 200px" />
+        </el-form-item>
+
+        <!--        <el-form-item required label="鏁版嵁鑼冨洿">-->
+        <!--          <el-select-->
+        <!--            v-model="dialogForm.datacode"-->
+        <!--            style="width:200px"-->
+        <!--            placeholder="璇烽�夋嫨"-->
+        <!--            :popper-append-to-body="false"-->
+        <!--          >-->
+        <!--            <el-option-->
+        <!--              v-for="item in datacodeArr"-->
+        <!--              :key="item.datacode"-->
+        <!--              :label="item.dataname"-->
+        <!--              :value="item.datacode"-->
+        <!--            />-->
+        <!--          </el-select>-->
+        <!--        </el-form-item>-->
+        <el-form-item required label="鐘舵��">
+          <el-radio-group v-model="dialogForm.status" style="width: 200px">
+            <el-radio label="Y">姝e父</el-radio>
+            <el-radio label="N">鍋滅敤</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <!--        <el-form-item v-if="dialogForm.datacode==='CUSTOM'" label="鏁版嵁鏉冮檺" style="margin: 0">-->
+        <!--          <el-checkbox-group v-model="checkboxGroupSelected" @change="checkboxGroupChange">-->
+        <!--            <el-checkbox v-for="item in checkboxGroup" :key="item" :label="item">-->
+        <!--              {{ item }}-->
+        <!--              <el-tooltip class="item" effect="dark" content="鍕鹃�夌埗鑺傜偣鏄惁鍚屾椂閫変腑瀛愯妭鐐�" placement="top">-->
+        <!--                <i v-if="item==='鐖跺瓙鑱斿姩'" class="el-icon-question" />-->
+        <!--              </el-tooltip>-->
+        <!--            </el-checkbox>-->
+        <!--          </el-checkbox-group>-->
+        <!--        </el-form-item>-->
+        <!--        <el-card-->
+        <!--          v-if="dialogForm.datacode==='CUSTOM'"-->
+        <!--          class="box-card"-->
+        <!--          shadow="never"-->
+        <!--          style="margin-bottom: 30px;width: 78%;margin-left: 12%;"-->
+        <!--        >-->
+
+        <!--          <el-tree-->
+        <!--            ref="tree"-->
+        <!--            :key="checkboxGroupSelected.toString()"-->
+        <!--            :data="treeData"-->
+        <!--            show-checkbox-->
+        <!--            :check-strictly="!checkboxGroupSelected.includes('鐖跺瓙鑱斿姩')"-->
+        <!--            :default-expand-all="checkboxGroupSelected.includes('灞曞紑/鎶樺彔')"-->
+        <!--            node-key="torg_code"-->
+        <!--            :props="defaultProps"-->
+        <!--          />-->
+        <!--        </el-card>-->
+
+        <el-form-item label="澶囨敞">
+          <el-input v-model="dialogForm.description" type="textarea" style="width:500px" />
+        </el-form-item>
+
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <div class="footerButton">
+          <el-button v-waves @click="dialogVisibleCancel">鍙� 娑�</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>
+
+  </div>
+</template>
+
+<script>
+import Pagination from '@/components/Pagination'
+import {
+  AddUpdateGroup,
+  DeleteGroup, RoleAddUpdateSava,
+  RoleData, RoleDeleteSava
+} from '@/api/basicSettings'
+import { validateCode } from '@/utils/global'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import { DataPermissions, PrentOrganization } from '@/api/GeneralBasicData'
+import arrayToTree from 'array-to-tree'
+
+export default {
+  name: 'RoleList',
+  components: {
+    Pagination
+  },
+  directives: { elDragDialog, waves },
+  data() {
+    return {
+      mainHeight: 0,
+      tableHeight: 0,
+      form: {
+        role_code: '',
+        role_name: '',
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
+      },
+      total: 10,
+      tableData: [],
+      dialogVisible: false,
+      dialogForm: {
+        rolecode: '', //
+        rolename: '', //
+        datacode: 'ALL',
+        description: '',
+        datapermissions: '', // 鏁版嵁鏉冮檺
+        status: 'Y'// 鐘舵��
+      },
+      datacodeArr: [],
+      checkboxGroupSelected: ['灞曞紑/鎶樺彔', '鐖跺瓙鑱斿姩'],
+      checkboxGroup: ['灞曞紑/鎶樺彔', '鍏ㄩ��/鍏ㄤ笉閫�', '鐖跺瓙鑱斿姩'],
+      operation: '',
+      dialogFormRules: {
+        rolecode: [
+          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
+        ],
+        rolename: [
+          { required: true, message: '璇疯緭鍏ョ粍缁囧悕绉�', trigger: ['blur', 'change'] }
+        ]
+      },
+      defaultProps: {
+        children: 'children',
+        label: 'torg_name'
+      },
+      treeData: []
+
+    }
+  },
+  activated() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+    this.getRoleData()
+    this.getPrentOrganization()
+    this.getDataPermissions()
+  },
+  created() {
+    this.getRoleData()
+  },
+  mounted() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+
+    this.getPrentOrganization()
+    this.getDataPermissions()
+  },
+  methods: {
+    async getRoleData() {
+      const res = await RoleData(this.form)
+      this.tableData = res.data
+      this.total = res.count
+    },
+    async getDataPermissions() {
+      const { data: res } = await DataPermissions()
+      this.datacodeArr = res
+    },
+    // 缁勭粐鏋舵瀯绾ц仈閫夋嫨鍣�
+    async getPrentOrganization() {
+      const { data: res } = await PrentOrganization()
+      this.treeData = arrayToTree(res, {
+        parentProperty: 'parent_id',
+        customID: 'torg_code',
+        childrenProperty: 'children'
+      })
+    },
+    // 鎺掑簭鏀瑰彉鏃�
+    sortChange({ column, prop, order }) {
+      if (order === 'descending') {
+        order = 'desc'
+      } else if (order === 'ascending') {
+        order = 'asc'
+      } else {
+        order = 'desc'
+      }
+      this.form.order = order
+      this.form.prop = prop
+      this.getRoleData()
+    },
+    // 閲嶇疆
+    reset() {
+      this.form.role_code = ''
+      this.form.role_name = ''
+      this.getRoleData()
+    },
+    // 鏂板鎸夐挳
+    add(operation) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Add'
+    },
+    // 淇敼鎸夐挳
+    async edit(operation, row) {
+      this.operation = operation
+      this.dialogVisible = true
+      this.dialogForm.OperType = 'Update'
+      this.$nextTick(() => {
+        this.dialogForm.rolecode = row.rolecode
+        this.dialogForm.rolename = row.rolename
+        this.dialogForm.datacode = row.datacode
+        this.dialogForm.status = row.status
+        this.dialogForm.description = row.description
+        if (this.dialogForm.datacode === 'CUSTOM') {
+          setTimeout(() => {
+            this.$refs.tree.setCheckedKeys(row.datapermissionscode.split(','))
+          })
+        }
+      })
+    },
+    // 鍒犻櫎鎸夐挳
+    async del(row) {
+      this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        RoleDeleteSava({ rolecode: row.rolecode }).then(res => {
+          if (res.code === '200') {
+            this.$notify.success('鍒犻櫎鎴愬姛!')
+            if (this.form.page > 1 && this.tableData.length === 1) {
+              this.form.page--
+            }
+            this.getRoleData()
+          }
+        })
+      }).catch(() => {
+        this.$notify.info('宸插彇娑堝垹闄�')
+      })
+    },
+    checkboxGroupChange(val) {
+      if (val.includes('鍏ㄩ��/鍏ㄤ笉閫�')) {
+        this.$refs.tree.setCheckedKeys([this.treeData[0].torg_code])
+      }
+    },
+    // 瀵硅瘽妗嗗叧闂簨浠�
+    handleClose() {
+      this.dialogForm.rolecode = ''
+      this.dialogForm.rolename = ''
+      this.dialogForm.description = ''
+      this.dialogForm.datapermissions = ''
+      this.dialogForm.datacode = 'ALL'
+      this.dialogForm.status = 'Y'
+      this.$refs.dialogForm.clearValidate()
+    },
+    // 瀵硅瘽妗嗗彇娑�
+    dialogVisibleCancel() {
+      this.dialogVisible = false
+    },
+    // 瀵硅瘽妗嗙‘璁�
+    dialogVisibleConfirm() {
+      this.$refs.dialogForm.validate(valid => {
+        if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
+          if (this.$refs.tree) {
+            this.dialogForm.datapermissions = this.$refs.tree.getCheckedKeys().join(',')
+          }
+          RoleAddUpdateSava(this.dialogForm).then(res => {
+            if (res.code === '200') {
+              this.$notify.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
+              this.dialogVisible = false
+              this.$store.state.app.buttonIsDisabled = false
+              this.getRoleData()
+            } else {
+              this.$store.state.app.buttonIsDisabled = false
+              this.$notify.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+            }
+          })
+        }
+      })
+    },
+    handleCommand(command, row) {
+      console.log(command, row)
+      if (command === 'menuPower') {
+        this.$router.push('./powerDivider?rolecode=' + row.rolecode)
+      }
+      if (command === 'divideUser') {
+        this.$router.push('./roleDivider?rolecode=' + row.rolecode)
+      }
+    },
+    // 鑾峰彇椤甸潰楂樺害
+    getHeight() {
+      this.$nextTick(() => {
+        this.mainHeight = window.innerHeight - 85
+        this.tableHeight = this.mainHeight - 200
+        this.$refs.tableDataRef.doLayout()
+      })
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3