fix: 🧩 修复bug

This commit is contained in:
2025-11-18 16:38:07 +08:00
parent e908048997
commit f4274d2fb3
6 changed files with 67 additions and 45 deletions

View File

@@ -39,6 +39,7 @@ const dataStore = reactive<any>({
labelWidth: "120px",
formData: cloneDeep(DETAILS_FORM_DATA),
ruleForm: cloneDeep(DETAILS_RULE_FORM),
compareRuleForm: {},
id: null,
title: ""
});
@@ -68,6 +69,8 @@ const getGoodsUp = async () => {
if (result?.code === 0) {
useMsg("success", "更新成功 ");
$Bus.emit("setGoodsResetList");
//更新成功以后调用详情接口是为了刷新对比数据防止对比数据不一致
getGoodsDetails();
}
};
//详情
@@ -80,6 +83,7 @@ const getGoodsDetails = async () => {
const result = await getGoodsDetailsApi(dataStore.id);
if (result?.code === 0) {
dataStore.ruleForm = result?.data;
dataStore.compareRuleForm = cloneDeep(result?.data);
}
};
getGoodsDetails();
@@ -110,10 +114,26 @@ const handleButtonClickCallback = (item: any) => {
dataStore.title === "新增仓位找货优先级" ? handleAdd() : getGoodsUp();
}
if (type === "preview") {
if (!dataStore.id) {
if (!dataStore.id && dataStore.title === "新增仓位找货优先级") {
useMsg("warning", "请先保存数据 !");
return;
}
// 编辑的话需要判断用户是否有修改
if (dataStore.title === "编辑仓位找货优先级") {
if (dataStore.compareRuleForm.use_org_number !== dataStore.ruleForm.use_org_number) {
useMsg("warning", "请先保存数据 !");
return;
}
if (dataStore.compareRuleForm.warehouse_number !== dataStore.ruleForm.warehouse_number) {
useMsg("warning", "请先保存数据 !");
return;
}
if (dataStore.compareRuleForm.pos_picking_priority !== dataStore.ruleForm.pos_picking_priority) {
useMsg("warning", "请先保存数据 !");
return;
}
}
$router.push({
path: "/foundation/set/goods/preview",
query: { id: dataStore.id, name: dataStore.title }

View File

@@ -1,8 +1,13 @@
export const BUTTON = [
{
text: "返回",
permission: "receiptWarehousingReceiptOrderAddBtnBack",
type: "back"
},
{
text: "提交",
permission: "receiptWarehousingReceiptOrderAddBtnCommit",
type: "commit",
permission: "receiptWarehousingReceiptOrderAddBtnSubmit",
type: "submit",
props: {
type: "primary"
}

View File

@@ -0,0 +1,7 @@
export const BUTTON = [
{
text: "返回",
permission: "receiptWarehousingReceiptOrderDetailsBtnBack",
type: "back"
}
];

View File

@@ -19,12 +19,12 @@ export const BUTTON = [
},
{
text: "导出",
permission: "inspectionManagementReportBtnExport",
permission: "receiptWarehousingReceiptOrderBtnExport",
type: "export"
},
{
text: "刷新",
permission: "inspectionManagementReportBtnRefresh",
permission: "receiptWarehousingReceiptOrderBtnRefresh",
type: "refresh"
}
];

View File

@@ -9,14 +9,20 @@
</div>
<ProTable
ref="proTable"
:formData="dataStore.formData"
ref="proTableRef"
:columns="dataStore.columns"
:request-api="getMaterialListApi"
:init-param="dataStore.initParam"
@selectionChange="selectionChange"
:orgCode="dataStore.ruleForm.orgCode"
>
<template v-slot:search>
<SearchForm
@search="handleSearch"
@reset="handleReset"
:searchParams="dataStore.initParam"
:formData="dataStore.formData"
/>
</template>
<template #boxBillNo="scope">
<a @click="handleOpen(scope.row)" class="break-word to-details">
{{ scope.row.boxBillNo }}
@@ -28,7 +34,6 @@
<script setup lang="ts" name="inspectionManagementReport">
import ProTable from "@/components/ProTable/index.vue";
// import { useMsg } from "@/hooks/useMsg";
import PermissionButton from "@/components/PermissionButton/index.vue";
import { getMaterialListApi } from "@/api/modules/foundationMaterial";
@@ -37,16 +42,14 @@ import { useRouter } from "vue-router";
import { RULE_FORM, FORM_DATA, COLUMNS, BUTTON } from "./constant/list/index";
//表格TS
import { ProTableInstance } from "@/components/ProTable/interface";
import { useUserStore } from "@/stores/modules/user";
import { btnClick } from "./init";
//深拷贝方法
import { cloneDeep } from "lodash-es";
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
const proTable = ref<ProTableInstance>();
const proTableRef = ref<ProTableInstance>();
const $router = useRouter();
// 获取用户信息(组织id)
const userStore = useUserStore();
// 数据源
const dataStore = reactive<any>({
columns: COLUMNS, //列表配置项
@@ -67,39 +70,26 @@ const handleButtonClickCallback = (item: any) => {
const { type } = item;
btnClick[type](item, $router);
};
// // 规格型号
// const remoteMethod1 = async (query: any) => {
// datas.loading = true;
// if (!query) {
// datas.loading = false;
// return;
// }
// let valClone = query.replace(/^\s*|\s*$/g, "");
// if (!valClone.length) {
// datas.loading = false;
// return;
// }
// const result = await getMaterialListApi(valClone);
// if (result.status === 200) {
// const { data } = result;
// datas.options = data;
// }
// datas.loading = false;
// };
//搜索
const handleSearch = async (params: any) => {
dataStore.initParam = cloneDeep(params);
//这里需要等到表格刷新以后才去请求
nextTick(() => {
proTableRef?.value!.getTableList();
});
};
//重置
const handleReset = () => {
dataStore.initParam = cloneDeep(RULE_FORM);
// init();
//这里需要等到表格刷新以后才去请求
nextTick(() => {
proTableRef?.value!.getTableList();
});
};
const handleOpen = (row: any) => {
console.log(row);
};
watch(
() => userStore.orgCode,
newVal => {
dataStore.ruleForm.orgCode = newVal;
dataStore.initParam.orgCode = newVal;
},
{
immediate: true,
deep: true
}
);
</script>
<style scope lang="scss">

View File

@@ -1,7 +1,7 @@
export const BUTTON = [
{
text: "重传",
permission: "receiptWarehousingWarehousingOrderBtnRetransmission",
permission: "receiptWarehousingWarehousingOrderBtnCC",
type: "retransmission",
props: {
type: "primary"
@@ -14,7 +14,7 @@ export const BUTTON = [
},
{
text: "同步成功",
permission: "receiptWarehousingWarehousingOrderBtnSynchronize",
permission: "receiptWarehousingWarehousingOrderBtnTB",
type: "synchronize"
}
];