|
@@ -29,7 +29,8 @@
|
|
|
<!-- <number placeholder="其中财政补助资金" v-model="form.czbtzjQt" :min="0" :max="10000000000" :precision="2" /> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="改造住房地址" prop="zfdz">
|
|
|
- <el-input v-model="form.zfdz" placeholder="请输入改造住房地址" clearable></el-input>
|
|
|
+ <!-- <el-input v-model="form.zfdz" placeholder="请输入改造住房地址" clearable></el-input> -->
|
|
|
+ <el-cascader v-model="form.zfdz" :props="props" placeholder="请输入改造住房地址" clearable></el-cascader>
|
|
|
<!-- <RegionCascaderSelect v-model="form.zfdz" style="width: 100%"></RegionCascaderSelect> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item label="详细地址" prop="xxdz">
|
|
@@ -84,30 +85,30 @@
|
|
|
<script setup>
|
|
|
import { getCurrentInstance, reactive, ref } from 'vue'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
-import { retrofitApply } from '@/api/home'
|
|
|
+import { retrofitApply, CountryDeptList } from '@/api/home'
|
|
|
|
|
|
let router = useRouter()
|
|
|
let timer
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
const { CZ035, CH048, CH049 } = proxy.useDict('CZ035', 'CH048', 'CH049')
|
|
|
+
|
|
|
+/* --------表单相关start---------- */
|
|
|
const loading = ref(false)
|
|
|
const formRef = ref()
|
|
|
const showForm = ref(true)
|
|
|
-// 表单数据
|
|
|
const form = reactive({
|
|
|
- // xm: '夏洛',
|
|
|
- // lxdh: '15512341234',
|
|
|
- // isTsknlr: '1',
|
|
|
- // gzzj: '10000',
|
|
|
- // czbtzjQt: '5000',
|
|
|
- // zfdz: '220102001001',
|
|
|
- // xxdz: '详细地址',
|
|
|
+ xm: '夏洛',
|
|
|
+ lxdh: '15512341234',
|
|
|
+ isTsknlr: '1',
|
|
|
+ gzzj: '10000',
|
|
|
+ czbtzjQt: '5000',
|
|
|
+ zfdz: '',
|
|
|
+ xxdz: '详细地址',
|
|
|
// sfdm:'01',
|
|
|
// gznr:'03',
|
|
|
- // tbrXm: '填报人',
|
|
|
- // tbrSjhm: '15512341234',
|
|
|
+ tbrXm: '填报人',
|
|
|
+ tbrSjhm: '15512341234',
|
|
|
})
|
|
|
-// 表单校验
|
|
|
const rules = reactive({
|
|
|
xm: [
|
|
|
{ required: true, message: '改造对象姓名不能为空', trigger: 'blur' },
|
|
@@ -159,22 +160,32 @@ function changeQT(value, value2, value3) {
|
|
|
this.form[value3] = "";
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
function ifQTS(value, value2) {
|
|
|
if (value && value.indexOf(value2) !== -1) {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
async function onSubmit(formEl) {
|
|
|
if (!formEl) return
|
|
|
await formEl.validate((valid, fields) => {
|
|
|
loading.value = true
|
|
|
if (valid) {
|
|
|
- form.gznr = form.gznr.join(',')
|
|
|
- retrofitApply(form).then((res) => {
|
|
|
- console.log(res);
|
|
|
+ let szxzqh = ''
|
|
|
+ if (Array.isArray(form.zfdz)) {
|
|
|
+ szxzqh = form.zfdz[form.zfdz.length - 1]
|
|
|
+ } else {
|
|
|
+ let data = JSON.parse(form.zfdz)
|
|
|
+ szxzqh = data[data.length - 1]
|
|
|
+ }
|
|
|
+ let postData = {
|
|
|
+ ...form,
|
|
|
+ gznr: form.gznr.join(','),
|
|
|
+ zfdz: szxzqh
|
|
|
+ }
|
|
|
+ console.log('postData', postData);
|
|
|
+ retrofitApply(postData).then((res) => {
|
|
|
+ console.log('res', res);
|
|
|
showForm.value = false
|
|
|
timer = setTimeout(() => router.push('/slhgzsq'), 2000)
|
|
|
}).finally(() => {
|
|
@@ -185,7 +196,36 @@ async function onSubmit(formEl) {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+/* --------表单相关end---------- */
|
|
|
|
|
|
+/* --------改造住房地址级联框start---------- */
|
|
|
+const props = {
|
|
|
+ lazy: true,
|
|
|
+ checkStrictly: true,
|
|
|
+ lazyLoad: async (node, resolve) => {
|
|
|
+ const { level } = node
|
|
|
+ let params = level === 0 ? "" : { parentId: node.data.nodeData.id }
|
|
|
+ let response = await CountryDeptList(params)
|
|
|
+ let code = response.code
|
|
|
+ let data = response.data || response.rows
|
|
|
+ if (code !== 200) {
|
|
|
+ this.$message.error("获取行政区划数据失败!")
|
|
|
+ resolve([])
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let res = data.map(item => {
|
|
|
+ let value = String(item["code"])
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value,
|
|
|
+ leaf: level >= 4,
|
|
|
+ nodeData: item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ resolve(res)
|
|
|
+ }
|
|
|
+}
|
|
|
+/* --------改造住房地址级联框end---------- */
|
|
|
</script>
|
|
|
|
|
|
|