update 建档审核/退回,退回保存/提交审核功能

This commit is contained in:
2021-06-10 18:23:48 +08:00
parent fe1f2fb821
commit c1a0c836fb
15 changed files with 694 additions and 50 deletions

View File

@@ -401,9 +401,9 @@ namespace Ewide.Application
public int? HouseUsedStatus { get; set; }
/// <summary>
/// 1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 4、退回审核被退回的数据5、审核中6、审核通过
/// -1 退回(审核被退回的数据) 1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 5、审核中6、审核通过
/// </summary>
[Comment("1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 4、退回审核被退回的数据5、审核中6、审核通过")]
[Comment("-1 退回(审核被退回的数据) 1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 5、审核中6、审核通过")]
[Required]
public int State { get; set; }

View File

@@ -144,7 +144,7 @@ namespace Ewide.Application
/// <summary>
/// -1退回0待处理1保存待提交2待审核3审核通过
/// </summary>
[Comment("-1退回0待处理1保存待提交2待审核3:审核通过")]
[Comment("-1退回0待处理1保存待提交2待审核6:审核通过")]
public int Status { get; set; } = 0;
/// <summary>

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Ewide.Application
{
[Table("bs_house_task_check_record")]
[Comment("房屋任务审核记录表")]
public class BsHouseTaskCheckRecord : Core.DEntityBase
{
/// <summary>
/// 任务Id
/// </summary>
[Comment("任务Id")]
[MaxLength(36)]
public string TaskId { get; set; }
/// <summary>
/// 通过1退回-1
/// </summary>
[Comment("通过3退回-1")]
public int PassOrBack { get; set; }
/// <summary>
/// 审核内容
/// </summary>
[Comment("审核内容")]
[MaxLength(500)]
public string Content { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
public enum DataStatus
{
/// <summary>
/// 审核退回
/// </summary>
[Description("审核退回")]
Back = -1,
/// <summary>
/// 初始未处理
/// </summary>
[Description("初始未处理")]
Init = 0,
/// <summary>
/// 暂存
/// </summary>
[Description("暂存")]
TempSaved = 1,
/// <summary>
/// 已保存,待提交
/// </summary>
[Description("已保存,待提交")]
Saved = 2,
/// <summary>
/// 已提交,待审核
/// </summary>
[Description("已提交,待审核")]
Submited = 3,
/// <summary>
/// 审核通过
/// </summary>
[Description("审核通过")]
Passed = 6
}
}

View File

@@ -306,7 +306,7 @@
</member>
<member name="P:Ewide.Application.BsHouseInfo.State">
<summary>
1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 4、退回审核被退回的数据5、审核中6、审核通过
-1 退回(审核被退回的数据) 1、待建档需要建档的数据未暂存未保存的2、暂存点击了暂存的数据3、待提交点击了保存的数据 5、审核中6、审核通过
</summary>
</member>
<member name="P:Ewide.Application.BsHouseInfo.InvestigateAgency">
@@ -504,6 +504,21 @@
最后提交时间
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTaskCheckRecord.TaskId">
<summary>
任务Id
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTaskCheckRecord.PassOrBack">
<summary>
通过1退回-1
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTaskCheckRecord.Content">
<summary>
审核内容
</summary>
</member>
<member name="P:Ewide.Application.BsHouseTaskOptions.TaskId">
<summary>
bs_house_code主键Id
@@ -539,6 +554,36 @@
是否选中
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.Back">
<summary>
审核退回
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.Init">
<summary>
初始未处理
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.TempSaved">
<summary>
暂存
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.Saved">
<summary>
已保存,待提交
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.Submited">
<summary>
已提交,待审核
</summary>
</member>
<member name="F:Ewide.Application.DataStatus.Passed">
<summary>
审核通过
</summary>
</member>
<member name="F:Ewide.Application.HouseManagerRole.CityManager">
<summary>
市住建部门
@@ -1219,6 +1264,21 @@
主管部门
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskCheckRecordInput.TaskId">
<summary>
任务Id
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskCheckRecordInput.PassOrBack">
<summary>
通过3退回-1
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskCheckRecordInput.Content">
<summary>
审核内容
</summary>
</member>
<member name="P:Ewide.Application.HouseTaskInput.SettlementTilt">
<summary>
沉降倾斜

View File

@@ -271,12 +271,21 @@ namespace Ewide.Application
public string CompetentDepartment { get; set; }
#endregion
public DataStatus StateDataStatus { get; set; }
public int State
{
get
{
return (int)StateDataStatus;
}
}
}
public class HouseInfoInputAdd
public class HouseInfoInputSave
{
public HouseCodeOutput houseCode { get; set; }
public HouseInfoInput houseInfo { get; set; }
public EditHouseTaskInput PatrolInfo { get; set; }
public HouseTaskCheckRecordInput TaskCheckRecord { get; set; }
}
}

View File

@@ -44,34 +44,21 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
[HttpPost("/houseInfo/save")]
[UnitOfWork]
[AllowAnonymous]
public async Task Save([FromBody] HouseInfoInputAdd input)
public async Task Save([FromBody] HouseInfoInputSave input)
{
var houseCode = input.houseCode.Adapt<BsHouseCode>();
await houseCode.UpdateIncludeAsync(new[] { nameof(BsHouseCode.Address), nameof(BsHouseCode.Lng), nameof(BsHouseCode.Lat) }, true);
//根据任务审核记录判断是否是审核操作,从而确定 DataStatus
//审核操作,则为 input.TaskCheckRecord.PassOrBackDataStatus
//非审核操作,则为 DataStatus.Saved
var isCheckAction = input.TaskCheckRecord != null;
await InputDataProcess(input, isCheckAction ? input.TaskCheckRecord.PassOrBackDataStatus : DataStatus.Saved);
}
var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id);
var houseInfo = input.houseInfo.Adapt<BsHouseInfo>();
houseInfo.HouseCodeId = input.houseCode.Id;
if(houseEntity == null)
{
houseInfo.Id = Guid.NewGuid().ToString();
houseInfo.State = 3;
await houseInfo.InsertAsync();
}
else
{
houseInfo.Id = houseEntity.Id;
houseInfo.State = houseEntity.State;
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true) ;
}
if(houseInfo.State != 6)
{
var houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
houseTask.HouseCodeId = input.houseCode.Id;
houseTask.Status = 1;
await houseTask.UpdateExcludeAsync(new string[] { nameof(BsHouseTask.TaskType) }, ignoreNullValues: true);
}
[HttpPost("/houseInfo/submitToCheck")]
[UnitOfWork]
[AllowAnonymous]
public async Task SubmitToCheck([FromBody] HouseInfoInputSave input)
{
await InputDataProcess(input,DataStatus.Submited);
}
[HttpGet("/houseInfo/getByTaskId")]
@@ -121,5 +108,64 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
return houseInfoOutputForDetailPage;
}
[NonAction]
public async Task InputDataProcess(HouseInfoInputSave input,DataStatus dataStatus = DataStatus.Init)
{
//房屋编码地址/坐标单独更新
var houseCode = input.houseCode.Adapt<BsHouseCode>();
await houseCode.UpdateIncludeAsync(new[] { nameof(BsHouseCode.Address), nameof(BsHouseCode.Lng), nameof(BsHouseCode.Lat) }, true);
//获取房屋详情实体,判断是新增还是更新
var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id);
//建档审核通过的房屋数据修改时对应的建档任务Task不处理
if (houseEntity.State != 6)
{
var houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
houseTask.HouseCodeId = input.houseCode.Id;
//任务没有暂存状态其他状态与HouseInfo的State一致
houseTask.Status = dataStatus == DataStatus.TempSaved ? (int)DataStatus.Saved : (int)dataStatus;
await houseTask.UpdateExcludeAsync(new string[] { nameof(BsHouseTask.TaskType) }, ignoreNullValues: true);
}
//判断房屋建档状态
//dataStatus == DataStatus.Saved 若是保存操作 则判断是新增/更新
//判断是新增/更新 根据传入参数dataStatus确定
input.houseInfo.StateDataStatus = dataStatus == DataStatus.Saved ? (houseEntity == null ? DataStatus.Saved : GetDataStatus(houseEntity.State)) : dataStatus;
var houseInfo = input.houseInfo.Adapt<BsHouseInfo>();
houseInfo.HouseCodeId = input.houseCode.Id;
if (houseEntity == null)
{
houseInfo.Id = Guid.NewGuid().ToString();
await houseInfo.InsertAsync();
}
else
{
houseInfo.Id = houseEntity.Id;
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
}
//审核操作则新增一条审核记录
if (dataStatus == DataStatus.Back || dataStatus == DataStatus.Passed)
{
var checkRecord = input.TaskCheckRecord.Adapt<BsHouseTaskCheckRecord>();
await checkRecord.InsertAsync();
}
}
private DataStatus GetDataStatus(int status)
{
return status switch
{
-1 => DataStatus.Back,
1 => DataStatus.TempSaved,
2 => DataStatus.Saved,
3 => DataStatus.Submited,
6 => DataStatus.Passed,
_ => DataStatus.Init,
};
}
}
}

View File

@@ -113,6 +113,12 @@ namespace Ewide.Application
public string Id { get; set; }
}
public class SubmitHouseTaskInput
{
[Required(ErrorMessage = "任务Id不能为空")]
public string TaskId { get; set; }
}
public class QueryHouseTaskInput : PageInputBase
{

View File

@@ -47,21 +47,35 @@ LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
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)
WHERE T.UserID=@UserID";
WHERE {0}";
var user = await _userManager.CheckUserAsync();
if (user == null) throw Oops.Oh("登录信息丢失");
var userRoles = await _userManager.GetUserRoleList();
var userOrg = await _userManager.GetUserOrgInfo();
var param = new DynamicParameters();
param.Add("UserID", user.Id);
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Count() > 0)
{
sql = String.Format(sql, " (T.Status !=3) AND T.UserID=@UserID ");
param.Add("UserID", user.Id);
}
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Count() > 0)
{
sql = String.Format(sql, " (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId ");
param.Add("ZoneId", userOrg.Id);
}
return await _dapperRepository.QueryPageDataDynamic(sql, input, param, filterFields: new string[] { "Type", "Address", "HouseCode" });
}
[HttpPost("/houseTask/submit")]
[UnitOfWork]
[AllowAnonymous]
public async Task Submit([Required] string taskId)
public async Task Submit([FromBody] SubmitHouseTaskInput input)
{
//获取任务实体
var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t => t.Id == taskId);
var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t => t.Id == input.TaskId);
if (houseTask == null) throw Oops.Oh("任务不存在");
houseTask.Status = 2;
houseTask.LastSubmitTime = DateTime.Now;

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application
{
public class HouseTaskCheckRecordInput
{
/// <summary>
/// 任务Id
/// </summary>
[Required(ErrorMessage = "任务参数有误")]
public string TaskId { get; set; }
/// <summary>
/// 通过3退回-1
/// </summary>
[Required(ErrorMessage = "审核结果不能为空")]
public int PassOrBack { get; set; }
public DataStatus PassOrBackDataStatus
{
get
{
return PassOrBack switch
{
-1 => DataStatus.Back,
1 => DataStatus.TempSaved,
2 => DataStatus.Saved,
3 => DataStatus.Submited,
6 => DataStatus.Passed,
_ => DataStatus.Init,
};
}
}
/// <summary>
/// 审核内容
/// </summary>
[Required(ErrorMessage = "审核内容不能为空")]
public string Content { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Application.Service.HouseSafety.HouseTaskCheckRecord.Dto
{
public class HouseTaskCheckRecordOutput
{
}
}

View File

@@ -1,4 +1,5 @@
export default {
houseInfoGetByTaskId: ['/houseInfo/getByTaskId', 'get'],
houseInfoSave:['houseInfo/save','post']
houseInfoSave: ['houseInfo/save', 'post'],
houseInfoSubmitToCheck: ['/houseInfo/submitToCheck', 'post']
}

View File

@@ -46,12 +46,12 @@
</a-col>
<a-col :span="24">
<a-form-model-item class="ant-row-flex" label="竣工验收备案" prop="houseInfo.completedRecord">
<a-form-model-item class="ant-row-flex" label="竣工验收备案" prop="houseInfo.completionRecord">
<a-upload
:custom-request="onFileUpload"
:file-list="form.houseInfo.completedRecord"
:file-list="form.houseInfo.completionRecord"
:showUploadList=" { showRemoveIcon: true, showDownloadIcon: true }"
@change="(data) => onFileChange(data, 'completedRecord')"
@change="(data) => onFileChange(data, 'completionRecord')"
@download="onFileDownload"
>
<a-button icon="upload" type="dashed">上传竣工验收备案</a-button>

View File

@@ -11,11 +11,42 @@
<div class="yo-form-page--bar-inner">
<span>
<!-- 可以在工具栏中增加其他控件(只能在一行内) -->
<a-form-model
:label-col="labelCol"
:model="form"
:rules="rules"
:wrapper-col="wrapperCol"
layout="inline"
ref="form"
v-if="param.record.patrolInfo.status == 3"
>
<a-form-model-item class="ant-row-flex" label="审核意见" prop="taskCheckRecord.content">
<a-textarea
auto-size
class="w-500"
placeholder="请输入审核意见"
v-model="form.taskCheckRecord.content"
/>
</a-form-model-item>
<a-form-model-item>
<a-button @click="onCheck(6)" type="primary">通过</a-button>
<a-button @click="onCheck(-1)" type="primary">退回</a-button>
</a-form-model-item>
</a-form-model>
<!-- ... -->
</span>
<span>
<a-button
@click="onSubmit('houseInfoSave')"
type="primary"
v-if="param.record.patrolInfo.status >=-1 && param.record.patrolInfo.status <3"
>保存</a-button>
<a-button
@click="onSubmitToCheck"
type="primary"
v-if="param.record.patrolInfo.status == 2"
>提交审核</a-button>
<a-button @click="closeContentWindow()">取消</a-button>
<a-button @click="onSubmit" type="primary">保存</a-button>
</span>
</div>
</container>
@@ -58,12 +89,10 @@
v-if="tab.show"
>
<component
:completed-year="completedYear"
:frame="self"
:id="id"
:is="tab.component"
:param="param"
@completedDateChanged="completedDateChanged"
ref="forms"
v-if="tab.component"
/>
@@ -80,7 +109,18 @@ export default {
data() {
return {
completedYear: '',
labelCol: { flex: '150px' },
wrapperCol: { flex: '1' },
form: {
taskCheckRecord: {
content: '',
},
},
rules: {
/* ... */
'taskCheckRecord.content': [{ required: true, message: '审核意见不能为空' }],
},
saving: false,
loading: true,
@@ -144,7 +184,25 @@ export default {
},
methods: {
async onSubmit() {
onCheck(result) {
this.$refs.form.validate((valid, err) => {
if (valid) {
var checkRecord = {
taskCheckRecord: {
taskId: this.param.taskId,
passOrBack: +result,
content: this.form.taskCheckRecord.content,
},
};
this.onSubmit('houseInfoSave', checkRecord);
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
} else {
console.log(err);
}
});
},
async onSubmit(api, append) {
let formData = {},
flag = true;
for (let i = 0; i < this.$refs.forms.length; i++) {
@@ -169,6 +227,13 @@ export default {
return;
}
if (append) {
formData = {
...formData,
...append,
};
}
/**
* 对表单提交进行处理
*/
@@ -182,11 +247,13 @@ export default {
this.saving = true;
this.$api.houseInfoSave(formData).finally(() => {
this.$api[api](formData).finally(() => {
this.saving = false;
});
},
onSubmitToCheck() {
this.onSubmit('houseInfoSubmitToCheck');
},
onTabChange(key) {
this.tabs.forEach((p, i) => {
p.active = i === key;
@@ -199,10 +266,6 @@ export default {
pane.show = show;
}
},
completedDateChanged(value) {
this.completedYear = value;
console.log('top-index' + value);
},
},
};
</script>

View File

@@ -0,0 +1,303 @@
<template>
<!--
普通查询表格
v 1.2
2021-04-30
Lufthafen
-->
<container>
<br />
<a-card :bordered="false">
<yo-table
:columns="columns"
:load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<Auth auth="houseTask:page" slot="query">
<!-- 此处添加查询表单控件 -->
<!-- ... -->
<a-form-model-item>
<a-cascader
:display-render="({ labels }) => labels.join(' - ')"
:field-names="{ label: 'name', value: 'code', children: 'children' }"
:options="options.areaTree"
class="w-400"
expand-trigger="hover"
placeholder="请选择所在区域"
v-model="query.areaCode"
/>
</a-form-model-item>
<a-form-model-item label="房屋性质">
<a-radio-group @change="onChangeQueryType" button-style="solid" v-model="query.type">
<a-radio-button value>全部</a-radio-button>
<a-radio-button
:key="item.code"
:value="item.code"
v-for="item in codes.type"
>{{item.value}}</a-radio-button>
</a-radio-group>
</a-form-model-item>
<a-form-model-item label="行业" v-if="query.type == 2">
<a-select class="w-150" placeholder="请选择行业" v-model="query.industry">
<a-select-option
:key="item.code"
:value="+item.code"
v-for="item in codes.industry"
>{{item.value}}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item label="地址">
<a-input placeholder="请输入地址" v-model="query.address" />
</a-form-model-item>
<a-form-model-item label="房屋唯一编码">
<a-input placeholder="请输入房屋唯一编码" v-model="query.houseCode" />
</a-form-model-item>
</Auth>
<!-- 格式化字段内容 -->
<!-- ... -->
<template slot="houseCode" slot-scope="text, record">
<span>{{`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${`000${record.no}`.slice(-3)}`}}</span>
</template>
<template slot="type" slot-scope="text, record">
<span>{{bindCodeValue(text, 'type') + (text === 2 ? `(${bindCodeValue(record.industry, 'industry')})` : '')}}</span>
</template>
<!-- 添加操作控件 -->
<span slot="action" slot-scope="text, record">
<yo-table-actions>
<Auth auth="houseInfo:getByTaskId">
<a
@click="openContentWindow({
title: '房屋表单',
path: 'business/house/info/form',
param: {
taskId:record.id
},
});"
>审核</a>
</Auth>
<!-- 可在此处添加其他操作控件 -->
<!-- ... -->
</yo-table-actions>
</span>
</yo-table>
</a-card>
</container>
</template>
<script>
/* 在此管理整个页面需要的接口名称 */
const api = {
page: 'houseTaskPage',
/* ... */
};
export default {
data() {
return {
api,
name: '',
/* 查询条件 */
query: {
type: '',
},
/* 表格字段 */
columns: [
{
title: '房屋编码',
dataIndex: 'houseCode',
sorter: true,
scopedSlots: { customRender: 'houseCode' },
width: 300,
},
{
title: '房屋性质及行业',
dataIndex: 'type',
sorter: true,
scopedSlots: { customRender: 'type' },
width: 150,
},
{
title: '地址',
dataIndex: 'address',
sorter: true,
},
{
title: '任务截止时间',
dataIndex: 'endTime',
sorter: true,
width: 150,
},
],
/* 字典编码储存格式 */
codes: {
type: [],
industry: [],
},
options: {
areaTree: [],
},
};
},
created() {
/** 按需加载字典编码 */
this.onLoadCodes();
this.onLoadAreaTree();
/** 根据权限添加操作列 */
const flag = this.$auth('houseInfo:getByTaskId');
if (flag) {
this.columns.push({
title: '操作',
width: '150px',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
});
}
},
methods: {
/**
* 必要的方法
* 传给yo-table以示意数据接口及其参数和返回的数据结构
*/
loadData(params) {
const query = this.$_.cloneDeep(this.query);
const searchInfo = this.$getSearchInfo({
query,
queryType: { type: '=', address: 'like', houseCode: 'like' },
});
if (query.areaCode) {
query.areaCode = query.areaCode[query.areaCode.length - 1];
}
return this.$api[api.page]({
...params,
// ...query,//通过searchInfo传递查询参数
searchInfo,
}).then((res) => {
return res.data;
});
},
/**
* 有查询功能时的必要方法
* 加载数据时初始化分页信息
*/
onQuery() {
this.$refs.table.onReloadData(true);
},
/**
* 有查询功能时的必要方法
* 重置查询条件
*/
onResetQuery() {
/** 在这里重置查询条件时,可对特殊的字段做保留处理 */
this.query = {
type: '',
};
this.onQuery();
},
/**
* 必要方法
* 重新列表数据
*/
onReloadData() {
this.$refs.table.onReloadData();
},
/**
* 必要方法
* 加载字典数据
* 如果不需要获取相应的字典数据,此方法内容可空
*/
onLoadCodes() {
this.$api
.sysDictTypeDropDowns({ code: ['dic_house_type', 'dic_house_industry'] })
.then(({ data: { dic_house_type, dic_house_industry } }) => {
this.codes.type = dic_house_type;
this.codes.industry = dic_house_industry;
});
},
/**
* 必要方法
* 绑定数据字典值
*/
bindCodeValue(code, name) {
const c = this.codes[name].find((p) => p.code == code);
if (c) {
return c.value;
}
return null;
},
/**
* 必要方法
* 从列表页调用窗口的打开方法
*/
onOpen(record) {
this.openContentWindow({
key: record ? record.id : 'business/house/code/form',
title: record ? '修改房屋编码' : '新增房屋编码',
subTitle:
record &&
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${`000${record.no}`.slice(-3)}`,
path: 'business/house/code/form',
param: {
record,
},
});
},
/**
* 必要方法
* 可以用做一系列操作的公共回调,此方法中会重新加载当前列表
*/
onResult(success, successMessage) {
if (success) {
this.$message.success(successMessage);
this.onReloadData();
}
},
/**
* 必要方法
* 删除时调用
*/
onDelete(record) {
this.$refs.table.onLoading();
this.$api[api.delete](record)
.then(({ success }) => {
this.onResult(success, '删除成功');
})
.finally(() => {
this.$refs.table.onLoaded();
});
},
onLoadAreaTree() {
return this.$api.getAreaTree().then(({ data }) => {
this.options.areaTree = data;
});
},
onChangeQueryType() {
if (this.query.type < 2 && this.query.hasOwnProperty('industry')) {
this.$delete(this.query, 'industry');
}
},
},
};
</script>