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

View File

@@ -1,8 +1,13 @@
export const BUTTON = [ export const BUTTON = [
{
text: "返回",
permission: "receiptWarehousingReceiptOrderAddBtnBack",
type: "back"
},
{ {
text: "提交", text: "提交",
permission: "receiptWarehousingReceiptOrderAddBtnCommit", permission: "receiptWarehousingReceiptOrderAddBtnSubmit",
type: "commit", type: "submit",
props: { props: {
type: "primary" 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: "导出", text: "导出",
permission: "inspectionManagementReportBtnExport", permission: "receiptWarehousingReceiptOrderBtnExport",
type: "export" type: "export"
}, },
{ {
text: "刷新", text: "刷新",
permission: "inspectionManagementReportBtnRefresh", permission: "receiptWarehousingReceiptOrderBtnRefresh",
type: "refresh" type: "refresh"
} }
]; ];

View File

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

View File

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