From 7483153aaf6391002a8f63f52f2f0fb1cea4cd25 Mon Sep 17 00:00:00 2001 From: quantulr <35954003+quantulr@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:25:28 +0800 Subject: [PATCH] update --- src/views/product/stock/index.vue | 223 +++++++++++++++----- src/views/sales/contract/index.vue | 231 ++++++++++---------- src/views/sales/team/index.vue | 301 ++------------------------ src/views/sales/team/person.vue | 93 ++++++++ src/views/sales/team/team.vue | 326 +++++++++++++++++++++++++++++ 5 files changed, 726 insertions(+), 448 deletions(-) create mode 100644 src/views/sales/team/person.vue create mode 100644 src/views/sales/team/team.vue diff --git a/src/views/product/stock/index.vue b/src/views/product/stock/index.vue index 01b82a3..5112874 100644 --- a/src/views/product/stock/index.vue +++ b/src/views/product/stock/index.vue @@ -4,10 +4,13 @@ import { loadStockList, loadStockLogList, } from "@/api/product/stock"; -import {computed, reactive, ref, toRefs} from "vue"; -import {dayjs} from "element-plus"; +import modal from "@/plugins/modal"; +import { computed, reactive, ref, toRefs } from "vue"; +import { dayjs } from "element-plus"; import ImagePreview from "@/components/ImagePreview/index.vue"; -import {Table as ATable} from "ant-design-vue"; +import { Table as ATable } from "ant-design-vue"; +import { download } from "@/utils/request"; +import { getToken } from "@/utils/auth"; const queryRef = ref(); const showSearch = ref(false); @@ -18,8 +21,9 @@ const data = reactive({ type: 1, }, }); + const total = ref(0); -const {queryParams} = toRefs(data); +const { queryParams } = toRefs(data); const expandedRowKeys = ref([]); const columns = [ { @@ -32,6 +36,11 @@ const columns = [ dataIndex: "modelName", key: "modelName", }, + { + title: "产品编号", + dataIndex: "serialNumber", + key: "serialNumber", + }, { title: "库存", dataIndex: "stock", @@ -57,12 +66,13 @@ const columns = [ const columnsFilter = computed(() => { if (queryParams.value.type === 0) { return columns.filter( - ({dataIndex}) => !["total", "provePic", "date"].includes(dataIndex) + ({ dataIndex }) => + !["total", "provePic", "date", "serialNumber"].includes(dataIndex) ); } else if (queryParams.value.type === 1) { - return columns.filter(({dataIndex}) => !["stock"].includes(dataIndex)); + return columns.filter(({ dataIndex }) => !["stock"].includes(dataIndex)); } else if (queryParams.value.type === 2) { - return columns.filter(({dataIndex}) => !["stock"].includes(dataIndex)); + return columns.filter(({ dataIndex }) => !["stock"].includes(dataIndex)); } else { return columns; } @@ -76,7 +86,6 @@ const getStockList = () => { stockLogList.value = resp.rows.map((el) => ({ ...el, key: el.modelId, - children: [], })); }); } else { @@ -85,7 +94,6 @@ const getStockList = () => { stockLogList.value = resp.rows.map((el) => ({ ...el, key: el.logId, - children: [], })); }); } @@ -104,14 +112,14 @@ function resetQuery() { const loadChildren = (row) => { if (queryParams.value.type === 0) { - loadProductSerialList({modelId: row.modelId, type: '1'}).then((resp) => { + loadProductSerialList({ modelId: row.modelId, type: "1" }).then((resp) => { row.series = resp.data.map((el) => ({ ...el, key: el.serialId, })); }); } else if (queryParams.value.type === 1 || queryParams.value.type === 2) { - loadProductSerialList({logId: row.logId}).then((resp) => { + loadProductSerialList({ logId: row.logId }).then((resp) => { row.series = resp.data.map((el) => ({ ...el, key: el.serialId, @@ -123,28 +131,86 @@ const loadChildren = (row) => { const handleExpandTable = (expanded, record) => { expanded && loadChildren(record); }; + +const uploadRef = ref(); +/*** 用户导入参数 */ +const upload = reactive({ + // 是否显示弹出层(用户导入) + open: false, + // 弹出层标题(用户导入) + title: "", + // 是否禁用上传 + isUploading: false, + // 是否更新已经存在的用户数据 + updateSupport: 0, + // 设置上传的请求头部 + headers: { Authorization: "Bearer " + getToken() }, + // 上传的地址 + url: import.meta.env.VITE_APP_BASE_API + "/product/stocklog/importData", +}); + +/** 导入按钮操作 */ +function handleImport() { + upload.title = "入库记录导入"; + upload.open = true; +} + +/** 下载模板操作 */ +function importTemplate() { + download( + "/product/stocklog/importTemplate", + {}, + `user_template_${new Date().getTime()}.xlsx` + ); +} + +/**文件上传中处理 */ +const handleFileUploadProgress = (event, file, fileList) => { + upload.isUploading = true; +}; + +/** 文件上传成功处理 */ +const handleFileSuccess = (response, file, fileList) => { + upload.open = false; + upload.isUploading = false; + uploadRef.value.handleRemove(file); + modal.alert( + "
" + + response.msg + + "
", + "导入结果", + { dangerouslyUseHTMLString: true } + ); + getStockList(); +}; + +/** 提交上传文件 */ +function submitFileForm() { + uploadRef.value.submit(); +} + getStockList(); diff --git a/src/views/sales/contract/index.vue b/src/views/sales/contract/index.vue index 371cf0e..92eee15 100644 --- a/src/views/sales/contract/index.vue +++ b/src/views/sales/contract/index.vue @@ -1,43 +1,42 @@