update 表单细节
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export default {
|
||||
houseTaskPage: ['/houseTask/page', 'post'],
|
||||
houseTaskEdit: ['/houseTask/edit', 'post'],
|
||||
houseTaskSubmit: ['/houseTask/submit', 'post']
|
||||
}
|
||||
@@ -150,6 +150,10 @@ const app = new Vue({
|
||||
*/
|
||||
siderCollapsed: false
|
||||
}
|
||||
},
|
||||
|
||||
transfer: {
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@@ -163,12 +163,15 @@ export default {
|
||||
// await this.onLoadCodes();
|
||||
/** 将默认数据覆盖到form */
|
||||
const record = this.param && this.param.record;
|
||||
const form = this.$_.cloneDeep(defaultForm);
|
||||
|
||||
if (record) {
|
||||
// this.$_.giveDeep(form, record);
|
||||
for (var key in defaultForm.houseInfo) {
|
||||
this.$_.giveDeep(form, record);
|
||||
|
||||
for (var key in form.houseInfo) {
|
||||
const fileValue = [];
|
||||
const fileList = !!record.houseInfo[key] ? record.houseInfo[key].split(',') : [];
|
||||
const fileList =
|
||||
!form.houseInfo[key] || form.houseInfo[key].length == 0 ? [] : form.houseInfo[key].split(',');
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
@@ -180,10 +183,9 @@ export default {
|
||||
status: 'done',
|
||||
});
|
||||
}
|
||||
defaultForm.houseInfo[key] = fileValue;
|
||||
form.houseInfo[key] = fileValue;
|
||||
}
|
||||
}
|
||||
const form = this.$_.cloneDeep(defaultForm);
|
||||
this.form = form;
|
||||
}
|
||||
this.loading = false;
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
<a-col :span="8">
|
||||
<a-form-model-item class="ant-row-flex" label="竣工日期" prop="houseInfo.completedDate">
|
||||
<a-date-picker
|
||||
@change="(date) => $root.transfer.completedYear = date.format('YYYY')"
|
||||
class="w-100-p"
|
||||
placeholder="请选择竣工日期"
|
||||
v-model="form.houseInfo.completedDate"
|
||||
@@ -626,13 +627,6 @@ export default {
|
||||
// 'form.houseInfo.coating'(value) {
|
||||
// this.frame.onTogglePane(value, 'coating');
|
||||
// },
|
||||
'form.houseInfo.completedDate': {
|
||||
handler(newVal, oldVal) {
|
||||
this.$emit('completedDateChanged', newVal.constructor === String ? newVal.substr(0, 4) : newVal.format('YYYY'));
|
||||
},
|
||||
deep: true,
|
||||
immediate: false,
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
@@ -641,6 +635,8 @@ export default {
|
||||
|
||||
beforeDestroy() {
|
||||
if (this.map) this.map.destroy();
|
||||
//组件销毁时,删除竣工日期的全局监听
|
||||
this.$delete(this.$root.transfer, 'completedYear');
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -662,7 +658,11 @@ export default {
|
||||
}
|
||||
|
||||
this.form = form;
|
||||
|
||||
this.$set(
|
||||
this.$root.transfer,
|
||||
'completedYear',
|
||||
!!this.form.houseInfo.completedDate ? this.form.houseInfo.completedDate.substr(0, 4) : ''
|
||||
);
|
||||
this.$nextTick(async () => {
|
||||
await this.onMapInit();
|
||||
if (this.form.houseCode.lng && this.form.houseCode.lat) {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
:is="part.component"
|
||||
:key="index"
|
||||
:param="param"
|
||||
@completedDateChanged="completedDateChanged"
|
||||
ref="forms"
|
||||
v-if="part.component"
|
||||
/>
|
||||
@@ -114,10 +113,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
completedDateChanged(value) {
|
||||
console.log(value);
|
||||
this.$emit('completedDateChanged', value);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -19,7 +19,11 @@
|
||||
<a-row :gutter="16" type="flex">
|
||||
<a-col :span="24">
|
||||
<a-form-model-item class="ant-row-flex" label="初始等级" prop="patrolInfo.initGrade">
|
||||
<a-radio-group button-style="solid" v-model="form.patrolInfo.initGrade">
|
||||
<a-radio-group
|
||||
:disabled="true"
|
||||
button-style="solid"
|
||||
v-model="form.patrolInfo.initGrade"
|
||||
>
|
||||
<a-radio-button
|
||||
:key="item.code"
|
||||
:value="+item.code"
|
||||
@@ -66,7 +70,7 @@ const defaultForm = {
|
||||
};
|
||||
|
||||
export default {
|
||||
props: ['param', 'completedYear'],
|
||||
props: ['param'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -98,13 +102,26 @@ export default {
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
completedYear(value) {
|
||||
'$root.transfer.completedYear'(value) {
|
||||
//初始等级无法手动更改,由房屋详情的竣工日期决定:2000年之后竣工的为一级,1995年~1999年竣工的为二级,1980年~1994年竣工的为三级,早于1980年竣工的为四级。选择房屋竣工日期后,初始等级会自动填充。
|
||||
console.log('patrol-grade:' + value);
|
||||
var year = +value;
|
||||
if (year > 1999) {
|
||||
this.form.patrolInfo.initGrade = 1;
|
||||
}
|
||||
if (year > 1994 && year < 2000) {
|
||||
this.form.patrolInfo.initGrade = 2;
|
||||
}
|
||||
if (year > 1979 && year < 1995) {
|
||||
this.form.patrolInfo.initGrade = 3;
|
||||
}
|
||||
if (year < 1980) {
|
||||
this.form.patrolInfo.initGrade = 4;
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.onFillData();
|
||||
console.log(this.param);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<section :id="`form-${index}-${id}`" :key="index">
|
||||
<h5 v-if="part.title">{{part.title}}</h5>
|
||||
<component
|
||||
:completed-year="completedYear"
|
||||
:frame="frame"
|
||||
:is="part.component"
|
||||
:key="index"
|
||||
@@ -44,7 +43,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['id', 'param', 'frame', 'completedYear'],
|
||||
props: ['id', 'param', 'frame'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -122,6 +122,11 @@ export default {
|
||||
fileFieldArr: ['settlementTiltFiles', 'otherInfoFiles'],
|
||||
};
|
||||
},
|
||||
|
||||
async created() {
|
||||
this.onFillData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* 必要的方法
|
||||
@@ -130,33 +135,19 @@ export default {
|
||||
async onFillData() {
|
||||
this.loading = true;
|
||||
{
|
||||
await this.onLoadCodes();
|
||||
|
||||
// await this.onLoadCodes();
|
||||
/** 将默认数据覆盖到form */
|
||||
const record = this.param && this.param.record;
|
||||
const form = this.$_.cloneDeep(defaultForm);
|
||||
|
||||
if (record) {
|
||||
// this.$_.giveDeep(form, record);
|
||||
// this.fileFieldArr.forEach((key) => {
|
||||
// const fileValue = [];
|
||||
// const fileList = !!record.patrolInfo[key] ? record.patrolInfo[key].split(',') : [];
|
||||
// for (let i = 0; i < fileList.length; i++) {
|
||||
// const file = await PreviewFile(fileList[i]);
|
||||
// const base64 = await BlobToBase64(file);
|
||||
// fileValue.push({
|
||||
// uid: fileList[i],
|
||||
// response: fileList[i], // 用于和新上传的文件一同回传
|
||||
// name: file.name,
|
||||
// url: base64,
|
||||
// status: 'done',
|
||||
// });
|
||||
// }
|
||||
// defaultForm.patrolInfo[key] = fileValue;
|
||||
// });
|
||||
for (var key in defaultForm.patrolInfo) {
|
||||
this.$_.giveDeep(form, record);
|
||||
|
||||
for (var key in form.patrolInfo) {
|
||||
if (key.indexOf('Files') > -1) {
|
||||
const fileValue = [];
|
||||
const fileList = !!record.patrolInfo[key] ? record.patrolInfo[key].split(',') : [];
|
||||
const fileList =
|
||||
!form.patrolInfo[key] || form.patrolInfo[key].length == 0 ? [] : form.patrolInfo[key].split(',');
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
const file = await PreviewFile(fileList[i]);
|
||||
const base64 = await BlobToBase64(file);
|
||||
@@ -168,11 +159,10 @@ export default {
|
||||
status: 'done',
|
||||
});
|
||||
}
|
||||
defaultForm.patrolInfo[key] = fileValue;
|
||||
form.patrolInfo[key] = fileValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
const form = this.$_.cloneDeep(defaultForm);
|
||||
this.form = form;
|
||||
}
|
||||
this.loading = false;
|
||||
|
||||
Reference in New Issue
Block a user