|
@@ -3,8 +3,11 @@ import type { VbenFormProps } from '@vben/common-ui';
|
|
|
|
|
|
|
|
import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
|
|
import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
|
|
|
|
|
+import { computed } from 'vue';
|
|
|
|
|
+
|
|
|
import { Page, useVbenModal } from '@vben/common-ui';
|
|
import { Page, useVbenModal } from '@vben/common-ui';
|
|
|
import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
|
|
import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
|
|
|
|
|
+import { useUserStore } from '@vben/stores';
|
|
|
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
|
|
|
@@ -14,6 +17,14 @@ import { $t } from '#/locales';
|
|
|
|
|
|
|
|
import ProductForm from './form.vue';
|
|
import ProductForm from './form.vue';
|
|
|
|
|
|
|
|
|
|
+// 获取用户信息
|
|
|
|
|
+const userStore = useUserStore();
|
|
|
|
|
+
|
|
|
|
|
+// 判断是否是经销商且不是管理员
|
|
|
|
|
+const isNonAdminMerchant = computed(() => {
|
|
|
|
|
+ return userStore.isDLS && !userStore.isSuperAdmin;
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const formOptions: VbenFormProps = {
|
|
const formOptions: VbenFormProps = {
|
|
|
// 默认展开
|
|
// 默认展开
|
|
|
collapsed: true,
|
|
collapsed: true,
|
|
@@ -58,37 +69,53 @@ const gridOptions: VxeGridProps<any> = {
|
|
|
},
|
|
},
|
|
|
ajax: {
|
|
ajax: {
|
|
|
query: async ({ page }, formValues) => {
|
|
query: async ({ page }, formValues) => {
|
|
|
- return await getProductListApi({
|
|
|
|
|
|
|
+ // 构建查询参数
|
|
|
|
|
+ const queryParams: any = {
|
|
|
pageindex: page.currentPage,
|
|
pageindex: page.currentPage,
|
|
|
rows: page.pageSize,
|
|
rows: page.pageSize,
|
|
|
...formValues,
|
|
...formValues,
|
|
|
- });
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 如果是经销商且不是管理员,添加经销商筛选条件
|
|
|
|
|
+ if (isNonAdminMerchant.value) {
|
|
|
|
|
+ queryParams.productsmerchantid =
|
|
|
|
|
+ userStore.userInfo?.workeruserid || '';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return await getProductListApi(queryParams);
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
columns: [
|
|
columns: [
|
|
|
- { title: '机具类型', field: 'productsjjlx', sortable: true },
|
|
|
|
|
- { title: '产品名称', field: 'productsname', sortable: true },
|
|
|
|
|
- { title: '产品类别', field: 'productscategory', sortable: true },
|
|
|
|
|
- { title: '产品型号', field: 'productsmodel', sortable: true },
|
|
|
|
|
|
|
+ { title: '机具类型', field: 'productsjjlx', sortable: true, width: 120 },
|
|
|
|
|
+ { title: '产品名称', field: 'productsname', sortable: true, width: 240 },
|
|
|
|
|
+ {
|
|
|
|
|
+ title: '产品类别',
|
|
|
|
|
+ field: 'productscategory',
|
|
|
|
|
+ sortable: true,
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ },
|
|
|
|
|
+ { title: '产品型号', field: 'productsmodel', sortable: true, width: 220 },
|
|
|
// { title: '产品sn号', field: 'productssn' },
|
|
// { title: '产品sn号', field: 'productssn' },
|
|
|
- { title: '品目', field: 'productspm', sortable: true },
|
|
|
|
|
- { title: '一级分类', field: 'productsfl1', sortable: true },
|
|
|
|
|
- { title: '二级分类', field: 'productsfl2', sortable: true },
|
|
|
|
|
- { title: '分档名称', field: 'productsfdmc', sortable: true },
|
|
|
|
|
- { title: '分档编号', field: 'productsfdbh', sortable: true },
|
|
|
|
|
|
|
+ { title: '品目', field: 'productspm', sortable: true, width: 120 },
|
|
|
|
|
+ { title: '一级分类', field: 'productsfl1', sortable: true, width: 120 },
|
|
|
|
|
+ { title: '二级分类', field: 'productsfl2', sortable: true, width: 120 },
|
|
|
|
|
+ { title: '分档名称', field: 'productsfdmc', sortable: true, width: 120 },
|
|
|
|
|
+ { title: '分档编号', field: 'productsfdbh', sortable: true, width: 120 },
|
|
|
{
|
|
{
|
|
|
title: '产品原价',
|
|
title: '产品原价',
|
|
|
field: 'productsprice',
|
|
field: 'productsprice',
|
|
|
formatter: formatMoney,
|
|
formatter: formatMoney,
|
|
|
sortable: true,
|
|
sortable: true,
|
|
|
|
|
+ width: 120,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '中央补贴金额',
|
|
title: '中央补贴金额',
|
|
|
field: 'productszybt',
|
|
field: 'productszybt',
|
|
|
formatter: formatMoney,
|
|
formatter: formatMoney,
|
|
|
sortable: true,
|
|
sortable: true,
|
|
|
|
|
+ width: 120,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '特殊县中央补贴金额',
|
|
title: '特殊县中央补贴金额',
|
|
@@ -97,7 +124,7 @@ const gridOptions: VxeGridProps<any> = {
|
|
|
width: 170,
|
|
width: 170,
|
|
|
sortable: true,
|
|
sortable: true,
|
|
|
},
|
|
},
|
|
|
- { title: '创建时间', field: 'productsdate' },
|
|
|
|
|
|
|
+ { title: '创建时间', field: 'productsdate', width: 180 },
|
|
|
{
|
|
{
|
|
|
title: '操作',
|
|
title: '操作',
|
|
|
field: 'action',
|
|
field: 'action',
|
|
@@ -191,6 +218,7 @@ async function handleDelete(row: any) {
|
|
|
/>
|
|
/>
|
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
|
<el-tooltip
|
|
<el-tooltip
|
|
|
|
|
+ v-if="!isNonAdminMerchant"
|
|
|
class="box-item"
|
|
class="box-item"
|
|
|
effect="dark"
|
|
effect="dark"
|
|
|
content="编辑"
|
|
content="编辑"
|
|
@@ -208,6 +236,21 @@ async function handleDelete(row: any) {
|
|
|
effect="dark"
|
|
effect="dark"
|
|
|
content="删除"
|
|
content="删除"
|
|
|
placement="top"
|
|
placement="top"
|
|
|
|
|
+ v-if="!isNonAdminMerchant"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ round
|
|
|
|
|
+ @click="() => handleDelete(row)"
|
|
|
|
|
+ :icon="MdiDelete"
|
|
|
|
|
+ class="!p-2"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-tooltip>
|
|
|
|
|
+ <el-tooltip
|
|
|
|
|
+ class="box-item"
|
|
|
|
|
+ effect="dark"
|
|
|
|
|
+ content="移除关联"
|
|
|
|
|
+ placement="top"
|
|
|
|
|
+ v-if="isNonAdminMerchant"
|
|
|
>
|
|
>
|
|
|
<el-button
|
|
<el-button
|
|
|
round
|
|
round
|