snow пре 2 година
родитељ
комит
dbf6480a12

+ 1 - 1
src/apis/user/axios.js

@@ -55,10 +55,10 @@ export default async (
       }
 
       const { noRelation } = config.data;
+
       //决定传递关联公司:非超管用户且单独的请求中data中没有设置noRelation
       const isAllowRelaComNo = !store.state.user.isSupertube && !noRelation;
       config.data.relaComNo = isAllowRelaComNo ? store.state.user.currentCompany : '';
-      if ('noRelation' in config.data) delete config.data.noRelation
       return config
     },
     error => {

+ 8 - 1
src/apis/user/index.js

@@ -14,12 +14,18 @@ export function login(data) {
 }
 // 获取个人信息
 export function userinfo(data) {
+  const _data = {
+    ...data,
+    noRelation: true
+  }
+
   return http({
     url: `${urlConfig.baseURL}admin/userinfo`,
     method: "post",
-    data,
+    data: _data,
   });
 }
+
 // 获取用户权限导航列表
 export function menuList(data) {
   return http({
@@ -48,6 +54,7 @@ export function usergetinfo(data) {
     data: _data
   });
 }
+
 // 获取角色流程节点详情
 export function roleProcessInfo(data) {
   return http({

+ 11 - 1
src/components/globalComponents/search-account/main.vue

@@ -28,6 +28,8 @@
 <script>
 import asyncRequest from "@/apis/components/search-account";
 import resToken from "@/mixins/resToken";
+import { mapState } from "vuex";
+
 export default {
   name: "SearchAccount",
   mixins: [resToken],
@@ -39,6 +41,7 @@ export default {
     "disabled",
     "names",
     "itemid",
+    "filterCompany"
   ],
   /**
    * 属性集合
@@ -49,6 +52,7 @@ export default {
    * @param {Boolean}       disabled         : 是否禁用            必填
    * @param {String}        names            : 选中值label         展示详情必填
    * @param {String}        itemid           : 组织id              非必填
+   * @param {boolean}       filterCompany    : 是否按当前公司筛选  
    */
   /**
    * 事件集合
@@ -61,6 +65,11 @@ export default {
       searchName: "",
     };
   },
+  computed:{
+    ...mapState({
+     currentCompany: (state) => state.user.currentCompany //当前选中的业务公司
+    })
+  },
   watch: {
     names: function (val, old) {
       this.searchName = val;
@@ -100,6 +109,7 @@ export default {
           size: 100,
           name: query,
           itemid: this.itemid || "",
+          companyNo: this.filterCompany ? this.currentCompany : ""
         };
 
         let res = await asyncRequest.list(formValue);
@@ -121,4 +131,4 @@ export default {
 </script>
 
 <style>
-</style>
+</style>

+ 2 - 3
src/layout/components/company-select/index.vue

@@ -30,8 +30,8 @@
 
 <script>
 import { mapState } from "vuex";
+import { setUserCompany } from "@/utils/auth";
 import { requsetSupertubeCompany, requsetBindCompany } from "@/apis/user";
-import { setUserCompany, setToken } from "@/utils/auth";
 
 export default {
   /**
@@ -149,7 +149,6 @@ export default {
           this.$router.push(`/login`);
           break;
         default:
-          setToken(data.token);
           queryString = keys.reduce(chunk, "?");
           this.$router.replace("/reload" + queryString);
           break;
@@ -198,7 +197,7 @@ export default {
         return [];
       }
 
-      this.params.page++;
+      this.params.page ++;
       return data.list;
     },
 

+ 50 - 0
src/mixins/companyHelper.js

@@ -0,0 +1,50 @@
+import { mapState } from "vuex";
+
+const _mapState = {
+  isSupertube: state => state.user.isSupertube, //是否超管
+  currentCompany: (state) => state.user.currentCompany //当前选中的业务公司
+}
+
+const companyHelper = {
+  computed: {
+    ...mapState(_mapState)
+  },
+  methods: {
+    /**
+     * 当前公司发生改变时默认执行的方法,重置列表数据
+     */
+    onCompanyChangeInner() {
+      const vm = this;
+      const { searchList, pageInfo, parmValue } = vm;
+      if (!searchList) return null;
+      if (pageInfo) this.pageInfo.curr = 1;
+      if (parmValue) this.parmValue.page = 1;
+      this.searchList();
+    },
+    /**
+     * 判断当前是否有选中公司 没有选中返回false并提示警告信息
+    */
+    isHasCurrentCompany(message = "请选择一家业务公司") {
+      const current = this.currentCompany;
+      if (!current) this.$message.warning(message);
+      return !!current
+    }
+  },
+  watch: {
+    /**
+     * 当前公司发生改变执行时默认执行mixins内部的onCompanyChangeInner
+     * 当组件内部methods实现了onCompanyChange方法则调用组件内部的onCompanyChange方法
+    */
+    currentCompany: {
+      handler() {
+        const vm = this;
+        const { onCompanyChange, onCompanyChangeInner } = vm;
+        if (!vm.isSupertube) return null;
+        onCompanyChange ? onCompanyChange() : onCompanyChangeInner();
+      },
+      deep: true
+    }
+  }
+}
+
+export default companyHelper

+ 0 - 34
src/mixins/reloadData.js

@@ -1,34 +0,0 @@
-import { mapState } from "vuex";
-
-/***
- * 超管用户切换公司后刷新列表
-*/
-const reloadData = {
-  computed: {
-    ...mapState({
-      currentCompany: (state) => state.user.currentCompany,
-      isSupertube: state => state.user.isSupertube
-    })
-  },
-  methods:{
-    onCompanyChangeInner(){
-      if(this.pageInfo) this.pageInfo.curr = 1;
-      if(this.parmValue) this.parmValue.page = 1;
-      this.searchList && this.searchList();
-    }
-  },
-  watch: {
-    currentCompany: {
-      handler() {
-        const vm = this;
-        const { onCompanyChange, onCompanyChangeInner } = vm;
-        if (!vm.isSupertube) return null //非超管用户不执行
-        onCompanyChange ? onCompanyChange() : onCompanyChangeInner();
-      },
-      //
-      deep: true
-    }
-  }
-}
-
-export default reloadData

+ 2 - 3
src/store/modules/user.js

@@ -183,9 +183,8 @@ const actions = {
             // commit("roleProcess", pdata ?? []);
 
           //保存是否超管用户
-          const isSupertube = udata.level === '1'
-          commit("setSupertube", isSupertube);
-
+          commit("setSupertube", udata.level === '1');
+          //获取菜单
           const { mcode, mdata, mmsg } = await getRoleMenuList();
             if (mcode >= 100 && mcode <= 104) {
               resolve("noToken");

+ 2 - 2
src/views/goodStore/grossProfit/index.vue

@@ -218,13 +218,13 @@ import asyncRequest from "@/apis/service/goodStore/grossProfit";
 import mixinPage from "@/mixins/elPaginationHandle";
 import { statusList } from "@/assets/js/statusList";
 import roleLevel from "@/assets/js/roleLevel";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 
 export default {
   name: "grossProfit",
-  mixins: [mixinPage, resToken, reloadData],
+  mixins: [mixinPage, resToken, companyHelper],
   components: {
     addEdit,
     addEditRate

+ 3 - 2
src/views/goodStore/platformGrossProfit/index.vue

@@ -205,10 +205,11 @@ import roleLevel from "@/assets/js/roleLevel";
 import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
+
 export default {
   name: "othsearchSort",
-  mixins: [mixinPage, resToken,reloadData],
+  mixins: [mixinPage, resToken, companyHelper],
   components: {
     addEditRate,
   },

+ 2 - 2
src/views/interest/account/index.vue

@@ -209,7 +209,7 @@ import resetPassword from "./resetPassword";
 import { statusList } from "@/assets/js/statusList";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
 
 export default {
   name: "Account",
@@ -217,7 +217,7 @@ export default {
     addEdit,
     resetPassword,
   },
-  mixins: [mixinPage, resToken,reloadData],
+  mixins: [mixinPage, resToken, companyHelper],
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {

+ 21 - 6
src/views/interest/action/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="action">
+  <div class="action" v-loading="loading">
     <div
       class="action_show_box"
       v-if=" powers.some((i) => i == '001') && currentCompany"
@@ -12,6 +12,7 @@
         >
           暂无数据
         </p>
+
         <li
           v-for="(item, index) in roleList"
           :key="'role' + index"
@@ -23,8 +24,10 @@
           <i v-if="isBtnDisabled && item.id == roleActive.id" class="el-icon-loading" />
         </li>
       </ul>
+
+
       <div class="rule-view fr">
-        <div class="rule-list">
+        <div class="rule-list" v-if="roleList.length > 0">
           <el-row v-for="(item, index) in actionList" :key="'menu' + item.id + index">
             <el-col v-if="item.child && item.child.length > 0" class="ffff" :span="24">
               <div class="ftitle">
@@ -148,8 +151,16 @@
             </el-col>
           </el-row>
         </div>
+
+        <p
+          v-else
+          style="line-height: 60px;margin-top: 50px ;text-align: center; color: #909399"
+        >
+          暂无数据
+        </p>
       </div>
-      <div class="rule-bottom fr">
+
+      <div class="rule-bottom fr" v-if="roleList.length > 0">
         <el-button
           size="small"
           type="primary"
@@ -174,10 +185,10 @@
 <script>
 import asyncRequest from "@/apis/service/interest/action";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper.js";
 export default {
   name: "Action",
-  mixins: [resToken,reloadData],
+  mixins: [resToken, companyHelper],
   data() {
     return {
       ruleForm: {},
@@ -195,6 +206,7 @@ export default {
       action: [], // 功能数据
       private_data: [], //私有数据菜单ID
       private_field: [],
+      loading:false
     };
   },
   computed: {
@@ -432,6 +444,7 @@ export default {
     },
     // 初始化功能权限列表
     async initactionList() {
+      this.loading = true
       if(!this.currentCompany){
         this.$message.warning("请在右上角选择一家公司");
         return
@@ -446,10 +459,12 @@ export default {
       } else {
         this.$message.warning(res.message);
       }
+
+      this.loading = false;
     },
     // 初始化角色列表
     async initRoleList() {
-      const res = await asyncRequest.getRole({});
+      const res = await asyncRequest.getRole({companyNo: this.currentCompany});
       if (res && res.code === 0 && res.data) {
         this.roleList = [].concat(res.data);
         if (this.roleList.length > 0) {

+ 2 - 2
src/views/interest/dataShare/index.vue

@@ -179,12 +179,12 @@ import { statusList } from "@/assets/js/statusList";
 import roleLevel from "@/assets/js/roleLevel";
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
 import { mapGetters } from "vuex";
 
 export default {
   name: "role",
-  mixins: [mixinPage, resToken, reloadData],
+  mixins: [mixinPage, resToken, companyHelper],
   components: {
     addEdit
   },

+ 2 - 2
src/views/interest/group/index.vue

@@ -170,13 +170,13 @@ import addEdit from "./addEdit";
 import asyncRequest from "@/apis/service/interest/group";
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
 import { mapGetters } from "vuex";
 import { shareTypes } from "./static";
 
 export default {
   name: "group",
-  mixins: [mixinPage, resToken,reloadData],
+  mixins: [mixinPage, resToken,companyHelper],
   components: {
     addEdit
   },

+ 7 - 3
src/views/interest/handover/addDetail.vue

@@ -14,7 +14,6 @@
         />
       </div>
       <!-- 
-
   <exam-form :id="$route.query.id" v-if="status==1"
           :newTime="newTime"/>
 
@@ -87,7 +86,12 @@ export default {
       val.hand_uid = val.hand_uid.toString();
       val.resign_uid = val.resign_uid.toString();
       this.loading = true;
-      const res = await asyncRequest.update(val);
+      //更新传入业务公司
+      const res = await asyncRequest.update({
+        ...val,
+        companyNo: this.currentCompany
+      });
+
       if (res && res.code === 0 && res.data) {
         // 获取到当前的type值,
         // this.type = 1;
@@ -107,7 +111,7 @@ export default {
         remark: "123",
         status: type,
       };
-      console.log(model);
+
       const res = await asyncRequest.updateStatus(model);
       if (res && res.code === 0) {
         const title = this.id === "add" ? "添加成功!" : "修改成功!";

+ 43 - 5
src/views/interest/handover/components/addEditForm.vue

@@ -25,6 +25,7 @@
             :names="resign_name"
             :placeholder="'离职人名称'"
             @searchChange="handleResignName"
+            :filter-company="true"
           />
         </el-form-item>
       </el-col>
@@ -43,9 +44,28 @@
             :names="hand_name"
             :placeholder="'接受人名称'"
             @searchChange="handleHandoverName"
+            :filter-company="true"
           />
         </el-form-item>
       </el-col>
+      <el-col :span="id !== 'add' ? 12 : 24">
+        <el-form-item label="离职日期" prop="resign_date">
+          <el-date-picker
+            v-model="ruleForm.resign_date"
+            type="datetime"
+            style="width: 100%"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            placeholder="离职日期"
+            :disabled="
+              !(
+                id === 'add' ||
+                (status + '' === '0' && powers.some((i) => i == '005'))
+              )
+            "
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
       <el-col :span="id !== 'add' ? 12 : 24">
         <el-form-item label="生效时间" prop="expire_date">
           <el-date-picker
@@ -95,10 +115,11 @@
 <script>
 import asyncRequest from "@/apis/service/interest/handover";
 import resToken from "@/mixins/resToken";
+import companyHelper from "@/mixins/companyHelper"
 export default {
   name: "handover",
   props: ["id", "newTime", "sitem"],
-  mixins: [resToken],
+  mixins: [resToken,companyHelper],
   data() {
     return {
       loading: false,
@@ -110,6 +131,7 @@ export default {
         hand_uid: [],
         resign_uid: [],
         expire_date: "",
+        resign_date: "",
         remark: "",
       },
       rulesThis: this.rules,
@@ -131,6 +153,13 @@ export default {
             trigger: "change",
           },
         ],
+        resign_date:[
+          {
+            required: true,
+            message: "请选择离职时间",
+            trigger: "blur",
+          },
+        ],
         expire_date: [
           {
             required: true,
@@ -191,27 +220,32 @@ export default {
             hand_uid,
             resign_uid,
             expire_date,
+            resign_date,
             remark,
           } = this.sitem;
           this.resign_name = resign_name || "";
           this.hand_name = hand_name || "";
           this.status = status || "";
+
+          console.log('line229',this.sitem)
           this.ruleForm = {
-            hand_uid: hand_uid ? hand_uid.split(",") : [],
-            resign_uid: resign_uid ? resign_uid.split(",") : [],
+            hand_uid: hand_uid ? String(hand_uid).split(",") : [],
+            resign_uid: resign_uid ? String(resign_uid).split(",") : [],
             expire_date: expire_date || "",
+            resign_date: resign_date || "",
             remark: remark || "",
           };
         }
       });
     },
     async submitForm() {
+      if(!this.isHasCurrentCompany()) return
+
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           if(!this.loading){
+          const { resign_uid, hand_uid, expire_date, resign_date } = this.ruleForm;
 
-         
-          const { resign_uid, hand_uid, expire_date } = this.ruleForm;
           let rUid = resign_uid.toString(),
             hUid = hand_uid.toString();
           if (rUid === hUid) {
@@ -219,12 +253,16 @@ export default {
             return;
           }
           this.loading = true;
+
           const model = {
             id: this.id,
             resign_uid: rUid,
             hand_uid: hUid,
             expire_date: expire_date,
+            resign_date: resign_date,
+            companyNo:this.currentCompany
           };
+
           let res = {};
           if (this.id === "add") {
             delete model["id"];

+ 13 - 3
src/views/interest/handover/index.vue

@@ -176,6 +176,7 @@
 <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import asyncRequest from "@/apis/service/interest/handover";
+import companyHelper from "@/mixins/companyHelper"
 import addEdit from "./components/addEdit.vue";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
@@ -184,7 +185,7 @@ export default {
   components: {
     addEdit,
   },
-  mixins: [mixinPage, resToken],
+  mixins: [mixinPage, resToken, companyHelper],
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
 
@@ -248,6 +249,10 @@ export default {
           prop: "hand_name",
           label: "接收人",
         },
+        {
+          prop: "companyNo",
+          label:"业务公司编号"
+        },
         {
           prop: "status",
           label: "状态",
@@ -317,7 +322,6 @@ export default {
         // this.parmValue.sselect = this.sselect ;
         // this.parmValue.sinput= this.sinput;
         //
-        console.log(this.parmValue);
         let routerModel = {
           options: JSON.parse(JSON.stringify(this.parmValue)),
           router: this.$route.path,
@@ -348,6 +352,7 @@ export default {
       this.searchList();
     },
     openModal(id, detail) {
+      if(!this.isHasCurrentCompany()) return
       this.showModel = true;
       this.modelId = id;
       this.isDetail = detail;
@@ -363,7 +368,11 @@ export default {
       }
 
       this.loading = true;
-      const res = await asyncRequest.list(this.parmValue);
+      const res = await asyncRequest.list({
+        ...this.parmValue,
+        companyNo: this.currentCompany
+      });
+
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
@@ -373,6 +382,7 @@ export default {
         this.tableData = [];
         this.pageInfo.total = 0;
       }
+      
       this.loading = false;
     },
     // 离职人姓名

+ 2 - 0
src/views/interest/organize/addEdit.vue

@@ -173,9 +173,11 @@ export default {
             delete model["is_display"];
             delete model["url"];
           }
+
           if (this.isAdd) {
             delete model["id"];
           }
+          
           if (this.isAdd) {
             res = await asyncRequest.add(model);
           } else {

+ 33 - 8
src/views/interest/organize/index.vue

@@ -87,7 +87,7 @@
         <el-col
           :span="24"
           v-if="
-             powers.some((i) => i == '001')
+             powers.some((i) => i == '001') && this.currentCompany
           "
         >
           <organize-tree
@@ -108,9 +108,17 @@
             @setUpEdit="setUpEdit"
           />
         </el-col>
+
         <div
           class="no-data"
-          v-if="item && item.length === 0 && depart && depart.length === 0"
+          v-else-if="!this.currentCompany"
+        >
+          请选择一家公司
+        </div>
+
+        <div
+          class="no-data"
+          v-if="item && item.length === 0 && depart && depart.length === 0 && this.currentCompany"
         >
           暂无数据
         </div>
@@ -141,19 +149,18 @@ import addEdit from "./addEdit";
 import {statusList} from "@/assets/js/statusList";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
+import companyHelper from "@/mixins/companyHelper"
 export default {
   name: "organize",
   components: {
     addEdit,
   },
-  mixins: [mixinPage, resToken],
+  mixins: [mixinPage, resToken,companyHelper],
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
-      const tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "organize"
-        ) || {};
+      const { btnList } = this.$store.getters;
+      const tran = btnList.find((item) => item.menu_route == "organize") || {};
       const { action } = tran ?? {};
       return action ?? [];
     },
@@ -163,7 +170,7 @@ export default {
       titleList: [],
       sitem: null,
       statusList: statusList,
-      loading: true,
+      loading: false,
       showModel: false,
       showInterface: false,
       isDetail: false,
@@ -197,6 +204,13 @@ export default {
       };
       this.searchList();
     },
+    onCompanyChange(){
+      this.parmValue.pid = ""
+      this.titleList = []
+      this.depart = []
+      this.item = []
+      this.searchList()
+    },
     // 原来
     // async changeBreadcrumb(index) {
     //   if (index + 1 !== this.titleList.length) {
@@ -279,6 +293,7 @@ export default {
       }
     },
     addEditFn(id, pid, level, isDetail, isAdd, formData) {
+      if(!this.isHasCurrentCompany()) return
       this.showModel = true;
       this.modelId = id;
       this.level = level;
@@ -403,7 +418,17 @@ export default {
         });
     },
     async searchList() {
+      if(!this.currentCompany){
+        this.$message.warning("请选择一家公司")
+        this.parmValue.pid = ""
+        this.titleList = []
+        this.depart = []
+        this.item = []
+        return 
+      }
+
       this.loading = true;
+      this.parmValue.companyNo = this.currentCompany
       const res = await asyncRequest.list(this.parmValue);
       if (res && res.code === 0 && res.data) {
         const { depart, item } = res.data;

+ 20 - 6
src/views/interest/processPermission/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="processPermission">
+  <div class="processPermission" v-loading="loading">
     <div class="processPermission_show_box" v-if="powers.some((i) => i == '001') && currentCompany">
       <ul class="role-list fl">
         <p class="role-list__title">角色列表</p>
@@ -20,8 +20,10 @@
           <i v-if="isBtnDisabled && item.id == roleActive.id" class="el-icon-loading" />
         </li>
       </ul>
+
+      
       <div class="rule-view fr">
-        <div class="rule-list">
+        <div class="rule-list" v-if="roleList.length > 0">
           <el-row v-for="(item, index) in perActionList" :key="'menu' + item.id + index">
             <el-col class="title" :span="24">
               <span>{{ item.process_name }}</span>
@@ -54,8 +56,16 @@
             </el-col>
           </el-row>
         </div>
+        
+        <p
+          v-else
+          style="line-height: 60px;margin-top: 50px ;text-align: center; color: #909399"
+        >
+          暂无数据
+        </p>
       </div>
-      <div class="rule-bottom fr">
+
+      <div class="rule-bottom fr" v-if="roleList.length > 0">
         <el-button
           size="small"
           type="primary"
@@ -79,13 +89,15 @@
 </template>
 <script>
 import asyncRequest from "@/apis/service/interest/processPermission";
+import companyHelper from "@/mixins/companyHelper.js";
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+
 export default {
   name: "processPermission",
-  mixins: [resToken,reloadData],
+  mixins: [resToken,companyHelper],
   data() {
     return {
+      loading:false,
       ruleForm: {},
       // 按钮是否可点击
       isBtnDisabled: false,
@@ -236,6 +248,7 @@ export default {
     },
     // 初始化功能权限列表
     async initperActionList() {
+      this.loading = true
       if(!this.currentCompany){
         this.$message.warning("请在右上角选择一家公司");
         return
@@ -252,10 +265,11 @@ export default {
         this.rules = [];
         this.$message.warning(message);
       }
+      this.loading = false
     },
     // 初始化角色列表
     async initRoleList() {
-      const res = await asyncRequest.getRole({});
+      const res = await asyncRequest.getRole({companyNo: this.currentCompany});
       if (res && res.code === 0 && res.data) {
         this.roleList = [].concat(res.data);
         if (this.roleList.length > 0) {

+ 25 - 9
src/views/interest/role/addEdit.vue

@@ -24,7 +24,7 @@
           label-width="80px"
           class="demo-ruleForm"
         >
-          <el-col :span="8">
+          <el-col :span="12">
             <el-form-item label="角色名称" prop="role_name">
               <el-input
                 v-model="ruleForm.role_name"
@@ -35,7 +35,7 @@
             </el-form-item>
           </el-col>
           
-         <el-col :span="9">
+         <el-col :span="12">
             <el-form-item
               label="关键字段权限"
               prop="private_field"
@@ -46,9 +46,9 @@
                 :disabled="isDetail"
                 placeholder="关键字段权限"
               >
-                <el-checkbox label="1" key="1">成本价</el-checkbox>
-                <el-checkbox label="2" key="2">销售价</el-checkbox>
-                <el-checkbox label="3" key="3">毛利率</el-checkbox>
+                <el-checkbox :label="1" :key="1">成本价</el-checkbox>
+                <el-checkbox :label="2" :key="2">销售价</el-checkbox>
+                <el-checkbox :label="3" :key="3">毛利率</el-checkbox>
               </el-checkbox-group>
             </el-form-item>
           </el-col>
@@ -71,6 +71,16 @@
               </el-select>
             </el-form-item>
           </el-col>
+          
+          <el-col :span="12">
+            <el-form-item label="是否允许查看价格" label-width="130px">
+              <el-select placeholder="是否允许查看价格" v-model="ruleForm.is_allow_see_price">
+                <el-option value="1" label="允许" />
+                <el-option value="0" label="不允许" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+
           <div class="quanxian-main">
             <div class="quanxian-title">
               <span style="color: #ff8888">*</span
@@ -309,6 +319,7 @@ export default {
         role_name: "",
         level: "1",
         private_field: [],
+        is_allow_see_price: ""
       },
       action_data: [], // 字段数据
       action: [], // 功能数据
@@ -521,6 +532,7 @@ export default {
       const res = await asyncRequest.detail({ roleid: this.id });
       if (res && res.code === 0 && res.data) {
         let resD = res.data;
+        console.log(resD)
 
         resD.private_field =
           resD.private_field === "" ? [] : resD.private_field;
@@ -544,6 +556,9 @@ export default {
         } else {
           this.private_data = [];
         }
+
+        this.ruleForm.is_allow_see_price = String(resD.is_allow_see_price);
+
         const arr = JSON.parse(JSON.stringify(this.actionList));
         arr.map((x) => {
           if (x.child && x.child.length > 0) {
@@ -645,6 +660,7 @@ export default {
           this.ruleForm = {
             role_name: "",
             private_field: [],
+            is_allow_see_price: "",
             level: "1",
           };
         }
@@ -682,14 +698,14 @@ export default {
             const model = {
               roleid: this.id,
               role_name: this.ruleForm.role_name,
-              // private_field: JSON.parse(
-              //   JSON.stringify(this.ruleForm.private_field)
-              // ),
-              is_allow_see_price:this.ruleForm.is_allow_see_price,
+              private_field: JSON.parse(
+                JSON.stringify(this.ruleForm.private_field)
+              ),
               level: this.ruleForm.level,
               action: this.action,
               action_data: this.action_data,
               private_data: arr,
+              is_allow_see_price:this.ruleForm.is_allow_see_price
             };
 
 

+ 2 - 3
src/views/interest/role/index.vue

@@ -185,13 +185,12 @@ import asyncRequest from "@/apis/service/interest/role";
 import { statusList } from "@/assets/js/statusList";
 import roleLevel from "@/assets/js/roleLevel";
 import mixinPage from "@/mixins/elPaginationHandle";
-``;
 import resToken from "@/mixins/resToken";
-import reloadData from "@/mixins/reloadData";
+import companyHelper from "@/mixins/companyHelper";
 import { mapGetters } from "vuex";
 export default {
   name: "role",
-  mixins: [mixinPage, resToken, reloadData],
+  mixins: [mixinPage, resToken, companyHelper],
   components: {
     addEdit
   },

+ 25 - 1
src/views/system/menuOperator/addEdit.vue

@@ -159,6 +159,15 @@
                 </el-col>
               </el-row>
             </el-form-item>
+
+            <el-form-item v-if="level < 3" label="菜单等级" prop="level">
+              <el-select v-model="ruleForm.level">
+                <el-option label="超管" value="1" />
+                <el-option label="运营" value="2" />
+                <el-option label="其他" value="3" />
+              </el-select>
+            </el-form-item>
+
           </el-col>
         </el-row>
       </el-form>
@@ -225,6 +234,13 @@ export default {
             trigger: "change",
           },
         ],
+        level: [
+          {
+            required: true,
+            message: "请选择菜单等级",
+            trigger: "change",
+          },
+        ],
         img: [
           {
             required: true,
@@ -367,6 +383,7 @@ export default {
         action_name,
         action_code,
         is_display,
+        level
       } = this.formData;
 
       if (this.level !== 3) {
@@ -384,6 +401,7 @@ export default {
           is_show: is_show + "", // 状态(1启用 0禁用)
           is_display: is_display + "",
           weight: parseInt(weight + ""), // 权重,越大越靠前
+          level:String(level)
         };
         if (this.level === 1) {
           delete this.ruleForm["parentIds"];
@@ -462,13 +480,14 @@ export default {
             weight,
             component,
             code,
+            level
           } = this.ruleForm;
 
           model = {
             id: this.id,
             pid: this.parentIds,
             menuid: this.parentIds,
-            name: name,
+            action_name: name,
             img: img,
             is_show: is_show,
             weight: weight,
@@ -477,6 +496,7 @@ export default {
             url: component,
             action_code: code,
             status: is_show,
+            level
           };
 
           if (this.level === 1) {
@@ -485,9 +505,11 @@ export default {
             delete model["url"];
             delete model["action_code"];
             delete model["status"];
+            delete modael['action_name']
           } else if (this.level === 2) {
             delete model["menuid"];
             delete model["action_code"];
+            delete modael['action_name']
             delete model["status"];
           } else {
             delete model["pid"];
@@ -498,9 +520,11 @@ export default {
             delete model["is_display"];
             delete model["url"];
           }
+
           if (this.isAdd) {
             delete model["id"];
           }
+          
           if (this.level < 3) {
             res = await asyncRequest.update(model);
           } else {