浏览代码

add btnList

xiaodai2017 2 年之前
父节点
当前提交
f64dea082a
共有 2 个文件被更改,包括 104 次插入52 次删除
  1. 55 0
      src/utils/btnList.ts
  2. 49 52
      src/views/interest/action/index.vue

+ 55 - 0
src/utils/btnList.ts

@@ -0,0 +1,55 @@
+const btnList = [
+  { code: "001", name: "列表" },
+  { code: "002", name: "刷新" },
+  { code: "003", name: "添加" },
+  { code: "004", name: "启/禁用" },
+  { code: "005", name: "修改" },
+  { code: "006", name: "删除" },
+  { code: "007", name: "详情" },
+  { code: "008", name: "提交" },
+  { code: "009", name: "提交审核" },
+  { code: "010", name: "审核审批" },
+  { code: "011", name: "价格" },
+  { code: "012", name: "复制" },
+  { code: "013", name: "竞标发布" },
+  { code: "014", name: "停止竞标" },
+  { code: "015", name: "发布" },
+  { code: "016", name: "取消发布" },
+  { code: "017", name: "提交新毛利" },
+  { code: "018", name: "上架" },
+  { code: "019", name: "下架" },
+  { code: "020", name: "重置密码" },
+  { code: "021", name: "设为管理员" },
+  { code: "022", name: "取消管理员" },
+  { code: "023", name: "模板下载" },
+  { code: "024", name: "重置" },
+  { code: "025", name: "财务" },
+  { code: "026", name: "上/下架" },
+  { code: "027", name: "取消申请" },
+  { code: "028", name: "业务审核" },
+  { code: "029", name: "财务审核" },
+  { code: "030", name: "发起审核流程" },
+  { code: "031", name: "发票上传" },
+  { code: "032", name: "发票识别结果校对" },
+  { code: "033", name: "财务付款回执" },
+  { code: "034", name: "反馈财务信息" },
+  { code: "035", name: "人工审核发票" },
+  { code: "036", name: "发票回执" },
+  { code: "037", name: "填写物流" },
+  { code: "038", name: "导入数据" },
+  { code: "039", name: "资金认领" },
+  { code: "040", name: "认领审核" },
+  { code: "041", name: "批量设置开票信息" },
+  { code: "042", name: "批量审核开票信息" },
+  { code: "043", name: "付款业务审核" },
+  { code: "044", name: "付款财务审核" },
+  { code: "045", name: "开票业务审核" },
+  { code: "046", name: "批量导出开票信息" },
+  { code: "047", name: "批量导入开票信息" },
+  { code: "048", name: "财务核销发票" },
+  { code: "049", name: "台账导出" },
+  { code: "050", name: "批量设置采购单无需对账状态" },
+  { code: "051", name: "采购单导出" },
+  { code: "052", name: "批量导出物流信息" }
+];
+export default btnList;

+ 49 - 52
src/views/interest/action/index.vue

@@ -5,7 +5,7 @@ import {
   httpUpdate,
   httpDetail
 } from "/@/api/interest/action";
-import { reactive, ref, onMounted, computed } from "vue";
+import { reactive, ref, onMounted, computed, nextTick } from "vue";
 import { ElMessage } from "element-plus";
 import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
 import { useNav } from "/@/layout/hooks/nav";
@@ -16,6 +16,7 @@ defineOptions({
 
 const roleList = ref([]);
 const loading = ref(true);
+const backupMenuactionList = ref([]);
 const menuactionList = ref([]);
 const editType = ref("add");
 const action_list = ref([]);
@@ -126,6 +127,14 @@ const handleFieldChange = (checked, id, index, subIndex, item) => {
   // this.$set(menuactionList.value, index, item);
   // console.log(menuactionList.value[index].child[subIndex]);
 };
+//选择角色
+const switchRoleHandle = async item => {
+  const { id } = item;
+  ruleForm.roleid = id;
+  await nextTick(async () => {
+    await refreshRoleDetail(id);
+  });
+};
 // 保存
 const submitForm = async () => {
   action_list.value = [];
@@ -174,6 +183,7 @@ const getMenuAll = async () => {
   if (code === 0) {
     let arr = JSON.parse(JSON.stringify(data ?? []));
     arr = arr.filter(item => item.child && item.child.length > 0);
+
     arr = arr.map(x => {
       x.child.map(y => {
         y.checkAll = false;
@@ -199,7 +209,8 @@ const getMenuAll = async () => {
       });
       return x;
     });
-    menuactionList.value = arr;
+    backupMenuactionList.value = arr;
+    // menuactionList.value = arr;
   } else if (code > 100 && code < 140) {
     logout();
   } else {
@@ -242,43 +253,17 @@ const refreshRoleDetail = async roleid => {
 };
 // 刷新选择状态
 const refreshRoleCheckAllStatus = async () => {
-  const list = JSON.parse(JSON.stringify(menuactionList.value));
-  let arr = list.filter(item => item.child && item.child.length > 0);
-  arr = arr.map(x => {
-    x.child.map(y => {
-      y.checkAll = false;
-      y.checkList = [];
-      y.fieldAll = false;
-      y.fieldList = [];
-      y.is_private_change = "0";
-      if (y.is_private === "0") {
-        y.private = [];
-      } else {
-        y.private = [
-          {
-            id: "0",
-            label: "公有数据"
-          },
-          {
-            id: "1",
-            label: "私有数据"
-          }
-        ];
-      }
-      return y;
-    });
-    return x;
-  });
-  this.actionList = arr;
-  this.actionList.forEach((x, xi) => {
+  menuactionList.value = JSON.parse(JSON.stringify(backupMenuactionList.value));
+  console.log(private_data_list.value);
+  menuactionList.value.forEach((x, xi) => {
     if (x.child && x.child.length > 0) {
       x.child.forEach((y, yi) => {
-        let id = y.id;
+        // let id = y.id;
         if (y.action && y.action.length > 0) {
           y.action.forEach(z => {
-            const Aindex = this.action.findIndex(a => a === z.id);
+            const Aindex = action_list.value.findIndex(a => a === z.id);
             if (Aindex !== -1) {
-              y.checkList.push(this.action[Aindex]);
+              y.checkList.push(action_list.value[Aindex]);
             }
             if (y.action.length === y.checkList.length) {
               y.checkAll = true;
@@ -287,9 +272,9 @@ const refreshRoleCheckAllStatus = async () => {
         }
         if (y.action_data && y.action_data.length > 0) {
           y.action_data.map(z => {
-            const Bindex = this.action_data.findIndex(a => a === z.id);
+            const Bindex = action_data_list.value.findIndex(a => a === z.id);
             if (Bindex !== -1) {
-              y.fieldList.push(this.action_data[Bindex]);
+              y.fieldList.push(action_data_list.value[Bindex]);
             }
           });
           if (y.action_data.length === y.fieldList.length) {
@@ -297,7 +282,10 @@ const refreshRoleCheckAllStatus = async () => {
           }
         }
         if (y.private && y.private.length === 2) {
-          let Cindex = this.private_data.findIndex(a => a === y.id);
+          let Cindex =
+            private_data_list.value.length > 0
+              ? private_data_list.value.findIndex(a => a === y.id)
+              : -1;
           if (Cindex !== -1) {
             y.is_private_change = "1";
           } else {
@@ -308,7 +296,7 @@ const refreshRoleCheckAllStatus = async () => {
         }
       });
     }
-    this.$set(this.actionList, xi, x);
+    // this.$set(this.actionList, xi, x);
   });
 };
 async function onSearch() {
@@ -368,12 +356,12 @@ onMounted(() => {
       <div class="action_show_box">
         <ul class="role-list">
           <p class="role-list__title">角色列表</p>
-          <!-- :class="{ active: item.id == roleActive.id }" -->
-          <!-- @click="!isBtnDisabled && switchRoleHandle(item)" -->
+          <!--  -->
+          <!--  -->
           <!-- v-if="isBtnDisabled && item.id == roleActive.id" -->
           <p
             v-if="roleList.length == 0"
-            style="line-height: 60px; text-align: center; color: #909399"
+            style="line-height: 60px; text-align: center; color: #858599"
           >
             暂无数据
           </p>
@@ -381,9 +369,12 @@ onMounted(() => {
             v-for="(item, index) in roleList"
             :key="'role' + index"
             class="role-list__item"
+            :class="{ active: item.id == ruleForm.roleid }"
+            @click="!loading && switchRoleHandle(item)"
           >
             {{ item.role_name }}
             <el-button
+              v-if="loading && item.id == ruleForm.roleid"
               class="fr"
               link
               :size="'mini'"
@@ -392,7 +383,7 @@ onMounted(() => {
           </li>
         </ul>
         <div class="rule-view">
-          <div class="rule-list">
+          <div class="rule-list" style="padding: 0 0 100px 0">
             <el-row
               v-for="(item, index) in menuactionList"
               :key="'menu' + item.id + index"
@@ -561,7 +552,7 @@ onMounted(() => {
       </div>
 
       <div class="rule-bottom">
-        <el-button size="small" class="fr" type="primary" @click="submitForm"
+        <el-button size="small" type="primary" @click="submitForm"
           >提 交</el-button
         >
       </div>
@@ -571,23 +562,27 @@ onMounted(() => {
 
 <style scoped lang="scss">
 .action {
-  height: calc(100vh - 84px);
+  height: calc(100vh - 85px);
   position: relative;
   background: #fff;
   width: 100%;
   text-align: center;
+  overflow: hidden;
   .action_show {
     position: relative;
     width: 100%;
-    height: calc(100vh - 122px);
+    height: calc(100vh - 85px);
     .rule-bottom {
-      padding: 18px 16px 0 18%;
-      background: #fff;
-      width: 100%;
-      text-align: left;
+      padding: 20px 30px 8px 0;
+      // background: #fff;
+      // width: 100px;
+      text-align: right;
+      position: fixed;
+      right: 0px;
+      bottom: 0px;
       &::before {
         content: "";
-        position: absolute;
+
         top: 0;
         right: 0;
         height: 2px;
@@ -598,8 +593,10 @@ onMounted(() => {
     }
     .action_show_box {
       position: relative;
-      height: calc(100% - 50px);
-      min-height: calc(100% - 50px);
+      height: 100%;
+      // calc(100% - 50px);
+      min-height: 100%;
+      //calc(100% - 50px);
 
       display: flex;
       text-align: left;