diff --git a/api/app/lib/controllers/resourceConsumption/index.js b/api/app/lib/controllers/resourceConsumption/index.js index cc0995d..6bf41bc 100644 --- a/api/app/lib/controllers/resourceConsumption/index.js +++ b/api/app/lib/controllers/resourceConsumption/index.js @@ -5,7 +5,7 @@ function getApproveList (opts) { return async function (ctx, next) { const models = ctx.fs.dc.models; - const { page, limit, applyAt, approveState, resourceName, applyBy, applyById } = ctx.query; + const { page, limit, applyAt, approveState, resourceName, applyBy, applyById, state } = ctx.query; let errMsg = { message: '获取消费审批列表失败' } try { @@ -16,11 +16,11 @@ function getApproveList (opts) { distinct: true, include: [{ model: models.User, - as:'applyUser', + as: 'applyUser', attributes: ['id', 'name'] - },{ + }, { model: models.User, - as:'approveUser', + as: 'approveUser', attributes: ['id', 'name'] },] } @@ -45,6 +45,19 @@ function getApproveList (opts) { option.where.approveState = approveState } + if (state == 1) { + option.where.approveState = '已审批' + option.where.token = { $ne: null } + } + if (state == 2) { + option.where.approveState = '已审批' + option.where.token = null + option.where.approveRemarks = { $ne: null } + } + if (state == 3) { + option.where.approveState = '审批中' + } + if (applyAt) { option.where.applyAt = { $between: [ diff --git a/web/client/src/sections/resourceConsumption/containers/myApplication.js b/web/client/src/sections/resourceConsumption/containers/myApplication.js index 2454d2d..ba783de 100644 --- a/web/client/src/sections/resourceConsumption/containers/myApplication.js +++ b/web/client/src/sections/resourceConsumption/containers/myApplication.js @@ -4,7 +4,7 @@ import moment from 'moment'; import ApproveModal from '../components/approveModal'; -import { Tabs, Form, Input, DatePicker, Button, Table } from 'antd'; +import { Tabs, Form, Input, DatePicker, Button, Table, Select } from 'antd'; import { v1 } from 'uuid'; @@ -84,15 +84,28 @@ function MyApplication ({ loading, clientHeight, actions, dispatch, user }) { setFormData({ ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) resourceData({ limit: 10, page: 0, ...v, applyAt: v.applyAt ? moment(v.applyAt).format('YYYY-MM-DD HH:mm:ss') : "" }) setQuery({ limit: 10, page: 0 }); - console.log(v); }} autoComplete="off" >