| | |
| | | refresh: '刷新', |
| | | remove_filter: 'Remove this filter', |
| | | remove_all_filters: '移除所有', |
| | | remove: 'Remove', |
| | | remove: '移除', |
| | | save: '保存', |
| | | search: '搜索', |
| | | select_all: '全部选中', |
| | |
| | | result: 'Contacts import complete. Imported %{success} success, with %{error} errors', |
| | | }, |
| | | loadMore: 'Load More Data', |
| | | complete: 'Complete', |
| | | }, |
| | | msg: { |
| | | confirm: { |
| | |
| | | result: '导入完成。已导入 %{success} 成功, 和 %{error} 失败', |
| | | }, |
| | | loadMore: '加载更多', |
| | | complete: '完成', |
| | | }, |
| | | msg: { |
| | | confirm: { |
| | |
| | | DeleteButton, |
| | | FunctionField, |
| | | Pagination, |
| | | useNotify, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Button, Chip } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | |
| | | const BusList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const notify = useNotify(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | const onCancel = (busId) => { |
| | | console.log(busId); |
| | | |
| | | request.get("/bus/cancel/" + busId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | |
| | | <TextField source="memo" label="common.field.memo" sortable={false} emptyText="-" /> |
| | | <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( |
| | | (record.busSts === 15 || true) && ( |
| | | // <DeleteButton label="" sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | // <Button |
| | | // size="small" |
| | | // color="error" |
| | | // startIcon={<CancelIcon />} |
| | | // sx={{ padding: '1px', fontSize: '.75rem' }} |
| | | // onClick={(event) => { |
| | | // event.stopPropagation(); |
| | | // onCancel(record); |
| | | // }} |
| | | // > |
| | | // {translate('ra.action.cancel')} |
| | | // </Button> |
| | | <ConfirmButton |
| | | label="ra.action.cancel" |
| | | size="small" |
| | |
| | | import * as Common from '@/utils/common'; |
| | | import TaskListAside from "./TaskListAside"; |
| | | import { getTaskStsChipColor } from '@/utils/color-util'; |
| | | import ConfirmButton from "../components/ConfirmButton"; |
| | | import ClearIcon from '@mui/icons-material/Clear'; |
| | | import CheckIcon from '@mui/icons-material/Check'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | const onComplete = (taskId) => { |
| | | request.get("/task/complete/" + taskId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const onCancel = (taskId) => { |
| | | request.get("/task/cancel/" + taskId).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | notify(msg || 'common.response.success', { type: 'success', messageArgs: { _: msg } }); |
| | | } else { |
| | | notify(msg || 'common.response.fail', { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | <FunctionField label="common.field.opt" cellClassName="opt" render={record => ( |
| | | (record.taskSts === 15 || true) && ( |
| | | <> |
| | | <ConfirmButton |
| | | label="common.action.complete" |
| | | size="small" |
| | | color="primary" |
| | | startIcon={<CheckIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '2px' |
| | | }, |
| | | mr: 1 |
| | | }} |
| | | data={record.seqNum} |
| | | onConfirm={() => { |
| | | onComplete(record.id); |
| | | }} |
| | | /> |
| | | <ConfirmButton |
| | | label="ra.action.cancel" |
| | | size="small" |
| | | color="error" |
| | | startIcon={<ClearIcon />} |
| | | sx={{ |
| | | padding: '1px', |
| | | fontSize: '.75rem', |
| | | '& .MuiButton-startIcon': { |
| | | marginRight: '1.5px' |
| | | }, |
| | | }} |
| | | data={record.seqNum} |
| | | onConfirm={() => { |
| | | onCancel(record.id); |
| | | }} |
| | | /> |
| | | </> |
| | | ) |
| | | )} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <TaskCreate |
| | |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | |
| | | import com.zy.acs.manager.manager.entity.Bus; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.BusStsType; |
| | | import com.zy.acs.manager.manager.enums.TaskStsType; |
| | | import com.zy.acs.manager.manager.service.BusService; |
| | | import com.zy.acs.manager.manager.service.LocService; |
| | | import com.zy.acs.manager.manager.service.StaService; |
| | |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | ExcelUtil.build(ExcelUtil.create(busService.list(), Bus.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:bus:update')") |
| | | @OperationLog("Cancel Bus") |
| | | @GetMapping("/bus/cancel/{id}") |
| | | @Transactional |
| | | public R cancel(@PathVariable Long id) { |
| | | Bus bus = busService.getById(id); |
| | | if (null == bus) { |
| | | return R.error("Cancel Fail"); |
| | | } |
| | | if (!bus.getBusStsEl().equals(BusStsType.RECEIVE.toString())) { |
| | | return R.error("Cancel Fail"); |
| | | } |
| | | List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getBusId, bus.getId()) |
| | | .in(Task::getTaskSts, TaskStsType.INIT.val(), TaskStsType.WAITING.val())); |
| | | if (!Cools.isEmpty(taskList)) { |
| | | for (Task task : taskList) { |
| | | taskService.cancel(task.getId(), getLoginUserId()); |
| | | } |
| | | } |
| | | bus.setBusSts(BusStsType.CANCEL.val()); |
| | | bus.setUpdateTime(new Date()); |
| | | bus.setUpdateBy(getLoginUserId()); |
| | | if (!busService.updateById(bus)) { |
| | | return R.error("Cancel Fail"); |
| | | } |
| | | |
| | | return R.ok("Cancel Success"); |
| | | } |
| | | |
| | | } |
| | |
| | | ExcelUtil.build(ExcelUtil.create(taskService.list(), Task.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @OperationLog("Complete Task") |
| | | @GetMapping("/task/complete/{id}") |
| | | public R complete(@PathVariable Long id) { |
| | | return taskService.complete(id, getLoginUserId()) ? R.ok("Complete Success") : R.error("Complete Fail"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @OperationLog("Cancel Task") |
| | | @GetMapping("/task/cancel/{id}") |
| | | public R cancel(@PathVariable Long id) { |
| | | return taskService.cancel(id, getLoginUserId()) ? R.ok("Cancel Success") : R.error("Cancel Fail"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "冻结"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | |
| | | public String getBusStsEl(){ |
| | | BusStsService service = SpringUtils.getBean(BusStsService.class); |
| | | BusSts busSts = service.getById(this.busSts); |
| | | if (!Cools.isEmpty(busSts)){ |
| | | return String.valueOf(busSts.getUuid()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | |
| | | |
| | | List<Map<String, Object>> selectStatByLastSevenDays(); |
| | | |
| | | Boolean complete(Long taskId, Long userId); |
| | | |
| | | Boolean cancel(Long taskId, Long userId); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.acs.framework.common.BaseRes; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.common.exception.BusinessException; |
| | | import com.zy.acs.manager.manager.entity.FuncSta; |
| | | import com.zy.acs.manager.manager.entity.Loc; |
| | |
| | | return this.baseMapper.selectStatByLastSevenDays(); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean complete(Long taskId, Long userId) { |
| | | Task task = this.getById(taskId); |
| | | if (null == task) { |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | task.setTaskSts(TaskStsType.COMPLETE.val()); |
| | | task.setUpdateTime(new Date()); |
| | | task.setUpdateBy(userId); |
| | | if (!this.updateById(task)) { |
| | | throw new CoolException(BaseRes.ERROR); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean cancel(Long taskId, Long userId) { |
| | | Task task = this.getById(taskId); |
| | | if (null == task) { |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | task.setTaskSts(TaskStsType.CANCEL.val()); |
| | | task.setUpdateTime(new Date()); |
| | | task.setUpdateBy(userId); |
| | | if (!this.updateById(task)) { |
| | | throw new CoolException(BaseRes.ERROR); |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | |
| | | } |