提交申请增加动态省市区

This commit is contained in:
wlikett 2023-12-08 17:49:22 +08:00
parent 0e42dbf6c1
commit 0300adf7d0
1 changed files with 35 additions and 22 deletions

View File

@ -248,18 +248,16 @@
import ShowImg from './comoonents/showImg.vue'
import {reactive, ref} from 'vue'
import EquipCard from 'components/equipCard.vue'
import {getDetail,getHotList,equipCollect,apiSubmitLease} from "@/http/api/equip"
import {getDetail,getHotList,equipCollect,apiSubmitLease,apiGetAddressList} from "@/http/api/equip"
import {useRoute, useRouter} from "vue-router";
import Navmenu from '@/components/Navmenu/index.vue'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import equipDetailTable from '@/components/equipDetailTable.vue'
import {ElMessage} from "element-plus";
import address from "@/assets/temporaryAddress.json"
const router = useRouter()
const route = useRoute()
const addressData = reactive(address)
const pageParams = route.params
//
@ -399,7 +397,7 @@ const ruleForm = ref({
entryTime: '',//
duration: '',//
machinist: 0,//
invoiceType: 0,//
invoiceType: '',//
projectDescription: ''//
})
const rules = reactive({
@ -462,30 +460,44 @@ const that = {
openPdf
}
const addressCascader = {
lazy:true,
label:'name',
value:'id',
lazyLoad(node,resolve){
const { level } = node
setTimeout(() => {
let nodes = []
if(level == 0){
nodes = addressData.province
}else if(level == 1){
nodes = addressData.city
}else if(level == 2){
nodes = addressData.county.map((item) => ({
...item,
leaf:true
}))
}
resolve(nodes)
},1000)
lazyLoad: async (node,resolve) =>{
const { level,data } = node
let nodes = []
if(level == 0){
const arr = await getAddressData()
nodes = arr
}else if(level == 1){
const arr = await getAddressData(data.code)
nodes = arr
}else if(level == 2){
const arr = await getAddressData(data.code)
nodes = arr.map((item) => ({
...item,
leaf:true
}))
}
resolve(nodes)
}
}
//
const getAddressData = async (code = '') => {
let params = {}
if(code){
params = { code }
}
const res = await apiGetAddressList(params)
return res.data || []
}
const handelDetailListClick = (fnName, arg) => {
if (fnName) {
that[fnName](arg)
@ -529,7 +541,7 @@ const submit = async() => {
realStartTime: ruleForm.value.entryTime,
duration: ruleForm.value.duration,
isMachinist: ruleForm.value.machinist,
invoiceType: -1,
invoiceType: ruleForm.value.invoiceType,
description: ruleForm.value.projectDescription
}
@ -554,6 +566,7 @@ init()
<style scoped lang="scss">
:deep(.dialoglease){
margin: 10px auto 0 !important;
min-width: 855px !important;
}
:deep(.el-form-item){