Browse Source

修改服务记录解决者查看+后端clickhouse语法+query未定义问题+可用率计算问题

dev
zhaobing 2 years ago
parent
commit
9b93a73fd8
  1. 6
      api/app/lib/controllers/maintenancePlan/index.js
  2. 2
      web/client/src/sections/service/components/recordModal.jsx
  3. 10
      web/client/src/sections/service/containers/serviceRecord.jsx

6
api/app/lib/controllers/maintenancePlan/index.js

@ -3,10 +3,10 @@
//维护计划
async function getMaintenancePlan(ctx) {
const query = ctx.query
try {
const { models } = ctx.fs.dc
const { clickHouse } = ctx.app.fs
const query = ctx.query
//console.log('11121', query)
let resCount = await models.MaintenancePlan.count({
where: { type: query.type }
@ -27,10 +27,10 @@ async function getMaintenancePlan(ctx) {
const arrayUserId = []
res.rows.forEach((item) => { item.maintenancePlanExecuteUsers.forEach((item1) => { arrayUserId.push(item1.pepUserId) }) })
const arrayUserIdCopy = [...new Set(arrayUserId)]
const whereOption = '(' + arrayUserIdCopy.toString() + ')'
//(${ [...pepProjectIds].join(',') }, -1)
const userRes = await clickHouse.pepEmis.query(`
SELECT * FROM user
WHERE id in ${whereOption}
WHERE id IN (${[...arrayUserIdCopy].join(',')},-1)
`).toPromise()
//console.log('userRes', userRes)
//console.log('res.rows', res.rows)

2
web/client/src/sections/service/components/recordModal.jsx

@ -56,7 +56,7 @@ const okHandler=()=>{
>
<Form wrapperCol={{ span: 20 }}
initValues={{'name':recordRow?.sketch,'startTime':recordRow?.occurrenceTime,
'endTime':recordRow?.solvingTime,'settler':recordRow?.maintenanceRecordExecuteUsers.map((item)=>{return item.account}),'type':recordRow?.type,'record':recordRow?.record}}
'endTime':recordRow?.solvingTime,'settler':recordRow?.maintenanceRecordExecuteUsers.map((item)=>{return item.name}),'type':recordRow?.type,'record':recordRow?.record}}
getFormApi={formApi => FormApi.current = formApi}
labelPosition='left'
labelAlign='right'>

10
web/client/src/sections/service/containers/serviceRecord.jsx

@ -114,6 +114,7 @@ const Server = (props) => {
title: '解决者',
//width:20,
render:(record)=>{
// console.log('ressss',record)
return <span>
{record?.maintenanceRecordExecuteUsers.map((item)=>{
return item.name
@ -132,10 +133,11 @@ const Server = (props) => {
},
];
const onChangeDate=(e)=> {
console.log('zzzz',e[0],e[1])
setMode('')
setDateValue(e)
setStime(moment(dateValue[0]).format('YYYY-MM-DD HH:mm:ss'))
setEtime(moment(dateValue[1]).format('YYYY-MM-DD HH:mm:ss'))
setStime(moment(e[0]).format('YYYY-MM-DD HH:mm:ss'))
setEtime(moment(e[1]).format('YYYY-MM-DD HH:mm:ss'))
const query={
sTime, eTime
}
@ -178,7 +180,7 @@ const addHandler=()=>{
<Radio value={'year'}>全年</Radio>
</RadioGroup>
<DatePicker type="dateTimeRange"
onChange={e => onChangeDate(e)}
onChange={e => onChangeDate(e) }
density="compact"
style={{ width: 260 }}
value={dateValue}
@ -195,7 +197,7 @@ const addHandler=()=>{
<Button theme='solid' type='secondary' onClick={addHandler}>新增</Button>
<div style={{display:'flex',alignItems:'baseline',marginLeft:700}}>
<span >产生时间</span>
<DatePicker type="dateRange" insetInput style={{ width: 200,marginLeft:10 }} onChange={(e)=>{//console.log('1',e[0],e[1])
<DatePicker type="dateRange" insetInput style={{ width: 200,marginLeft:10 }} onChange={(e)=>{
setStartTime((e[0])+'');setEndTime(e[1]+'') }}
onClear={()=>{setStartTime(null);setEndTime(null);setCalculability('')}} />
<Button style={{ marginLeft:20 }} onClick={()=>{

Loading…
Cancel
Save