update 建档登记页面完善

This commit is contained in:
2021-06-04 17:57:54 +08:00
parent 4c34153d93
commit a15512892c
22 changed files with 1352 additions and 524 deletions

View File

@@ -392,7 +392,7 @@ namespace Ewide.Application
/// 房屋等级 1,2,3,4,C,d
/// </summary>
[Comment("房屋等级 1,2,3,4,C,d")]
public int? HouseLevel { get; set; }
public int? HouseGrade { get; set; }
/// <summary>
/// 房屋使用状态

View File

@@ -62,19 +62,19 @@ namespace Ewide.Application
/// 初始等级
/// </summary>
[Comment("初始等级")]
public int? InitLevel { get; set; }
public int? InitGrade { get; set; }
/// <summary>
/// 损坏等级
/// </summary>
[Comment("损坏等级")]
public int? DamageLevel { get; set; }
public int? DamageGrade { get; set; }
/// <summary>
/// 综合等级
/// </summary>
[Comment("综合等级")]
public int? ComprehensiveLevel { get; set; }
public int? ComprehensiveGrade { get; set; }
/// <summary>
/// 主要安全隐患综述

View File

@@ -294,7 +294,7 @@
外立面照片
</summary>
</member>
<member name="P:Ewide.Application.BsHouseInfo.HouseLevel">
<member name="P:Ewide.Application.BsHouseInfo.HouseGrade">
<summary>
房屋等级 1,2,3,4,C,d
</summary>
@@ -394,17 +394,17 @@
其他情况附件
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTask.InitLevel">
<member name="P:Ewide.Application.BsHouseTask.InitGrade">
<summary>
初始等级
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTask.DamageLevel">
<member name="P:Ewide.Application.BsHouseTask.DamageGrade">
<summary>
损坏等级
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTask.ComprehensiveLevel">
<member name="P:Ewide.Application.BsHouseTask.ComprehensiveGrade">
<summary>
综合等级
</summary>
@@ -915,7 +915,7 @@
其他调查内容
</summary>
</member>
<member name="P:Ewide.Application.HouseInfoInput.HouseLevel">
<member name="P:Ewide.Application.HouseInfoInput.HouseGrade">
<summary>
房屋等级 1,2,3,4,C,d
</summary>
@@ -1136,12 +1136,12 @@
其他调查内容
</summary>
</member>
<member name="P:Ewide.Application.HouseInfoOutput.HouseLevel">
<member name="P:Ewide.Application.HouseInfoOutput.HouseGrade">
<summary>
房屋等级 1,2,3,4,C,d
</summary>
</member>
<member name="P:Ewide.Application.HouseInfoOutput.UsedStatus">
<member name="P:Ewide.Application.HouseInfoOutput.HouseUsedStatus">
<summary>
房屋使用状态
</summary>
@@ -1286,5 +1286,100 @@
上报备注
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.SettlementTilt">
<summary>
沉降倾斜
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.SettlementTiltFiles">
<summary>
沉降倾斜附件
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.OtherInfo">
<summary>
其他情况
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.OtherInfoFiles">
<summary>
其他情况附件
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.InitGrade">
<summary>
初始等级
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.DamageGrade">
<summary>
损坏等级
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ComprehensiveGrade">
<summary>
综合等级
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.MainSafety">
<summary>
主要安全隐患综述
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.HandlingOpinion">
<summary>
处理意见
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.HandlingOpinionRemark">
<summary>
处理意见备注
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.RectifyAndReform">
<summary>
整改情况
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.RectifyAndReformRemark">
<summary>
整改情况备注
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.PatrolResult">
<summary>
巡查结果1正常,-1异常
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.PatrolResultRemark">
<summary>
巡查异常描述
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ReportRoad">
<summary>
上报街道
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ReportRoadTime">
<summary>
上报街道时间
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ReportArea">
<summary>
上报区住建
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ReportAreaTime">
<summary>
上报区住建时间
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskOutput.ReportRemark">
<summary>
上报备注
</summary>
</member>
</members>
</doc>

View File

@@ -189,7 +189,7 @@ namespace Ewide.Application
/// <summary>
/// 房屋等级 1,2,3,4,C,d
/// </summary>
public int? HouseLevel { get; set; }
public int? HouseGrade { get; set; }
/// <summary>
/// 房屋使用状态

View File

@@ -189,12 +189,12 @@ namespace Ewide.Application
/// <summary>
/// 房屋等级 1,2,3,4,C,d
/// </summary>
public int? HouseLevel { get; set; }
public int? HouseGrade { get; set; }
/// <summary>
/// 房屋使用状态
/// </summary>
public int? UsedStatus { get; set; }
public int? HouseUsedStatus { get; set; }
#endregion
#region drawing
@@ -275,10 +275,10 @@ namespace Ewide.Application
public class HouseInfoOutputForDetailPage
{
#region header
public HouseCodeOutput houseCode { get; set; }
public HouseCodeOutput HouseCode { get; set; }
#endregion
public HouseInfoOutput houseInfo { get; set; }
public HouseInfoOutput HouseInfo { get; set; }
public HouseTaskOutput PatrolInfo { get; set; }
}
}

View File

@@ -81,8 +81,9 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
//获取房屋编码信息
var houseCodeOutputAsync = await _dapperRepository.QueryAsync<HouseCodeOutput>(
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No FROM bs_house_code HC
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No FROM bs_house_code HC
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
LEFT JOIN sys_org O ON HC.ZoneId = O.Id
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
@@ -98,7 +99,7 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
var houseInfo = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == houseTask.HouseCodeId);
var houseInfoOutputForDetailPage = new HouseInfoOutputForDetailPage
{
houseCode = houseCodeOutput
HouseCode = houseCodeOutput
};
houseInfoOutputForDetailPage.PatrolInfo = new HouseTaskOutput
@@ -109,12 +110,12 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
if (houseInfo == null)
{
houseInfoOutputForDetailPage.houseInfo = new HouseInfoOutput();
houseInfoOutputForDetailPage.HouseInfo = new HouseInfoOutput();
return houseInfoOutputForDetailPage;
}
var houseInfoOutput = (await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.HouseCodeId == houseTask.HouseCodeId)).Adapt<HouseInfoOutput>();
houseInfoOutputForDetailPage.houseInfo = houseInfoOutput;
houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput;
return houseInfoOutputForDetailPage;
}

View File

@@ -37,11 +37,11 @@ namespace Ewide.Application
public string OtherInfoFiles { get; set; }
//[Required(ErrorMessage = "巡查初始等级不能为空")]
public int InitLevel { get; set; }
public int InitGrade { get; set; }
//[Required(ErrorMessage = "巡查损坏等级不能为空")]
public int DamageLevel { get; set; }
public int DamageGrade { get; set; }
//[Required(ErrorMessage = "巡查综合等级不能为空")]
public int ComprehensiveLevel { get; set; }
public int ComprehensiveGrade { get; set; }
/// <summary>
/// 主要安全隐患综述

View File

@@ -10,5 +10,100 @@ namespace Ewide.Application
{
public DateTime? PatrolDate { get; set; }
public string PatrolUser { get; set; }
/// <summary>
/// 沉降倾斜
/// </summary>
public string SettlementTilt { get; set; }
/// <summary>
/// 沉降倾斜附件
/// </summary>
public string SettlementTiltFiles { get; set; }
/// <summary>
/// 其他情况
/// </summary>
public string OtherInfo { get; set; }
/// <summary>
/// 其他情况附件
/// </summary>
public string OtherInfoFiles { get; set; }
/// <summary>
/// 初始等级
/// </summary>
public int? InitGrade { get; set; }
/// <summary>
/// 损坏等级
/// </summary>
public int? DamageGrade { get; set; }
/// <summary>
/// 综合等级
/// </summary>
public int? ComprehensiveGrade { get; set; }
/// <summary>
/// 主要安全隐患综述
/// </summary>
public string MainSafety { get; set; }
/// <summary>
/// 处理意见
/// </summary>
public int? HandlingOpinion { get; set; }
/// <summary>
/// 处理意见备注
/// </summary>
public string HandlingOpinionRemark { get; set; }
/// <summary>
/// 整改情况
/// </summary>
public int? RectifyAndReform { get; set; }
/// <summary>
/// 整改情况备注
/// </summary>
public string RectifyAndReformRemark { get; set; }
/// <summary>
/// 巡查结果1正常,-1异常
/// </summary>
public int? PatrolResult { get; set; }
/// <summary>
/// 巡查异常描述
/// </summary>
public string PatrolResultRemark { get; set; }
/// <summary>
/// 上报街道
/// </summary>
public int? ReportRoad { get; set; }
/// <summary>
/// 上报街道时间
/// </summary>
public DateTime? ReportRoadTime { get; set; }
/// <summary>
/// 上报区住建
/// </summary>
public int? ReportArea { get; set; }
/// <summary>
/// 上报区住建时间
/// </summary>
public DateTime? ReportAreaTime { get; set; }
/// <summary>
/// 上报备注
/// </summary>
public string ReportRemark { get; set; }
}
}

View File

@@ -18,10 +18,10 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="外立面照片" prop="facadePhoto">
<a-form-model-item class="ant-row-flex" label="外立面照片" prop="houseInfo.facadePhoto">
<a-upload
:custom-request="onFileUpload"
:file-list="form.facadePhoto"
:file-list="form.houseInfo.facadePhoto"
:preview-file="onPreviewFile"
@change="onFileChange"
@preview="onFilePreview"
@@ -47,7 +47,9 @@ import PhotoSwipe from '@/components/photoSwipe';
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
facadePhoto: [],
},
};
export default {
@@ -63,11 +65,13 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
facadePhoto: [{ required: true, message: '请上传外立面照片' }],
'houseInfo.facadePhoto': [{ required: true, message: '请上传外立面照片' }],
},
/** 加载异步数据状态 */
@@ -81,7 +85,6 @@ export default {
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -91,13 +94,15 @@ export default {
* 在打开编辑页时允许填充数据
*/
async onFillData() {
this.loading = true;
{
/** 将默认数据覆盖到form */
const record = this.param && this.param.record,
facadePhoto = [];
// 从数据中的文件id转换成uploader所需的格式
if (record) {
const fileList = record.facadePhoto.split(',');
const fileList = !!record.facadePhoto ? record.facadePhoto.split(',') : [];
for (let i = 0; i < fileList.length; i++) {
const file = await PreviewFile(fileList[i]);
const base64 = await BlobToBase64(file);
@@ -113,11 +118,9 @@ export default {
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
facadePhoto,
});
}
this.loading = false;
},
/**
@@ -126,7 +129,7 @@ export default {
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -136,20 +139,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -163,23 +158,12 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
/* 上传图片相关 Begin */
onFileChange({ fileList }) {
this.form.facadePhoto = fileList;
this.form.houseInfo.facadePhoto = fileList;
},
onPreviewFile(file) {
return new Promise((resolve) => {
@@ -200,8 +184,8 @@ export default {
},
onFilePreview(file) {
const items = [];
for (let i = 0; i < this.form.facadePhoto.length; i++) {
const _file = this.form.facadePhoto[i];
for (let i = 0; i < this.form.houseInfo.facadePhoto.length; i++) {
const _file = this.form.houseInfo.facadePhoto[i];
const img = new Image();
const src = _file.url || _file.thumbUrl;
img.src = src;
@@ -212,7 +196,7 @@ export default {
});
}
this.$refs['photo-swipe'].initPhotoSwipe(items, {
index: this.form.facadePhoto.indexOf(file),
index: this.form.houseInfo.facadePhoto.indexOf(file),
});
},
/* 上传图片相关 End */

View File

@@ -18,10 +18,10 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="立项文件" prop="anEntryDocument">
<a-form-model-item class="ant-row-flex" label="立项文件" prop="houseInfo.anEntryDocument">
<a-upload
:custom-request="onFileUpload"
:file-list="form.anEntryDocument"
:file-list="form.houseInfo.anEntryDocument"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'anEntryDocument')"
@download="onFileDownload"
@@ -32,10 +32,10 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="规划许可" prop="planningPermission">
<a-form-model-item class="ant-row-flex" label="规划许可" prop="houseInfo.planningPermission">
<a-upload
:custom-request="onFileUpload"
:file-list="form.planningPermission"
:file-list="form.houseInfo.planningPermission"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'planningPermission')"
@download="onFileDownload"
@@ -46,10 +46,10 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="竣工验收备案" prop="completedRecord">
<a-form-model-item class="ant-row-flex" label="竣工验收备案" prop="houseInfo.completedRecord">
<a-upload
:custom-request="onFileUpload"
:file-list="form.completedRecord"
:file-list="form.houseInfo.completedRecord"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'completedRecord')"
@download="onFileDownload"
@@ -60,10 +60,10 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="监理文件" prop="monitorDocument">
<a-form-model-item class="ant-row-flex" label="监理文件" prop="houseInfo.monitorDocument">
<a-upload
:custom-request="onFileUpload"
:file-list="form.monitorDocument"
:file-list="form.houseInfo.monitorDocument"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'monitorDocument')"
@download="onFileDownload"
@@ -74,10 +74,14 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="鉴定报告" prop="identificationReport">
<a-form-model-item
class="ant-row-flex"
label="鉴定报告"
prop="houseInfo.identificationReport"
>
<a-upload
:custom-request="onFileUpload"
:file-list="form.identificationReport"
:file-list="form.houseInfo.identificationReport"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'identificationReport')"
@download="onFileDownload"
@@ -88,10 +92,10 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="其他附件" prop="otherDocument">
<a-form-model-item class="ant-row-flex" label="其他附件" prop="houseInfo.otherDocument">
<a-upload
:custom-request="onFileUpload"
:file-list="form.otherDocument"
:file-list="form.houseInfo.otherDocument"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'otherDocument')"
@download="onFileDownload"
@@ -110,12 +114,20 @@ import { GetFileName } from '@/util/file';
/* 表单内容默认值 */
const defaultForm = {
/* ... */
// anEntryDocument: [],
// planningPermission: [],
// completionRecord: [],
// monitor: [],
// identificationReport: [],
// otherDocument: [],
houseInfo: {
anEntryDocument: [],
planningPermission: [],
completionRecord: [],
monitor: [],
identificationReport: [],
otherDocument: [],
},
};
export default {
@@ -127,7 +139,9 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
@@ -142,7 +156,6 @@ export default {
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -151,25 +164,28 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
// await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
});
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -178,20 +194,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -205,17 +213,6 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
@@ -232,7 +229,7 @@ export default {
}
},
onFileChange({ fileList }, key) {
this.form[key] = fileList;
this.form.houseInfo[key] = fileList;
},
onFileDownload(file) {
this.$api.sysFileInfoDownload({ id: file.response }).then((res) => {

View File

@@ -18,8 +18,8 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="图纸资料存档处" prop="drawingMaterial">
<a-checkbox-group v-model="form.drawingMaterial">
<a-form-model-item class="ant-row-flex" label="图纸资料存档处" prop="houseInfo.drawingMaterial">
<a-checkbox-group v-model="form.houseInfo.drawingMaterial">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -29,8 +29,8 @@
<a-input
class="w-300"
placeholder="请输入其他图纸资料存档处"
v-if="form.drawingMaterial && form.drawingMaterial.indexOf(codes.houseStorageOfDrawings[codes.houseStorageOfDrawings.length - 1].code) >= 0"
v-model="form.drawingMaterialText"
v-if="form.houseInfo.drawingMaterial && form.houseInfo.drawingMaterial.indexOf(codes.houseStorageOfDrawings[codes.houseStorageOfDrawings.length - 1].code) >= 0"
v-model="form.houseInfo.drawingMaterialText"
/>
</a-checkbox-group>
</a-form-model-item>
@@ -43,6 +43,10 @@
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
drawingMaterial: null,
drawingMaterialText: null,
},
};
export default {
@@ -54,11 +58,13 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
drawingMaterial: [{ required: true, message: '请选择图纸资料存档处' }],
'houseInfo.drawingMaterial': [{ required: true, message: '请选择图纸资料存档处' }],
},
/** 加载异步数据状态 */
@@ -73,7 +79,6 @@ export default {
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -82,16 +87,20 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
});
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
@@ -100,7 +109,7 @@ export default {
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -109,20 +118,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -136,18 +137,6 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
await this.onLoadCodes();
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {

View File

@@ -18,8 +18,8 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="鉴定等级" prop="identification">
<a-radio-group button-style="solid" v-model="form.identification">
<!-- <a-form-model-item class="ant-row-flex" label="鉴定等级" prop="houseInfo.identification">
<a-radio-group button-style="solid" v-model="form.houseInfo.identification">
<a-radio-button
:key="item.code"
:value="item.code"
@@ -27,8 +27,8 @@
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
<a-form-model-item class="ant-row-flex" label="治理改造措施" prop="government">
<a-radio-group button-style="solid" v-model="form.government">
<a-form-model-item class="ant-row-flex" label="治理改造措施" prop="houseInfo.government">
<a-radio-group button-style="solid" v-model="form.houseInfo.government">
<a-radio-button
:key="item.code"
:value="item.code"
@@ -36,24 +36,24 @@
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
<a-form-model-item class="ant-row-flex" label="是否已通过解危鉴定" prop="fireproofGrade">
<a-form-model-item class="ant-row-flex" label="是否已通过解危鉴定" prop="houseInfo.fireproofGrade">
<a-switch />
</a-form-model-item>
<a-form-model-item class="ant-row-flex" label="房屋使用状态" prop="usedStatus">
<a-radio-group button-style="solid" v-model="form.usedStatus">
</a-form-model-item>-->
<a-form-model-item class="ant-row-flex" label="房屋使用状态" prop="houseInfo.houseUsedStatus">
<a-radio-group button-style="solid" v-model="form.houseInfo.houseUsedStatus">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.usedStatus"
v-for="item in codes.houseUsedStatus"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
<a-form-model-item class="ant-row-flex" label="综合等级" prop="houseLevel">
<a-radio-group button-style="solid" v-model="form.houseLevel">
<a-form-model-item class="ant-row-flex" label="综合等级" prop="houseInfo.houseGrade">
<a-radio-group button-style="solid" v-model="form.houseInfo.houseGrade">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.houseLevel"
v-for="item in codes.houseGrade"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
@@ -66,6 +66,11 @@
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
// identification: null,
houseUsedStatus: null,
houseGrade: null,
},
};
export default {
@@ -77,13 +82,15 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
identification: [{ required: true, message: '请选择鉴定等级' }],
houseStatus: [{ required: true, message: '请选择房屋使用状态' }],
comprehensiveGrade: [{ required: true, message: '请选择综合等级' }],
// 'houseInfo.identification': [{ required: true, message: '请选择鉴定等级' }],
'houseInfo.houseUsedStatus': [{ required: true, message: '请选择房屋使用状态' }],
'houseInfo.houseGrade': [{ required: true, message: '请选择综合等级' }],
},
/** 加载异步数据状态 */
@@ -94,14 +101,13 @@ export default {
codes: {
houseIdentification: [],
houseGovernment: [],
houseStatus: [],
houseComprehensiveGrade: [],
houseUsedStatus: [],
houseGrade: [],
},
};
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -110,16 +116,20 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
});
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
@@ -128,7 +138,7 @@ export default {
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -137,20 +147,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -164,39 +166,20 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
await this.onLoadCodes();
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {
return this.$api
.sysDictTypeDropDowns({
code: [
'dic_house_identification',
'dic_house_government',
'dic_house_status',
'dic_house_comprehensive_grade',
],
code: ['dic_house_identification', 'dic_house_government', 'dic_house_used_status', 'dic_house_grade'],
})
.then(
({
data: { dic_house_identification, dic_house_government, dic_house_status, dic_house_comprehensive_grade },
}) => {
({ data: { dic_house_identification, dic_house_government, dic_house_used_status, dic_house_grade } }) => {
this.codes = {
houseIdentification: dic_house_identification,
houseGovernment: dic_house_government,
houseStatus: dic_house_status,
houseComprehensiveGrade: dic_house_comprehensive_grade,
houseUsedStatus: dic_house_used_status,
houseGrade: dic_house_grade,
};
}
);

View File

@@ -59,34 +59,34 @@ export default {
// title: '管理情况',
// component: () => import('./manager'),
// },
// {
// title: '调查情况',
// component: () => import('./investigation'),
// },
// {
// title: '鉴定治理',
// component: () => import('./identification'),
// },
// {
// title: '图纸资料存档处',
// component: () => import('./drawing'),
// },
// {
// title: '相关附件资料',
// component: () => import('./attachments'),
// },
{
title: '调查情况',
component: () => import('./investigation'),
},
{
title: '鉴定治理',
component: () => import('./identification'),
},
{
title: '图纸资料存档处',
component: () => import('./drawing'),
},
{
title: '相关附件资料',
component: () => import('./attachments'),
},
// {
// title: '物业维修资金',
// component: () => import('./fund'),
// },
// {
// title: '建筑概貌',
// component: () => import('./aspect'),
// },
// {
// title: '调查单位',
// component: () => import('./unit'),
// },
{
title: '建筑概貌',
component: () => import('./aspect'),
},
{
title: '调查单位',
component: () => import('./unit'),
},
],
};
},

View File

@@ -18,8 +18,8 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="房屋场地" prop="houseSite">
<a-checkbox-group v-model="form.houseSite">
<a-form-model-item class="ant-row-flex" label="房屋场地" prop="houseInfo.houseSite">
<a-checkbox-group v-model="form.houseInfo.houseSite">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -30,8 +30,12 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="相邻施工" prop="adjacentConstruction">
<a-checkbox-group v-model="form.adjacentConstruction">
<a-form-model-item
class="ant-row-flex"
label="相邻施工"
prop="houseInfo.adjacentConstruction"
>
<a-checkbox-group v-model="form.houseInfo.adjacentConstruction">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -42,8 +46,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="化学侵蚀" prop="chemicalErosion">
<a-checkbox-group v-model="form.chemicalErosion">
<a-form-model-item class="ant-row-flex" label="化学侵蚀" prop="houseInfo.chemicalErosion">
<a-checkbox-group v-model="form.houseInfo.chemicalErosion">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -54,8 +58,12 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="结构拆改" prop="structuralDismantling">
<a-radio-group button-style="solid" v-model="form.structuralDismantling">
<a-form-model-item
class="ant-row-flex"
label="结构拆改"
prop="houseInfo.structuralDismantling"
>
<a-radio-group button-style="solid" v-model="form.houseInfo.structuralDismantling">
<a-radio-button
:key="item.code"
:value="item.code"
@@ -65,8 +73,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="加层改造" prop="addingLayer">
<a-radio-group button-style="solid" v-model="form.addingLayer">
<a-form-model-item class="ant-row-flex" label="加层改造" prop="houseInfo.addingLayer">
<a-radio-group button-style="solid" v-model="form.houseInfo.addingLayer">
<a-radio-button
:key="item.code"
:value="item.code"
@@ -76,8 +84,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="修缮加固" prop="repairAndReinforce">
<a-checkbox-group v-model="form.repairAndReinforce">
<a-form-model-item class="ant-row-flex" label="修缮加固" prop="houseInfo.repairAndReinforce">
<a-checkbox-group v-model="form.houseInfo.repairAndReinforce">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -88,8 +96,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="历史灾害" prop="historicalCalamity">
<a-checkbox-group v-model="form.historicalCalamity">
<a-form-model-item class="ant-row-flex" label="历史灾害" prop="houseInfo.historicalCalamity">
<a-checkbox-group v-model="form.houseInfo.historicalCalamity">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -100,8 +108,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="使用功能变更" prop="functionalChange">
<a-checkbox-group v-model="form.functionalChange">
<a-form-model-item class="ant-row-flex" label="使用功能变更" prop="houseInfo.functionalChange">
<a-checkbox-group v-model="form.houseInfo.functionalChange">
<a-checkbox
:key="item.code"
:value="item.code"
@@ -112,8 +120,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="其他调查内容" prop="otherContents">
<a-textarea auto-size placeholder="请输入其他调查内容" v-model="form.otherContents" />
<a-form-model-item class="ant-row-flex" label="其他调查内容" prop="houseInfo.otherContents">
<a-textarea auto-size placeholder="请输入其他调查内容" v-model="form.houseInfo.otherContents" />
</a-form-model-item>
</a-col>
</a-row>
@@ -124,6 +132,17 @@
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
houseSite: null,
adjacentConstruction: null,
chemicalErosion: null,
structuralDismantling: null,
addingLayer: null,
repairAndReinforce: null,
historicalCalamity: null,
functionalChange: null,
otherContents: null,
},
};
export default {
@@ -135,18 +154,20 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
houseSite: [{ required: true, message: '请选择房屋场地' }],
adjacentConstruction: [{ required: true, message: '请选择相邻施工' }],
chemicalErosion: [{ required: true, message: '请选择化学侵蚀' }],
structuralDismantling: [{ required: true, message: '请选择结构拆改' }],
addingLayer: [{ required: true, message: '请选择加层改造' }],
repairAndReinforce: [{ required: true, message: '请选择修缮加固' }],
historicalCalamity: [{ required: true, message: '请选择历史灾害' }],
functionalChange: [{ required: true, message: '请选择使用功能变更' }],
'houseInfo.houseSite': [{ required: true, message: '请选择房屋场地' }],
'houseInfo.adjacentConstruction': [{ required: true, message: '请选择相邻施工' }],
'houseInfo.chemicalErosion': [{ required: true, message: '请选择化学侵蚀' }],
'houseInfo.structuralDismantling': [{ required: true, message: '请选择结构拆改' }],
'houseInfo.addingLayer': [{ required: true, message: '请选择加层改造' }],
'houseInfo.repairAndReinforce': [{ required: true, message: '请选择修缮加固' }],
'houseInfo.historicalCalamity': [{ required: true, message: '请选择历史灾害' }],
'houseInfo.functionalChange': [{ required: true, message: '请选择使用功能变更' }],
},
/** 加载异步数据状态 */
@@ -168,25 +189,24 @@ export default {
},
watch: {
'form.adjacentConstruction'(value, oldValue) {
'form.houseInfo.adjacentConstruction'(value, oldValue) {
this.onCheckedNone(value, oldValue, 'adjacentConstruction');
},
'form.chemicalErosion'(value, oldValue) {
'form.houseInfo.chemicalErosion'(value, oldValue) {
this.onCheckedNone(value, oldValue, 'chemicalErosion');
},
'form.repairAndReinforce'(value, oldValue) {
'form.houseInfo.repairAndReinforce'(value, oldValue) {
this.onCheckedNone(value, oldValue, 'repairAndReinforce');
},
'form.historicalCalamity'(value, oldValue) {
'form.houseInfo.historicalCalamity'(value, oldValue) {
this.onCheckedNone(value, oldValue, 'historicalCalamity');
},
'form.functionalChange'(value, oldValue) {
'form.houseInfo.functionalChange'(value, oldValue) {
this.onCheckedNone(value, oldValue, 'functionalChange');
},
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -195,16 +215,21 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
});
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
@@ -213,7 +238,7 @@ export default {
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -222,20 +247,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -249,18 +266,6 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
await this.onLoadCodes();
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {
@@ -306,10 +311,10 @@ export default {
onCheckedNone(value, oldValue, key) {
// 选中"无"时全不选,反之取消选择"无"
if (value.indexOf('0') >= 0 && oldValue.indexOf('0') === -1) {
this.form[key] = ['0'];
if (value.indexOf('0') >= 0 && (!oldValue || oldValue.indexOf('0') === -1)) {
this.form.houseInfo[key] = ['0'];
} else if (value.indexOf('0') >= 0 && value.length > 1) {
this.form[key].splice(value.indexOf('0'), 1);
this.form.houseInfo[key].splice(value.indexOf('0'), 1);
}
},
},

View File

@@ -18,8 +18,8 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="产权性质" prop="propertyRights">
<a-radio-group button-style="solid" v-model="form.propertyRights">
<a-form-model-item class="ant-row-flex" label="产权性质" prop="houseInfo.propertyRights">
<a-radio-group button-style="solid" v-model="form.houseInfo.propertyRights">
<a-radio-button
:key="item.code"
:value="item.code"
@@ -35,7 +35,7 @@
:colon="false"
class="ant-row-flex"
label="直管公房"
prop="straightHouseCount"
prop="houseInfo.straightHouseCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -43,7 +43,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.straightHouseCount"
v-model="form.houseInfo.straightHouseCount"
/>
</a-col>
<a-col>
@@ -55,7 +55,7 @@
:colon="false"
class="ant-row-flex"
label="单位自管公房"
prop="selfHouseCount"
prop="houseInfo.selfHouseCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -63,7 +63,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.selfHouseCount"
v-model="form.houseInfo.selfHouseCount"
/>
</a-col>
<a-col>
@@ -74,7 +74,12 @@
<a-form-model-item :colon="false" class="ant-row-flex" label="其他" props="otherCount">
<a-row type="flex">
<a-col flex="1">
<a-input-number :min="0" :step="1" placeholder="几" v-model="form.otherCount" />
<a-input-number
:min="0"
:step="1"
placeholder="几"
v-model="form.houseInfo.otherCount"
/>
</a-col>
<a-col>
<span class="yo-addon"></span>
@@ -87,7 +92,7 @@
:colon="false"
class="ant-row-flex"
label="商品房"
prop="businessCount"
prop="houseInfo.businessCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -95,7 +100,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.businessCount"
v-model="form.houseInfo.businessCount"
/>
</a-col>
<a-col>
@@ -107,7 +112,7 @@
:colon="false"
class="ant-row-flex"
label="房改房"
prop="changeHouseCount"
prop="houseInfo.changeHouseCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -115,7 +120,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.changeHouseCount"
v-model="form.houseInfo.changeHouseCount"
/>
</a-col>
<a-col>
@@ -127,7 +132,7 @@
:colon="false"
class="ant-row-flex"
label="拆迁安置房"
prop="resettlementHouseCount"
prop="houseInfo.resettlementHouseCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -135,7 +140,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.resettlementHouseCount"
v-model="form.houseInfo.resettlementHouseCount"
/>
</a-col>
<a-col>
@@ -149,7 +154,7 @@
:colon="false"
class="ant-row-flex"
label="私房"
prop="privateHouseCount"
prop="houseInfo.privateHouseCount"
>
<a-row type="flex">
<a-col flex="1">
@@ -157,7 +162,7 @@
:min="0"
:step="1"
placeholder="几"
v-model="form.privateHouseCount"
v-model="form.houseInfo.privateHouseCount"
/>
</a-col>
<a-col>
@@ -165,10 +170,20 @@
</a-col>
</a-row>
</a-form-model-item>
<a-form-model-item :colon="false" class="ant-row-flex" label="总共" prop="houseCount">
<a-form-model-item
:colon="false"
class="ant-row-flex"
label="总共"
prop="houseInfo.houseCount"
>
<a-row type="flex">
<a-col flex="1">
<a-input-number :min="0" :step="1" placeholder="几" v-model="form.houseCount" />
<a-input-number
:min="0"
:step="1"
placeholder="几"
v-model="form.houseInfo.houseCount"
/>
</a-col>
<a-col>
<span class="yo-addon"></span>
@@ -179,28 +194,36 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="产权单位" prop="propertyUnit">
<a-input placeholder="请输入产权单位" v-model="form.propertyUnit" />
<a-form-model-item class="ant-row-flex" label="产权单位" prop="houseInfo.propertyUnit">
<a-input placeholder="请输入产权单位" v-model="form.houseInfo.propertyUnit" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="负责人" prop="propertyUnitUser">
<a-input placeholder="请输入负责人" v-model="form.propertyUnitUser" />
<a-form-model-item class="ant-row-flex" label="负责人" prop="houseInfo.propertyUnitUser">
<a-input placeholder="请输入负责人" v-model="form.houseInfo.propertyUnitUser" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="负责人电话" prop="propertyUnitUserTel">
<a-input placeholder="请输入负责人电话" v-model="form.propertyUnitUserTel" />
<a-form-model-item
class="ant-row-flex"
label="负责人电话"
prop="houseInfo.propertyUnitUserTel"
>
<a-input placeholder="请输入负责人电话" v-model="form.houseInfo.propertyUnitUserTel" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="联系人" prop="propertyUnitConent">
<a-input placeholder="请输入联系人" v-model="form.propertyUnitConent" />
<a-form-model-item class="ant-row-flex" label="联系人" prop="houseInfo.propertyUnitConent">
<a-input placeholder="请输入联系人" v-model="form.houseInfo.propertyUnitConent" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="联系人电话" prop="propertyUnitConentTel">
<a-input placeholder="请输入联系人电话" v-model="form.propertyUnitConentTel" />
<a-form-model-item
class="ant-row-flex"
label="联系人电话"
prop="houseInfo.propertyUnitConentTel"
>
<a-input placeholder="请输入联系人电话" v-model="form.houseInfo.propertyUnitConentTel" />
</a-form-model-item>
</a-col>
</a-row>
@@ -211,6 +234,22 @@
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
propertyRights: null,
straightHouseCount: null,
selfHouseCount: null,
otherCount: null,
businessCount: null,
changeHouseCount: null,
resettlementHouseCount: null,
privateHouseCount: null,
houseCount: null,
propertyUnit: null,
propertyUnitUser: null,
propertyUnitUserTel: null,
propertyUnitConent: null,
propertyUnitConentTel: null,
},
};
export default {
@@ -222,17 +261,19 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
propertyRights: [{ required: true, message: '请选择产权性质' }],
straightHouseCount: [{ required: true, message: '请输入直管公房' }],
selfHouseCount: [{ required: true, message: '请输入单位自管公房' }],
otherCount: [{ required: true, message: '请输入其他' }],
businessCount: [{ required: true, message: '请输入商品房' }],
changeHouseCount: [{ required: true, message: '请输入房改房' }],
resettlementHouseCount: [{ required: true, message: '请输入拆迁安置房' }],
'houseInfo.propertyRights': [{ required: true, message: '请选择产权性质' }],
'houseInfo.straightHouseCount': [{ required: true, message: '请输入直管公房' }],
'houseInfo.selfHouseCount': [{ required: true, message: '请输入单位自管公房' }],
'houseInfo.otherCount': [{ required: true, message: '请输入其他' }],
'houseInfo.businessCount': [{ required: true, message: '请输入商品房' }],
'houseInfo.changeHouseCount': [{ required: true, message: '请输入房改房' }],
'houseInfo.resettlementHouseCount': [{ required: true, message: '请输入拆迁安置房' }],
},
/** 加载异步数据状态 */
@@ -247,7 +288,6 @@ export default {
},
async created() {
this.form = this.$_.cloneDeep(defaultForm);
this.onFillData();
},

View File

@@ -18,23 +18,23 @@
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="调查登记机构" prop="investigateAgency">
<a-input placeholder="请输入登记机构" v-model="form.investigateAgency" />
<a-form-model-item class="ant-row-flex" label="调查登记机构" prop="houseInfo.investigateAgency">
<a-input placeholder="请输入登记机构" v-model="form.houseInfo.investigateAgency" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="调查人员" prop="investigateUser">
<a-input placeholder="请输入调查人员" v-model="form.investigateUser" />
<a-form-model-item class="ant-row-flex" label="调查人员" prop="houseInfo.investigateUser">
<a-input placeholder="请输入调查人员" v-model="form.houseInfo.investigateUser" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="审核人员" prop="offlineAuditor">
<a-input placeholder="请输入审核人员" v-model="form.offlineAuditor" />
<a-form-model-item class="ant-row-flex" label="审核人员" prop="houseInfo.offlineAuditor">
<a-input placeholder="请输入审核人员" v-model="form.houseInfo.offlineAuditor" />
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item class="ant-row-flex" label="主管部门" prop="competentDepartment">
<a-input placeholder="请输入主管部门" v-model="form.competentDepartment" />
<a-form-model-item class="ant-row-flex" label="主管部门" prop="houseInfo.competentDepartment">
<a-input placeholder="请输入主管部门" v-model="form.houseInfo.competentDepartment" />
</a-form-model-item>
</a-col>
</a-row>
@@ -45,6 +45,12 @@
/* 表单内容默认值 */
const defaultForm = {
/* ... */
houseInfo: {
investigateAgency: null,
investigateUser: null,
offlineAuditor: null,
competentDepartment: null,
},
};
export default {
@@ -56,14 +62,16 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
investigateAgency: [{ required: true, message: '请输入调查登记机构' }],
investigateUser: [{ required: true, message: '请输入调查人员' }],
offlineAuditor: [{ required: true, message: '请输入审核人员' }],
competentDepartment: [{ required: true, message: '请输入主管部门' }],
'houseInfo.investigateAgency': [{ required: true, message: '请输入调查登记机构' }],
'houseInfo.investigateUser': [{ required: true, message: '请输入调查人员' }],
'houseInfo.offlineAuditor': [{ required: true, message: '请输入审核人员' }],
'houseInfo.competentDepartment': [{ required: true, message: '请输入主管部门' }],
},
/** 加载异步数据状态 */
@@ -75,7 +83,6 @@ export default {
},
async created() {
await this.onInit();
this.onFillData();
},
@@ -84,25 +91,28 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
// await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
this.form = this.$_.cloneDeep({
...defaultForm,
...record,
/** 在此处添加其他默认数据转换 */
/* ... */
});
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
@@ -111,20 +121,12 @@ export default {
reslove(record);
} else {
reject();
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -138,17 +140,6 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
},

View File

@@ -49,7 +49,9 @@ export default {
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {},
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
@@ -65,9 +67,6 @@ export default {
},
async created() {
this.form = this.$_.cloneDeep(defaultForm);
await this.onInit();
this.onFillData();
},
@@ -76,7 +75,9 @@ export default {
* 必要的方法
* 在打开编辑页时允许填充数据
*/
onFillData() {
async onFillData() {
this.loading = true;
{
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
@@ -96,8 +97,9 @@ export default {
}
});
}
this.form = form;
}
this.loading = false;
},
/**
@@ -121,14 +123,6 @@ export default {
});
},
/**
* 必要的方法
* 在外部窗口进行保存时调用表单验证
*/
onValidate(callback) {
this.$refs.form.validate(callback);
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
@@ -142,63 +136,8 @@ export default {
}, 300);
},
/**
* 必要方法
* 加载当前表单中所需要的异步数据
*/
async onInit() {
this.loading = true;
/** 可以在这里await获取一些异步数据 */
/* ... */
await this.onLoadCodes();
this.loading = false;
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {
return this.$api
.sysDictTypeDropDowns({
code: [
'dic_land_attribute',
'dic_house_structure_type',
'dic_house_aseismic_grade',
'dic_house_base_info',
'dic_house_insulation_material',
'dic_house_wall_material',
'dic_house_fireproof_grade',
'dic_house_building_curtain_wall',
'dic_house_elevator',
],
})
.then(
({
data: {
dic_land_attribute,
dic_house_structure_type,
dic_house_aseismic_grade,
dic_house_base_info,
dic_house_insulation_material,
dic_house_wall_material,
dic_house_fireproof_grade,
dic_house_building_curtain_wall,
dic_house_elevator,
},
}) => {
this.codes = {
landAttribute: dic_land_attribute,
houseStructureType: dic_house_structure_type,
houseSseismicGrade: dic_house_aseismic_grade,
houseBaseInfo: dic_house_base_info,
houseInsulationMaterial: dic_house_insulation_material,
houseWallMaterial: dic_house_wall_material,
houseFireproofGrade: dic_house_fireproof_grade,
houseBuildingCurtainWall: dic_house_building_curtain_wall,
houseElevator: dic_house_elevator,
};
}
);
},
},
};
</script>

View File

@@ -0,0 +1,177 @@
<template>
<!--
整页表单的分片表单
v 1.0
2021-05-12
Lufthafen
-->
<a-form-model
:label-col="labelCol"
:model="form"
:rules="rules"
:wrapper-col="wrapperCol"
ref="form"
>
<a-spin :spinning="loading">
<a-icon slot="indicator" spin type="loading" />
<!-- 表单控件 -->
<!-- ... -->
<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-button
:key="item.code"
:value="item.code"
v-for="item in codes.houseInitGrade"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="损坏等级" prop="patrolInfo.damageGrade">
<a-radio-group button-style="solid" v-model="form.patrolInfo.damageGrade">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.houseDamageGrade"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="综合等级" prop="patrolInfo.comprehensiveGrade">
<a-radio-group button-style="solid" v-model="form.patrolInfo.comprehensiveGrade">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.houseGrade"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
</a-row>
</a-spin>
</a-form-model>
</template>
<script>
/* 表单内容默认值 */
const defaultForm = {
/* ... */
patrolInfo: {
initGrade: '1',
damageGrade: '1',
comprehensiveGrade: '1',
},
};
export default {
props: ['param'],
data() {
return {
labelCol: { flex: '150px' },
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
'patrolInfo.initGrade': [{ required: true, message: '请选择初始等级' }],
'patrolInfo.damageGrade': [{ required: true, message: '请选择损坏等级' }],
'patrolInfo.comprehensiveGrade': [{ required: true, message: '请选择综合等级' }],
},
/** 加载异步数据状态 */
loading: false,
/** 其他成员属性 */
/* ... */
codes: {
houseInitGrade: [],
houseDamageGrade: [],
houseGrade: [],
},
};
},
async created() {
this.onFillData();
},
methods: {
/**
* 必要的方法
* 在打开编辑页时允许填充数据
*/
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
reslove(record);
} else {
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
*/
onResetFields() {
setTimeout(() => {
this.$refs.form.resetFields();
/** 在这里可以初始化当前组件中其他属性 */
/* ... */
}, 300);
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {
return this.$api
.sysDictTypeDropDowns({
code: ['dic_house_patrol_init_grade', 'dic_house_patrol_damage_grade', 'dic_house_grade'],
})
.then(({ data: { dic_house_patrol_init_grade, dic_house_patrol_damage_grade, dic_house_grade } }) => {
this.codes = {
houseInitGrade: dic_house_patrol_init_grade,
houseDamageGrade: dic_house_patrol_damage_grade,
houseGrade: dic_house_grade,
};
});
},
},
};
</script>

View File

@@ -0,0 +1,189 @@
<template>
<!--
整页表单的分片表单
v 1.0
2021-05-12
Lufthafen
-->
<a-form-model
:label-col="labelCol"
:model="form"
:rules="rules"
:wrapper-col="wrapperCol"
ref="form"
>
<a-spin :spinning="loading">
<a-icon slot="indicator" spin type="loading" />
<!-- 表单控件 -->
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="处理建议" prop="patrolInfo.handlingOpinion">
<a-radio-group button-style="solid" v-model="form.patrolInfo.handlingOpinion">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.handlingOpinion"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
class="ant-row-flex"
label="处理建议备注"
prop="patrolInfo.handlingOpinionRemark"
>
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入处理建议备注"
v-model="form.patrolInfo.handlingOpinionRemark"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="整改情况" prop="patrolInfo.rectifyAndReform">
<a-radio-group button-style="solid" v-model="form.patrolInfo.rectifyAndReform">
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.rectifyAndReform"
>{{ item.value }}</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
class="ant-row-flex"
label="整改情况备注"
prop="patrolInfo.rectifyAndReformRemark"
>
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入整改情况备注"
v-model="form.patrolInfo.rectifyAndReformRemark"
/>
</a-form-model-item>
</a-col>
</a-row>
</a-spin>
</a-form-model>
</template>
<script>
/* 表单内容默认值 */
const defaultForm = {
/* ... */
patrolInfo: {
handlingOpinion: '0',
handlingOpinionRemark: null,
rectifyAndReform: '1',
rectifyAndReformRemark: null,
},
};
export default {
props: ['param'],
data() {
return {
labelCol: { flex: '150px' },
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
'patrolInfo.handlingOpinion': [{ required: true, message: '请选择处理建议' }],
},
/** 加载异步数据状态 */
loading: false,
/** 其他成员属性 */
/* ... */
codes: {
handlingOpinion: [],
rectifyAndReform: [],
},
};
},
async created() {
this.onFillData();
},
methods: {
/**
* 必要的方法
* 在打开编辑页时允许填充数据
*/
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
reslove(record);
} else {
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
*/
onResetFields() {
setTimeout(() => {
this.$refs.form.resetFields();
/** 在这里可以初始化当前组件中其他属性 */
/* ... */
}, 300);
},
/** 当前组件的其他方法 */
/* ... */
onLoadCodes() {
return this.$api
.sysDictTypeDropDowns({
code: ['dic_house_patrol_handling_opinion', 'dic_house_patrol_rectify_Reform'],
})
.then(({ data: { dic_house_patrol_handling_opinion, dic_house_patrol_rectify_Reform } }) => {
this.codes = {
handlingOpinion: dic_house_patrol_handling_opinion,
rectifyAndReform: dic_house_patrol_rectify_Reform,
};
});
},
},
};
</script>

View File

@@ -52,42 +52,22 @@ export default {
title: '巡查基本情况',
component: () => import('./base'),
},
// {
// title: '权属情况',
// component: () => import('./ownership'),
// },
// {
// title: '管理情况',
// component: () => import('./manager'),
// },
// {
// title: '调查情况',
// component: () => import('./investigation'),
// },
// {
// title: '鉴定治理',
// component: () => import('./identification'),
// },
// {
// title: '图纸资料存档处',
// component: () => import('./drawing'),
// },
// {
// title: '相关附件资料',
// component: () => import('./attachments'),
// },
// {
// title: '物业维修资金',
// component: () => import('./fund'),
// },
// {
// title: '建筑概貌',
// component: () => import('./aspect'),
// },
// {
// title: '调查单位',
// component: () => import('./unit'),
// },
{
title: '房屋检查',
component: () => import('./inspection'),
},
{
title: '等级划分',
component: () => import('./grade'),
},
{
title: '处理情况',
component: () => import('./handling'),
},
{
title: '本期巡查结果',
component: () => import('./result'),
},
],
};
},

View File

@@ -0,0 +1,221 @@
<template>
<!--
整页表单的分片表单
v 1.0
2021-05-12
Lufthafen
-->
<a-form-model
:label-col="labelCol"
:model="form"
:rules="rules"
:wrapper-col="wrapperCol"
ref="form"
>
<a-spin :spinning="loading">
<a-icon slot="indicator" spin type="loading" />
<!-- 表单控件 -->
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="沉降倾斜情况" prop="patrolInfo.settlementTilt">
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入沉降倾斜情况"
v-model="form.patrolInfo.settlementTilt"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
class="ant-row-flex"
label="沉降倾斜情况照片"
prop="patrolInfo.settlementTiltFiles"
>
<a-upload
:custom-request="onFileUpload"
:file-list="form.patrolInfo.settlementTiltFiles"
:preview-file="onPreviewFile"
@change="onFileChange"
@preview="onFilePreview"
list-type="picture-card"
>
<div>
<a-icon type="plus" />
<div class="ant-upload-text">沉降倾斜照片</div>
</div>
</a-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="其他情况" prop="patrolInfo.otherInfo">
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入其他情况"
v-model="form.patrolInfo.otherInfo"
/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="其他情况照片" prop="patrolInfo.otherInfoFiles">
<a-upload
:custom-request="onFileUpload"
:file-list="form.patrolInfo.otherInfoFiles"
:preview-file="onPreviewFile"
@change="onFileChange"
@preview="onFilePreview"
list-type="picture-card"
>
<div>
<a-icon type="plus" />
<div class="ant-upload-text">其他情况照片</div>
</div>
</a-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="主要安全隐患综述" prop="patrolInfo.MainSafety">
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入主要安全隐患综述"
v-model="form.patrolInfo.MainSafety"
/>
</a-form-model-item>
</a-col>
</a-row>
</a-spin>
<PhotoSwipe ref="photo-swipe" />
</a-form-model>
</template>
<script>
import { PreviewFile, BlobToBase64 } from '@/util/file';
import PhotoSwipe from '@/components/photoSwipe';
/* 表单内容默认值 */
const defaultForm = {
patrolInfo: {
settlementTilt: null,
settlementTiltFiles: [],
otherInfo: null,
otherInfoFiles: [],
MainSafety: null,
},
};
export default {
components: {
PhotoSwipe,
},
props: ['param'],
data() {
return {
labelCol: { flex: '150px' },
wrapperCol: { flex: '1' },
form: {
...defaultForm,
},
rules: {},
/** 加载异步数据状态 */
loading: false,
/** 其他成员属性 */
codes: {},
};
},
methods: {
async onFillData() {
this.loading = true;
{
await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
record.facadePhoto = record.facadePhoto.map((p) => p.response).join(',');
reslove(record);
} else {
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
*/
onResetFields() {
setTimeout(() => {
this.$refs.form.resetFields();
/** 在这里可以初始化当前组件中其他属性 */
/* ... */
}, 300);
},
/** 当前组件的其他方法 */
/* ... */
/* 上传图片相关 Begin */
onFileChange({ fileList }) {
this.form.patrolInfo.settlementTiltFiles = fileList;
},
onPreviewFile(file) {
return new Promise((resolve) => {
const base64 = BlobToBase64(file);
resolve(base64);
});
},
async onFileUpload({ file, onProgress, onSuccess, onError }) {
onProgress();
const fd = new FormData();
fd.append('file', file);
try {
const { data: fileId } = await this.$api.sysFileInfoUpload(fd);
onSuccess(fileId);
} catch {
onError();
}
},
onFilePreview(file) {
const items = [];
for (let i = 0; i < this.form.patrolInfo.settlementTiltFiles.length; i++) {
const _file = this.form.patrolInfo.settlementTiltFiles[i];
const img = new Image();
const src = _file.url || _file.thumbUrl;
img.src = src;
items.push({
src,
w: img.naturalWidth,
h: img.naturalHeight,
});
}
this.$refs['photo-swipe'].initPhotoSwipe(items, {
index: this.form.patrolInfo.settlementTiltFiles.indexOf(file),
});
},
/* 上传图片相关 End */
},
};
</script>

View File

@@ -0,0 +1,142 @@
<template>
<!--
整页表单的分片表单
v 1.0
2021-05-12
Lufthafen
-->
<a-form-model
:label-col="labelCol"
:model="form"
:rules="rules"
:wrapper-col="wrapperCol"
ref="form"
>
<a-spin :spinning="loading">
<a-icon slot="indicator" spin type="loading" />
<!-- 表单控件 -->
<!-- ... -->
<a-row :gutter="16" type="flex">
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="正常与否" prop="patrolInfo.patrolResult">
<a-radio-group button-style="solid" v-model="form.patrolInfo.patrolResult">
<a-radio-button value="0">正常</a-radio-button>
<a-radio-button value="-1">异常</a-radio-button>
</a-radio-group>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item
class="ant-row-flex"
label="异常情况描述"
prop="patrolInfo.patrolResultRemark"
>
<a-textarea
:auto-size="{ minRows: 3 }"
placeholder="请输入异常情况描述"
v-model="form.patrolInfo.patrolResultRemark"
/>
</a-form-model-item>
</a-col>
</a-row>
</a-spin>
</a-form-model>
</template>
<script>
/* 表单内容默认值 */
const defaultForm = {
/* ... */
patrolInfo: {
patrolResult: '0',
patrolResultRemark: null,
},
};
export default {
props: ['param'],
data() {
return {
labelCol: { flex: '150px' },
wrapperCol: { flex: '1' },
/** 表单数据 */
form: {
...defaultForm,
},
/** 验证格式 */
rules: {
/* ... */
'patrolInfo.patrolResult': [{ required: true, message: '请选择本期巡查结果' }],
},
/** 加载异步数据状态 */
loading: false,
/** 其他成员属性 */
/* ... */
codes: {},
};
},
async created() {
this.onFillData();
},
methods: {
/**
* 必要的方法
* 在打开编辑页时允许填充数据
*/
async onFillData() {
this.loading = true;
{
// await this.onLoadCodes();
/** 将默认数据覆盖到form */
const record = this.param && this.param.record;
const form = this.$_.cloneDeep(defaultForm);
if (record) {
this.$_.giveDeep(form, record);
}
this.form = form;
}
this.loading = false;
},
/**
* 必要方法
* 验证表单并获取表单数据
*/
onGetData() {
return new Promise((reslove, reject) => {
this.$refs.form.validate((valid, err) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
reslove(record);
} else {
reject(err);
}
});
});
},
/**
* 必要的方法
* 在外部窗口关闭或重置时对表单验证进行初始化
*/
onResetFields() {
setTimeout(() => {
this.$refs.form.resetFields();
/** 在这里可以初始化当前组件中其他属性 */
/* ... */
}, 300);
},
},
};
</script>