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

@@ -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>