diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs index 560ba40..a99b541 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs @@ -40,7 +40,7 @@ namespace Ewide.Application.Service [HttpPost("/houseTask/page")] public async Task QueryPage([FromBody] QueryHouseTaskInput input) { - var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,HI.State FROM `bs_house_task` T + var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,IFNULL(HI.State,0) State FROM `bs_house_task` T LEFT JOIN bs_house_code HC ON T.HouseCodeId = HC.Id LEFT JOIN bs_house_info HI ON HI.HouseCodeId = T.HouseCodeId LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId @@ -56,7 +56,7 @@ WHERE {0}"; var param = new DynamicParameters(); if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Count() > 0) { - sql = String.Format(sql, " (T.Status !=3) AND T.UserID=@UserID "); + sql = String.Format(sql, " T.UserID=@UserID "); param.Add("UserID", user.Id); } @@ -66,7 +66,7 @@ WHERE {0}"; param.Add("ZoneId", userOrg.Id); } - return await _dapperRepository.QueryPageDataDynamic(sql, input, param, filterFields: new string[] { "Type", "Address", "HouseCode" }); + return await _dapperRepository.QueryPageDataDynamic(sql, input, param, filterFields: new string[] { "Type", "Address", "HouseCode", "Status","State" }); } [HttpPost("/houseTask/submit")] diff --git a/web-react/src/pages/business/house/info/form/index.jsx b/web-react/src/pages/business/house/info/form/index.jsx index dcd940b..5a2363d 100644 --- a/web-react/src/pages/business/house/info/form/index.jsx +++ b/web-react/src/pages/business/house/info/form/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { Form, Button, Input, Descriptions, message as Message, Spin, Tabs } from 'antd' +import { Form, Button, Input, Descriptions, message as Message, Modal, Spin, Tabs } from 'antd' import { merge, isEqual } from 'lodash' import { AntIcon, ComponentDynamic, Container } from 'components' import { api } from 'common/api' @@ -46,6 +46,23 @@ const tabs = [ show: true, }, ] +const actions = { + save: { + action: 'houseInfoSave', + remark: '保存', + after: 'reload', + }, + submit: { + action: 'houseInfoSubmitToCheck', + remark: '提交', + after: 'close', + }, + check: { + action: 'houseInfoSave', + remark: '审核', + after: 'close', + }, +} export default class index extends Component { state = { @@ -89,22 +106,43 @@ export default class index extends Component { } } + async onSave() { + await this.onPostData(actions.save) + } + + async onSubmit() { + Modal.confirm({ + content: '确认提交审核吗?', + onOk: () => { + this.onPostData(actions.submit) + }, + onCancel: () => {}, + }) + } + async onCheck(pass_or_back) { const form = this.checkForm.current const valid = await form.validateFields() - if (valid) { - var checkRecord = { - taskCheckRecord: { - taskId: this.props.param.taskId, - passOrBack: +pass_or_back, - content: form.getFieldValue(['taskCheckRecord', 'content']), - }, - } - await this.onSubmit('houseInfoSave', checkRecord) - } + + Modal.confirm({ + content: '审核结果即将提交,请确认', + onOk: () => { + if (valid) { + var checkRecord = { + taskCheckRecord: { + taskId: this.props.param.taskId, + passOrBack: +pass_or_back, + content: form.getFieldValue(['taskCheckRecord', 'content']), + }, + } + this.onPostData(actions.check, checkRecord) + } + }, + onCancel: () => {}, + }) } - async onSubmit(action, append) { + async onPostData(action, append) { for (const child of this.children) { try { const data = await child.getData() @@ -133,12 +171,28 @@ export default class index extends Component { console.log(this.formData) this.setState({ saving: true }) - api[action](this.formData) - .then(({ data }) => {}) - .catch(() => {}) - .finally(() => { + if (action) { + try { + const { success } = await api[action.action](this.formData) + if (success) { + Message.success(action.remark + '成功') + this.setState({ saving: false }) + if (this.props.param.table) { + this.props.param.table.current.onReloadData() + } + switch (action.after) { + case 'close': + window.closeContentWindow() + break + default: + this.componentDidMount() + break + } + } + } finally { this.setState({ saving: false }) - }) + } + } // setTimeout(() => { // Message.success('提交成功') @@ -200,16 +254,13 @@ export default class index extends Component { disabled={saveDisabled} loading={saving} type="primary" - onClick={() => this.onSubmit('houseInfoSave')} + onClick={() => this.onSave()} > 保存 )} {this.state.taskStatus == 2 && ( - )} diff --git a/web-react/src/pages/business/house/task/check/index.jsx b/web-react/src/pages/business/house/task/check/index.jsx index a03fb32..aef209a 100644 --- a/web-react/src/pages/business/house/task/check/index.jsx +++ b/web-react/src/pages/business/house/task/check/index.jsx @@ -6,6 +6,7 @@ import auth from 'components/authorized/handler' import { isEqual } from 'lodash' import getDictData from 'util/dic' import { toCamelCase } from 'util/format' +import { getSearchInfo } from 'util/query' /** * 注释段[\/**\/]为必须要改 @@ -27,6 +28,10 @@ const authName = 'houseTask' export default class index extends Component { state = { codes: { + status: [ + { code: 3, value: '审核中' }, + { code: 6, value: '审核通过' }, + ], houseType: [], houseIndustry: [], }, @@ -78,6 +83,13 @@ export default class index extends Component { sorter: true, width: 150, }, + { + title: '审核状态', + dataIndex: 'status', + sorter: true, + width: 100, + render: text => this.bindCodeValue(text, 'status'), + }, ] /** @@ -97,7 +109,9 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(record.id)}>审核 + this.onOpen(record.id)}> + {record.state === 3 ? `审核` : `查看`} + ), @@ -125,7 +139,7 @@ export default class index extends Component { const { onLoading, onLoadData } = this.table.current onLoading() getDictData('house_type', 'house_industry').then(codes => { - this.setState({ codes }, () => { + this.setState({ codes: { ...this.state.codes, ...codes } }, () => { onLoadData() }) }) @@ -139,9 +153,20 @@ export default class index extends Component { * @returns */ loadData = async (params, query) => { + const searchInfo = getSearchInfo({ + query, + queryType: { + type: '=', + industry: '=', + address: 'like', + houseCode: 'like', + status: '=', + }, + }) + const { data } = await apiAction.page({ ...params, - ...query, + searchInfo, }) return data } @@ -175,6 +200,7 @@ export default class index extends Component { path: 'business/house/info/form', param: { taskId, + table: this.table, }, }) } @@ -218,6 +244,7 @@ export default class index extends Component { columns={this.columns} queryInitialValues={{ type: '', + status: '', }} onQueryChange={values => { if (values.hasOwnProperty('type')) { @@ -257,6 +284,16 @@ export default class index extends Component { + + + 全部 + {codes.status.map(item => ( + + {item.value} + + ))} + + } /> diff --git a/web-react/src/pages/business/house/task/index.jsx b/web-react/src/pages/business/house/task/index.jsx index 367e675..635eded 100644 --- a/web-react/src/pages/business/house/task/index.jsx +++ b/web-react/src/pages/business/house/task/index.jsx @@ -31,7 +31,6 @@ export default class index extends Component { status: [ { code: -1, value: '审核退回' }, { code: 0, value: '待处理' }, - { code: null, value: '待处理' }, { code: 1, value: '暂存' }, { code: 2, value: '待提交' }, { code: 3, value: '审核中' }, @@ -169,6 +168,7 @@ export default class index extends Component { industry: '=', address: 'like', houseCode: 'like', + state: '=', }, }) @@ -208,6 +208,7 @@ export default class index extends Component { path: 'business/house/info/form', param: { taskId, + table: this.table, }, }) } @@ -251,6 +252,7 @@ export default class index extends Component { columns={this.columns} queryInitialValues={{ type: '', + state: 0, }} onQueryChange={values => { if (values.hasOwnProperty('type')) { @@ -290,6 +292,16 @@ export default class index extends Component { + + + } />