| | |
| | | </view> |
| | | </template> |
| | | |
| | | <view v-if="item.showDesc" class="mt-2"> |
| | | <view v-if="item.inspResult === '2'" class="mt-2"> |
| | | <wd-input |
| | | v-model="item.inspDesc" |
| | | placeholder="请输入异常描述" |
| | |
| | | /> |
| | | <!-- 新增提交按钮 --> |
| | | <view class="flex justify-around mt-4"> |
| | | <wd-button type="primary" block size="large" v-if="inspSt.status === '0'" @click="handleClickRight">提交</wd-button> |
| | | <wd-button type="success" block size="large" v-if="isLeader() && inspSt.status === '1'" @click="handleComplete">确认完成</wd-button> |
| | | <wd-button type="primary" block size="large" v-if="inspSt.status === '0' || inspSt.status === '1'" @click="handleClickRight">提交</wd-button> |
| | | <!-- <wd-button type="success" block size="large" v-if="isLeader() && inspSt.status === '1'" @click="handleComplete">确认完成</wd-button>--> |
| | | </view> |
| | | </view> |
| | | </z-paging> |
| | |
| | | |
| | | <script setup lang="ts"> |
| | | import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' |
| | | import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' |
| | | import { isLeader, isLineOrRepair } from '@/utils/RoleUtils' |
| | | import { |
| | | getInspStRecordList, |
| | | getInspSt, |
| | |
| | | status: '', |
| | | inspUser: '', |
| | | specialNote: '', |
| | | runTimes: 0, |
| | | faultTimes: 0, |
| | | runTimes: undefined, |
| | | faultTimes: undefined, |
| | | }) |
| | | |
| | | const paging = ref(null) |
| | |
| | | // 修改时间格式为 YYYY-MM-DD HH:mm:ss |
| | | const now = new Date() |
| | | item.inspTime = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` |
| | | |
| | | if (item.inspResult === '2') { |
| | | item.showDesc = true |
| | | } else { |
| | | item.showDesc = false |
| | | item.inspDesc = '' |
| | | } |
| | | } |
| | | |
| | | const goBack = () => { |
| | |
| | | } |
| | | |
| | | function handleClickRight() { |
| | | if (isOperatorOrRepair()) { |
| | | |
| | | if (inspSt.status === '0') { |
| | | handleConfirm() |
| | | } else if (inspSt.status === '1') { |
| | | handleComplete() |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | inspSt.status = '0' |
| | | } |
| | | |
| | | updateInspectSt(inspSt) |
| | | .then((res: any) => { |
| | | toast.success('操作成功') |
| | |
| | | * 确认完成按钮点击事件 |
| | | */ |
| | | function handleComplete() { |
| | | if (!isLeader()) { |
| | | toast.info('无权限操作'); |
| | | return; |
| | | console.log('handleComplete', inspSt) |
| | | if (!inspSt.runTimes || !inspSt.faultTimes) { |
| | | message.alert('请填写运行次数和故障次数!') |
| | | return false |
| | | } |
| | | const now = new Date(); |
| | | const data: any = Object.assign( |
| | | {}, |
| | | { |
| | | id: inspSt.id, |
| | | runTimes: inspSt.runTimes, |
| | | faultTimes: inspSt.faultTimes, |
| | | status: '2', |
| | | verifyUser: userStore?.userInfo?.userId, |
| | | verifyTime: `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}` |