Commit 6c2932a0 by linjinhong

发货地址添加暂无提示

parent 3fa77032
......@@ -35,6 +35,7 @@ declare module 'vue' {
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElOptionGroup: typeof import('element-plus/es')['ElOptionGroup']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
......
......@@ -295,6 +295,10 @@ export function getLogisticsCustomsRuleList(params: {
)
}
//物流方式列表
export function usableAllList() {
return axios.get<never, BaseRespData<never>>('/logisticsWay/usableAllList')
}
//新增
export function addLogisticsCustomsRule(params: AddDeclarationRuleObj) {
return axios.post<never, BaseRespData<never>>(
......
......@@ -86,7 +86,9 @@ export default defineComponent({
watch(
() => props.config,
(val) => {
tableConfig.value = val
console.log(89, val)
tableConfig.value = val.filter((item) => !item.isIncludeProp)
},
{ immediate: true, deep: true },
)
......@@ -127,7 +129,11 @@ export default defineComponent({
// 表单验证方法
const clearValidate = async (clearFields?: string[]) => {
if (!formRef.value) return false
return await formRef.value.clearValidate(clearFields)
if (clearFields) {
return await formRef.value?.clearValidate(clearFields)
} else {
return await formRef.value?.clearValidate()
}
}
// 重置表单
......@@ -148,11 +154,9 @@ export default defineComponent({
.filter((item) => !item.fixed)
.concat(tableConfig.value.filter((item) => item.fixed))
} else {
tableConfig.value = [
...props.config.filter((item) => !item.isIncludeProp),
]
console.log(tableConfig.value)
tableConfig.value = props.config.filter((item) => !item.isIncludeProp)
}
console.log(154, tableConfig.value)
}
return {
......
......@@ -71,16 +71,23 @@ const allOption = {
value: '',
label: '全部',
}
const fields = reactive({})
const fields = reactive({
value: props.value,
label: props.label,
})
watch(
[() => props.value, () => props.label],
(val) => {
console.log('modelValue', val)
fields['value'] = val[0]
fields['label'] = val[1]
},
{ immediate: true },
)
// 选项处理
const getOptions = computed(() => {
const value = props.labelIsValue ? fields.label : fields.value
const arr = cloneDeep(props.options)
const data = arr.map((item) => {
!item.value && (item.value = eval(`item.${value}`))
!item.label && (item.label = eval(`item.${fields.label}`))
......@@ -91,6 +98,7 @@ const getOptions = computed(() => {
data.unshift(allOption)
return data
}
return data
})
......
import { defineComponent, ref } from 'vue'
import {
ElPopover,
ElScrollbar,
ElCheckbox,
ElCheckboxGroup,
ElInput,
} from 'element-plus'
import { usableAllList } from '@/api/logistics'
const styles = {
searchForm: {
position: 'relative',
},
titleBox: {
display: 'flex',
padding: '10px',
justifyContent: 'space-between',
alignItems: 'center',
},
checkboxGroup: {
display: 'flex',
padding: '10px',
justifyContent: 'space-between',
backgroundColor: '#efefef',
},
} as const
export default defineComponent({
name: 'CustomizeForm',
props: {
modelValue: {
type: Array as PropType<(string | number)[]>,
default: () => [],
},
},
emits: ['update:modelValue', 'validate'],
setup() {
const companySelectStatus = ref([])
const companyList = ref([{ name: '1', items: [{ name: '1', id: '1' }] }])
const selectedList = ref<(string | number)[]>([])
const logisticsWayId = ref([])
function setCheckAll() {}
async function getAllList() {
try {
const res = await Promise.allSettled([usableAllList()])
res.forEach(
(
item: PromiseSettledResult<{ code: number; data: never[] }>,
index,
) => {
if (item?.status === 'fulfilled') {
if (item.value.code === 200) {
if (index == 0) {
logisticsWayId.value = [...(item.value.data || [])]
}
}
}
},
)
console.log(59, logisticsWayId.value)
} catch (error) {
console.log(error)
}
}
onMounted(() => {
getAllList()
})
return () => (
<ElPopover
width="650px"
placement="bottom-start"
trigger="click"
popper-style={{ padding: 0 }}
v-slots={{
reference: () => (
<ElInput style={{ width: '100%' }} placeholder="请选择物流方式" />
),
}}
>
<ElScrollbar class="scroll-container" maxHeight="450px">
{companyList.value.map((company, index) => (
<div class="companyBox" key={index}>
<div style={styles.titleBox}>
<div class="title">{company.name}</div>
<ElCheckbox
modelValue={companySelectStatus.value[index]}
onChange={() => setCheckAll()}
class="selectAll"
>
全选
</ElCheckbox>
</div>
<ElCheckboxGroup
modelValue={selectedList.value}
onUpdate:modelValue={(value) => (selectedList.value = value)}
style={styles.checkboxGroup}
>
{company.items.map((item) => (
<ElCheckbox
label={item.name}
value={item.id}
key={`item-${item.id}`}
class="checkboxItem"
/>
))}
</ElCheckboxGroup>
</div>
))}
</ElScrollbar>
</ElPopover>
)
},
})
......@@ -90,7 +90,7 @@ import { debounce } from 'lodash-es'
import { AddDeclarationRuleObj } from './types/declarationRule'
import { Edit, Delete, List } from '@element-plus/icons-vue'
import { ISeachFormConfig } from '@/types/searchType'
import LogisticsWaySelect from './components/LogisticsWaySelect.tsx'
const [searchForm] = useValue({})
const [editForm, resetEditForm] = useValue<AddDeclarationRuleObj>({
type: 1,
......@@ -141,7 +141,7 @@ const mapData = ref(
]),
)
const formConfig = ref<IFormConfig[]>([
const formConfig = computed<IFormConfig[]>(() => [
{
prop: 'name',
type: 'input',
......@@ -172,6 +172,21 @@ const formConfig = ref<IFormConfig[]>([
],
},
{
prop: 'logisticsWay',
type: 'select',
label: '物流方式',
render: () => {
return <LogisticsWaySelect></LogisticsWaySelect>
},
rules: [
{
required: true,
message: '请选择物流方式',
},
],
},
{
prop: 'type',
type: 'select',
label: '申报类型',
......@@ -590,6 +605,32 @@ async function showLog(row: AddDeclarationRuleObj) {
console.log(error)
}
}
onMounted(() => {
// getAllList()
})
/**
* @description: 获取物流方式列表
*/
// const logisticsWayId = ref([])
// async function getAllList() {
// try {
// const res = await Promise.allSettled([usableAllList()])
// res.forEach(
// (item: PromiseSettledResult<{ code: number; data: never[] }>, index) => {
// if (item?.status === 'fulfilled') {
// if (item.value.code === 200) {
// if (index == 0) {
// logisticsWayId.value = [...(item.value.data || [])]
// }
// }
// }
// },
// )
// } catch (error) {
// console.log(error)
// }
// }
</script>
<style lang="scss" scoped>
......
......@@ -219,14 +219,14 @@ const formConfig = computed<IFormConfig[]>(() => [
name: string
id: string | number
}) => {
console.log(222, value)
editForm.value.company = value.name
if (value.code === 'UINUIN') {
editFormRef.value?.refashConfig(['uinuinWarehouseId'])
editFormRef.value?.clearValidate()
} else {
editFormRef.value?.refashConfig([])
editFormRef.value?.clearValidate(['uinuinWarehouseId'])
editForm.value.uinuinWarehouseId = undefined
editFormRef.value?.clearValidate()
editForm.value.uinuinWarehouseId = null
}
},
},
......@@ -599,6 +599,11 @@ async function editWay(item: LogisticsMethod) {
console.log(493, editForm.value)
dialogVisible.value = true
if (item.uinuinWarehouseId) {
nextTick(() => {
editFormRef.value?.refashConfig(['uinuinWarehouseId'])
})
}
} catch (e) {
console.log(e)
}
......@@ -668,9 +673,9 @@ const save = debounce(async () => {
*/
function addDialog() {
dialogVisible.value = true
nextTick(() => {
editFormRef.value?.refashConfig([])
})
// nextTick(() => {
// editFormRef.value?.refashConfig()
// })
}
/**
......@@ -751,6 +756,8 @@ async function getAllList() {
if (index == 0) {
warehouseList.value = item.value.data || []
} else if (index == 1) {
console.log(758, item.value.data)
ruleNameList.value = item.value.data || []
} else if (index == 2) {
platformList.value = item.value.data || []
......
......@@ -121,6 +121,11 @@
</div>
</div>
</el-col>
<el-col :span="24" v-if="tableData.length === 0">
<div class="empty-box">
<el-empty description="暂无发货地址" />
</div>
</el-col>
</el-row>
</div>
<ElPagination
......
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