Merge branch 'master' of http://gitea.zianxin.com/zianxin-tec/biz-pc-cloud
# Conflicts: # src/views/supermarketerp/components/linkCodeDialog.vue
This commit is contained in:
commit
616d8caddb
77 files changed
+2679
-2664
No files matched your search
@@ -17,7 +17,11 @@
|
||||
<vxe-column field="planDate" title="单据日期" align="center" width="200"></vxe-column>
|
||||
<vxe-column field="productName" title="商品名称" align="center" width="200"></vxe-column>
|
||||
<vxe-column field="handlerUserId" title="经办人" align="center" width="100"></vxe-column>
|
||||
<!-- <vxe-column field="checkStatus" title="审批状态" align="center" width="100"></vxe-column>-->
|
||||
<vxe-column field="checkStatus" title="审批状态" align="center" width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-tag :options="check_status" :value="row.checkStatus" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="remark" title="备注" show-overflow align="center" min-width="100"></vxe-column>
|
||||
</vxe-table>
|
||||
<!-- <pagination
|
||||
@@ -57,7 +61,9 @@
|
||||
<script setup lang="ts" name="linkCgCodeDialog">
|
||||
import { ref } from "vue"
|
||||
import { VxeTableEvents } from "vxe-table"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
const { check_status } = useDict("check_status")
|
||||
const linkCodeDialogVisible = defineModel()
|
||||
const emit = defineEmits(["getSelectedLinkCode"])
|
||||
const props = withDefaults(
|
||||
|
||||
@@ -149,7 +149,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpCgInventory.xlsx")
|
||||
// downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购退货.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -105,7 +105,7 @@ const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, do
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpCgDd/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpCgDd.xlsx")
|
||||
downBlobFile("/supermarket/smErpCgDd/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购订单.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -149,7 +149,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpCgInventory.xlsx")
|
||||
downBlobFile("/supermarket/smErpInventoryRecords/export", Object.assign(state.queryForm, { ids: selectObjs }), "采购入库.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -120,7 +120,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpCgPlan/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpCgPlan.xlsx")
|
||||
downBlobFile("/supermarket/smErpCgPlan/export", Object.assign(state.queryForm, { ids: selectObjs }), "补货申请.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -147,7 +147,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpRetailBack/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpRetailBack.xlsx")
|
||||
downBlobFile("/supermarket/smErpRetailBack/export", Object.assign(state.queryForm, { ids: selectObjs }), "零售退货.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -149,7 +149,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/smErpRetailDelivery/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpRetailDelivery.xlsx")
|
||||
downBlobFile("/supermarket/smErpRetailDelivery/export", Object.assign(state.queryForm, { ids: selectObjs }), "零售出库.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -53,21 +53,21 @@
|
||||
<el-tag type="danger" v-if="scope.row.warnType == 2">库存超额</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="barcode" label="条码" show-overflow-tooltip min-width="160" />
|
||||
<el-table-column prop="categoryId" label="分类" show-overflow-tooltip>
|
||||
<el-table-column prop="barcode" label="条码" show-overflow-tooltip min-width="120" />
|
||||
<el-table-column prop="categoryId" label="分类" show-overflow-tooltip min-width="100">
|
||||
<template #default="scope">
|
||||
{{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId)?.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="inventoryLowerLimit" label="库存下限" show-overflow-tooltip min-width="100" />
|
||||
<el-table-column prop="inventoryUpperLimit" label="库存上限" show-overflow-tooltip min-width="100" />
|
||||
<el-table-column prop="packageNum" label="内装数量" show-overflow-tooltip min-width="100" />
|
||||
<el-table-column prop="inventoryLowerLimit" label="库存下限" show-overflow-tooltip min-width="90" />
|
||||
<el-table-column prop="inventoryUpperLimit" label="库存上限" show-overflow-tooltip min-width="90" />
|
||||
<el-table-column prop="packageNum" label="内装数量" show-overflow-tooltip min-width="90" />
|
||||
<el-table-column prop="picUrl" label="商品图" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<preview-image :src="scope.row.picUrl" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="productCode" label="货号" show-overflow-tooltip min-width="160" />
|
||||
<el-table-column prop="productCode" label="货号" show-overflow-tooltip min-width="120" />
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@ const selectionChangHandle = (objs: { supplierId: string }[]) => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarketerp/smErpInventoryWarning/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpSupplier.xlsx")
|
||||
downBlobFile("/supermarketerp/smErpInventoryWarning/export", Object.assign(state.queryForm, { ids: selectObjs }), "库存预警.xlsx")
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -168,7 +168,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarketerp/smErpSupplier/export", Object.assign(state.queryForm, { ids: selectObjs }), "smErpSupplier.xlsx")
|
||||
downBlobFile("/supermarketerp/smErpSupplier/export", Object.assign(state.queryForm, { ids: selectObjs }), "货商管理.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -73,7 +73,13 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarketerp_smErpSupplierType_del'" @click="handleDelete([scope.row.id])">
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarketerp_smErpSupplierType_del'"
|
||||
@click="handleDelete([scope.row.id])"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -88,66 +94,66 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSmErpSupplierType">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { fetchList, delObjs } from '/@/api/supermarketerp/smErpSupplierType';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/@/api/supermarketerp/smErpSupplierType"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields();
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarketerp/smErpSupplierType/export', Object.assign(state.queryForm, { ids: selectObjs }), 'smErpSupplierType.xlsx');
|
||||
};
|
||||
downBlobFile("/supermarketerp/smErpSupplierType/export", Object.assign(state.queryForm, { ids: selectObjs }), "货商类别.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -71,7 +71,12 @@
|
||||
@click="formDialogRef.openDialog(scope.row.id)"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_supermarketAuxiliaryCode_del'" @click="handleDelete([scope.row.id])"
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_supermarketAuxiliaryCode_del'"
|
||||
@click="handleDelete([scope.row.id])"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
@@ -86,64 +91,64 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSupermarketAuxiliaryCode">
|
||||
import { BasicTableProps, useTable } from '/@/hooks/table';
|
||||
import { fetchList, delObjs } from '/src/api/supermarketerp/supermarketAuxiliaryCode';
|
||||
import { useMessage, useMessageBox } from '/@/hooks/message';
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table"
|
||||
import { fetchList, delObjs } from "/src/api/supermarketerp/supermarketAuxiliaryCode"
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields();
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarket/supermarketAuxiliaryCode/export', Object.assign(state.queryForm, { ids: selectObjs }), 'supermarketAuxiliaryCode.xlsx');
|
||||
};
|
||||
downBlobFile("/supermarket/supermarketAuxiliaryCode/export", Object.assign(state.queryForm, { ids: selectObjs }), "辅助条码管理.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -78,13 +78,7 @@
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
icon="delete"
|
||||
text
|
||||
type="primary"
|
||||
v-auth="'supermarket_supermarketBrand_del'"
|
||||
@click="handleDelete([scope.row.id])"
|
||||
>
|
||||
<el-button icon="delete" text type="primary" v-auth="'supermarket_supermarketBrand_del'" @click="handleDelete([scope.row.id])">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -123,8 +117,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
@@ -137,11 +130,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile(
|
||||
"/supermarket/supermarketBrand/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"supermarketBrand.xlsx",
|
||||
)
|
||||
downBlobFile("/supermarket/supermarketBrand/export", Object.assign(state.queryForm, { ids: selectObjs }), "商品品牌.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -125,8 +125,7 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } =
|
||||
useTable(state)
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
@@ -139,11 +138,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile(
|
||||
"/supermarket/supermarketCategory/export",
|
||||
Object.assign(state.queryForm, { ids: selectObjs }),
|
||||
"supermarketCategory.xlsx",
|
||||
)
|
||||
downBlobFile("/supermarket/supermarketCategory/export", Object.assign(state.queryForm, { ids: selectObjs }), "商品分类.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
+32
-17
@@ -13,7 +13,7 @@
|
||||
:column-config="{ resizable: true }"
|
||||
:row-config="{ isHover: true }"
|
||||
:resizable-config="{ dragMode: 'fixed' }"
|
||||
:data="supermarketAuxiliaryCodeEntityList"
|
||||
:data="auxiliaryCodeList"
|
||||
:edit-config="{
|
||||
trigger: 'click',
|
||||
mode: 'cell',
|
||||
@@ -32,20 +32,20 @@
|
||||
<vxe-column type="seq" width="50" fixed="left" />
|
||||
<vxe-column field="unit" title="单位" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<el-select v-model="row.unit">
|
||||
<el-select v-model="row.unitId">
|
||||
<div v-for="item in smErpUnitEntityList">
|
||||
<el-option v-if="item.unit !== ''" :label="item.unit" :value="item.unit" />
|
||||
<el-option :label="item.unit" :value="item.id" />
|
||||
</div>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.unit">{{ row.unit }}</span>
|
||||
<span v-if="row.unitId">{{ smErpUnitEntityList?.find((item) => item.id === row.unitId)?.unit }}</span>
|
||||
<span v-else style="color: #c0c4cf">请选择</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="barCode" title="条码">
|
||||
<template #default="{ row }">
|
||||
{{ smErpUnitEntityList?.find((item: any) => item.unit == row.unit)?.barCode }}
|
||||
{{ smErpUnitEntityList?.find((item) => item.id == row.unitId)?.barCode }}
|
||||
</template>
|
||||
</vxe-column>
|
||||
</vxe-table>
|
||||
@@ -54,36 +54,53 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { nanoid } from "nanoid"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { rowVU } from "./packageUnit.vue"
|
||||
|
||||
const supermarketAuxiliaryCodeEntityList = defineModel("supermarketAuxiliaryCodeEntityList", {
|
||||
export interface rowVC {
|
||||
id: string
|
||||
unitId: string
|
||||
barCode: string
|
||||
isNew?: boolean
|
||||
}
|
||||
|
||||
const auxiliaryCodeList = defineModel("modelValue", {
|
||||
default: [
|
||||
{
|
||||
id: nanoid(5),
|
||||
unit: "",
|
||||
unitId: "",
|
||||
barCode: "",
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
defineProps<{
|
||||
smErpUnitEntityList: any[]
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
smErpUnitEntityList?: rowVU[]
|
||||
}>(),
|
||||
{
|
||||
smErpUnitEntityList: [] as any,
|
||||
},
|
||||
)
|
||||
|
||||
const editableTableRef = ref()
|
||||
|
||||
// const validRules = {
|
||||
// unit: [{ required: true, message: "包装单位不能为空", trigger: "blur" }],
|
||||
// // barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }],
|
||||
// barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }],
|
||||
// }
|
||||
|
||||
// 底部表格行新增
|
||||
const pushEvent = () => {
|
||||
const newRow: any = {
|
||||
if (props.smErpUnitEntityList?.length === 0) return useMessage().warning("请先添加包装单位")
|
||||
|
||||
const newRow: rowVC = {
|
||||
id: nanoid(5),
|
||||
unit: "",
|
||||
unitId: "",
|
||||
barCode: "",
|
||||
isNew: true,
|
||||
}
|
||||
supermarketAuxiliaryCodeEntityList.value.push(newRow)
|
||||
auxiliaryCodeList.value.push(newRow)
|
||||
nextTick(() => {
|
||||
const $table = editableTableRef.value
|
||||
if ($table) {
|
||||
@@ -98,9 +115,7 @@ const removeSelectRowEvent = () => {
|
||||
if ($table) {
|
||||
const selectRecords = $table.getCheckboxRecords()
|
||||
if (selectRecords.length > 0) {
|
||||
supermarketAuxiliaryCodeEntityList.value = supermarketAuxiliaryCodeEntityList.value.filter(
|
||||
(item: any) => !selectRecords.some((row: any) => row.id === item.id),
|
||||
)
|
||||
auxiliaryCodeList.value = auxiliaryCodeList.value.filter((item: rowVC) => !selectRecords.some((row: rowVC) => row.id === item.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商户" prop="merchantId">-->
|
||||
<!-- <select-mch v-model="form.merchantId" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货号" prop="productCode">
|
||||
<el-input v-model.trim="form.productCode" placeholder="请输入货号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="自编码/条码" prop="barcode">-->
|
||||
<!-- <el-input v-model.trim="form.barcode" placeholder="请输入自编码/条码" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
<el-input v-model.trim="form.productName" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<select-supplier v-model="form.supplierId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品分类" prop="categoryId">
|
||||
<el-select v-model="form.categoryId" placeholder="请选择商品分类">
|
||||
<el-option v-for="item in categoryOptions" :key="item?.id" :label="item?.name" :value="item?.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="品牌" prop="brandId">
|
||||
<el-select v-model="form.brandId" placeholder="请选择品牌">
|
||||
<el-option v-for="item in brandOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品性质" prop="productNature">
|
||||
<el-select v-model="form.productNature" placeholder="请选择商品性质">
|
||||
<el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品封面图" prop="picUrl">
|
||||
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="单位" prop="unit">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon>–>-->
|
||||
<!-- <!– <p>最小售卖的基本单位</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input placeholder="请输入单位" v-model.trim="form.unit" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="14" class="mb20">-->
|
||||
<!-- <el-form-item label="内装数" prop="packageNum">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon >–>-->
|
||||
<!-- <!– <p>注:内装数据必须为该商品的基本单位的内装数,否则无法完成库存数量转换。–>-->
|
||||
<!-- <!– 例如:零售一瓶矿泉水内装数为1,按一箱售卖矿泉水内装填'24'</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input-number v-model="form.packageNum" :min="0" :precision="0" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="零售价" prop="retailPrice">-->
|
||||
<!-- <el-input-number v-model="form.retailPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="进价" prop="purchasePrice">-->
|
||||
<!-- <el-input-number v-model="form.purchasePrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="促销价" prop="promotionPrice">-->
|
||||
<!-- <el-input-number v-model="form.promotionPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="成本价" prop="costPrice">-->
|
||||
<!-- <el-input-number v-model="form.costPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="item.value" v-for="(item, index) in status" border :key="index">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="规格" prop="spec">-->
|
||||
<!-- <el-input placeholder="请输入规格" v-model.trim="form.spec" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="产地" prop="origin">
|
||||
<el-input v-model.trim="form.origin" placeholder="请输入产地" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序字段" prop="sort">
|
||||
<el-input-number :min="0" :max="1000" :precision="0" v-model="form.sort" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="毛利率" prop="grossMargin">
|
||||
<el-input-number v-model="form.grossMargin" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue"
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { getSupermarketCategory, getSupermarketBrand } from "/@/api/supermarketerp/supermarketSpu"
|
||||
|
||||
const form = defineModel<any>("modelValue")
|
||||
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
const categoryOptions = ref<any>([]) // 商品分类的下拉选项
|
||||
const brandOptions = ref<any>([]) // 超市品牌的下拉选项
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取分类下拉选项 & 获取品牌下拉选项
|
||||
const [categoryDict, brandDict] = await Promise.allSettled([getSupermarketCategory(), getSupermarketBrand()]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
|
||||
categoryDict && categoryDict.code === 0 && (categoryOptions.value = categoryDict.data)
|
||||
brandDict && brandDict.code === 0 && (brandOptions.value = brandDict.data)
|
||||
})
|
||||
</script>
|
||||
+22
-14
@@ -25,7 +25,7 @@
|
||||
:column-config="{ resizable: true }"
|
||||
:row-config="{ isHover: true }"
|
||||
:resizable-config="{ dragMode: 'fixed' }"
|
||||
:data="supermarketUnitEntityList"
|
||||
:data="packageUnitList"
|
||||
:edit-rules="validRules"
|
||||
:edit-config="{
|
||||
trigger: 'click',
|
||||
@@ -92,11 +92,7 @@
|
||||
<el-input-number v-model="row.promotionPrice" controls-position="right" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="costPrice" title="成本价(元)" :edit-render="{ autoFocus: 'input', placeholder: '请输入' }">
|
||||
<template #edit="{ row }">
|
||||
<el-input-number v-model="row.costPrice" controls-position="right" :min="0" :precision="2" />
|
||||
</template>
|
||||
</vxe-column>
|
||||
<vxe-column field="costPrice" title="成本价(元)" />
|
||||
</vxe-table>
|
||||
</div>
|
||||
</template>
|
||||
@@ -104,7 +100,22 @@
|
||||
<script setup lang="ts">
|
||||
import { nanoid } from "nanoid"
|
||||
|
||||
const supermarketUnitEntityList = defineModel("supermarketUnitEntityList", {
|
||||
export interface rowVU {
|
||||
id: string
|
||||
barCode: string
|
||||
spec: string
|
||||
unit: string
|
||||
status: string
|
||||
packageNum: number
|
||||
purchasePrice: number
|
||||
retailPrice: number
|
||||
promotionPrice: number
|
||||
costPrice: number
|
||||
isNew?: boolean
|
||||
isBase?: boolean | null
|
||||
}
|
||||
|
||||
const packageUnitList = defineModel<rowVU[]>("modelValue", {
|
||||
default: [
|
||||
{
|
||||
id: nanoid(5),
|
||||
@@ -131,12 +142,11 @@ const validRules = {
|
||||
retailPrice: [{ required: true, message: "零售价不能为空", trigger: "blur" }],
|
||||
purchasePrice: [{ required: true, message: "进价不能为空", trigger: "blur" }],
|
||||
promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
// costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
}
|
||||
|
||||
// 底部表格行新增
|
||||
const pushEvent = () => {
|
||||
const newRow: any = {
|
||||
const newRow: rowVU = {
|
||||
id: nanoid(5),
|
||||
barCode: "",
|
||||
spec: "",
|
||||
@@ -149,7 +159,7 @@ const pushEvent = () => {
|
||||
costPrice: 0,
|
||||
isNew: true,
|
||||
}
|
||||
supermarketUnitEntityList.value.push(newRow)
|
||||
packageUnitList.value.push(newRow)
|
||||
nextTick(() => {
|
||||
const $table = editableTableRef.value
|
||||
if ($table) {
|
||||
@@ -164,9 +174,7 @@ const removeSelectRowEvent = () => {
|
||||
if ($table) {
|
||||
const selectRecords = $table.getCheckboxRecords()
|
||||
if (selectRecords.length > 0) {
|
||||
supermarketUnitEntityList.value = supermarketUnitEntityList.value.filter(
|
||||
(item: any) => !selectRecords.some((row: any) => row.id === item.id),
|
||||
)
|
||||
packageUnitList.value = packageUnitList.value.filter((item: rowVU) => !selectRecords.some((row: rowVU) => row.id === item.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,7 +192,7 @@ const getRadioEvent = () => {
|
||||
const setRadioRow = (index: number) => {
|
||||
const $table = editableTableRef.value
|
||||
if ($table) {
|
||||
$table.setRadioRow(supermarketUnitEntityList.value[index])
|
||||
$table.setRadioRow(packageUnitList.value[index])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="总库存" prop="stock" class="flex w-full h-full">
|
||||
<el-input-number v-model="stock" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="库存上限" prop="inventoryUpperLimit">
|
||||
<el-input-number v-model="inventoryUpperLimit" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="库存下限" prop="inventoryLowerLimit">
|
||||
<el-input-number v-model="inventoryLowerLimit" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-alert type="warning" show-icon :closable="false">
|
||||
注:最小售卖单位的总库存,否则无法换算完成库存扣减,每卖出一个包装形式的商品,都会进行总库存-内装数,实现多种包装形式售卖
|
||||
</el-alert>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const stock = defineModel<number | null>("stock", { default: 0 })
|
||||
const inventoryUpperLimit = defineModel<number | null>("inventoryUpperLimit", { default: 0 })
|
||||
const inventoryLowerLimit = defineModel<number | null>("inventoryLowerLimit", { default: 0 })
|
||||
</script>
|
||||
@@ -1,96 +0,0 @@
|
||||
<template>
|
||||
<div class="w-full h-full">
|
||||
<el-tooltip effect="light" placement="right">
|
||||
<template #content>
|
||||
<el-alert class="w-[500px] h-24" type="warning" show-icon :closable="false">
|
||||
<p>注:最小售卖单位的总库存,否则无法换算完成库存扣减,每卖出一个包装形式的商品,都会进行总库存-内装数,实现多种包装形式售卖</p>
|
||||
</el-alert>
|
||||
</template>
|
||||
<el-icon class="text-xl my-auto ml-4 text-yellow-600"><WarningFilled /></el-icon>
|
||||
</el-tooltip>
|
||||
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px">
|
||||
<el-row>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="总库存" prop="stock" class="flex w-full h-full">
|
||||
<el-input-number v-model="stock" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="库存上限" prop="inventoryUpperLimit">
|
||||
<el-input-number v-model="inventoryUpperLimit" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="库存下限" prop="inventoryLowerLimit">
|
||||
<el-input-number v-model="inventoryLowerLimit" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue"
|
||||
const stock = defineModel<number | null>("stock")
|
||||
const inventoryUpperLimit = defineModel<number | null>("inventoryUpperLimit")
|
||||
const inventoryLowerLimit = defineModel<number | null>("inventoryLowerLimit")
|
||||
|
||||
const dataFormRef = ref()
|
||||
const form = reactive<{
|
||||
stock: number | null | undefined
|
||||
inventoryUpperLimit: number | null | undefined
|
||||
inventoryLowerLimit: number | null | undefined
|
||||
}>({
|
||||
stock: null,
|
||||
inventoryUpperLimit: null,
|
||||
inventoryLowerLimit: null,
|
||||
})
|
||||
|
||||
watch(
|
||||
() => stock.value,
|
||||
(val) => {
|
||||
form.stock = val
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
watch(
|
||||
() => inventoryUpperLimit.value,
|
||||
(val) => {
|
||||
form.inventoryUpperLimit = val
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
watch(
|
||||
() => inventoryLowerLimit.value,
|
||||
(val) => {
|
||||
form.inventoryLowerLimit = val
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
|
||||
const dataRules = ref({
|
||||
stock: [{ required: true, message: "总库存不能为空", trigger: "blur" }],
|
||||
inventoryUpperLimit: [{ required: true, message: "库存上限不能为空", trigger: "blur" }],
|
||||
inventoryLowerLimit: [{ required: true, message: "库存下限不能为空", trigger: "blur" }],
|
||||
})
|
||||
|
||||
// 库存校验
|
||||
const stockValidate = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
return valid
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
stockValidate,
|
||||
})
|
||||
</script>
|
||||
@@ -1,144 +1,22 @@
|
||||
<template>
|
||||
<el-dialog width="80%" :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-dialog width="95%" :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="auto" v-loading="loading">
|
||||
<el-tabs v-model="tabPaneActiveName" @tab-change="handleTabChange">
|
||||
<el-tab-pane label="基础信息" name="基础信息" style="overflow-y: auto; height: 60vh">
|
||||
<el-row>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商户" prop="merchantId">-->
|
||||
<!-- <select-mch v-model="form.merchantId" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货号" prop="productCode">
|
||||
<el-input v-model.trim="form.productCode" placeholder="请输入货号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="自编码/条码" prop="barcode">-->
|
||||
<!-- <el-input v-model.trim="form.barcode" placeholder="请输入自编码/条码" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
<el-input v-model.trim="form.productName" placeholder="请输入商品名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货商" prop="supplierId">
|
||||
<select-supplier v-model="form.supplierId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品分类" prop="categoryId">
|
||||
<el-select v-model="form.categoryId" placeholder="请选择商品分类">
|
||||
<el-option v-for="item in categoryOptions" :key="item?.id" :label="item?.name" :value="item?.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="品牌" prop="brandId">
|
||||
<el-select v-model="form.brandId" placeholder="请选择品牌">
|
||||
<el-option v-for="item in brandOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品性质" prop="productNature">
|
||||
<el-select v-model="form.productNature" placeholder="请选择商品性质">
|
||||
<el-option :value="item.value" :label="item.label" v-for="(item, index) in supermarket_nature" :key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品封面图" prop="picUrl">
|
||||
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="单位" prop="unit">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon>–>-->
|
||||
<!-- <!– <p>最小售卖的基本单位</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input placeholder="请输入单位" v-model.trim="form.unit" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="14" class="mb20">-->
|
||||
<!-- <el-form-item label="内装数" prop="packageNum">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon >–>-->
|
||||
<!-- <!– <p>注:内装数据必须为该商品的基本单位的内装数,否则无法完成库存数量转换。–>-->
|
||||
<!-- <!– 例如:零售一瓶矿泉水内装数为1,按一箱售卖矿泉水内装填'24'</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input-number v-model="form.packageNum" :min="0" :precision="0" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="零售价" prop="retailPrice">-->
|
||||
<!-- <el-input-number v-model="form.retailPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="进价" prop="purchasePrice">-->
|
||||
<!-- <el-input-number v-model="form.purchasePrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="促销价" prop="promotionPrice">-->
|
||||
<!-- <el-input-number v-model="form.promotionPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="成本价" prop="costPrice">-->
|
||||
<!-- <el-input-number v-model="form.costPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio :label="item.value" v-for="(item, index) in status" border :key="index">{{ item.label }} </el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="规格" prop="spec">-->
|
||||
<!-- <el-input placeholder="请输入规格" v-model.trim="form.spec" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="产地" prop="origin">
|
||||
<el-input v-model.trim="form.origin" placeholder="请输入产地" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序字段" prop="sort">
|
||||
<el-input-number :min="0" :max="1000" :precision="0" v-model="form.sort" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="毛利率" prop="grossMargin">
|
||||
<el-input-number v-model="form.grossMargin" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-tab-pane class="el-tab-pane" label="基础信息" name="基础信息">
|
||||
<base-info v-model="form" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="包装单位" name="包装单位" style="overflow-y: auto; height: 60vh">
|
||||
<supermarket-unit ref="supermarketUnitEntityListRef" v-model:supermarketUnitEntityList="form.smErpUnitEntityList" />
|
||||
<el-tab-pane class="el-tab-pane" label="包装单位" name="包装单位">
|
||||
<package-unit ref="packageUnitRef" v-model="form.smErpUnitEntityList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="库存" name="库存" style="overflow-y: auto; height: 60vh">
|
||||
<supermarket-inventory
|
||||
ref="supermarketInventoryRef"
|
||||
<el-tab-pane class="el-tab-pane" label="库存" name="库存">
|
||||
<product-inventory
|
||||
v-model:stock="form.stock"
|
||||
v-model:inventoryUpperLimit="form.inventoryUpperLimit"
|
||||
v-model:inventoryLowerLimit="form.inventoryLowerLimit"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="辅助条码" name="辅助条码" style="overflow-y: auto; height: 60vh">
|
||||
<supermarket-auxiliaryCode
|
||||
ref="supermarketAuxiliaryCodeEntityList"
|
||||
:smErpUnitEntityList="form.smErpUnitEntityList"
|
||||
v-model:supermarketAuxiliaryCodeEntityList="form.smErpAuxiliaryCodeEntityList"
|
||||
/>
|
||||
<el-tab-pane class="el-tab-pane" label="辅助条码" name="辅助条码">
|
||||
<auxiliary-code :smErpUnitEntityList="form.smErpUnitEntityList" v-model="form.smErpAuxiliaryCodeEntityList" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
@@ -153,27 +31,25 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useDict } from "/@/hooks/dict"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { getObj, addObj, putObj, getSupermarketCategory, getSupermarketBrand } from "/@/api/supermarketerp/supermarketSpu"
|
||||
import { rule } from "/@/utils/validate"
|
||||
import SupermarketUnit from "./components/supermarketUnit.vue"
|
||||
import supermarketInventory from "./components/supermarketInventory.vue"
|
||||
import SupermarketAuxiliaryCode from "./components/supermarketAuxiliaryCode.vue"
|
||||
import baseInfo from "./components/baseInfo.vue"
|
||||
import packageUnit, { type rowVU } from "./components/packageUnit.vue"
|
||||
import productInventory from "./components/productInventory.vue"
|
||||
import auxiliaryCode, { rowVC } from "./components/auxiliaryCode.vue"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/supermarketSpu"
|
||||
import { TabPaneName } from "element-plus"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
const supermarketUnitEntityListRef = ref()
|
||||
const supermarketInventoryRef = ref()
|
||||
const supermarketAuxiliaryCodeEntityList = ref()
|
||||
const tabPaneEnum = ["基础信息", "包装单位", "库存", "辅助条码"]
|
||||
const dataFormRef = ref()
|
||||
const packageUnitRef = ref()
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const tabPaneEnum = ["基础信息", "包装单位", "库存", "辅助条码"]
|
||||
const currentTabPaneIndex = ref(0)
|
||||
const tabPaneActiveName = computed(() => tabPaneEnum[currentTabPaneIndex.value])
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive<any>({
|
||||
id: "",
|
||||
@@ -224,17 +100,17 @@ const dataRules = {
|
||||
promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
packageNum: [{ required: true, message: "内装数不能为空", trigger: "blur" }],
|
||||
|
||||
stock: [{ required: true, message: "总库存不能为空", trigger: "blur" }],
|
||||
inventoryUpperLimit: [{ required: true, message: "库存上限不能为空", trigger: "blur" }],
|
||||
inventoryLowerLimit: [{ required: true, message: "库存下限不能为空", trigger: "blur" }],
|
||||
}
|
||||
const { supermarket_nature, status } = useDict("supermarket_nature", "status")
|
||||
const categoryOptions = ref<any>([]) // 商品分类的下拉选项
|
||||
const brandOptions = ref<any>([]) // 超市品牌的下拉选项
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = async (id: string) => {
|
||||
visible.value = true
|
||||
currentTabPaneIndex.value = 0
|
||||
form.id = ""
|
||||
|
||||
// 重置表单数据
|
||||
resetForm()
|
||||
|
||||
@@ -243,47 +119,35 @@ const openDialog = async (id: string) => {
|
||||
form.id = id
|
||||
await getsupermarketSpuData(id)
|
||||
|
||||
// 设置基础包装单位单选行
|
||||
supermarketUnitEntityListRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase))
|
||||
// 设置基础包装单位的单选行
|
||||
packageUnitRef.value.setRadioRow(form.smErpUnitEntityList.findIndex((item: any) => item.isBase))
|
||||
}
|
||||
|
||||
// 获取分类下拉选项 & 获取品牌下拉选项
|
||||
const [categoryDict, brandDict] = await Promise.allSettled([getSupermarketCategory(), getSupermarketBrand()]).then((results) =>
|
||||
results.map((result) => (result.status === "fulfilled" ? result.value : null)),
|
||||
)
|
||||
|
||||
categoryDict && categoryDict.code === 0 && (categoryOptions.value = categoryDict.data)
|
||||
brandDict && brandDict.code === 0 && (brandOptions.value = brandDict.data)
|
||||
}
|
||||
|
||||
// 初始化表单数据
|
||||
const getsupermarketSpuData = async (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getObj(id).finally(() => (loading.value = false))
|
||||
if (res.code === 0) {
|
||||
res.data.smErpUnitEntityList = res.data.smErpUnitEntityList.map((item: any) => {
|
||||
// 格式化数据
|
||||
item.retailPrice = parseFloat(displayPrice(item.retailPrice, ""))
|
||||
item.promotionPrice = parseFloat(displayPrice(item.promotionPrice, ""))
|
||||
item.purchasePrice = parseFloat(displayPrice(item.purchasePrice, ""))
|
||||
item.costPrice = parseFloat(displayPrice(item.costPrice, ""))
|
||||
res.data.smErpUnitEntityList = res.data.smErpUnitEntityList.map((item: rowVU) => {
|
||||
// 格式化金额数据
|
||||
item.retailPrice = parseFloat(displayPrice(item.retailPrice, "", 2))
|
||||
item.promotionPrice = parseFloat(displayPrice(item.promotionPrice, "", 2))
|
||||
item.purchasePrice = parseFloat(displayPrice(item.purchasePrice, "", 2))
|
||||
item.costPrice = parseFloat(displayPrice(item.costPrice, "", 2))
|
||||
return item
|
||||
})
|
||||
|
||||
Object.assign(form, {
|
||||
...res.data,
|
||||
costPrice: parseFloat(displayPrice(res.data.costPrice, "")),
|
||||
purchasePrice: parseFloat(displayPrice(res.data.purchasePrice, "")),
|
||||
retailPrice: parseFloat(displayPrice(res.data.retailPrice, "")),
|
||||
grossMargin: parseFloat(displayPrice(res.data.grossMargin, "", 2)),
|
||||
})
|
||||
|
||||
console.log("获取的商品详情:", res.data)
|
||||
}
|
||||
} catch (error: any) {
|
||||
loading.value = false
|
||||
useMessage().error(error.msg)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,19 +156,16 @@ const resetForm = () => {
|
||||
dataFormRef.value?.resetFields()
|
||||
form.smErpUnitEntityList = []
|
||||
form.smErpAuxiliaryCodeEntityList = []
|
||||
form.stock = null
|
||||
form.inventoryUpperLimit = null
|
||||
form.inventoryLowerLimit = null
|
||||
}
|
||||
|
||||
// tab栏切换
|
||||
const handleTabChange = (name: TabPaneName) => (currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name))
|
||||
|
||||
// 整理包装单位列表
|
||||
const useHandleUnit = () => {
|
||||
const curRadioRow = supermarketUnitEntityListRef.value.getRadioEvent()
|
||||
return form.smErpUnitEntityList.map((item: any) => {
|
||||
if (item.id === curRadioRow.id) {
|
||||
const usePackageUnitList = () => {
|
||||
const curRadioRowUnit = packageUnitRef.value.getRadioEvent()
|
||||
return form.smErpUnitEntityList.map((item: rowVU) => {
|
||||
if (item.id === curRadioRowUnit.id) {
|
||||
item.isBase = true
|
||||
} else {
|
||||
item.isBase = null
|
||||
@@ -322,10 +183,10 @@ const useHandleUnit = () => {
|
||||
}
|
||||
|
||||
// 整理辅助条码列表
|
||||
const useHandleAuxiliaryCode = () => {
|
||||
return form.smErpAuxiliaryCodeEntityList.map((item: any) => {
|
||||
const barCode = form.smErpUnitEntityList.find((item2: any) => item2.unit === item.unit).barCode
|
||||
item.barCode = barCode
|
||||
const useAuxiliaryCode = () => {
|
||||
return form.smErpAuxiliaryCodeEntityList.map((item: rowVC) => {
|
||||
const barCode = form.smErpUnitEntityList.find((unitItem: any) => unitItem.id === item.unitId)?.barCode
|
||||
if (barCode) item.barCode = barCode
|
||||
if (item.isNew) {
|
||||
item.id = ""
|
||||
delete item.isNew
|
||||
@@ -337,25 +198,39 @@ const useHandleAuxiliaryCode = () => {
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {})
|
||||
if (!valid) return useMessage().warning("基础信息必填项未填写完整")
|
||||
if (!valid) return useMessage().warning("基础信息和库存必填项未填写完整")
|
||||
if (!form.smErpUnitEntityList || form.smErpUnitEntityList.length <= 0) return useMessage().warning("请添加包装单位")
|
||||
if (!(await supermarketUnitEntityListRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整")
|
||||
if (!supermarketUnitEntityListRef.value.getRadioEvent()) return useMessage().warning("请选择基础包装单位")
|
||||
if (!(await supermarketInventoryRef.value.stockValidate())) return useMessage().warning("库存必填项未填写完整")
|
||||
if (!(await packageUnitRef.value.editableTableValidate())) return useMessage().warning("包装单位必填项未填写完整")
|
||||
if (!packageUnitRef.value.getRadioEvent()) return useMessage().warning("请选择基础包装单位")
|
||||
// if (!form.stock || !form.inventoryUpperLimit || !form.inventoryLowerLimit) return useMessage().warning("库存必填项未填写完整")
|
||||
// if (!form.smErpAuxiliaryCodeEntityList || form.smErpAuxiliaryCodeEntityList.length <= 0) return useMessage().warning("请添加辅助条码")
|
||||
// if (!(await supermarketAuxiliaryCodeEntityList.value.editableTableValidate())) return useMessage().warning("辅助条码必填项未填写完整")
|
||||
// if (!(await auxiliaryCodeRef.value.editableTableValidate())) return useMessage().warning("辅助条码必填项未填写完整")
|
||||
|
||||
const handleUnit = useHandleUnit()
|
||||
const handleAuxiliaryCode = useHandleAuxiliaryCode()
|
||||
console.log("提交的数据", { ...form, smErpUnitEntityList: handleUnit, smErpAuxiliaryCodeEntityList: handleAuxiliaryCode })
|
||||
const handlePackageUnit = usePackageUnitList()
|
||||
const handleAuxiliaryCode = useAuxiliaryCode()
|
||||
console.log("提交的数据", {
|
||||
...form,
|
||||
grossMargin: storePrice(form.grossMargin),
|
||||
smErpUnitEntityList: handlePackageUnit,
|
||||
smErpAuxiliaryCodeEntityList: handleAuxiliaryCode,
|
||||
})
|
||||
|
||||
try {
|
||||
loading.value = true
|
||||
const _pa = { ...form, smErpUnitEntityList: handleUnit, smErpAuxiliaryCodeEntityList: handleAuxiliaryCode }
|
||||
form.id ? await putObj(_pa) : await addObj(_pa)
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
const _pa = {
|
||||
...form,
|
||||
grossMargin: storePrice(form.grossMargin),
|
||||
smErpUnitEntityList: handlePackageUnit,
|
||||
smErpAuxiliaryCodeEntityList: handleAuxiliaryCode,
|
||||
}
|
||||
const res = form.id ? await putObj(_pa) : await addObj(_pa)
|
||||
if (res.code === 0) {
|
||||
useMessage().success(form.id ? "修改成功" : "添加成功")
|
||||
visible.value = false
|
||||
emit("refresh")
|
||||
} else {
|
||||
useMessage().error(res.msg ?? "修改失败")
|
||||
}
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg)
|
||||
} finally {
|
||||
@@ -367,3 +242,10 @@ defineExpose({
|
||||
openDialog,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-tab-pane {
|
||||
overflow-y: auto;
|
||||
height: 60vh;
|
||||
}
|
||||
</style>
|
||||
@@ -48,9 +48,16 @@
|
||||
style="float: right"
|
||||
@queryTable="getDataList"
|
||||
/>
|
||||
<el-button plain v-auth="'supermarket_supermarketSpu_export'" class="ml10" icon="upload-filled" type="primary" @click="excelUploadRef.show()">
|
||||
{{ $t("common.importBtn") }}
|
||||
</el-button>
|
||||
<el-button
|
||||
plain
|
||||
v-auth="'supermarket_supermarketSpu_export'"
|
||||
class="ml10"
|
||||
icon="upload-filled"
|
||||
type="primary"
|
||||
@click="excelUploadRef.show()"
|
||||
>
|
||||
{{ $t("common.importBtn") }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table
|
||||
@@ -65,7 +72,7 @@
|
||||
<el-table-column type="selection" width="40" fixed="left" />
|
||||
<el-table-column type="index" label="#" width="50" fixed="left" />
|
||||
<el-table-column prop="productCode" label="货号" show-overflow-tooltip />
|
||||
<!-- <el-table-column prop="barcode" label="自编码/条码" show-overflow-tooltip width="100" />-->
|
||||
<!-- <el-table-column prop="barcode" label="自编码/条码" show-overflow-tooltip width="100" /> -->
|
||||
<el-table-column prop="productName" label="商品名称" show-overflow-tooltip width="100" />
|
||||
<el-table-column prop="unit" label="单位" show-overflow-tooltip />
|
||||
<el-table-column prop="categoryId" label="商品分类" show-overflow-tooltip width="100">
|
||||
@@ -73,11 +80,11 @@
|
||||
{{ supermarketCategory?.find((item: any) => item.id === scope.row.categoryId)?.name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
|
||||
<!-- <el-table-column prop="brandId" label="品牌" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ supermarketBrand?.find((item: any) => item.id === scope.row.brandId)?.name }}
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
</el-table-column> -->
|
||||
<el-table-column prop="picUrl" label="封面图" width="100">
|
||||
<template #default="scope">
|
||||
<preview-image :src="scope.row.picUrl" />
|
||||
@@ -128,12 +135,12 @@
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importErpSpuTip')"
|
||||
url="/supermarket/supermarketSpu/import"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
<upload-excel
|
||||
ref="excelUploadRef"
|
||||
:title="$t('supermarket.importErpSpuTip')"
|
||||
url="/supermarket/supermarketSpu/import"
|
||||
@refreshDataList="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -160,7 +167,6 @@ const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
pageList: fetchList,
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
@@ -174,7 +180,7 @@ const resetQuery = () => {
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile("/supermarket/supermarketSpu/export", Object.assign(state.queryForm, { ids: selectObjs }), "supermarketSpu.xlsx")
|
||||
downBlobFile("/supermarket/supermarketSpu/export", Object.assign(state.queryForm, { ids: selectObjs }), "库存商品.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
|
||||
@@ -86,64 +86,64 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemSupermarketAuxiliaryCode">
|
||||
import { BasicTableProps, useTable } from '/src/hooks/table';
|
||||
import { fetchList, delObjs } from '/src/api/supermarketerp/supermarketUnit';
|
||||
import { useMessage, useMessageBox } from '/src/hooks/message';
|
||||
import { BasicTableProps, useTable } from "/src/hooks/table"
|
||||
import { fetchList, delObjs } from "/src/api/supermarketerp/supermarketUnit"
|
||||
import { useMessage, useMessageBox } from "/src/hooks/message"
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref();
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref();
|
||||
const showSearch = ref(true);
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any;
|
||||
const multiple = ref(true);
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList,
|
||||
});
|
||||
})
|
||||
|
||||
// table hook
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
|
||||
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields();
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = [];
|
||||
getDataList();
|
||||
};
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/supermarket/supermarketUnit/export', Object.assign(state.queryForm, { ids: selectObjs }), 'supermarketUnit.xlsx');
|
||||
};
|
||||
downBlobFile("/supermarket/supermarketUnit/export", Object.assign(state.queryForm, { ids: selectObjs }), "商品包装单位.xlsx")
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
selectObjs.value = objs.map(({ id }) => id)
|
||||
multiple.value = !objs.length
|
||||
}
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
await useMessageBox().confirm("此操作将永久删除")
|
||||
} catch {
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
await delObjs(ids)
|
||||
getDataList()
|
||||
useMessage().success("删除成功")
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
useMessage().error(err.msg)
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user