|
|
@ -8,7 +8,7 @@ import moment from "moment"; |
|
|
|
import Uploads from '$components/Uploads'; |
|
|
|
import IssueHandleModal from '../components/isuue-handle-mdal' |
|
|
|
import '../style.less' |
|
|
|
|
|
|
|
import { Func } from '$utils'; |
|
|
|
const { Panel } = Collapse; |
|
|
|
const ISSUEHANDLE_STATE = [1, 2, 3, 4, 5, 6, 7] |
|
|
|
const STATE_TEXT = { 1: '待制定计划', 2: '待审核', 3: '计划驳回', 4: '待维修', 5: '待验收', 6: '验收通过', 7: '验收不通过', } |
|
|
@ -18,7 +18,7 @@ const PatrolRecord = (props) => { |
|
|
|
const { patrolManage, issueHandle } = actions |
|
|
|
const [tableList, settableList] = useState([]) |
|
|
|
const [name, setName] = useState(''); |
|
|
|
const [curState, setCurState] = useState('null'); |
|
|
|
const [curState, setCurState] = useState('全部'); |
|
|
|
const format = 'YYYY-MM-DD HH:mm:ss' |
|
|
|
const times = [moment().subtract(70, 'years').format(format), moment().format(format)] |
|
|
|
const [search, setSearch] = useState({ name: null, time: [times[0], times[1]], state: 'null' }) |
|
|
@ -32,6 +32,7 @@ const PatrolRecord = (props) => { |
|
|
|
if (res.success) { |
|
|
|
settableList(name != null ? res.payload.data?.filter(v => |
|
|
|
(v.points.user.name.indexOf(name) != -1 || v.points.project.name.indexOf(name) != -1)) |
|
|
|
.filter(x => curState == '全部' || curState == renderOptionText(x?.patrolRecordIssueHandles[0]?.state)) |
|
|
|
.map(v => ({ ...v, key: v.id })) : res.payload.data?.map(v => ({ ...v, key: v.id }))) |
|
|
|
} |
|
|
|
}) |
|
|
@ -65,7 +66,7 @@ const PatrolRecord = (props) => { |
|
|
|
}; |
|
|
|
|
|
|
|
const renderOptionText = (currentState) => { |
|
|
|
let text = '查看' |
|
|
|
let text = '待制定计划' |
|
|
|
|
|
|
|
return STATE_TEXT[currentState] || text |
|
|
|
} |
|
|
@ -119,11 +120,11 @@ const PatrolRecord = (props) => { |
|
|
|
render: (text, record, index) => { |
|
|
|
const LEVELS_ = ['严重', '中度', '轻微']; |
|
|
|
const recordLevels = [] |
|
|
|
Object.keys(record?.points?.inspectContent).map(key => { |
|
|
|
record?.points?.inspectContent ? Object.keys(record?.points?.inspectContent).map(key => { |
|
|
|
recordLevels.push(record?.points?.inspectContent[key]?.level) |
|
|
|
}) |
|
|
|
}) : '' |
|
|
|
const level = LEVELS_.find(s => recordLevels.find(x => x == s)) |
|
|
|
return level; |
|
|
|
return level || '-'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
@ -143,39 +144,41 @@ const PatrolRecord = (props) => { |
|
|
|
key: 'operation', |
|
|
|
render: (text, record, index) => { |
|
|
|
const options = []; |
|
|
|
if (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0) { |
|
|
|
if (Func.isAuthorized('ZHIDINGJIHUA') && (!record?.patrolRecordIssueHandles || record?.patrolRecordIssueHandles?.length == 0)) { |
|
|
|
options.push(<IssueHandleModal |
|
|
|
editData={record} |
|
|
|
readOnly={false} |
|
|
|
key="edit" |
|
|
|
title="制定计划" |
|
|
|
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(1)}</a>} |
|
|
|
triggerRender={<a style={{ marginRight: 8 }}>制定计划</a>} |
|
|
|
user={user} |
|
|
|
onFinish={onFinish} />) |
|
|
|
} |
|
|
|
if (record?.patrolRecordIssueHandles[0]?.state == 2) { |
|
|
|
|
|
|
|
if (Func.isAuthorized('XIUGAIJIUHA') && (record?.patrolRecordIssueHandles[0]?.state == 3 || record?.patrolRecordIssueHandles[0]?.state == 2)) { |
|
|
|
options.push(<IssueHandleModal |
|
|
|
editData={record} |
|
|
|
readOnly={true} |
|
|
|
readOnly={false} |
|
|
|
key="edit" |
|
|
|
title="审核" |
|
|
|
triggerRender={<a style={{ marginRight: 6 }}>{renderOptionText(2)}</a>} |
|
|
|
title="修改计划" |
|
|
|
triggerRender={<a style={{ marginRight: 8 }}>修改计划</a>} |
|
|
|
user={user} |
|
|
|
onFinish={onFinish} />) |
|
|
|
} |
|
|
|
|
|
|
|
if (record?.patrolRecordIssueHandles[0]?.state == 3) { |
|
|
|
if (Func.isAuthorized('SHENHE') && record?.patrolRecordIssueHandles[0]?.state == 2) { |
|
|
|
options.push(<IssueHandleModal |
|
|
|
editData={record} |
|
|
|
readOnly={false} |
|
|
|
readOnly={true} |
|
|
|
key="edit" |
|
|
|
title="修改计划" |
|
|
|
triggerRender={<a style={{ marginRight: 6 }}>修改计划</a>} |
|
|
|
title="审核" |
|
|
|
triggerRender={<a style={{ marginRight: 8 }}>审核</a>} |
|
|
|
user={user} |
|
|
|
onFinish={onFinish} />) |
|
|
|
} |
|
|
|
|
|
|
|
options.push(<IssueHandleModal |
|
|
|
|
|
|
|
Func.isAuthorized('CHAKANXIANGQING') && options.push(<IssueHandleModal |
|
|
|
editData={record} |
|
|
|
readOnly={true} |
|
|
|
key="edit" |
|
|
@ -195,17 +198,15 @@ const PatrolRecord = (props) => { |
|
|
|
<Input style={{ width: 240, marginRight: 20 }} |
|
|
|
value={name} onChange={e => { setName(e.target.value) }} |
|
|
|
placeholder="请输入结构物名称或上报人" allowClear /> |
|
|
|
<Select style={{ width: 140, marginRight: 20 }} allowClear |
|
|
|
<Select |
|
|
|
value={curState} |
|
|
|
onChange={e => { setCurState(e) }} |
|
|
|
style={{ width: 140, marginRight: 20 }} |
|
|
|
options={[ |
|
|
|
{ value: 'null', label: '全部' }, |
|
|
|
{ value: 1, label: '待制定计划' }, |
|
|
|
{ value: 2, label: '待审核' }, |
|
|
|
{ value: 3, label: '计划驳回' }, |
|
|
|
{ value: 4, label: '待维修' }, |
|
|
|
{ value: 5, label: '待验收' }, |
|
|
|
{ value: 6, label: '验收通过' }, |
|
|
|
{ value: 7, label: '验收不通过' }, |
|
|
|
]} /> |
|
|
|
{ value: '全部', label: '全部' }, |
|
|
|
].concat(ISSUEHANDLE_STATE.map(s => { |
|
|
|
return { value: renderOptionText(s), label: renderOptionText(s) } |
|
|
|
}))} /> |
|
|
|
<Button type='primary' onClick={() => { queryData() }}>搜索</Button> |
|
|
|
</div> |
|
|
|
<Table |
|
|
@ -217,8 +218,6 @@ const PatrolRecord = (props) => { |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
|