|
|
@@ -36,6 +36,11 @@
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
import {useRouter} from "vue-router";
|
|
|
import { WarningFilled } from '@element-plus/icons-vue'
|
|
|
+import {
|
|
|
+ PressureTaskOrderTaskStatus
|
|
|
+} from '@/utils/constants'
|
|
|
+import {PipeTaskOrderOrderItemVO} from "@/api/pressure2/pipetaskorder";
|
|
|
+import {useUserStore} from "@/store/modules/user";
|
|
|
|
|
|
interface ReportItem {
|
|
|
id: string
|
|
|
@@ -52,7 +57,7 @@ const props = defineProps<{
|
|
|
}>()
|
|
|
|
|
|
const PartTypeList = getStrDictOptions(DICT_TYPE.PRESSURE2_BOILER_PART_TYPE)
|
|
|
-
|
|
|
+const userStore = useUserStore()
|
|
|
const getTypeName = (type: string) => {
|
|
|
const item = PartTypeList.find(item => item.value === type)
|
|
|
return item ? item.label : ''
|
|
|
@@ -82,12 +87,40 @@ const handleClick = (row, item: ReportItem) => {
|
|
|
if (row.isClaim === false) {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ if (!canCheckInput(row)){
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //判断报告编制时是否有结束检验日期
|
|
|
+ if (row.taskStatus >= PressureTaskOrderTaskStatus.REPORT_INPUT){
|
|
|
+ if (!row.endCheckDate) {
|
|
|
+ ElMessage.error('请添加结束检验时间再进行编制!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
localStorage.setItem('activePipeDetailItemId', item.id)
|
|
|
router.push({
|
|
|
name: 'PipeCheckerTaskDetail',
|
|
|
query: {id: row.id, type: 'PipeMyTask'},
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+// 判断是否可以检验录入:当前用户是检验员或主检人
|
|
|
+const canCheckInput = (row: PipeTaskOrderOrderItemVO) => {
|
|
|
+ const userId = userStore.user.id
|
|
|
+ // 检查是否是主检人
|
|
|
+ if (row.mainCheckerUser && row.mainCheckerUser.id === userId) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ // 检查是否是检验员
|
|
|
+ if (row.checkUsers && row.checkUsers.length > 0) {
|
|
|
+ return row.checkUsers.some(user => user.id === userId)
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|