feat: 🚀 修复bug

This commit is contained in:
2025-10-17 16:38:54 +08:00
parent 7efeb8faf0
commit c913152460
7 changed files with 100 additions and 26 deletions

View File

@@ -13,6 +13,7 @@
:labelWidth="dataStore.labelWidth"
@selectMultipleRemoveTag="handleSelectMultipleRemoveTag"
:inline="true"
ref="detailsRef"
/>
</div>
</div>
@@ -29,7 +30,7 @@ import { useMsg } from "@/hooks/useMsg";
import { BUTTON } from "./constant/add/button";
import { useUserStore } from "@/stores/modules/user";
import { cloneDeep } from "lodash-es";
import $Bus from "@/utils/mittBus";
const dataStore = reactive({
formData: cloneDeep(FORM_DATA),
ruleForm: cloneDeep(RULE_FORM),
@@ -42,9 +43,9 @@ const dataStore = reactive({
const userStore = useUserStore();
const $route = useRoute();
const $router = useRouter();
const detailsRef = ref<any>(null);
dataStore.formData[0].options = userStore.orgIdArr;
const init = () => {
//$route.query.title === "新增订阅" ? org_number: ["101"],
if ($route.query.title === "新增订阅") {
dataStore.ruleForm.org_number = ["101"];
}
@@ -65,12 +66,20 @@ const handleAdd = () => {
})
.then(async () => {
dataStore.ruleForm = cloneDeep(RULE_FORM);
dataStore.ruleForm.org_number = ["101"];
dataStore.isAdd = true;
detailsRef?.value?.formElement?.resetFields();
})
.catch(() => {});
}
};
const handleGoList = () => {
detailsRef?.value?.formElement?.resetFields();
setTimeout(() => {
$router.replace({ path: "/foundation/subscribe/list/index" });
$Bus.emit("setResetList");
}, 300);
};
//添加
const getSubscribeAdd = async (params: any) => {
console.log(params);
@@ -78,10 +87,7 @@ const getSubscribeAdd = async (params: any) => {
if (result?.code === 0) {
useMsg("success", "新增成功 ");
dataStore.ruleForm = cloneDeep(RULE_FORM);
init();
setTimeout(() => {
$router.replace({ path: "/foundation/subscribe/list/index" });
}, 300);
dataStore.ruleForm.org_number = ["101"];
}
};
//更新
@@ -89,6 +95,7 @@ const getSubscribeUpdate = async (params: any) => {
const result = await getSubscribeUpdateApi($route.query.id, params);
if (result?.code === 0) {
useMsg("success", "更新成功 ");
handleGoList();
}
};

View File

@@ -23,7 +23,7 @@ export const FORM_DATA: any[] = [
{
prop: "customer_number",
placeholder: "请输入",
type: "input",
type: "textarea",
label: "客户编码:",
disabled: true,
required: true,

View File

@@ -35,6 +35,7 @@
</template>
<script setup lang="ts" name="foundationSubscribeList">
import { onMounted } from "vue";
import SearchForm from "@/components/SearchForm/index.vue";
import ProTable from "@/components/ProTable/index.vue";
import PermissionButton from "@/components/PermissionButton/index.vue";
@@ -46,7 +47,7 @@ import { ProTableInstance } from "@/components/ProTable/interface";
import { btnClick } from "./init";
import { useRouter } from "vue-router";
import { useUserStore } from "@/stores/modules/user";
import $Bus from "@/utils/mittBus";
//深拷贝方法
import { cloneDeep } from "lodash-es";
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数)
@@ -162,6 +163,13 @@ watch(
deep: true
}
);
onMounted(() => {
$Bus.on("setResetList", () => {
nextTick(() => {
proTableRef?.value!.getTableList();
});
});
});
</script>
<style scope lang="scss">

View File

@@ -1,9 +1,13 @@
import { useMsg } from "@/hooks/useMsg";
import { getSubscribeResetListApi, getSubscribeResetListExportApi } from "@/api/modules/warehousing";
import { cloneDeep } from "lodash-es";
// 导出
export const handleExport = async (params: any) => {
const { initParam } = params;
const result = await getSubscribeResetListExportApi(initParam);
export const handleExport = async (data: any) => {
const { initParam } = data;
let params = cloneDeep(initParam);
params.org_number =
Array.isArray(params?.org_number) && params?.org_number?.length ? params.org_number.join(",") : params.org_number;
const result = await getSubscribeResetListExportApi(params);
if (result?.code === 0) {
useMsg("success", "导出成功 ");
}