Browse Source

修改bug+脚本

dev
zhaobing 2 years ago
parent
commit
b1b9b9ed34
  1. 4
      api/app/lib/controllers/maintenancePlan/index.js
  2. 2
      api/app/lib/controllers/record/index.js
  3. 2
      api/app/lib/models/maintenance_plan.js
  4. 2
      script/0.26/schema/2.update_maintenance_plan.sql
  5. 2
      web/client/src/sections/service/components/cycAddmodal.jsx
  6. 4
      web/client/src/sections/service/components/temporyModal.jsx
  7. 8
      web/client/src/sections/service/containers/cyclePlan.jsx
  8. 6
      web/client/src/sections/service/containers/serviceRecord.jsx
  9. 6
      web/client/src/sections/service/containers/temporaryResponse.jsx

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

@ -46,7 +46,7 @@ async function getMaintenancePlan(ctx) {
state: item.state, state: item.state,
maintenancePlanExecuteUsers: maintenancePlanExecuteUsers:
item.maintenancePlanExecuteUsers.map((item1) => { item.maintenancePlanExecuteUsers.map((item1) => {
const nameArr = userRes.filter((ac) => { return ac.id == item1.pepUserId })[0] const nameArr = userRes.find((ac) => { return ac.id == item1.pepUserId })
return { return {
id: item1.id, id: item1.id,
maintenancePlanId: item1.maintenancePlanId, maintenancePlanId: item1.maintenancePlanId,
@ -99,10 +99,10 @@ async function delMaintenancePlan(ctx) {
} }
async function editMaintenancePlan(ctx) { async function editMaintenancePlan(ctx) {
const data = ctx.request.body
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const { models } = ctx.fs.dc const { models } = ctx.fs.dc
const data = ctx.request.body
//console.log('data1', data) //console.log('data1', data)
//存在id为编辑,否则是添加 //存在id为编辑,否则是添加
if (data.id) { if (data.id) {

2
api/app/lib/controllers/record/index.js

@ -54,7 +54,7 @@ async function getRecord(ctx) {
type: item.type, type: item.type,
maintenanceRecordExecuteUsers: maintenanceRecordExecuteUsers:
item.maintenanceRecordExecuteUsers.map((item1) => { item.maintenanceRecordExecuteUsers.map((item1) => {
const userArr = userRes.filter((ac) => { return ac.id == item1.pepUserId })[0] const userArr = userRes.find((ac) => { return ac.id == item1.pepUserId })
return { return {
id: item1.id, id: item1.id,
maintenanceRecordId: item1.maintenanceRecordId, maintenanceRecordId: item1.maintenanceRecordId,

2
api/app/lib/models/maintenance_plan.js

@ -72,7 +72,7 @@ module.exports = dc => {
}, },
state: { state: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "完成状态 unfinished 未完成 / underway 进行中 / completed 已完成 / suspend 挂起暂停 / inspected 已检查", comment: "完成状态 unfinished 未完成 / underway 进行中 / completed 已完成 / suspend 挂起暂停 / inspected 已检查",
primaryKey: false, primaryKey: false,

2
script/0.26/schema/2.update_maintenance_plan.sql

@ -0,0 +1,2 @@
alter table public.maintenance_plan
alter column state drop not null;

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

@ -70,7 +70,7 @@ const okHandler=()=>{
</Form.Select> </Form.Select>
<Form.TextArea label='备注' field='notes' placeholder='故障发生原因及解决方案'></Form.TextArea> <Form.TextArea label='备注' field='notes' placeholder='故障发生原因及解决方案'></Form.TextArea>
<Form.DatePicker label='计划完成时间:' field='planTime' rules={[{ required: true, message: '请选择计划完成时间' },]}></Form.DatePicker> <Form.DatePicker label='计划完成时间:' field='planTime' rules={[{ required: true, message: '请选择计划完成时间' },]}></Form.DatePicker>
<Form.DatePicker label='实际完成时间:' field='realityTime' rules={[{ required: true, message: '请选择实际完成时间' },]}></Form.DatePicker> <Form.DatePicker label='实际完成时间:' field='realityTime'></Form.DatePicker>
</Form> </Form>
</Modal> </Modal>

4
web/client/src/sections/service/components/temporyModal.jsx

@ -64,7 +64,7 @@ const okHandler=()=>{
})} })}
</Form.Select.OptGroup> )})} </Form.Select.OptGroup> )})}
</Form.Select> </Form.Select>
<Form.Input field='reason' label='操作原因' maxLength={30} rules={[{ required: true, message: '请输入操作原因' }]}></Form.Input> <Form.Input field='reason' label='操作原因' maxLength={50} rules={[{ required: true, message: '请输入操作原因' }]}></Form.Input>
<Form.Select label='状态'style={{ width: 200 }} field='status'> <Form.Select label='状态'style={{ width: 200 }} field='status'>
<Form.Select.Option value='未完成'>未完成</Form.Select.Option> <Form.Select.Option value='未完成'>未完成</Form.Select.Option>
@ -74,7 +74,7 @@ const okHandler=()=>{
</Form.Select> </Form.Select>
<Form.TextArea label='备注' field='notes' placeholder='故障发生原因及解决方案'></Form.TextArea> <Form.TextArea label='备注' field='notes' placeholder='故障发生原因及解决方案'></Form.TextArea>
<Form.DatePicker label='计划完成时间:' field='planTime' rules={[{ required: true, message: '请选择计划完成时间' }]}></Form.DatePicker> <Form.DatePicker label='计划完成时间:' field='planTime' rules={[{ required: true, message: '请选择计划完成时间' }]}></Form.DatePicker>
<Form.DatePicker label='实际完成时间:' field='realityTime' rules={[{ required: true, message: '请选择实际完成时间' }]}></Form.DatePicker> <Form.DatePicker label='实际完成时间:' field='realityTime' ></Form.DatePicker>
</Form> </Form>
</Modal> </Modal>

8
web/client/src/sections/service/containers/cyclePlan.jsx

@ -93,13 +93,13 @@ const Server = (props) => {
{ {
title: '计划完成时间', title: '计划完成时间',
render:(record)=>{ render:(record)=>{
return <span>{moment(record.planFinishTime).format('YYYY-MM-DD HH:mm:ss')}</span> return <span>{moment(record.planFinishTime).format('YYYY-MM-DD')}</span>
}, },
}, },
{ {
title: '实际完成时间', title: '实际完成时间',
render:(record)=>{ render:(record)=>{
return <span>{moment(record.actualFinishTime).format('YYYY-MM-DD HH:mm:ss')}</span> return <span>{moment(record.actualFinishTime).format('YYYY-MM-DD')}</span>
}, },
}, },
{ {
@ -116,7 +116,7 @@ const Server = (props) => {
<div style={{background: '#FFFFFF', margin: '8px 12px', padding: '20px 20px 0px 20px'}}> <div style={{background: '#FFFFFF', margin: '8px 12px', padding: '20px 20px 0px 20px'}}>
<div style={{marginBottom:20}}> <div style={{marginBottom:20}}>
<Button theme='solid' type='secondary' onClick={()=>{setAddVis(true)}}>新增</Button> <Button theme='solid' type='secondary' onClick={()=>{setAddVis(true)}}>新增</Button>
<Button theme='solid' type='secondary' style={{marginLeft:50}}>导入</Button> {/* <Button theme='solid' type='secondary' style={{marginLeft:50}}>导入</Button> */}
</div> </div>
<div> <div>
<Table columns={columns} dataSource={cycPlan} pagination={false}></Table> <Table columns={columns} dataSource={cycPlan} pagination={false}></Table>
@ -135,7 +135,7 @@ const Server = (props) => {
setPageIndex(pageIndex) setPageIndex(pageIndex)
setPageSize(pageSize) setPageSize(pageSize)
const query={ const query={
pageIndex,pageSize,type:'temp',msg:'获取周期性计划' pageIndex,pageSize,type:'period',msg:'获取周期性计划'
} }
getCycPlan(query) getCycPlan(query)
}}></Pagination> }}></Pagination>

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

@ -180,11 +180,11 @@ const addHandler=()=>{
<Button theme='solid' type='secondary' onClick={addHandler}>新增</Button> <Button theme='solid' type='secondary' onClick={addHandler}>新增</Button>
<div style={{display:'flex',alignItems:'baseline',marginLeft:700}}> <div style={{display:'flex',alignItems:'baseline',marginLeft:700}}>
<span >产生时间</span> <span >产生时间</span>
<DatePicker type="dateRange" insetInput style={{ width: 200,marginLeft:10 }} onChange={(e)=>{ <DatePicker type="dateRange" insetInput style={{ width: 280,marginLeft:10 }} onChange={(e)=>{
setStartTime((e[0])+'');setEndTime(e[1]+'') }} setStartTime((e[0])+'');setEndTime(e[1]+'') }}
onClear={()=>{setStartTime(null);setEndTime(null);setCalculability('')}} /> onClear={()=>{setStartTime(null);setEndTime(null)}} />
<Button style={{ marginLeft:20 }} onClick={()=>{ <Button style={{ marginLeft:20 }} onClick={()=>{
getRecordList({ startTime,endTime}); getRecordList({ startTime,endTime,pageIndex,pageSize});
//console.log('setStartTime',startTime,'setEndTime',endTime) //console.log('setStartTime',startTime,'setEndTime',endTime)
}}>查询</Button> }}>查询</Button>
</div> </div>

6
web/client/src/sections/service/containers/temporaryResponse.jsx

@ -57,7 +57,7 @@ const SetControl = (props) => {
// console.log('record.id',record.id,'maintenancePlanExecuteUsersId',record.maintenancePlanExecuteUsers.map((item)=>{return item.pepUserId})) // console.log('record.id',record.id,'maintenancePlanExecuteUsersId',record.maintenancePlanExecuteUsers.map((item)=>{return item.pepUserId}))
const query={ const query={
responseId:record.id, responseId:record.id,
msg:'删除周期性计划' msg:'删除临时响应'
} }
//console.log('service',response) //console.log('service',response)
dispatch(service.delMaintenancePlan(query)).then((res)=>{ dispatch(service.delMaintenancePlan(query)).then((res)=>{
@ -97,13 +97,13 @@ const SetControl = (props) => {
{ {
title: '计划完成时间', title: '计划完成时间',
render:(record)=>{ render:(record)=>{
return <span>{moment(record.planFinishTime).format('YYYY-MM-DD HH:mm:ss')}</span> return <span>{moment(record.planFinishTime).format('YYYY-MM-DD')}</span>
}, },
}, },
{ {
title: '实际完成时间', title: '实际完成时间',
render:(record)=>{ render:(record)=>{
return <span>{moment(record.actualFinishTime).format('YYYY-MM-DD HH:mm:ss')}</span> return <span>{moment(record.actualFinishTime).format('YYYY-MM-DD')}</span>
}, },
}, },

Loading…
Cancel
Save