Commit 521c8bd762a6d450d577b5dbaf0b7f301ee677aa

Authored by sanmu
1 parent 32aef76f

feat: 调整权限

README.md
... ... @@ -7,3 +7,41 @@ vue-admin-vben
7 7 39: /home/web/qingdao-order-erp/dist
8 8  
9 9 47: /order-erp/dist
  10 +
  11 +# 权限整理
  12 +
  13 +### 管理员
  14 +
  15 +所有按钮权限,所有订单列表展示,所有订单字段编辑
  16 +
  17 +### 总监
  18 +
  19 +读:基本信息,跟单,质检
  20 +
  21 +写:没有权限
  22 +
  23 +导出: 基本信息,跟单,质检
  24 +
  25 +### 跟单员(只有自己订单)
  26 +
  27 +读:基本信息,利润分析(只有单价美元,客户单价,客户总价),跟单,质检
  28 +
  29 +写:基本信息,跟单
  30 +
  31 +导出:基本信息,利润分析(只有单价美元,客户单价,客户总价),跟单,质检
  32 +
  33 +### 质检员(所有人订单)
  34 +
  35 +读:基本信息,跟单,质检
  36 +
  37 +写:质检
  38 +
  39 +导出:无导出权限
  40 +
  41 +### 业务员(只有自己订单)
  42 +
  43 +读:所有列
  44 +
  45 +写:利润分析,项目报告书
  46 +
  47 +导出:基本信息,利润分析,跟单,质检
... ...
src/views/project/account/account.data.tsx
... ... @@ -5,7 +5,7 @@ export const columns: BasicColumn[] = [
5 5 {
6 6 title: '手机号',
7 7 dataIndex: 'phone',
8   - width: 120,
  8 + width: 200,
9 9 },
10 10 {
11 11 title: '昵称',
... ...
src/views/project/order/ExportModal.vue
... ... @@ -67,6 +67,22 @@
67 67 });
68 68  
69 69 const options = computed(() => {
  70 + // 运营总监-基本信息,跟单,质检
  71 + if (props.role === ROLE.DATA_REPORT_USER) {
  72 + return [
  73 + { label: '基本信息', value: 'baseFields' },
  74 + { label: '跟单信息', value: 'trackStageFields' },
  75 + { label: '质检信息', value: 'inspectionStageFields' },
  76 + ];
  77 + }
  78 + if (props.role === ROLE.BUSINESS) {
  79 + return [
  80 + { label: '基本信息', value: 'baseFields' },
  81 + { label: '利润分析', value: 'profitAnalysisFields' },
  82 + { label: '跟单信息', value: 'trackStageFields' },
  83 + { label: '质检信息', value: 'inspectionStageFields' },
  84 + ];
  85 + }
70 86 if (props.role === ROLE.TRACKER) {
71 87 return [
72 88 { label: '基本信息', value: 'baseFields' },
... ... @@ -75,20 +91,19 @@
75 91 { label: '质检信息', value: 'inspectionStageFields' },
76 92 ];
77 93 }
78   - if (props.role === ROLE.INSPECT) {
  94 +
  95 + if (props.role === ROLE.ADMIN) {
79 96 return [
80 97 { label: '基本信息', value: 'baseFields' },
  98 + { label: '项目报告', value: 'reportFields' },
  99 + { label: '利润分析', value: 'profitAnalysisFields' },
81 100 { label: '跟单信息', value: 'trackStageFields' },
82 101 { label: '质检信息', value: 'inspectionStageFields' },
83 102 ];
84 103 }
85   - return [
86   - { label: '基本信息', value: 'baseFields' },
87   - { label: '项目报告', value: 'reportFields' },
88   - { label: '利润分析', value: 'profitAnalysisFields' },
89   - { label: '跟单信息', value: 'trackStageFields' },
90   - { label: '质检信息', value: 'inspectionStageFields' },
91   - ];
  104 +
  105 + // 质检不能导出任何
  106 + return [];
92 107 });
93 108  
94 109 function handleShow(visible: boolean) {
... ... @@ -117,9 +132,8 @@
117 132 .filter((k) =>
118 133 [
119 134 'customerPrice',
120   - 'customerRmbPrice',
121   - 'customerTotalPrice',
122   - 'customerRmbTotalPrice',
  135 + 'productionDepartmentPrice',
  136 + 'productionDepartmentTotalPrice',
123 137 ].includes(k.dataIndex),
124 138 )
125 139 .map((item) => ({
... ...
src/views/project/order/index.vue
... ... @@ -85,14 +85,17 @@
85 85 <a-button type="primary" @click="handleRateModal" v-if="role === ROLE.ADMIN"
86 86 >比重计算</a-button
87 87 >
88   - <a-button type="primary" @click="handleExportModal">导出</a-button>
  88 + <!-- 质检角色不能导出任何信息 -->
  89 + <a-button type="primary" @click="handleExportModal" v-if="role !== ROLE.INSPECT"
  90 + >导出</a-button
  91 + >
89 92 <a-button type="primary" @click="handleProfitModal" v-if="role === ROLE.ADMIN"
90 93 >分析利润</a-button
91 94 >
92 95 <a-button
93 96 type="primary"
94 97 @click="handleAdd"
95   - v-if="role === ROLE.ADMIN || role === ROLE.BUSINESS || role === ROLE.TRACKER"
  98 + v-if="role === ROLE.ADMIN || role === ROLE.TRACKER"
96 99 >创建订单</a-button
97 100 >
98 101 </template>
... ...
src/views/project/order/tableData.tsx
... ... @@ -610,7 +610,7 @@ const ORDER_LIST_SCHEDULE = [
610 610 // 订单列表,也就是读权限
611 611 export function getOrderColumns(role: ROLE) {
612 612 // 管理员/业务员看到所有列
613   - if (role === ROLE.ADMIN || role === ROLE.BUSINESS) {
  613 + if (role === ROLE.ADMIN) {
614 614 return [
615 615 ...ORDER_LIST_BASE_FIELDS,
616 616 ...ORDER_LIST_PROFIT_FIELDS,
... ... @@ -620,13 +620,28 @@ export function getOrderColumns(role: ROLE) {
620 620 ...ORDER_LIST_SCHEDULE,
621 621 ];
622 622 }
623   - // 跟单 -基本信息-利润分析(单价,总价),跟单,质检
  623 + //业务员看到-基本,项目报告书,利润分析,跟单信息,质检
  624 + if (role === ROLE.BUSINESS) {
  625 + return [
  626 + ...ORDER_LIST_BASE_FIELDS,
  627 + ...ORDER_LIST_PROFIT_FIELDS,
  628 + ...ORDER_LIST_REPORT_FIELDS,
  629 + ...ORDER_LIST_TRACK_FIELDS,
  630 + ...ORDER_LIST_INSPECT_FIELDS,
  631 + ...ORDER_LIST_SCHEDULE,
  632 + ];
  633 + }
  634 +
  635 + // 跟单 -基本信息-利润分析(单价美元,生产科单价,生产科总价),跟单,质检
624 636 if (role === ROLE.TRACKER) {
625 637 return [
626 638 ...ORDER_LIST_BASE_FIELDS,
627 639 ...ORDER_LIST_PROFIT_FIELDS.map((item) => {
628 640 const children = item.children.filter(
629   - (k) => k.dataIndex === 'customerPrice' || k.dataIndex === 'customerTotalPrice',
  641 + (k) =>
  642 + k.dataIndex === 'customerPrice' ||
  643 + k.dataIndex === 'productionDepartmentPrice' ||
  644 + k.dataIndex === 'productionDepartmentTotalPrice',
630 645 );
631 646 item.children = children;
632 647  
... ... @@ -639,7 +654,17 @@ export function getOrderColumns(role: ROLE) {
639 654 }
640 655  
641 656 // 质检-基本,跟单,质检
642   - if (role === ROLE.INSPECT || role === ROLE.DATA_REPORT_USER) {
  657 + if (role === ROLE.INSPECT) {
  658 + return [
  659 + ...ORDER_LIST_BASE_FIELDS,
  660 + ...ORDER_LIST_TRACK_FIELDS,
  661 + ...ORDER_LIST_INSPECT_FIELDS,
  662 + ...ORDER_LIST_SCHEDULE,
  663 + ];
  664 + }
  665 +
  666 + // 运营总监-基本,跟单,质检
  667 + if (role === ROLE.DATA_REPORT_USER) {
643 668 return [
644 669 ...ORDER_LIST_BASE_FIELDS,
645 670 ...ORDER_LIST_TRACK_FIELDS,
... ...