From a2bce22a3a4df5f4662c373e57c07fa4268aeee1 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 13 六月 2025 09:02:52 +0800
Subject: [PATCH] 1.修改工单打印模板

---
 src/views/basicSettings/roleDivider.vue | 1116 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 561 insertions(+), 555 deletions(-)

diff --git a/src/views/basicSettings/roleDivider.vue b/src/views/basicSettings/roleDivider.vue
index 7213e22..b230dc2 100644
--- a/src/views/basicSettings/roleDivider.vue
+++ b/src/views/basicSettings/roleDivider.vue
@@ -1,555 +1,561 @@
-<template>
-  <div>
-    <div class="body" :style="{height:mainHeight+'px'}">
-      <div class="bodyTopButtonGroup">
-        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
-        <el-button v-waves type="danger" icon="el-icon-error" @click="batchCancel">鎵归噺鍙栨秷鎺堟潈</el-button>
-        <!--        <el-button v-waves type="warning" icon="el-icon-close">鍏抽棴</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-select
-                v-model="form.role_code"
-                style="width:200px"
-                placeholder="璇烽�夋嫨"
-                @change="roleChange"
-              >
-                <el-option
-                  v-for="item in roleArr"
-                  :key="item.rolecode"
-                  :label="item.rolename"
-                  :value="item.rolecode"
-                />
-              </el-select>
-            </el-form-item>
-            <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">
-              <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />
-            </el-form-item>
-            <el-form-item label="鐢ㄦ埛鍚嶇О" style=" display: flex;">
-              <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />
-            </el-form-item>
-
-            <el-form-item label="缁勭粐缂栫爜" style=" display: flex;">
-              <el-cascader
-                ref="cascader"
-                v-model="form.storg_code"
-                :options="cascaderOptions"
-                filterable
-                :props="defaultProps"
-                :show-all-levels="false"
-              />
-            </el-form-item>
-            <el-form-item v-show="isExpandForm" label="宀椾綅鍚嶇О" style=" display: flex;">
-              <el-select
-                v-model="form.post_code"
-                style="width:200px"
-                multiple
-                collapse-tags
-                placeholder="璇烽�夋嫨"
-              >
-                <el-option
-                  v-for="item in postArr"
-                  :key="item.postcode"
-                  :label="item.postname"
-                  :value="item.postcode"
-                />
-              </el-select>
-            </el-form-item>
-            <el-form-item v-show="isExpandForm" label="鐝粍缂栫爜" style=" display: flex;">
-              <el-select
-                v-model="form.group_code"
-                style="width:200px"
-                multiple
-                collapse-tags
-                placeholder="璇烽�夋嫨"
-              >
-                <el-option
-                  v-for="item in groupArr"
-                  :key="item.usergroupcode"
-                  :label="item.usergroupname"
-                  :value="item.usergroupcode"
-                />
-              </el-select>
-            </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="getRoleAssignedUserData">鏌ヨ</el-button>
-            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
-          </div>
-        </el-form>
-        <div
-          class="bodyTopFormExpand"
-        >
-          <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="isExpandForm?tableHeight:(tableHeight+40)+'px'"
-          border
-          row-class-name="custom-row"
-          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
-          highlight-current-row
-          :row-key="getRowKey"
-          :header-cell-style="this.$headerCellStyle"
-          :cell-style="this.$cellStyle"
-          @selection-change="handleSelectionChange"
-          @sort-change="sortChange"
-        >
-          <el-table-column
-            type="selection"
-            width="50"
-            :reserve-selection="true"
-            fixed
-          />
-          <el-table-column
-            prop="rowNum"
-            width="50"
-            fixed
-            label="搴忓彿"
-          />
-          <el-table-column
-            prop="usercode"
-            label="鐢ㄦ埛缂栫爜"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="username"
-            label="鐢ㄦ埛鍚嶇О"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="storg_name"
-            label="鎵�灞炵粍缁�"
-            sortable="custom"
-          />
-          <el-table-column
-            prop="rolename"
-            label="瑙掕壊"
-            show-overflow-tooltip
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              {{ row.rolename ? row.rolename : '/' }}
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="postname"
-            label="宀椾綅"
-            sortable="custom"
-            show-overflow-tooltip
-          >
-            <template slot-scope="{row}">
-              {{ row.postname ? row.postname : '/' }}
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="group_name"
-            label="鐝粍"
-            show-overflow-tooltip
-            sortable="custom"
-          >
-            <template slot-scope="{row}">
-              {{ row.group_name ? row.group_name : '/' }}
-            </template>
-          </el-table-column>
-
-          <el-table-column
-            label="鎿嶄綔"
-            width="200"
-            fixed="right"
-          >
-            <template slot-scope="{row}">
-              <div class="operationClass">
-                <el-button
-                  type="text"
-                  style="cursor: pointer;font-size: 14px"
-                  @click="cancel(row.usercode)"
-                >鍙栨秷鎺堟潈
-                </el-button>
-
-              </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="getRoleAssignedUserData"
-      />
-    </div>
-
-    <el-dialog
-      v-el-drag-dialog
-      title="鏂板"
-      :visible.sync="dialogVisible"
-      width="1200px"
-      :close-on-click-modal="false"
-      top="15vh"
-      @closed="handleClose"
-      @close="handleClose"
-    >
-      <div>
-        <el-table
-          ref="tableDataDialogRef"
-          class="tableFixed"
-          :data="tableDataDialog"
-          row-class-name="custom-row"
-
-          height="400"
-          border
-          :style="{width: 100+'%',height:'400px',}"
-          highlight-current-row
-          :row-key="getRowKey"
-          :header-cell-style="this.$headerCellStyle"
-          :cell-style="this.$cellStyle"
-          @selection-change="handleDialogSelectionChange"
-        >
-          <el-table-column
-            type="selection"
-            width="50"
-            :reserve-selection="true"
-            fixed
-          />
-          <el-table-column
-            prop="rowNum"
-            width="50"
-            fixed
-            label="搴忓彿"
-          />
-          <el-table-column
-            prop="usercode"
-            label="鐢ㄦ埛缂栫爜"
-          />
-          <el-table-column
-            prop="username"
-            label="鐢ㄦ埛鍚嶇О"
-          />
-          <el-table-column
-            prop="storg_name"
-            label="鎵�灞炵粍缁�"
-          />
-          <el-table-column
-            prop="rolename"
-            show-overflow-tooltip
-            label="瑙掕壊"
-          >
-            <template slot-scope="{row}">
-              {{ row.rolename?row.rolename:'/' }}
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="postname"
-            label="宀椾綅"
-            show-overflow-tooltip
-          >
-            <template slot-scope="{row}">
-              {{ row.postname?row.postname:'/' }}
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="group_name"
-            show-overflow-tooltip
-            label="鐝粍"
-          >
-            <template slot-scope="{row}">
-              {{ row.group_name?row.group_name:'/' }}
-            </template>
-          </el-table-column>
-        </el-table>
-        <!--鍒嗛〉-->
-        <pagination
-          :total="totalDialog"
-          :page.sync="dialogForm.page"
-          :limit.sync="dialogForm.rows"
-          align="right"
-          style="margin-top: 10px;"
-          layout="total,prev, pager, next,sizes,jumper"
-          popper-class="select_bottom"
-          @pagination="add"
-        />
-      </div>
-      <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 {
-  RoleAssignedUserBatchAdd,
-  RoleAssignedUserBatchCancel,
-  RoleAssignedUserData
-} from '@/api/basicSettings'
-import elDragDialog from '@/directive/el-drag-dialog'
-import waves from '@/directive/waves'
-import arrayToTree from 'array-to-tree'
-import { GroupsPermissions, PostPermissions, PrentOrganization, RolePermissions } from '@/api/GeneralBasicData'
-
-export default {
-  name: 'RoleDivider',
-  components: {
-    Pagination
-  },
-  directives: { elDragDialog, waves },
-  data() {
-    return {
-      mouseHoverType: 'mouseout',
-      isExpandForm: false,
-      mainHeight: 0,
-      tableHeight: 0,
-      form: {
-        flag: 'TRUE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�)
-        role_code: '', // 瑙掕壊缂栫爜
-        usercode: '', // 鐢ㄦ埛缂栫爜
-        username: '', // 鐢ㄦ埛鍚嶇О
-        storg_code: [], //
-        post_code: [], //
-        group_code: [], //
-        prop: 'lm_date', // 鎺掑簭瀛楁
-        order: 'desc', // 鎺掑簭瀛楁
-        page: 1, // 绗嚑椤�
-        rows: 20 // 姣忛〉澶氬皯鏉�
-      },
-      total: 10,
-      tableData: [],
-
-      cascaderOptions: [],
-      defaultProps: {
-        checkStrictly: true,
-        expandTrigger: 'hover',
-        value: 'torg_code',
-        label: 'torg_name'
-      },
-      roleArr: [],
-      postArr: [],
-      groupArr: [],
-
-      dialogVisible: false,
-      dialogForm: {
-        page: 1, // 绗嚑椤�
-        rows: 20 // 姣忛〉澶氬皯鏉�
-      },
-      tableDataDialog: [],
-      totalDialog: 10,
-
-      batchRoleCode: [],
-      batchDialogRoleCode: []
-
-    }
-  },
-  activated() {
  window.addEventListener('resize', this.getHeight)
  this.getHeight()
},
created() {
-  },
-  mounted() {
-    window.addEventListener('resize', this.getHeight)
-    this.getHeight()
-
-    this.getAllSelectData()
-    this.getPrentOrganization()
-  },
-  methods: {
-    // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇�
-    async getRoleAssignedUserData() {
-      if (window.location.hash.indexOf('?') !== -1) {
-        this.form.role_code = window.location.hash.split('?')[1].split('=')[1]
-      }
-
-      if (!this.form.role_code) {
-        this.form.role_code = this.roleArr[0].rolecode
-      }
-
-      this.form.storg_code = this.form.storg_code ? this.form.storg_code[this.form.storg_code.length - 1] : ''
-      this.form.post_code = this.form.post_code ? this.form.post_code.join(',') : ''
-      this.form.group_code = this.form.group_code ? this.form.group_code.join(',') : ''
-
-      const res = await RoleAssignedUserData(this.form)
-      this.tableData = res.data
-      this.total = res.count
-    },
-    async getPrentOrganization() {
-      const { data: res } = await PrentOrganization()
-      this.cascaderOptions = arrayToTree(res, {
-        parentProperty: 'parent_id',
-        customID: 'torg_code',
-        childrenProperty: 'children'
-      })
-    },
-    // 宀椾綅 瑙掕壊 鐝粍
-    async getAllSelectData() {
-      const { data: res2 } = await RolePermissions()
-      this.roleArr = res2
-      await this.getRoleAssignedUserData()
-
-      const { data: res1 } = await PostPermissions()
-      this.postArr = res1
-
-      const { data: res3 } = await GroupsPermissions()
-      this.groupArr = res3
-    },
-    // 鎺掑簭鏀瑰彉鏃�
-    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.getRoleAssignedUserData()
-    },
-    // 閲嶇疆
-    reset() {
-      this.form.usercode = ''
-      this.form.username = ''
-
-      this.form.storg_code = []
-      this.form.post_code = []
-      this.form.group_code = []
-      this.getRoleAssignedUserData()
-    },
-    roleChange(val) {
-      this.getRoleAssignedUserData()
-      this.batchRoleCode = []
-      this.$refs.tableDataRef.clearSelection()
-    },
-
-    async cancel(code) {
-      // if (!this.form.role_code) {
-      //   return this.$message.error('')
-      // }
-
-      const res = await RoleAssignedUserBatchCancel([code], this.form.role_code)
-      if (res.code === '200') {
-        this.$notify.success('鍙栨秷鎺堟潈鎴愬姛锛�')
-        await this.getRoleAssignedUserData()
-      } else {
-        this.$notify.error('鍙栨秷鎺堟潈澶辫触锛�')
-      }
-    },
-
-    async batchCancel() {
-      const res = await RoleAssignedUserBatchCancel(this.batchRoleCode, this.form.role_code)
-      if (res.code === '200') {
-        this.$notify.success(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冩垚鍔燂紒')
-        await this.getRoleAssignedUserData()
-        this.batchRoleCode = []
-        this.$refs.tableDataRef.clearSelection()
-      } else {
-        this.$notify.error(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冨け璐ワ紒')
-      }
-    },
-
-    // 鏂板鎸夐挳
-    async add() {
-      this.dialogVisible = true
-
-      const data = {
-        flag: 'FALSE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�)
-        role_code: this.form.role_code, // 瑙掕壊缂栫爜
-        usercode: '', // 鐢ㄦ埛缂栫爜
-        username: '', // 鐢ㄦ埛鍚嶇О
-        storg_code: '', //
-        post_code: '', //
-        group_code: '', //
-        prop: 'lm_date', // 鎺掑簭瀛楁
-        order: 'desc', // 鎺掑簭瀛楁
-        page: this.dialogForm.page, // 绗嚑椤�
-        rows: this.dialogForm.rows // 姣忛〉澶氬皯鏉�
-      }
-      const res = await RoleAssignedUserData(data)
-      this.tableDataDialog = res.data
-      this.totalDialog = res.count
-    },
-
-    // 瀵硅瘽妗嗗叧闂簨浠�
-    handleClose() {
-      // this.form.flag = 'TRUE'
-    },
-    getRowKey(row) {
-      return row.usercode
-    },
-    handleSelectionChange(rows) {
-      this.batchRoleCode = rows.map(i => i.usercode)
-    },
-    handleDialogSelectionChange(rows) {
-      this.batchDialogRoleCode = rows.map(i => i.usercode)
-    },
-    // 瀵硅瘽妗嗗彇娑�
-    dialogVisibleCancel() {
-      this.dialogVisible = false
-    },
-    // 瀵硅瘽妗嗙‘璁�
-    async  dialogVisibleConfirm() {
-      const res = await RoleAssignedUserBatchAdd(this.batchDialogRoleCode, this.form.role_code)
-      if (res.code === '200') {
-        this.$notify.success(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冩垚鍔燂紒')
-        await this.getRoleAssignedUserData()
-        this.batchDialogRoleCode = []
-        this.$refs.tableDataDialogRef.clearSelection()
-        this.dialogVisible = false
-      } else {
-        this.$notify.error(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冨け璐ワ紒')
-      }
-    },
-    // 鑾峰彇椤甸潰楂樺害
-    getHeight() {
-      this.$nextTick(() => {
-        this.mainHeight = window.innerHeight - 85
-        this.tableHeight = this.mainHeight - 255
-        this.$refs.tableDataRef.doLayout()
-      })
-    }
-  }
-}
-</script>
+<template>
+  <div>
+    <div class="body" :style="{height:mainHeight+'px'}">
+      <div class="bodyTopButtonGroup">
+        <el-button v-waves type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+        <el-button v-waves type="danger" icon="el-icon-error" @click="batchCancel">鎵归噺鍙栨秷鎺堟潈</el-button>
+        <!--        <el-button v-waves type="warning" icon="el-icon-close">鍏抽棴</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-select
+                v-model="form.role_code"
+                style="width:200px"
+                placeholder="璇烽�夋嫨"
+                @change="roleChange"
+              >
+                <el-option
+                  v-for="item in roleArr"
+                  :key="item.rolecode"
+                  :label="item.rolename"
+                  :value="item.rolecode"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="鐢ㄦ埛缂栫爜" style=" display: flex;">
+              <el-input v-model="form.usercode" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+            <el-form-item label="鐢ㄦ埛鍚嶇О" style=" display: flex;">
+              <el-input v-model="form.username" placeholder="璇疯緭鍏�" style="width: 200px" />
+            </el-form-item>
+
+            <el-form-item label="缁勭粐缂栫爜" style=" display: flex;">
+              <el-cascader
+                ref="cascader"
+                v-model="form.storg_code"
+                :options="cascaderOptions"
+                filterable
+                :props="defaultProps"
+                :show-all-levels="false"
+              />
+            </el-form-item>
+            <el-form-item v-show="isExpandForm" label="宀椾綅鍚嶇О" style=" display: flex;">
+              <el-select
+                v-model="form.post_code"
+                style="width:200px"
+                multiple
+                collapse-tags
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in postArr"
+                  :key="item.postcode"
+                  :label="item.postname"
+                  :value="item.postcode"
+                />
+              </el-select>
+            </el-form-item>
+            <el-form-item v-show="isExpandForm" label="鐝粍缂栫爜" style=" display: flex;">
+              <el-select
+                v-model="form.group_code"
+                style="width:200px"
+                multiple
+                collapse-tags
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in groupArr"
+                  :key="item.usergroupcode"
+                  :label="item.usergroupname"
+                  :value="item.usergroupcode"
+                />
+              </el-select>
+            </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="getRoleAssignedUserData">鏌ヨ</el-button>
+            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>
+          </div>
+        </el-form>
+        <div
+          class="bodyTopFormExpand"
+        >
+          <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="isExpandForm?tableHeight:(tableHeight+40)+'px'"
+          border
+          row-class-name="custom-row"
+          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
+          highlight-current-row
+          :row-key="getRowKey"
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+          @selection-change="handleSelectionChange"
+          @sort-change="sortChange"
+        >
+          <el-table-column
+            type="selection"
+            width="50"
+            :reserve-selection="true"
+            fixed
+          />
+          <el-table-column
+            prop="rowNum"
+            width="50"
+            fixed
+            label="搴忓彿"
+          />
+          <el-table-column
+            prop="usercode"
+            label="鐢ㄦ埛缂栫爜"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="username"
+            label="鐢ㄦ埛鍚嶇О"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="storg_name"
+            label="鎵�灞炵粍缁�"
+            sortable="custom"
+          />
+          <el-table-column
+            prop="rolename"
+            label="瑙掕壊"
+            show-overflow-tooltip
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              {{ row.rolename ? row.rolename : '/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="postname"
+            label="宀椾綅"
+            sortable="custom"
+            show-overflow-tooltip
+          >
+            <template slot-scope="{row}">
+              {{ row.postname ? row.postname : '/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="group_name"
+            label="鐝粍"
+            show-overflow-tooltip
+            sortable="custom"
+          >
+            <template slot-scope="{row}">
+              {{ row.group_name ? row.group_name : '/' }}
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            label="鎿嶄綔"
+            width="200"
+            fixed="right"
+          >
+            <template slot-scope="{row}">
+              <div class="operationClass">
+                <el-button
+                  type="text"
+                  style="cursor: pointer;font-size: 14px"
+                  @click="cancel(row.usercode)"
+                >鍙栨秷鎺堟潈
+                </el-button>
+
+              </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="getRoleAssignedUserData"
+      />
+    </div>
+
+    <el-dialog
+      v-el-drag-dialog
+      title="鏂板"
+      :visible.sync="dialogVisible"
+      width="1200px"
+      :close-on-click-modal="false"
+      top="15vh"
+      @closed="handleClose"
+      @close="handleClose"
+    >
+      <div>
+        <el-table
+          ref="tableDataDialogRef"
+          class="tableFixed"
+          :data="tableDataDialog"
+          row-class-name="custom-row"
+
+          height="400"
+          border
+          :style="{width: 100+'%',height:'400px',}"
+          highlight-current-row
+          :row-key="getRowKey"
+          :header-cell-style="this.$headerCellStyle"
+          :cell-style="this.$cellStyle"
+          @selection-change="handleDialogSelectionChange"
+        >
+          <el-table-column
+            type="selection"
+            width="50"
+            :reserve-selection="true"
+            fixed
+          />
+          <el-table-column
+            prop="rowNum"
+            width="50"
+            fixed
+            label="搴忓彿"
+          />
+          <el-table-column
+            prop="usercode"
+            label="鐢ㄦ埛缂栫爜"
+          />
+          <el-table-column
+            prop="username"
+            label="鐢ㄦ埛鍚嶇О"
+          />
+          <el-table-column
+            prop="storg_name"
+            label="鎵�灞炵粍缁�"
+          />
+          <el-table-column
+            prop="rolename"
+            show-overflow-tooltip
+            label="瑙掕壊"
+          >
+            <template slot-scope="{row}">
+              {{ row.rolename?row.rolename:'/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="postname"
+            label="宀椾綅"
+            show-overflow-tooltip
+          >
+            <template slot-scope="{row}">
+              {{ row.postname?row.postname:'/' }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="group_name"
+            show-overflow-tooltip
+            label="鐝粍"
+          >
+            <template slot-scope="{row}">
+              {{ row.group_name?row.group_name:'/' }}
+            </template>
+          </el-table-column>
+        </el-table>
+        <!--鍒嗛〉-->
+        <pagination
+          :total="totalDialog"
+          :page.sync="dialogForm.page"
+          :limit.sync="dialogForm.rows"
+          align="right"
+          style="margin-top: 10px;"
+          layout="total,prev, pager, next,sizes,jumper"
+          popper-class="select_bottom"
+          @pagination="add"
+        />
+      </div>
+      <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 {
+  RoleAssignedUserBatchAdd,
+  RoleAssignedUserBatchCancel,
+  RoleAssignedUserData
+} from '@/api/basicSettings'
+import elDragDialog from '@/directive/el-drag-dialog'
+import waves from '@/directive/waves'
+import arrayToTree from 'array-to-tree'
+import { GroupsPermissions, PostPermissions, PrentOrganization, RolePermissions } from '@/api/GeneralBasicData'
+
+export default {
+  name: 'RoleDivider',
+  components: {
+    Pagination
+  },
+  directives: { elDragDialog, waves },
+  data() {
+    return {
+      mouseHoverType: 'mouseout',
+      isExpandForm: false,
+      mainHeight: 0,
+      tableHeight: 0,
+      form: {
+        flag: 'TRUE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�)
+        role_code: '', // 瑙掕壊缂栫爜
+        usercode: '', // 鐢ㄦ埛缂栫爜
+        username: '', // 鐢ㄦ埛鍚嶇О
+        storg_code: [], //
+        post_code: [], //
+        group_code: [], //
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
+      },
+      total: 10,
+      tableData: [],
+
+      cascaderOptions: [],
+      defaultProps: {
+        checkStrictly: true,
+        expandTrigger: 'hover',
+        value: 'torg_code',
+        label: 'torg_name'
+      },
+      roleArr: [],
+      postArr: [],
+      groupArr: [],
+
+      dialogVisible: false,
+      dialogForm: {
+        page: 1, // 绗嚑椤�
+        rows: 20 // 姣忛〉澶氬皯鏉�
+      },
+      tableDataDialog: [],
+      totalDialog: 10,
+
+      batchRoleCode: [],
+      batchDialogRoleCode: []
+
+    }
+  },
+  activated() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+    this.getAllSelectData()
+    this.getPrentOrganization()
+  },
+  created() {
+  },
+  mounted() {
+    window.addEventListener('resize', this.getHeight)
+    this.getHeight()
+
+    this.getAllSelectData()
+    this.getPrentOrganization()
+  },
+  methods: {
+    // 缁勭粐鏋舵瀯澶у垪琛ㄦ煡璇�
+    async getRoleAssignedUserData() {
+      if (window.location.hash.indexOf('?') !== -1) {
+        this.form.role_code = window.location.hash.split('?')[1].split('=')[1]
+      }
+
+      if (!this.form.role_code) {
+        this.form.role_code = this.roleArr[0].rolecode
+      }
+
+      this.form.storg_code = this.form.storg_code ? this.form.storg_code[this.form.storg_code.length - 1] : ''
+      this.form.post_code = this.form.post_code ? this.form.post_code.join(',') : ''
+      this.form.group_code = this.form.group_code ? this.form.group_code.join(',') : ''
+
+      const res = await RoleAssignedUserData(this.form)
+      this.tableData = res.data
+      this.total = res.count
+    },
+    async getPrentOrganization() {
+      const { data: res } = await PrentOrganization()
+      this.cascaderOptions = arrayToTree(res, {
+        parentProperty: 'parent_id',
+        customID: 'torg_code',
+        childrenProperty: 'children'
+      })
+    },
+    // 宀椾綅 瑙掕壊 鐝粍
+    async getAllSelectData() {
+      const { data: res2 } = await RolePermissions()
+      this.roleArr = res2
+      await this.getRoleAssignedUserData()
+
+      const { data: res1 } = await PostPermissions()
+      this.postArr = res1
+
+      const { data: res3 } = await GroupsPermissions()
+      this.groupArr = res3
+    },
+    // 鎺掑簭鏀瑰彉鏃�
+    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.getRoleAssignedUserData()
+    },
+    // 閲嶇疆
+    reset() {
+      this.form.usercode = ''
+      this.form.username = ''
+
+      this.form.storg_code = []
+      this.form.post_code = []
+      this.form.group_code = []
+      this.getRoleAssignedUserData()
+    },
+    roleChange(val) {
+      this.getRoleAssignedUserData()
+      this.batchRoleCode = []
+      this.$refs.tableDataRef.clearSelection()
+    },
+
+    async cancel(code) {
+      // if (!this.form.role_code) {
+      //   return this.$message.error('')
+      // }
+
+      const res = await RoleAssignedUserBatchCancel([code], this.form.role_code)
+      if (res.code === '200') {
+        this.$notify.success('鍙栨秷鎺堟潈鎴愬姛锛�')
+        await this.getRoleAssignedUserData()
+      } else {
+        this.$notify.error('鍙栨秷鎺堟潈澶辫触锛�')
+      }
+    },
+
+    async batchCancel() {
+      const res = await RoleAssignedUserBatchCancel(this.batchRoleCode, this.form.role_code)
+      if (res.code === '200') {
+        this.$notify.success(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冩垚鍔燂紒')
+        await this.getRoleAssignedUserData()
+        this.batchRoleCode = []
+        this.$refs.tableDataRef.clearSelection()
+      } else {
+        this.$notify.error(this.batchRoleCode.length + '涓敤鎴峰彇娑堟巿鏉冨け璐ワ紒')
+      }
+    },
+
+    // 鏂板鎸夐挳
+    async add() {
+      this.dialogVisible = true
+
+      const data = {
+        flag: 'FALSE', // TRUE(宸插叧鑱�) FALSE(鏈叧鑱�)
+        role_code: this.form.role_code, // 瑙掕壊缂栫爜
+        usercode: '', // 鐢ㄦ埛缂栫爜
+        username: '', // 鐢ㄦ埛鍚嶇О
+        storg_code: '', //
+        post_code: '', //
+        group_code: '', //
+        prop: 'lm_date', // 鎺掑簭瀛楁
+        order: 'desc', // 鎺掑簭瀛楁
+        page: this.dialogForm.page, // 绗嚑椤�
+        rows: this.dialogForm.rows // 姣忛〉澶氬皯鏉�
+      }
+      const res = await RoleAssignedUserData(data)
+      this.tableDataDialog = res.data
+      this.totalDialog = res.count
+    },
+
+    // 瀵硅瘽妗嗗叧闂簨浠�
+    handleClose() {
+      // this.form.flag = 'TRUE'
+    },
+    getRowKey(row) {
+      return row.usercode
+    },
+    handleSelectionChange(rows) {
+      this.batchRoleCode = rows.map(i => i.usercode)
+    },
+    handleDialogSelectionChange(rows) {
+      this.batchDialogRoleCode = rows.map(i => i.usercode)
+    },
+    // 瀵硅瘽妗嗗彇娑�
+    dialogVisibleCancel() {
+      this.dialogVisible = false
+    },
+    // 瀵硅瘽妗嗙‘璁�
+    async  dialogVisibleConfirm() {
+      const res = await RoleAssignedUserBatchAdd(this.batchDialogRoleCode, this.form.role_code)
+      if (res.code === '200') {
+        this.$notify.success(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冩垚鍔燂紒')
+        await this.getRoleAssignedUserData()
+        this.batchDialogRoleCode = []
+        this.$refs.tableDataDialogRef.clearSelection()
+        this.dialogVisible = false
+      } else {
+        this.$notify.error(this.batchDialogRoleCode.length + '涓敤鎴锋柊澧炴巿鏉冨け璐ワ紒')
+      }
+    },
+    // 鑾峰彇椤甸潰楂樺害
+    getHeight() {
+      this.$nextTick(() => {
+        this.mainHeight = window.innerHeight - 85
+        this.tableHeight = this.mainHeight - 255
+        this.$refs.tableDataRef.doLayout()
+      })
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3