| | |
| | | <el-button link |
| | | type="primary" |
| | | size="small" |
| | | :disabled="scope.row.isRectify" |
| | | @click="openForm('edit2', scope.row)">整改</el-button> |
| | | <el-button link |
| | | type="primary" |
| | |
| | | prop="createUser"> |
| | | <el-select v-model="form.createUser" |
| | | placeholder="请选择" |
| | | @change="handleChange" |
| | | disabled |
| | | clearable> |
| | | <el-option v-for="item in userList" |
| | | :key="item.userId" |
| | |
| | | <el-form-item label="上报时间:" |
| | | prop="createTime"> |
| | | <el-date-picker style="width: 100%" |
| | | readonly |
| | | disabled |
| | | v-model="form.createTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" /> |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" /> |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div v-if="operationType === 'edit2' || operationType === 'edit3'" |
| | | class="classtitle">隐患详情</div> |
| | | <el-descriptions :column="2" |
| | | style="margin-bottom: 20px;" |
| | | v-if="operationType === 'edit2' || operationType === 'edit3'" |
| | | title="隐患详情" |
| | | border> |
| | | <el-descriptions-item label="隐患编号"> |
| | | <span class="detail-title">{{ form.hiddenCode }}</span> |
| | |
| | | <span class="detail-title">{{ form.hiddenDesc }}</span> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="隐患类型"> |
| | | <span class="detail-title">{{ form.type }}</span> |
| | | <span class="detail-title">{{ TypeLabel(form.type) }}</span> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="隐患风险等级"> |
| | | <span class="detail-title">{{ form.riskLevel }}</span> |
| | | <el-tag :type="getTypeTagType(form.riskLevel)"> |
| | | {{ form.riskLevel }} |
| | | </el-tag> |
| | | </el-descriptions-item> |
| | | <el-descriptions-item label="上报人"> |
| | | <span class="detail-title">{{ form.createUserName }}</span> |
| | |
| | | <span class="detail-title">{{ form.rectifyTime }}</span> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | <div class="classtitle" |
| | | v-if="operationType === 'edit3'" |
| | | style="margin-top: 40px;">整改详情</div> |
| | | <el-descriptions :column="2" |
| | | style="margin-bottom: 20px;" |
| | | v-if="operationType === 'edit3'" |
| | | title="整改详情" |
| | | border> |
| | | <el-descriptions-item label="整改具体措施" |
| | | :span="2"> |
| | |
| | | <span class="detail-title">{{ form2.rectifyActualTime }}</span> |
| | | </el-descriptions-item> |
| | | </el-descriptions> |
| | | <div class="classtitle" |
| | | v-if="operationType === 'edit2' || operationType === 'edit3'" |
| | | style="margin-top: 40px;margin-bottom: 30px;">验收情况</div> |
| | | <el-form :model="form2" |
| | | v-if="operationType === 'edit2'" |
| | | label-width="140px" |
| | |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'view'" /> |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | v-model="fileListDialogVisible" |
| | | :show-upload-button="true" |
| | | :show-delete-button="true" |
| | | :is-show-pagination="true" |
| | | :page="filePagination" |
| | | :upload-method="handleUpload" |
| | | :delete-method="handleFileDelete" |
| | | @pagination="paginationSearch" |
| | | title="附件列表" /> |
| | | </div> |
| | | </template> |
| | |
| | | <script setup> |
| | | import { getToken } from "@/utils/auth"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import { onMounted, ref, getCurrentInstance } from "vue"; |
| | | import { onMounted, ref, getCurrentInstance, computed } from "vue"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | |
| | | } else if (type === "edit3") { |
| | | return "验收页面"; |
| | | } |
| | | }; |
| | | // 获取类型标签类型 |
| | | const getTypeTagType = type => { |
| | | const typeMap = { |
| | | 较大风险: "warning", |
| | | 低风险: "info", |
| | | 一般风险: "info", |
| | | 重大风险: "danger", |
| | | }; |
| | | return typeMap[type] || "info"; |
| | | }; |
| | | // 用户信息表单弹框数据 |
| | | const operationType = ref(""); |
| | |
| | | verifyResult: [{ required: true, message: "请选择", trigger: "change" }], |
| | | acceptDesc: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | }; |
| | | const typeList = ref([ |
| | | { |
| | | value: "设备安全", |
| | | label: "设备安全", |
| | | }, |
| | | { |
| | | value: "人员操作", |
| | | label: "人员操作", |
| | | }, |
| | | { |
| | | value: "环境风险", |
| | | label: "环境风险", |
| | | }, |
| | | { |
| | | value: "物料管控", |
| | | label: "物料管控", |
| | | }, |
| | | { |
| | | value: "其他", |
| | | label: "其他", |
| | | }, |
| | | ]); |
| | | const { hidden_danger_type } = proxy.useDict("hidden_danger_type"); |
| | | const typeList = computed(() => hidden_danger_type?.value || []); |
| | | const TypeLabel = val => { |
| | | const item = typeList.value.find(i => String(i.value) === String(val)); |
| | | return item ? item.label : val; |
| | | }; |
| | | const form2 = ref({ |
| | | rectifyActualTime: "", // 实际整改完成时间 |
| | | rectifyMeasures: "", // 整改具体措施 |
| | |
| | | label: "低风险", |
| | | }, |
| | | ]); |
| | | // 隐患类型选项 |
| | | const { type_qualification } = proxy.useDict("type_qualification"); |
| | | const { form, rules } = toRefs(data); |
| | | const { form: searchForm } = useFormData(data.searchForm); |
| | | // 产品表单弹框数据 |
| | |
| | | customer: "", |
| | | }); |
| | | |
| | | const handleChange = userId => { |
| | | const selectedUser = userList.value.find(user => user.userId === userId); |
| | | if (selectedUser) { |
| | | form.value.createUserName = selectedUser.nickName; |
| | | } |
| | | }; |
| | | const handleChange2 = userId => { |
| | | const selectedUser = userList.value.find(user => user.userId === userId); |
| | | if (selectedUser) { |
| | |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | total.value = res.data.total; |
| | | tableData.value.forEach(item => { |
| | | // console.log(item.rectifyUserId, currentUserId.value, "======="); |
| | | if (Number(item.rectifyUserId) != Number(currentUserId.value)) { |
| | | item.isRectify = true; |
| | | } else { |
| | | item.isRectify = false; |
| | | } |
| | | }); |
| | | return res; |
| | | }) |
| | | .catch(() => { |
| | |
| | | hiddenCode: "", // 隐患编号 |
| | | location: "", // 隐患位置 |
| | | hiddenDesc: "", // 隐患描述 |
| | | createUser: "", // 上报人 |
| | | createUserName: "", |
| | | createUser: Number(currentUserId.value), // 上报人 |
| | | createUserName: currentUserName.value, |
| | | createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 上报时间 |
| | | rectifyUserId: "", // 整改责任人 |
| | | rectifyUserName: "", |
| | |
| | | proxy.$modal.msg("已取消"); |
| | | }); |
| | | }; |
| | | const isPeople = rectifyUserId => { |
| | | return Number(rectifyUserId) == Number(currentUserId.value); |
| | | }; |
| | | |
| | | /** |
| | | * 判断是否可以发货 |
| | |
| | | const statusStr = shippingStatus ? String(shippingStatus).trim() : ""; |
| | | return statusStr === "待发货" || statusStr === "审核拒绝"; |
| | | }; |
| | | const filePagination = ref({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | |
| | | /** |
| | | * 下载文件 |
| | |
| | | const currentFileRow = ref(null); |
| | | const downLoadFile = row => { |
| | | currentFileRow.value = row; |
| | | fileListPage({ safeHiddenId: row.id }).then(res => { |
| | | fileListPage({ |
| | | safeHiddenId: row.id, |
| | | current: filePagination.value.current, |
| | | size: filePagination.value.size, |
| | | }).then(res => { |
| | | if (fileListRef.value) { |
| | | fileListRef.value.open(res.data.records); |
| | | fileListRef.value.open(res.data.records || []); |
| | | console.log("res.data", res.data); |
| | | filePagination.value.total = res.data.total || 0; |
| | | } |
| | | }); |
| | | }; |
| | | const currentUserId = ref(""); |
| | | const currentUserName = ref(""); |
| | | const getCurrentFactoryName = async () => { |
| | | let res = await userStore.getInfo(); |
| | | currentUserId.value = res.user.userId; |
| | | currentUserName.value = res.user.nickName; |
| | | }; |
| | | |
| | | /** |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getCurrentFactoryName(); |
| | | getList(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | | getCurrentFactoryName(); |
| | | }); |
| | | // 上传附件 |
| | | const handleUpload = async () => { |
| | |
| | | // 重新加载文件列表 |
| | | const listRes = await fileListPage({ |
| | | safeHiddenId: currentFileRow.value.id, |
| | | current: filePagination.value.current, |
| | | size: filePagination.value.size, |
| | | }); |
| | | if (listRes.code === 200 && fileListRef.value) { |
| | | const fileList = (listRes.data?.records || []).map(item => ({ |
| | |
| | | ...item, |
| | | })); |
| | | fileListRef.value.setList(fileList); |
| | | filePagination.value.total = listRes.data?.total || 0; |
| | | } |
| | | // 返回新文件信息 |
| | | resolve({ |
| | |
| | | input.click(); |
| | | }); |
| | | }; |
| | | // 分页查询文件列表 |
| | | const paginationSearch = async (page, size) => { |
| | | filePagination.value.current = page; |
| | | filePagination.value.size = size; |
| | | const listRes = await fileListPage({ |
| | | safeHiddenId: currentFileRow.value.id, |
| | | current: filePagination.value.current, |
| | | size: filePagination.value.size, |
| | | }); |
| | | if (listRes.code === 200) { |
| | | const fileList = (listRes.data?.records || []).map(item => ({ |
| | | name: item.name, |
| | | url: item.url, |
| | | id: item.id, |
| | | ...item, |
| | | })); |
| | | fileListRef.value.setList(fileList); |
| | | filePagination.value.total = listRes.data?.total || 0; |
| | | } |
| | | }; |
| | | // 删除附件 |
| | | const handleFileDelete = async row => { |
| | | try { |
| | |
| | | if (currentFileRow.value && fileListRef.value) { |
| | | const listRes = await fileListPage({ |
| | | safeHiddenId: currentFileRow.value.id, |
| | | current: filePagination.value.current, |
| | | size: filePagination.value.size, |
| | | }); |
| | | if (listRes.code === 200) { |
| | | const fileList = (listRes.data?.records || []).map(item => ({ |
| | |
| | | ...item, |
| | | })); |
| | | fileListRef.value.setList(fileList); |
| | | filePagination.value.total = listRes.data?.total || 0; |
| | | } |
| | | } |
| | | return true; // 返回 true 表示删除成功,组件会更新列表 |
| | |
| | | page-break-after: avoid; |
| | | } |
| | | } |
| | | .classtitle { |
| | | font-size: 16px; |
| | | font-weight: 600; |
| | | color: #303133; |
| | | border-left: 4px solid #409eff; |
| | | padding-left: 12px; |
| | | margin-bottom: 12px; |
| | | } |
| | | </style> |