This commit is contained in:
2021-06-29 22:01:28 +08:00
4 changed files with 129 additions and 29 deletions

View File

@@ -40,7 +40,7 @@ namespace Ewide.Application.Service
[HttpPost("/houseTask/page")]
public async Task<dynamic> 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")]

View File

@@ -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()}
>
保存
</Button>
)}
{this.state.taskStatus == 2 && (
<Button
type="primary"
onClick={() => this.onSubmit('houseInfoSubmitToCheck')}
>
<Button type="primary" onClick={() => this.onSubmit()}>
提交审核
</Button>
)}

View File

@@ -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) => (
<QueryTableActions>
<Auth auth={{ houseInfo: 'getByTaskId' }}>
<a onClick={() => this.onOpen(record.id)}>审核</a>
<a onClick={() => this.onOpen(record.id)}>
{record.state === 3 ? `审核` : `查看`}
</a>
</Auth>
</QueryTableActions>
),
@@ -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 {
<Form.Item label="房屋唯一编码" name="houseCode">
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
</Form.Item>
<Form.Item label="审核状态" name="status">
<Radio.Group buttonStyle="solid">
<Radio.Button value="">全部</Radio.Button>
{codes.status.map(item => (
<Radio.Button key={item.code} value={item.code}>
{item.value}
</Radio.Button>
))}
</Radio.Group>
</Form.Item>
</Auth>
}
/>

View File

@@ -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 {
<Form.Item label="房屋唯一编码" name="houseCode">
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
</Form.Item>
<Form.Item label="建档状态" name="state">
<Select allowClear className="w-150" placeholder="建档状态">
<Select.Option value="">全部</Select.Option>
{codes.status.map(item => (
<Select.Option key={item.code} value={item.code}>
{item.value}
</Select.Option>
))}
</Select>
</Form.Item>
</Auth>
}
/>