Commit 9e016cfd by wusiyi

feat: 打开弹窗实时更新下拉数据 #1012529

parent 551fb03e
...@@ -259,7 +259,13 @@ import type { ...@@ -259,7 +259,13 @@ import type {
SortingRuleCondition, SortingRuleCondition,
SortingRuleDetail, SortingRuleDetail,
} from '@/types/api/order' } from '@/types/api/order'
import { getAreaListApi, addAreaApi, editAreaApi } from '@/api/order' import {
getAreaListApi,
addAreaApi,
editAreaApi,
getSortingUserListApi,
getCategoryListApi,
} from '@/api/order'
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
...@@ -268,10 +274,8 @@ const props = defineProps<{ ...@@ -268,10 +274,8 @@ const props = defineProps<{
warehouseId: number warehouseId: number
warehouseName: string warehouseName: string
isDisabled?: boolean isDisabled?: boolean
categoryList: OperatorList[]
pickingRuleList: OperatorList[] pickingRuleList: OperatorList[]
operatorList: OperatorList[] operatorList: OperatorList[]
sortingUserList: OperatorList[]
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'update:modelValue', value: boolean): void (e: 'update:modelValue', value: boolean): void
...@@ -289,6 +293,8 @@ const visible = computed({ ...@@ -289,6 +293,8 @@ const visible = computed({
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const areaList = ref<OperatorList[]>([]) const areaList = ref<OperatorList[]>([])
const sortingUserList = ref<OperatorList[]>([])
const categoryList = ref<OperatorList[]>([])
const form = ref<SortingRuleDetail>({ const form = ref<SortingRuleDetail>({
areaDesc: '', areaDesc: '',
areaCode: '', areaCode: '',
...@@ -475,6 +481,20 @@ const loadAreaList = async () => { ...@@ -475,6 +481,20 @@ const loadAreaList = async () => {
} }
} }
// 获取所属客户列表
const getSortingUserList = async () => {
const res = await getSortingUserListApi()
if (res.code !== 200) return
sortingUserList.value = res.data
}
// 获取商品类目
const getCategoryList = async () => {
const res = await getCategoryListApi()
if (res.code !== 200) return
categoryList.value = res.data
}
// 提交 // 提交
const handleSubmit = async () => { const handleSubmit = async () => {
form.value.warehouseId = props.warehouseId form.value.warehouseId = props.warehouseId
...@@ -508,7 +528,7 @@ const handleSubmit = async () => { ...@@ -508,7 +528,7 @@ const handleSubmit = async () => {
} }
onMounted(async () => { onMounted(async () => {
await loadAreaList() await Promise.all([loadAreaList(), getSortingUserList(), getCategoryList()])
if (props.editData) { if (props.editData) {
form.value = { form.value = {
...props.editData, ...props.editData,
......
...@@ -134,10 +134,8 @@ ...@@ -134,10 +134,8 @@
:edit-data="editData" :edit-data="editData"
:warehouse-id="searchForm.warehouseId" :warehouse-id="searchForm.warehouseId"
:warehouse-name="searchForm.warehouseName" :warehouse-name="searchForm.warehouseName"
:category-list="categoryList"
:picking-rule-list="pickingRuleList" :picking-rule-list="pickingRuleList"
:operator-list="operatorList" :operator-list="operatorList"
:sorting-user-list="sortingUserList"
@submit="getSortingRuleList" @submit="getSortingRuleList"
/> />
<el-dialog <el-dialog
...@@ -172,7 +170,6 @@ import { ...@@ -172,7 +170,6 @@ import {
getCategoryListApi, getCategoryListApi,
getConditionTypeListApi, getConditionTypeListApi,
getOperatorListApi, getOperatorListApi,
getSortingUserListApi,
} from '@/api/order' } from '@/api/order'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import LogList from '@/components/LogList.vue' import LogList from '@/components/LogList.vue'
...@@ -245,7 +242,6 @@ const sortingList = ref<SortingList[]>([]) // 规则列表 ...@@ -245,7 +242,6 @@ const sortingList = ref<SortingList[]>([]) // 规则列表
const categoryList = ref<OperatorList[]>([]) // 商品类目 const categoryList = ref<OperatorList[]>([]) // 商品类目
const pickingRuleList = ref<OperatorList[]>([]) // 配货规则条件 const pickingRuleList = ref<OperatorList[]>([]) // 配货规则条件
const operatorList = ref<OperatorList[]>([]) // 配货规则操作符 const operatorList = ref<OperatorList[]>([]) // 配货规则操作符
const sortingUserList = ref<OperatorList[]>([]) // 所属客户列表
const isEnableSorting = ref(false) // 是否开启配货分拣 const isEnableSorting = ref(false) // 是否开启配货分拣
const currentId = ref(0) // 当前操作id const currentId = ref(0) // 当前操作id
const isEdit = ref(false) // 是否编辑 const isEdit = ref(false) // 是否编辑
...@@ -413,13 +409,6 @@ const loadWarehouseList = async () => { ...@@ -413,13 +409,6 @@ const loadWarehouseList = async () => {
} }
} }
// 获取所属客户列表
const getSortingUserList = async () => {
const res = await getSortingUserListApi()
if (res.code !== 200) return
sortingUserList.value = res.data
}
const handleWarehouseChange = (warehouseId: number) => { const handleWarehouseChange = (warehouseId: number) => {
searchForm.value.warehouseId = warehouseId searchForm.value.warehouseId = warehouseId
if (!isEnableSorting.value) return if (!isEnableSorting.value) return
...@@ -462,12 +451,18 @@ const updateConfig = async () => { ...@@ -462,12 +451,18 @@ const updateConfig = async () => {
// 查询列表 // 查询列表
const getSortingRuleList = async () => { const getSortingRuleList = async () => {
loading.value = true loading.value = true
const res = await getSortingRuleListApi({ try {
warehouseId: searchForm.value.warehouseId, const [, res] = await Promise.all([
}) getCategoryList(),
if (res.code !== 200) return getSortingRuleListApi({
sortingList.value = res.data.records warehouseId: searchForm.value.warehouseId,
loading.value = false }),
])
if (res.code !== 200) return
sortingList.value = res.data.records
} finally {
loading.value = false
}
} }
// 新增/编辑 // 新增/编辑
...@@ -525,13 +520,10 @@ onMounted(async () => { ...@@ -525,13 +520,10 @@ onMounted(async () => {
await Promise.all([ await Promise.all([
loadWarehouseList(), loadWarehouseList(),
getFunctionSwitch(), getFunctionSwitch(),
getCategoryList(),
getConditionTypeList(), getConditionTypeList(),
getOperatorList(), getOperatorList(),
getSortingUserList(),
]) ])
await getSortingRuleList() await getSortingRuleList()
loading.value = false
}) })
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment