diff --git a/package.json b/package.json
index 8c4350c..b9cca10 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"json-editor-vue3": "^1.1.1",
"lodash": "^4.17.21",
"mitt": "^3.0.0",
+ "nanoid": "^3.3.8",
"nprogress": "^0.2.0",
"pinia": "2.0.32",
"postcss": "8.4.40",
diff --git a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue
new file mode 100644
index 0000000..df8ed9f
--- /dev/null
+++ b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/form.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue
new file mode 100644
index 0000000..926b5ca
--- /dev/null
+++ b/src/views/supermarket/supermarketSpu/components/supermarketAuxiliaryCode/index.vue
@@ -0,0 +1,163 @@
+
+
+
+
+
+
+ 新 增
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue b/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue
new file mode 100644
index 0000000..d4c8ee0
--- /dev/null
+++ b/src/views/supermarket/supermarketSpu/components/supermarketUnit/form.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue
new file mode 100644
index 0000000..d5f3da4
--- /dev/null
+++ b/src/views/supermarket/supermarketSpu/components/supermarketUnit/index.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
+ 新 增
+
+
+
+
+
+
+
+
+
+
+
+
+ 正常
+ 停销
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/supermarket/supermarketSpu/form.vue b/src/views/supermarket/supermarketSpu/form.vue
index 4657bdd..cd071cc 100644
--- a/src/views/supermarket/supermarketSpu/form.vue
+++ b/src/views/supermarket/supermarketSpu/form.vue
@@ -1,8 +1,8 @@
-
+
-
+
@@ -75,13 +75,13 @@
-
+
@@ -110,7 +110,7 @@
- ???
+
@@ -183,24 +183,11 @@
- aaaa
-
-
-
-
-
-
-
+
+
+
+
+
@@ -220,9 +207,13 @@
import { useDict } from '/@/hooks/dict';
import { useMessage } from '/@/hooks/message';
import { getObj, addObj, putObj, getSupermarketCategory, getSupermarketBrand } from '/@/api/supermarket/supermarketSpu';
+import { getObj as getSupermarketUnit } from '/@/api/supermarket/supermarketUnit';
+import { getObj as getSupermarketAuxiliaryCode } from '/@/api/supermarket/supermarketAuxiliaryCode';
+import { fetchList } from '/@/api/supermarketerp/smErpSupplier';
import { rule } from '/@/utils/validate';
-import { BasicTableProps, useTable } from '/@/hooks/table';
-import { fetchList } from '/@/api/supermarket/supermarketAuxiliaryCode';
+import supermarketAuxiliaryCode from './components/supermarketAuxiliaryCode/index.vue';
+import supermarketUnit from './components/supermarketUnit/index.vue';
+
const emit = defineEmits(['refresh']);
const tabPaneEnum = ['基础信息', '包装单位', '辅助条码'];
@@ -268,6 +259,8 @@ const form = reactive({
inventoryUpperLimit: 0,
inventoryLowerLimit: 0,
grossMargin: 0,
+ supermarketUnitEntityList: [],
+ supermarketAuxiliaryCodeEntityList: [],
});
// 定义校验规则
const dataRules = {
@@ -285,24 +278,7 @@ const dataRules = {
const { supermarket_nature, status } = useDict('supermarket_nature', 'status');
const categoryOptions = ref([]); // 商品分类的下拉选项
const brandOptions = ref([]); // 超市品牌的下拉选项
-
-// 辅助条码state
-const auxiliaryCodeState: BasicTableProps = reactive({
- queryForm: {},
- pageList: fetchList,
-});
-const auxiliaryCodeTableRef = ref();
-// 辅助条码多选变量
-const auxiliaryCodeSelectObjs = ref([]) as any;
-const { getDataList: getAuxiliaryCodeList, tableStyle } = useTable(auxiliaryCodeState);
-// 辅助条码多选事件
-const auxiliaryCodeSelectionChangHandle = (objs: { id: string }[]) => {
- auxiliaryCodeSelectObjs.value = objs;
-};
-// 表格行点击事件
-const HandleAuxiliaryCodeRowClick = (row: any) => {
- auxiliaryCodeTableRef.value.toggleRowSelection(row);
-};
+const supplierOptions = ref([]); // 货商的下拉选项
// 初始化表单数据
const getsupermarketSpuData = (id: string) => {
@@ -315,12 +291,28 @@ const getsupermarketSpuData = (id: string) => {
.finally(() => {
loading.value = false;
});
+ getSupermarketUnit(id)
+ .then((res: any) => {
+ form.supermarketUnitEntityList = res.data;
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+ getSupermarketAuxiliaryCode(id)
+ .then((res: any) => {
+ form.supermarketAuxiliaryCodeEntityList = res.data;
+ })
+ .finally(() => {
+ loading.value = false;
+ });
};
// 打开弹窗
const openDialog = async (id: string) => {
visible.value = true;
form.id = '';
+ form.supermarketUnitEntityList = [];
+ form.supermarketAuxiliaryCodeEntityList = [];
// 重置表单数据
nextTick(() => {
@@ -353,18 +345,37 @@ const openDialog = async (id: string) => {
}
}
- // 获取辅助条码列表
- getAuxiliaryCodeList();
+ // 获取货商选项
+ if (supplierOptions.value.length <= 0) {
+ try {
+ const res = await fetchList();
+ supplierOptions.value = res.data.records;
+ } catch (error) {
+ supplierOptions.value = [];
+ }
+ }
};
// 提交
const onSubmit = async () => {
+ console.log(form);
+
const valid = await dataFormRef.value.validate().catch(() => {});
if (!valid) return false;
try {
loading.value = true;
- form.id ? await putObj(form) : await addObj(form);
+ if (form.id) {
+ await putObj(form);
+ } else {
+ form.supermarketUnitEntityList.map((item: any) => {
+ item.id = '';
+ });
+ form.supermarketAuxiliaryCodeEntityList.map((item: any) => {
+ item.id = '';
+ });
+ await addObj(form);
+ }
useMessage().success(form.id ? '修改成功' : '添加成功');
visible.value = false;
emit('refresh');
diff --git a/src/views/supermarket/supermarketSpu/index.vue b/src/views/supermarket/supermarketSpu/index.vue
index 7bc8043..cf54c36 100644
--- a/src/views/supermarket/supermarketSpu/index.vue
+++ b/src/views/supermarket/supermarketSpu/index.vue
@@ -53,12 +53,16 @@
@sort-change="sortChangeHandle"
>
-
+
-
+
+
+ {{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId).name }}
+
+
@@ -67,22 +71,22 @@
-
-
+
+
-
+
-
+
-
-
-
+
+
+
@@ -105,13 +109,12 @@