Răsfoiți Sursa

feat(price-approval): 价格审批新增权限控制;编辑-成本选择修改

xinyan 5 luni în urmă
părinte
comite
9c58dfd852

+ 1 - 26
src/views/customers-voice/components/DataTable.vue

@@ -122,32 +122,7 @@ defineExpose({ fetchList });
 	<vxe-grid ref="gridRef" :cell-style="cellStyle" v-bind="gridOptions" v-on="gridEvents">
 		<!-- 工具栏左侧 -->
 		<template #toolbar_buttons>
-			<!--<div class="flex gap-2">-->
-			<!--	<div>-->
-			<!--		<PermissionButton :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>-->
-			<!--	</div>-->
-			<!--	<div class="custom-el-input">-->
-			<!--		<el-select v-model="templateType" style="width: 200px">-->
-			<!--			<template #prefix>-->
-			<!--				<div class="flex items-center">-->
-			<!--					<el-button-->
-			<!--						size="small"-->
-			<!--						style="margin-left: -7px; font-size: 14px; border-radius: 29px"-->
-			<!--						text-->
-			<!--						type="success"-->
-			<!--						@click.stop="downloadTemplate"-->
-			<!--					>-->
-			<!--						下载-->
-			<!--					</el-button>-->
-			<!--					<VerticalDivider style="margin-left: 7px" />-->
-			<!--				</div>-->
-			<!--			</template>-->
-			<!--			<el-option label="审批查看(供货)" value="cost" />-->
-			<!--		</el-select>-->
-			<!--	</div>-->
-			<!--	<VerticalDivider class="px-1" style="margin-left: 7px" />-->
-			<!--	<ImportButton :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>-->
-			<!--</div>-->
+
 		</template>
 		<!-- 工具栏右侧 -->
 		<template #toolbar_tools>

+ 3 - 3
src/views/customers-voice/components/show-detail/components/LineChart.vue

@@ -65,7 +65,7 @@ const option: any = {
 	// 	align: 'right',
 	// },
 	grid: {
-		top: '30%',
+		top: '18%',
 		left: '5%',
 		right: '5%',
 		bottom: '5%',
@@ -157,7 +157,7 @@ function removeResize() {
 
 <template>
 	<el-card v-loading="loading" class="border-none mt-5">
-		<div class=" flex items-center">
+		<!--<div class=" flex items-center">-->
 			<span class="font-semibold italic mr-2">时间范围:</span>
 			<el-select v-model="week" style="width: 100px" @change="initLine">
 				<el-option label="一周" value="1"></el-option>
@@ -167,7 +167,7 @@ function removeResize() {
 				<el-option label="八周" value="8"></el-option>
 				<el-option label="十二周" value="12"></el-option>
 			</el-select>
-		</div>
+		<!--</div>-->
 		<!-- 图表区域 -->
 		<div ref="chartRef" style="width: 100%; height: 500px; background: #fff"></div>
 	</el-card>

+ 13 - 8
src/views/customers-voice/components/show-detail/components/TitleCard.vue

@@ -27,14 +27,15 @@ const ncx_rate = computed(() => {
 </script>
 
 <template>
-	<el-card body-class="flex justify-between items-center gap-5" class="border-none top-5 z-10 mt-5">
-		<div class="flex">
+	<el-card  class="border-none top-5 z-10 mt-5">
+		<el-row :gutter="20">
+			<el-col :span="2">
 			<el-image
 				:src="`https://d1ge0kk1l5kms0.cloudfront.net/images/I/${rowData.img}.jpg`"
 				class="mr-5"
 				fit="fill"
 				lazy
-				style="min-width: 135px; height: 135px"
+				style="min-width: 120px; height: 120px"
 			>
 				<template #error>
 					<div class="flex justify-center items-center h-full w-full text-2xl" style="background: var(--el-fill-color-light)">
@@ -44,6 +45,8 @@ const ncx_rate = computed(() => {
 					</div>
 				</template>
 			</el-image>
+			</el-col>
+			<el-col :span="20">
 			<div class="flex flex-col justify-between">
 				<el-row>
 					<el-col :span="24">
@@ -59,8 +62,8 @@ const ncx_rate = computed(() => {
 						</el-link>
 					</el-col>
 				</el-row>
-				<div class="mt-2" >
-					<el-row class="d-flex align-items-center">
+				<div class="mt-3" >
+					<el-row >
 						<el-col :span="6">
 							<div class="font-semibold italic">ASIN : {{ rowData.asin || '-' }}</div>
 						</el-col>
@@ -68,8 +71,8 @@ const ncx_rate = computed(() => {
 							<div class="font-semibold italic">SKU : {{ rowData.sku || '-' }}</div>
 						</el-col>
 					</el-row>
-					<el-divider style="margin-top: 10px; margin-bottom: 10px" />
-					<el-row>
+					<el-divider style="margin-top: 10px; margin-bottom: 8px" />
+					<el-row class="d-flex align-items-center">
 						<el-col :span="3">
 							<div class="font-semibold italic">总订单数 : {{ rowData.order_count || '-' }}</div>
 						</el-col>
@@ -111,7 +114,9 @@ const ncx_rate = computed(() => {
 					</el-row>
 				</div>
 			</div>
-		</div>
+				</el-col>
+		</el-row>
+
 		<!--<el-button :icon="Back" plain round type="info" @click="handleBack">返 回</el-button>-->
 	</el-card>
 </template>

+ 1 - 1
src/views/customers-voice/index.vue

@@ -56,7 +56,7 @@ const disabledDate = (time: Date) => {
 						<el-row :gutter="20" style="margin-bottom: 5px">
 							<el-col :span="5">
 								<div class="flex items-center">
-									<el-input v-model="formInline.asin" clearable placeholder="请输入标题/ASIN">
+									<el-input v-model="formInline.asin" clearable placeholder="ASIN/SKU">
 										<template #prepend>
 											<el-icon>
 												<Search />

+ 5 - 5
src/views/price-approval/Columns.ts

@@ -1,6 +1,6 @@
 export const CostDetailColumns = [
 	{ type: 'seq', title: '序 号', minWidth: 50, align: 'center' },
-	{ field: 'description', title: '描 述', minWidth: 200, align: 'center', showOverflow: true, slots: { default: 'description' } },
+	{ field: 'description', title: '成本模板名称', minWidth: 200, align: 'center', showOverflow: true, slots: { default: 'description' } },
 	{ field: 'station', title: '地 区', minWidth: 100, align: 'center', showOverflow: true, slots: { default:'station' } },
 	{ field: 'platform', title: '平 台', minWidth: 100, align: 'center', showOverflow: true, slots: { default: 'platform' } },
 	// { field: '', title: '货币单位', minWidth: 'auto', align: 'center', showOverflow: true,},
@@ -42,8 +42,9 @@ export const CostDetailColumns = [
 ];
 
 export const CostSelectColumns = [
-	{ type: 'radio', minWidth: 50, align: 'center' },
-	{ field: 'description', title: '描 述', minWidth: 200, align: 'center', showOverflow: true },
+	{ minWidth: 50, align: 'center' ,slots: { default: 'radio' } },
+	{ field: 'id', title: 'ID', minWidth: 50, align: 'center' },
+	{ field: 'description', title: '成本模板名称', minWidth: 200, align: 'center', showOverflow: true },
 	{ field: 'station', title: '地 区', minWidth: 100, align: 'center', showOverflow: true },
 	{ field: 'platform', title: '平 台', minWidth: 100, align: 'center', showOverflow: true },
 	// { field: '', title: '货币单位', minWidth: 'auto', align: 'center', showOverflow: true,},
@@ -75,8 +76,7 @@ export const CostSelectColumns = [
 			},
 		],
 	},
-	{ field: 'price_supply_rate', title: '供货价折算率', minWidth: 'auto', align: 'center',
-		slots: { default: 'price_supply_rate' }},
+	{ field: 'price_supply_rate', title: '供货价折算率', minWidth: 'auto', align: 'center', },
 ];
 
 export const SupplyCheckColumns_Regular = [

+ 8 - 0
src/views/price-approval/api.ts

@@ -47,3 +47,11 @@ export function postDirectCreate(body: any) {
     data: body
   });
 }
+
+export function getDept(){
+  return request({
+    url: '/api/system/user/user_info/',
+    method: 'GET',
+  });
+}
+

+ 25 - 6
src/views/price-approval/approval-review-supply/components/DataTable.vue

@@ -18,9 +18,12 @@ import VerticalDivider from '/src/components/VerticalDivider/index.vue';
 import * as api from '../api';
 import { useResponse } from '/@/utils/useResponse';
 import {
+	SupplyCheckColumns_Regular,
 	SupplyCheckColumns_Special,
 } from '/@/views/price-approval/Columns';
 import EditDrawer from '/@/views/price-approval/approval-review-supply/components/EditDrawer.vue';
+import { hasPermission } from '/@/utils/hasPermission';
+import { getDept } from '/@/views/price-approval/api';
 
 const router = useRouter();
 
@@ -50,6 +53,7 @@ const gridOptions: any = reactive({
     }
   },
   rowConfig: {
+		height: 50,
     isHover: true
   },
   columnConfig: {
@@ -75,11 +79,13 @@ const btnLoading = ref(false);
 const editOpen = ref(false);
 const rowData = ref({});
 
-const dialogVisible = ref(false);
-
 const templateType = ref('cost');
 
+const is_superuser = ref(false);
+const roleKey = ref('');
+
 onBeforeMount(() => {
+	fetchDept();
   gridOptions.pagerConfig.limit = 10;
 });
 
@@ -87,6 +93,12 @@ onMounted(() => {
   fetchList();
 });
 
+async function fetchDept() {
+	const resp = (await useResponse(getDept)).data;
+	is_superuser.value = resp.is_superuser;
+	roleKey.value = resp.role_info.length > 0?resp.role_info.map(role => role.key):'';
+}
+
 async function fetchList(isQuery = false) {
   if (isQuery) {
     gridOptions.pagerConfig.page = 1;
@@ -101,9 +113,16 @@ async function fetchList(isQuery = false) {
 		country_code: queryParameter?.country_code,
 		sales_mode: queryParameter?.sales_mode,
 	};
-
   await useTableData(api.getTableData, query, gridOptions);
-  if (gridOptions && gridOptions.data?.length) await gridRef.value.loadColumn(SupplyCheckColumns_Special);
+	if (gridOptions && gridOptions.data?.length) {
+		if (is_superuser.value) {
+			await gridRef.value.loadColumn(SupplyCheckColumns_Special);
+		} else if (!roleKey.value.includes('price.manage')) {
+			await gridRef.value.loadColumn(SupplyCheckColumns_Regular);
+		}else {
+			await gridRef.value.loadColumn(SupplyCheckColumns_Regular);
+		}
+	}
   gridOptions.showHeader = Boolean(gridOptions.data?.length);
 }
 
@@ -187,7 +206,7 @@ defineExpose({ fetchList });
     <template #toolbar_buttons>
       <div class="flex gap-2">
         <div>
-          <PermissionButton :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
+          <PermissionButton v-if="hasPermission('PRICE_SUPPLY_CREATE')" :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
         </div>
         <div class="custom-el-input">
           <el-select v-model="templateType" style="width: 200px">
@@ -209,7 +228,7 @@ defineExpose({ fetchList });
           </el-select>
         </div>
         <VerticalDivider class="px-1" style="margin-left: 7px" />
-        <ImportButton :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>
+        <ImportButton v-if="hasPermission('SUPPLY_IMPORT_DATA')" :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>
       </div>
     </template>
     <!-- 工具栏右侧 -->

+ 2 - 2
src/views/price-approval/approval-review-supply/components/DataTableSlot.vue

@@ -51,14 +51,14 @@ function onConfirm() {
 	<div class="font-semibold">
 		<div v-if="field === 'operate'">
 			<div class="flex justify-center gap-2">
-				<div>
+				<div v-if="hasPermission('PRICE_SUPPLY_UPDATE')">
 					<PermissionButton circle plain type="warning" @click="handleEdit">
 						<el-icon>
 							<Operation />
 						</el-icon>
 					</PermissionButton>
 				</div>
-				<div>
+				<div v-if="hasPermission('PRICE_SUPPLY_DEL')">
 					<el-popconfirm :icon="InfoFilled" icon-color="#626AEF" title="你确定要删除此项吗?" width="220" @confirm="onConfirm">
 						<template #reference>
 							<PermissionButton circle plain type="danger">

+ 1 - 1
src/views/price-approval/approval-review-supply/components/EditDrawer.vue

@@ -206,7 +206,7 @@ function closeDrawer() {
 			</el-form>
 		</el-drawer>
 	</div>
-	<SelectDrawer v-if="isShow" v-model="isShow" :title="costType ==='supply' ? '供货' : '直销'" @sendCheckId="getCheckId" />
+	<SelectDrawer v-if="isShow" v-model="isShow" :title="costType ==='supply' ? '供货' : '直销'" :rowData="rowData" @sendCheckId="getCheckId" />
 </template>
 
 <style scoped>

+ 154 - 154
src/views/price-approval/components/SelectDrawer.vue

@@ -16,12 +16,11 @@ import { CostSelectColumns } from '/@/views/price-approval/Columns';
 import { useResponse } from '/@/utils/useResponse';
 import CreateDialog from '/@/views/price-approval/cost-detail/component/CreateDialog.vue';
 
-
 const isShow = defineModel({ default: false });
 
 const props = defineProps({
-  rowData: <any>Object,
-  title: String
+	rowData: <any>Object,
+	title: String,
 });
 const { rowData, title } = props;
 
@@ -39,193 +38,194 @@ const createOpen = ref(false);
 
 const { tableOptions, handlePageChange } = usePagination(fetchList);
 
-const checkedId = ref(null);
+const checkedId = ref(rowData? rowData.cost : null);
 
 const gridRef = ref();
 const gridOptions: any = reactive({
-  size: 'mini',
-  border: false,
-  round: true,
-  stripe: true,
-  showHeader: true,
-  currentRowHighLight: true,
-  height: 750,
-  toolbarConfig: {
-    size: 'large',
-    slots: {
-      buttons: 'toolbar_buttons',
-      tools: 'toolbar_tools'
-    }
-  },
-  rowConfig: {
-    isHover: true
-  },
-  radioConfig: {
-    strict: false
-  },
-  pagerConfig: {
-    total: tableOptions.value.total,
-    page: tableOptions.value.page,
-    limit: tableOptions.value.limit
-  },
-  loading: false,
-  loadingConfig: {
-    icon: 'vxe-icon-indicator roll',
-    text: '正在拼命加载中...'
-  },
-  columns: '',
-  data: ''
+	size: 'mini',
+	border: false,
+	round: true,
+	stripe: true,
+	showHeader: true,
+	currentRowHighLight: true,
+	height: 750,
+	toolbarConfig: {
+		size: 'large',
+		slots: {
+			buttons: 'toolbar_buttons',
+			tools: 'toolbar_tools',
+		},
+	},
+	rowConfig: {
+		isHover: true,
+	},
+	radioConfig: {
+		strict: false,
+	},
+	pagerConfig: {
+		total: tableOptions.value.total,
+		page: tableOptions.value.page,
+		limit: tableOptions.value.limit,
+	},
+	loading: false,
+	loadingConfig: {
+		icon: 'vxe-icon-indicator roll',
+		text: '正在拼命加载中...',
+	},
+	columns: '',
+	data: '',
 });
 
 onBeforeMount(() => {
-  fetchList();
-  fetchOptions();
+	fetchList();
+	fetchOptions();
 });
 
 async function fetchList(isQuery = false) {
-  if (isQuery) {
-    gridOptions.pagerConfig.page = 1;
-  }
-
-  gridOptions.data = [];
-  gridOptions.columns = [];
-
-  const query = {
-    description: queryRow?.description,
-    platform: queryRow?.platform,
-    station: queryRow?.station
-  };
-
-  await useTableData(api.getTableData, query, gridOptions);
-  if (gridOptions && gridOptions.data?.length) await gridRef.value.loadColumn(CostSelectColumns);
-  gridOptions.showHeader = Boolean(gridOptions.data?.length);
+	if (isQuery) {
+		gridOptions.pagerConfig.page = 1;
+	}
+
+	gridOptions.data = [];
+	gridOptions.columns = [];
+
+	const query = {
+		description: queryRow?.description,
+		platform: queryRow?.platform,
+		station: queryRow?.station,
+	};
+
+	await useTableData(api.getTableData, query, gridOptions);
+	if (gridOptions && gridOptions.data?.length) await gridRef.value.loadColumn(CostSelectColumns);
+	gridOptions.showHeader = Boolean(gridOptions.data?.length);
 }
 
 function handleRefresh() {
-  fetchList();
+	fetchList();
 }
 
 function handleCreate() {
-  createOpen.value = true;
+	createOpen.value = true;
 }
 
 async function fetchOptions() {
-  const resp = (await useResponse(api.getCostOptions)).data;
-  platformOptions.value = resp.platform_list;
-  stationOptions.value = resp.station_list;
+	const resp = (await useResponse(api.getCostOptions)).data;
+	platformOptions.value = resp.platform_list;
+	stationOptions.value = resp.station_list;
 }
 
 function radioChangeEvent({ row }: any) {
-  checkedId.value = row.id;
-  if (checkedId.value) {
-    emit('sendCheckId', checkedId);
-    editDrawer.value.handleClose();
-  }
+	checkedId.value = row.id;
+	if (checkedId.value) {
+		emit('sendCheckId', checkedId);
+		editDrawer.value.handleClose();
+	}
 }
 
 defineExpose({ editDrawer });
-
 </script>
 
 <template>
-  <div class="drawer-container">
-    <el-drawer
-        ref="editDrawer"
-        v-model="isShow"
-        :destroy-on-close="true"
-        :show-close="false"
-        :title="`审批查看( ${title}) --> 成本选择`"
-        direction="btt"
-        size="80%"
-        style="background-color:#F3F4FB;">
-      <div class="px-5 mb-5">
-        <el-card class="border-none mt-2">
-          <!-- 查询条件 -->
-          <div class="flex flex-1">
-            <div class="w-full whitespace-nowrap">
-              <el-row :gutter="20" style="margin-bottom: 5px">
-                <el-col :span="5">
-                  <div class="flex items-center">
-                    <span class="mr-2">描 述</span>
-                    <el-input v-model="queryRow.description" clearable placeholder="请输入描述" @change="fetchList(true)" />
-                  </div>
-                </el-col>
-                <el-col :span="4" class="flex">
-                  <div class="flex items-center">
-                    <span class="mr-2">地 区</span>
-                    <el-select v-model="queryRow.station" clearable placeholder="请选择地区" @change="fetchList(true)">
-                      <el-option v-for="item in stationOptions" :key="item" :label="item" :value="item" />
-                    </el-select>
-                  </div>
-                </el-col>
-                <el-col :span="4">
-                  <div class="flex items-center">
-                    <span class="mr-2">平 台</span>
-                    <el-select v-model="queryRow.platform" placeholder="请选择平台" @change="fetchList(true)">
-                      <el-option v-for="item in platformOptions" :key="item" :label="item" :value="item" />
-                    </el-select>
-                  </div>
-                </el-col>
-              </el-row>
-            </div>
-          </div>
-          <el-divider />
-          <vxe-grid ref="gridRef" class="z-0" v-bind="gridOptions" @radio-change="radioChangeEvent">
-            <template #toolbar_buttons>
-              <div class="flex gap-2">
-                <PermissionButton v-if="hasPermission('ReviewCreate')" :icon="Plus" plain round type="primary"
-                                  @click="handleCreate">
-                  新 增
-                </PermissionButton>
-                <VerticalDivider class="px-1" style="margin-left: 7px" />
-              </div>
-            </template>
-            <template #toolbar_tools>
-              <el-button circle class="toolbar-btn" @click="handleRefresh">
-                <el-icon>
-                  <Refresh />
-                </el-icon>
-              </el-button>
-            </template>
-            <template #top>
-              <div class="mb-2"></div>
-            </template>
-            <template #pager>
-              <vxe-pager
-                  v-model:currentPage="gridOptions.pagerConfig.page"
-                  v-model:pageSize="gridOptions.pagerConfig.limit"
-                  :total="gridOptions.pagerConfig.total"
-                  class="mt-1.5"
-                  @page-change="handlePageChange"
-              />
-            </template>
-            <template #empty>
-              <el-empty description="暂无数据" />
-            </template>
-            <!-- TODO: 供货价折算率 -->
-            <template #price_supply_rate>
-            </template>
-          </vxe-grid>
-        </el-card>
-      </div>
-    </el-drawer>
-    <CreateDialog v-if="createOpen" v-model="createOpen" @refresh="fetchList" />
-  </div>
+	<div class="drawer-container">
+		<el-drawer
+			ref="editDrawer"
+			v-model="isShow"
+			:destroy-on-close="true"
+			:show-close="false"
+			:title="`审批查看( ${title}) --> 成本选择`"
+			direction="btt"
+			size="80%"
+			style="background-color: #f3f4fb"
+		>
+			<div class="px-5 mb-5">
+				<el-card class="border-none mt-2">
+					<!-- 查询条件 -->
+					<div class="flex flex-1">
+						<div class="w-full whitespace-nowrap">
+							<el-row :gutter="20" style="margin-bottom: 5px">
+								<el-col :span="5">
+									<div class="flex items-center">
+										<span class="mr-2">描 述</span>
+										<el-input v-model="queryRow.description" clearable placeholder="请输入描述" @change="fetchList(true)" />
+									</div>
+								</el-col>
+								<el-col :span="4" class="flex">
+									<div class="flex items-center">
+										<span class="mr-2">地 区</span>
+										<el-select v-model="queryRow.station" clearable placeholder="请选择地区" @change="fetchList(true)">
+											<el-option v-for="item in stationOptions" :key="item" :label="item" :value="item" />
+										</el-select>
+									</div>
+								</el-col>
+								<el-col :span="4">
+									<div class="flex items-center">
+										<span class="mr-2">平 台</span>
+										<el-select v-model="queryRow.platform" placeholder="请选择平台" @change="fetchList(true)">
+											<el-option v-for="item in platformOptions" :key="item" :label="item" :value="item" />
+										</el-select>
+									</div>
+								</el-col>
+							</el-row>
+						</div>
+					</div>
+					<el-divider />
+					<vxe-grid ref="gridRef" class="z-0" v-bind="gridOptions" @radio-change="radioChangeEvent">
+						<template #toolbar_buttons>
+							<div class="flex gap-2">
+								<PermissionButton v-if="hasPermission('ReviewCreate')" :icon="Plus" plain round type="primary" @click="handleCreate">
+									新 增
+								</PermissionButton>
+								<VerticalDivider class="px-1" style="margin-left: 7px" />
+							</div>
+						</template>
+						<template #toolbar_tools>
+							<el-button circle class="toolbar-btn" @click="handleRefresh">
+								<el-icon>
+									<Refresh />
+								</el-icon>
+							</el-button>
+						</template>
+						<template #top>
+							<div class="mb-2"></div>
+						</template>
+						<template #pager>
+							<vxe-pager
+								v-model:currentPage="gridOptions.pagerConfig.page"
+								v-model:pageSize="gridOptions.pagerConfig.limit"
+								:total="gridOptions.pagerConfig.total"
+								class="mt-1.5"
+								@page-change="handlePageChange"
+							/>
+						</template>
+						<template #empty>
+							<el-empty description="暂无数据" />
+						</template>
+						<template #radio="{ row }">
+							<el-radio-group v-model="checkedId" @change="radioChangeEvent({ row })">
+								<el-radio :value="row.id"/>
+							</el-radio-group>
+						</template>
+					</vxe-grid>
+				</el-card>
+			</div>
+		</el-drawer>
+		<CreateDialog v-if="createOpen" v-model="createOpen" @refresh="fetchList" />
+	</div>
 </template>
 
 <style scoped>
 .drawer-container :deep(.el-drawer__header) {
-  border-bottom: none;
-  font-weight: 500;
+	border-bottom: none;
+	font-weight: 500;
 }
 
 .drawer-container :deep(.el-drawer__title) {
-  font-size: 18px;
+	font-size: 18px;
 }
 
 .toolbar-btn {
-  width: 34px;
-  height: 34px;
-  font-size: 18px
+	width: 34px;
+	height: 34px;
+	font-size: 18px;
 }
 </style>

+ 3 - 3
src/views/price-approval/cost-detail/component/CreateDialog.vue

@@ -60,7 +60,7 @@ const validateRate = (rule, value, callback) => {
 };
 
 const rules = reactive<FormRules<RuleForm>>({
-	description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
+	description: [{ required: true, message: '请输入成本模板名称', trigger: 'blur' }],
 	station: [{ required: true, message: '请输入地区', trigger: 'blur' }],
 	platform: [{ required: true, message: '请输入平台', trigger: 'blur' }],
 	export_tax_rate: [{ required: true, message: '请输入出口报关费率', trigger: 'blur' },
@@ -136,8 +136,8 @@ const resetForm = (formEl: FormInstance | undefined) => {
 		<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" class="mx-2.5 mt-5" label-position="top" label-width="auto" status-icon>
 			<el-row :gutter="20">
 				<el-col :span="12">
-					<el-form-item class="font-medium" label="描 述" prop="description">
-						<el-input v-model="ruleForm.description" placeholder="请输入描述" />
+					<el-form-item class="font-medium" label="成本模板名称" prop="description">
+						<el-input v-model="ruleForm.description" placeholder="请输入成本模板名称" />
 					</el-form-item>
 					<el-form-item class="font-medium" label="地 区" prop="station">
 						<!--<el-select v-model="ruleForm.station" placeholder="请选择地区">-->

+ 4 - 2
src/views/price-approval/cost-detail/component/DataTable.vue

@@ -20,6 +20,7 @@ import { CostDetailColumns } from '/@/views/price-approval/Columns';
 import CreateDialog from '/@/views/price-approval/cost-detail/component/CreateDialog.vue';
 import EditDrawer from '/@/views/price-approval/cost-detail/component/EditDrawer.vue';
 import { downloadFile } from '/@/utils/service';
+import { hasPermission } from '/@/utils/hasPermission';
 
 interface Parameter {
 	description: string;
@@ -52,6 +53,7 @@ const gridOptions: any = reactive({
 		},
 	},
 	rowConfig: {
+		height: 50,
 		isHover: true,
 	},
 	columnConfig: {
@@ -204,7 +206,7 @@ defineExpose({ fetchList });
 				<!--	</el-popconfirm>-->
 				<!--</div>-->
 				<div>
-					<PermissionButton :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
+					<PermissionButton v-if="hasPermission('PRICE_COST_CREATE')" :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
 				</div>
 				<div class="custom-el-input">
 					<el-select v-model="templateType" style="width: 190px">
@@ -226,7 +228,7 @@ defineExpose({ fetchList });
 					</el-select>
 				</div>
 				<VerticalDivider class="px-1" style="margin-left: 7px" />
-				<ImportButton :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>
+				<ImportButton v-if="hasPermission('COST_IMPORT_DATA')" :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>
 			</div>
 		</template>
 		<!-- 工具栏右侧 -->

+ 2 - 2
src/views/price-approval/cost-detail/component/DataTableSlot.vue

@@ -31,14 +31,14 @@ function onConfirm() {
 	<div class="font-semibold">
 		<div v-if="field === 'operate'">
 			<div class="flex justify-center gap-2">
-				<div v-if="hasPermission('SkuAttrUpdate')">
+				<div v-if="hasPermission('PRICE_COST_UPDATE')">
 					<PermissionButton circle plain type="warning" @click="handleEdit">
 						<el-icon>
 							<Operation />
 						</el-icon>
 					</PermissionButton>
 				</div>
-				<div v-if="hasPermission('SkuAttrDelete')">
+				<div v-if="hasPermission('PEICR_COST_DEL')">
 					<el-popconfirm :icon="InfoFilled" icon-color="#626AEF" title="你确定要删除此项吗?" width="220"
 												 @confirm="onConfirm">
 						<template #reference>

+ 3 - 3
src/views/price-approval/cost-detail/component/EditDrawer.vue

@@ -67,7 +67,7 @@ const validateRate = (rule, value, callback) => {
 };
 
 const rules = reactive<FormRules<RuleForm>>({
-	description: [{ required: true, message: '请输入描述', trigger: 'blur' }],
+	description: [{ required: true, message: '请输入成本模板名称', trigger: 'blur' }],
 	station: [{ required: true, message: '请输入地区', trigger: 'blur' }],
 	platform: [{ required: true, message: '请输入平台', trigger: 'blur' }],
 	export_tax_rate: [{ required: true, message: '请输入出口报关费率', trigger: 'blur' },
@@ -128,8 +128,8 @@ function closeDrawer() {
 			<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" class="mx-2.5 mt-7" label-position="top" label-width="auto" status-icon>
 				<el-row :gutter="20">
 					<el-col :span="12">
-						<el-form-item class="font-medium" label="描 述" prop="description">
-							<el-input v-model="ruleForm.description" placeholder="请输入描述" />
+						<el-form-item class="font-medium" label="成本模板名称" prop="description">
+							<el-input v-model="ruleForm.description" placeholder="请输入成本模板名称" />
 						</el-form-item>
 						<el-form-item class="font-medium" label="地 区" prop="station">
 							<!--<el-select v-model="ruleForm.station" placeholder="请选择地区">-->

+ 192 - 178
src/views/price-approval/direct-sales/component/DataTable.vue

@@ -18,17 +18,20 @@ import VerticalDivider from '/src/components/VerticalDivider/index.vue';
 import * as api from '../api';
 import { useResponse } from '/@/utils/useResponse';
 import {
-  DirectSalesCheckColumns_Regular, DirectSalesCheckColumns_Special
+	DirectSalesCheckColumns_Regular,
+	DirectSalesCheckColumns_Special, SupplyCheckColumns_Regular,
+	SupplyCheckColumns_Special,
 } from '/@/views/price-approval/Columns';
 import EditDrawer from '/@/views/price-approval/direct-sales/component/EditDrawer.vue';
 import router from '/@/router';
-
+import { hasPermission } from '/@/utils/hasPermission';
+import { getDept } from '/@/views/price-approval/api';
 
 interface Parameter {
-  sku: string;
-  platform: string;
-  country_code: string;
-  sales_mode: string;
+	sku: string;
+	platform: string;
+	country_code: string;
+	sales_mode: string;
 }
 
 const queryParameter: Parameter | undefined = inject('query-parameter');
@@ -36,37 +39,38 @@ const { tableOptions, handlePageChange } = usePagination(fetchList);
 
 const gridRef = ref();
 const gridOptions: any = reactive({
-  size: 'mini',
-  border: false,
-  round: true,
-  stripe: true,
-  currentRowHighLight: true,
-  height: '100%',
-  toolbarConfig: {
-    size: 'large',
-    slots: {
-      buttons: 'toolbar_buttons',
-      tools: 'toolbar_tools'
-    }
-  },
-  rowConfig: {
-    isHover: true
-  },
-  columnConfig: {
-    resizable: true
-  },
-  pagerConfig: {
-    total: tableOptions.value.total,
-    page: tableOptions.value.page,
-    limit: tableOptions.value.limit
-  },
-  loading: false,
-  loadingConfig: {
-    icon: 'vxe-icon-indicator roll',
-    text: '正在拼命加载中...'
-  },
-  columns: '',
-  data: ''
+	size: 'mini',
+	border: false,
+	round: true,
+	stripe: true,
+	currentRowHighLight: true,
+	height: '100%',
+	toolbarConfig: {
+		size: 'large',
+		slots: {
+			buttons: 'toolbar_buttons',
+			tools: 'toolbar_tools',
+		},
+	},
+	rowConfig: {
+		isHover: true,
+		height: 50,
+	},
+	columnConfig: {
+		resizable: true,
+	},
+	pagerConfig: {
+		total: tableOptions.value.total,
+		page: tableOptions.value.page,
+		limit: tableOptions.value.limit,
+	},
+	loading: false,
+	loadingConfig: {
+		icon: 'vxe-icon-indicator roll',
+		text: '正在拼命加载中...',
+	},
+	columns: '',
+	data: '',
 });
 
 const checkedList = ref<Set<number>>(new Set());
@@ -79,194 +83,204 @@ const dialogVisible = ref(false);
 
 const templateType = ref('cost');
 
+const is_superuser = ref(false);
+const roleKey = ref('');
+
 onBeforeMount(() => {
-  gridOptions.pagerConfig.limit = 10;
+	fetchDept();
+	gridOptions.pagerConfig.limit = 10;
 });
 
 onMounted(() => {
-  fetchList();
+	fetchList();
 });
 
+async function fetchDept() {
+	const resp = (await useResponse(getDept)).data;
+	is_superuser.value = resp.is_superuser;
+	roleKey.value = resp.role_info.length > 0 ? resp.role_info.map((role) => role.key) : '';
+	console.log('=>(DataTable.vue:100) roleKey.value', roleKey.value);
+}
+
 async function fetchList(isQuery = false) {
-  if (isQuery) {
-    gridOptions.pagerConfig.page = 1;
-  }
+	if (isQuery) {
+		gridOptions.pagerConfig.page = 1;
+	}
 
-  gridOptions.data = [];
-  gridOptions.columns = [];
+	gridOptions.data = [];
+	gridOptions.columns = [];
 
-  const query = {
-    sku: queryParameter?.sku,
-    platform: queryParameter?.platform,
-    country_code: queryParameter?.country_code,
-    sales_mode: queryParameter?.sales_mode
-  };
+	const query = {
+		sku: queryParameter?.sku,
+		platform: queryParameter?.platform,
+		country_code: queryParameter?.country_code,
+		sales_mode: queryParameter?.sales_mode,
+	};
 
-  await useTableData(api.getTableData, query, gridOptions);
-  if (gridOptions && gridOptions.data?.length) await gridRef.value.loadColumn(DirectSalesCheckColumns_Special);
-  gridOptions.showHeader = Boolean(gridOptions.data?.length);
+	await useTableData(api.getTableData, query, gridOptions);
+	if (gridOptions && gridOptions.data?.length) {
+		if (is_superuser.value) {
+			await gridRef.value.loadColumn(DirectSalesCheckColumns_Special);
+		} else if (!roleKey.value.includes('price.manage')) {
+			await gridRef.value.loadColumn(DirectSalesCheckColumns_Regular);
+		}else {
+			await gridRef.value.loadColumn(DirectSalesCheckColumns_Regular);
+		}
+	}
+	gridOptions.showHeader = Boolean(gridOptions.data?.length);
 }
 
 function handleRefresh() {
-  fetchList();
+	fetchList();
 }
 
 async function handleDownload() {
-  gridOptions.loading = true;
-  try {
-  	await uesDownloadFile({
-  		apiMethod: api.exportData,
-  		queryParams: {
-  			sku: queryParameter?.sku,
-  			platform: queryParameter?.platform,
-  			country_code:queryParameter?.country_code,
-  			sales_mode: queryParameter?.sales_mode,
-  		},
-  		fileName: '审批查看(直销)数据.xlsx',
-  		successMessage: () => ElMessage.success('数据导出成功!'),
-  		errorMessage: () => ElMessage.error('数据导出失败,请重试!'),
-  	});
-  } finally {
-  	gridOptions.loading = false;
-  }
+	gridOptions.loading = true;
+	try {
+		await uesDownloadFile({
+			apiMethod: api.exportData,
+			queryParams: {
+				sku: queryParameter?.sku,
+				platform: queryParameter?.platform,
+				country_code: queryParameter?.country_code,
+				sales_mode: queryParameter?.sales_mode,
+			},
+			fileName: '审批查看(直销)数据.xlsx',
+			successMessage: () => ElMessage.success('数据导出成功!'),
+			errorMessage: () => ElMessage.error('数据导出失败,请重试!'),
+		});
+	} finally {
+		gridOptions.loading = false;
+	}
 }
 
 function handleCreate() {
-  router.push({ path: '/addPage', query: { type: 'direct' } });
+	router.push({ path: '/addPage', query: { type: 'direct' } });
 }
 
 function handleEdit(row: any) {
-  editOpen.value = true;
-  rowData.value = row;
+	editOpen.value = true;
+	rowData.value = row;
 }
 
 async function singleDelete(row: any) {
-  const res = await useResponse(api.deleteRow, row);
-  if (res.code === 2000) {
-    ElMessage.error({ message: '已删除!', plain: true, icon: 'Delete' });
-    handleRefresh();
-  }
+	const res = await useResponse(api.deleteRow, row);
+	if (res.code === 2000) {
+		ElMessage.error({ message: '已删除!', plain: true, icon: 'Delete' });
+		handleRefresh();
+	}
 }
 
 function downloadTemplate() {
-  const url = '/api/pricing/price_product_direct/import_data/';
-  const fileName = '审批查看(直销)模板.xlsx';
+	const url = '/api/pricing/price_product_direct/import_data/';
+	const fileName = '审批查看(直销)模板.xlsx';
 
-  if (url) {
-  	downloadFile({
-  		url,
-  		method: 'GET',
-  		filename: fileName,
-  	});
-  } else {
-  	console.error('未知的模板类型:', templateType.value);
-  }
+	if (url) {
+		downloadFile({
+			url,
+			method: 'GET',
+			filename: fileName,
+		});
+	} else {
+		console.error('未知的模板类型:', templateType.value);
+	}
 }
 
 const gridEvents = {
-  custom({ type }: any) {
-    if (type == 'confirm') {
-      fetchList();
-    }
-  }
+	custom({ type }: any) {
+		if (type == 'confirm') {
+			fetchList();
+		}
+	},
 };
 
 function cellStyle() {
-  return {
-    fontWeight: 600
-  };
+	return {
+		fontWeight: 600,
+	};
 }
 
 defineExpose({ fetchList });
 </script>
 
 <template>
-  <vxe-grid ref="gridRef" :cell-style="cellStyle" v-bind="gridOptions" v-on="gridEvents">
-    <!-- 工具栏左侧 -->
-    <template #toolbar_buttons>
-      <div class="flex gap-2">
-        <!--<div>-->
-        <!--	<el-popconfirm :icon="InfoFilled" icon-color="#626AEF" title="你确定要删除此项吗?" width="220" @confirm="batchDelete">-->
-        <!--		<template #reference>-->
-        <!--			<PermissionButton :disabled="!checkedList.size" :icon="Delete" plain round type="danger"> 批量删除 </PermissionButton>-->
-        <!--		</template>-->
-        <!--		<template #actions="{ confirm, cancel }">-->
-        <!--			<el-button size="small" @click="cancel">No!</el-button>-->
-        <!--			<el-button size="small" type="danger" @click="confirm">Yes?</el-button>-->
-        <!--		</template>-->
-        <!--	</el-popconfirm>-->
-        <!--</div>-->
-        <div>
-          <PermissionButton :icon="Plus" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
-        </div>
-        <div class="custom-el-input">
-          <el-select v-model="templateType" style="width: 200px">
-            <template #prefix>
-              <div class="flex items-center">
-                <el-button
-                    size="small"
-                    style="margin-left: -7px; font-size: 14px; border-radius: 29px"
-                    text
-                    type="success"
-                    @click.stop="downloadTemplate"
-                >
-                  下载
-                </el-button>
-                <VerticalDivider style="margin-left: 7px" />
-              </div>
-            </template>
-            <el-option label="审批查看(直销)" value="cost" />
-          </el-select>
-        </div>
-        <VerticalDivider class="px-1" style="margin-left: 7px" />
-        <ImportButton :icon="Upload" :uploadFunction="api.upload" bg text>导 入</ImportButton>
-      </div>
-    </template>
-    <!-- 工具栏右侧 -->
-    <template #toolbar_tools>
-      <el-button circle class="toolbar-btn" @click="handleRefresh">
-        <el-icon>
-          <Refresh />
-        </el-icon>
-      </el-button>
-      <el-button circle class="toolbar-btn" @click="handleDownload">
-        <el-icon>
-          <Download />
-        </el-icon>
-      </el-button>
-    </template>
-    <template #top>
-      <div class="mb-2"></div>
-    </template>
-    <!-- 分页 -->
-    <template #pager>
-      <vxe-pager
-          v-model:currentPage="gridOptions.pagerConfig.page"
-          v-model:pageSize="gridOptions.pagerConfig.limit"
-          :total="gridOptions.pagerConfig.total"
-          class="mt-1.5"
-          @page-change="handlePageChange"
-      />
-    </template>
-    <template #empty>
-      <el-empty description="暂无数据" />
-    </template>
-    <!-- 自定义列插槽 -->
-    <template v-for="col in DirectSalesCheckColumns_Special" #[`${col.field}`]="{ row }">
-      <DataTableSlot :field="col.field" :row="row" @edit-row="handleEdit" @handle-delete="singleDelete" />
-    </template>
-  </vxe-grid>
-  <EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" @refresh="handleRefresh" />
+	<vxe-grid ref="gridRef" :cell-style="cellStyle" v-bind="gridOptions" v-on="gridEvents">
+		<!-- 工具栏左侧 -->
+		<template #toolbar_buttons>
+			<div class="flex gap-2">
+				<div>
+					<PermissionButton v-if="hasPermission('PRICE_DIRECT_CREATE')" :icon="Plus" plain round type="primary" @click="handleCreate"
+						>新 增
+					</PermissionButton>
+				</div>
+				<div class="custom-el-input">
+					<el-select v-model="templateType" style="width: 200px">
+						<template #prefix>
+							<div class="flex items-center">
+								<el-button
+									size="small"
+									style="margin-left: -7px; font-size: 14px; border-radius: 29px"
+									text
+									type="success"
+									@click.stop="downloadTemplate"
+								>
+									下载
+								</el-button>
+								<VerticalDivider style="margin-left: 7px" />
+							</div>
+						</template>
+						<el-option label="审批查看(直销)" value="cost" />
+					</el-select>
+				</div>
+				<VerticalDivider class="px-1" style="margin-left: 7px" />
+				<ImportButton v-if="hasPermission('DIRECT_IMPORT_DATA')" :icon="Upload" :uploadFunction="api.upload" bg text>导 入 </ImportButton>
+			</div>
+		</template>
+		<!-- 工具栏右侧 -->
+		<template #toolbar_tools>
+			<el-button circle class="toolbar-btn" @click="handleRefresh">
+				<el-icon>
+					<Refresh />
+				</el-icon>
+			</el-button>
+			<el-button circle class="toolbar-btn" @click="handleDownload">
+				<el-icon>
+					<Download />
+				</el-icon>
+			</el-button>
+		</template>
+		<template #top>
+			<div class="mb-2"></div>
+		</template>
+		<!-- 分页 -->
+		<template #pager>
+			<vxe-pager
+				v-model:currentPage="gridOptions.pagerConfig.page"
+				v-model:pageSize="gridOptions.pagerConfig.limit"
+				:total="gridOptions.pagerConfig.total"
+				class="mt-1.5"
+				@page-change="handlePageChange"
+			/>
+		</template>
+		<template #empty>
+			<el-empty description="暂无数据" />
+		</template>
+		<!-- 自定义列插槽 -->
+		<template v-for="col in DirectSalesCheckColumns_Special" #[`${col.field}`]="{ row }">
+			<DataTableSlot :field="col.field" :row="row" @edit-row="handleEdit" @handle-delete="singleDelete" />
+		</template>
+	</vxe-grid>
+	<EditDrawer v-if="editOpen" v-model="editOpen" :row-data="rowData" @refresh="handleRefresh" />
 </template>
 
 <style scoped>
 .toolbar-btn {
-  width: 34px;
-  height: 34px;
-  font-size: 18px;
+	width: 34px;
+	height: 34px;
+	font-size: 18px;
 }
 
 :deep(.custom-el-input .el-select__wrapper) {
-  border-radius: 20px;
+	border-radius: 20px;
 }
 </style>

+ 3 - 3
src/views/price-approval/direct-sales/component/DataTableSlot.vue

@@ -59,14 +59,14 @@ function onConfirm() {
 	<div class="font-semibold">
 		<div v-if="field === 'operate'">
 			<div class="flex justify-center gap-2">
-				<div v-if="hasPermission('SkuAttrUpdate')">
-					<PermissionButton circle plain type="warning" @click="handleEdit">
+				<div v-if="hasPermission('PRICE_DIRECT_UPDATE')">
+					<PermissionButton  circle plain type="warning" @click="handleEdit">
 						<el-icon>
 							<Operation />
 						</el-icon>
 					</PermissionButton>
 				</div>
-				<div v-if="hasPermission('SkuAttrDelete')">
+				<div v-if="hasPermission('PRICE_DIRECT_DEL')">
 					<el-popconfirm :icon="InfoFilled" icon-color="#626AEF" title="你确定要删除此项吗?" width="220" @confirm="onConfirm">
 						<template #reference>
 							<PermissionButton circle plain type="danger">

+ 1 - 1
src/views/price-approval/direct-sales/component/EditDrawer.vue

@@ -209,7 +209,7 @@ function closeDrawer() {
       </el-form>
     </el-drawer>
   </div>
-	<SelectDrawer v-if="isShow" v-model="isShow" :title="costType ==='supply' ? '供货' : '直销'" @sendCheckId="getCheckId" />
+	<SelectDrawer v-if="isShow" v-model="isShow" :title="costType ==='supply' ? '供货' : '直销'" :rowData="rowData" @sendCheckId="getCheckId" />
 </template>
 
 <style scoped>

+ 1 - 1
src/views/sku-manage/company-sku/component/DataTable.vue

@@ -218,7 +218,7 @@ defineExpose({ fetchList });
     <template #toolbar_buttons>
       <div class="flex gap-2">
         <div>
-          <PermissionButton :icon="Plus" v-if="hasPermission('SkuCreate')" plain round type="primary" @click="handleCreate">新 增</PermissionButton>
+          <PermissionButton v-if="hasPermission('SkuCreate')" :icon="Plus"  plain round type="primary" @click="handleCreate">新 增</PermissionButton>
         </div>
         <div v-if="hasPermission('SkuBulkPublish')">
           <el-popconfirm :icon="InfoFilled" icon-color="#626AEF" title="此操作将会把所有选中的SKU全部发布, 是否继续?"