|
@@ -34,25 +34,25 @@
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_detect_test_copy">
|
|
|
- <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
|
|
|
+ <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="copyLoading" @click="copyDataClick">
|
|
|
<HcIcon name="file-copy-2"/>
|
|
|
<span>复制</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_detect_test_del">
|
|
|
- <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="delModalClick">
|
|
|
+ <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="removeLoading" @click="delModalClick">
|
|
|
<HcIcon name="delete-bin-2"/>
|
|
|
<span>删除</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_detect_test_print">
|
|
|
- <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
|
|
|
+ <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="printPdfLoading" @click="printPdfClick">
|
|
|
<HcIcon name="printer"/>
|
|
|
<span>批量打印</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="tentative_detect_test_null">
|
|
|
- <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
|
|
|
+ <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="printNullPdfLoading" @click="printNullPdfClick">
|
|
|
<HcIcon name="printer"/>
|
|
|
<span>打印空表</span>
|
|
|
</el-button>
|
|
@@ -91,9 +91,26 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection">
|
|
|
- <template #key5="{row}">
|
|
|
- <span class="text-link" @click="tableRowEdit(row)" v-if="btn_edit">{{row?.key5}}</span>
|
|
|
- <span v-else>{{row?.key5}}</span>
|
|
|
+ <template #recordNo="{row}">
|
|
|
+ <span class="text-link" @click="tableRowEdit(row)">{{row?.recordNo}}</span>
|
|
|
+ </template>
|
|
|
+ <template #reportNo="{row}">
|
|
|
+ <span class="text-link" @click="tableRowEdit(row)">{{row?.reportNo}}</span>
|
|
|
+ </template>
|
|
|
+ <template #trialProjectName="{row}">
|
|
|
+ <span class="text-link font-bold" @click="tableRowPdf(row)">{{row?.trialProjectName}}</span>
|
|
|
+ </template>
|
|
|
+ <template #detectionCategory="{row}">
|
|
|
+ <span>{{getArrKeyValue(categoryData, 'dictKey', 'dictValue', row.detectionCategory)}}</span>
|
|
|
+ </template>
|
|
|
+ <template #isUploadCertificate="{row}">
|
|
|
+ <span>{{row.isUploadCertificate == 0 ? '是' : '否'}}</span>
|
|
|
+ </template>
|
|
|
+ <template #contractId="{row}">
|
|
|
+ <span>{{contractInfo?.name}}</span>
|
|
|
+ </template>
|
|
|
+ <template #detectionResult="{row}">
|
|
|
+ <span>{{row.detectionResult == 1 ? '合格' : '不合格'}}</span>
|
|
|
</template>
|
|
|
<template #action="{row}">
|
|
|
<HcTooltip keys="tentative_detect_test_annex">
|
|
@@ -115,7 +132,7 @@
|
|
|
<template #extra>
|
|
|
<HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
|
|
|
</template>
|
|
|
- <div class="hc-switch-tab-content">
|
|
|
+ <div class="hc-switch-tab-content" v-loading="viewAttachmentLoading">
|
|
|
<div class="h-full w-full flex">
|
|
|
<div class="pdf-file-list-box">
|
|
|
<div class="file-item cur">文件名称1.pdf</div>
|
|
@@ -147,11 +164,12 @@ import {ref, watch, onMounted} from "vue";
|
|
|
import {useRouter} from 'vue-router'
|
|
|
import {useAppStore} from "~src/store";
|
|
|
import TestTree from "../material/components/TestTree.vue"
|
|
|
-import {getStoreData, setStoreData} from '~src/utils/storage'
|
|
|
+import {getStoreData, setStoreData, delStoreData} from '~src/utils/storage'
|
|
|
+import {getArrValue, getArrKeyValue, isString} from "vue-utils-plus";
|
|
|
import HcDragUpload from "./components/HcDragUpload.vue"
|
|
|
import dataApi from "~api/tentative/detect/test";
|
|
|
-//import {delMessage, rowsToId} from "~uti/tools";
|
|
|
-import {getArrValue} from "vue-utils-plus";
|
|
|
+import {delMessage, rowsToId} from "~uti/tools";
|
|
|
+import {getDictionary} from "~api/other";
|
|
|
|
|
|
//变量
|
|
|
const router = useRouter()
|
|
@@ -186,6 +204,7 @@ const btn_edit = ref(false)
|
|
|
onMounted(() => {
|
|
|
btn_edit.value = getButtonsVal('tentative_detect_test_edit')
|
|
|
setContractType(contractInfo.value?.contractType)
|
|
|
+ getCategoryData()
|
|
|
})
|
|
|
|
|
|
const qualifiedData = ref([
|
|
@@ -193,6 +212,19 @@ const qualifiedData = ref([
|
|
|
{label: '合格', value: '1'}
|
|
|
])
|
|
|
|
|
|
+//获取检测类别类型
|
|
|
+const categoryData = ref([])
|
|
|
+const getCategoryData = async () => {
|
|
|
+ const { data } = await getDictionary({
|
|
|
+ code: 'trial_detection_category'
|
|
|
+ })
|
|
|
+ const arrData = getArrValue(data)
|
|
|
+ arrData.forEach(item => {
|
|
|
+ item.dictKey = Number(item.dictKey)
|
|
|
+ })
|
|
|
+ categoryData.value = arrData
|
|
|
+}
|
|
|
+
|
|
|
//搜索表单
|
|
|
const searchForm = ref({
|
|
|
trialUserName: null, queryStatus: null, queryValue: null, type: '1',
|
|
@@ -272,22 +304,21 @@ const pageChange = ({current, size}) => {
|
|
|
//表格数据
|
|
|
const tableRef = ref(null)
|
|
|
const tableColumn = ref([
|
|
|
- {key:'key1', name: '编号'},
|
|
|
- {key:'key2', name: '记录编号'},
|
|
|
- {key:'key3', name: '报告编号'},
|
|
|
- {key:'key4', name: '取样地点'},
|
|
|
- {key:'key5', name: '试验项目名称'},
|
|
|
- {key:'key6', name: '检测类别'},
|
|
|
- {key:'key7', name: '是否上传合格证'},
|
|
|
- {key:'key8', name: '合同段'},
|
|
|
- {key:'key9', name: '单位'},
|
|
|
- {key:'key10', name: '样品编号'},
|
|
|
- {key:'key11', name: '规格类型'},
|
|
|
- {key:'key12', name: '检测结果'},
|
|
|
- {key:'key13', name: '工程部位及用途'},
|
|
|
- {key:'key14', name: '报告日期'},
|
|
|
- {key:'key15', name: '试验人员'},
|
|
|
- {key:'key16', name: '任务状态'},
|
|
|
+ {key:'recordNo', name: '记录编号', width: 220},
|
|
|
+ {key:'reportNo', name: '报告编号', width: 220},
|
|
|
+ {key:'samplingLocation', name: '取样地点', width: 220},
|
|
|
+ {key:'trialProjectName', name: '试验项目名称', width: 220},
|
|
|
+ {key:'detectionCategory', name: '检测类别', width: 120},
|
|
|
+ {key:'isUploadCertificate', name: '是否上传合格证', width: 130},
|
|
|
+ {key:'contractId', name: '合同段', width: 220},
|
|
|
+ {key:'company', name: '单位', width: 160},
|
|
|
+ {key:'specificationNumber', name: '样品编号', width: 220},
|
|
|
+ {key:'specificationModel', name: '规格类型', width: 200},
|
|
|
+ {key:'detectionResult', name: '检测结果', width: 160},
|
|
|
+ {key:'projectPosition', name: '工程部位及用途', width: 160},
|
|
|
+ {key:'reportDate', name: '报告日期', width: 170},
|
|
|
+ {key:'trialUserName', name: '试验人员', width: 170},
|
|
|
+ {key:'taskStatus', name: '任务状态', width: 140},
|
|
|
{key:'action', name: '操作', width: 150, fixed: 'right', align: 'center'},
|
|
|
])
|
|
|
const tableData = ref([])
|
|
@@ -320,6 +351,7 @@ const tableSelection = (rows) => {
|
|
|
|
|
|
//新增
|
|
|
const addFormModalClick = () => {
|
|
|
+ delStoreData('test-form')
|
|
|
router.push({
|
|
|
path: '/tentative/detect/test-form',
|
|
|
query: {
|
|
@@ -330,47 +362,160 @@ const addFormModalClick = () => {
|
|
|
}
|
|
|
|
|
|
//编辑
|
|
|
-const tableRowEdit = () => {
|
|
|
+const tableRowEdit = (row) => {
|
|
|
+ setStoreData('test-form', row)
|
|
|
router.push({
|
|
|
path: '/tentative/detect/test-form',
|
|
|
query: {
|
|
|
- //wbsId: queryKey.value, //树节点ID
|
|
|
- //dataType: dataType, //存储目录格式 1按部位存储,2按日期存储
|
|
|
- //fileType: fileType, //文件类型,1视频文件,2图片文件
|
|
|
- //classifyId: dataId, //classifyId,分类ID,
|
|
|
+ id: row.id,
|
|
|
+ nodeId: row.nodeId,
|
|
|
+ dataType: row.type
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+//预览PDF
|
|
|
+const tableRowPdf = ({pdfUrl}) => {
|
|
|
+ if (pdfUrl) {
|
|
|
+ window.open(pdfUrl,'_blank')
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('该数据暂无PDF')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//复制
|
|
|
+const copyDataClick = () => {
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ if (rows.length > 0) {
|
|
|
+ const ids = rowsToId(rows)
|
|
|
+ copyDataApi(ids)
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('请先勾选需要复制的记录')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//请求复制
|
|
|
+const copyLoading = ref(false)
|
|
|
+const copyDataApi = async (ids) => {
|
|
|
+ //请求数据
|
|
|
+ copyLoading.value = true
|
|
|
+ const { error, code, msg } = await dataApi.copyData({
|
|
|
+ ids: ids
|
|
|
+ },false)
|
|
|
+ //处理数据
|
|
|
+ copyLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('复制成功')
|
|
|
+ searchClick()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//删除
|
|
|
const delModalClick = () => {
|
|
|
- window?.$messageBox?.alert('请谨慎考虑后,确认是否需要删除?', '删除提醒', {
|
|
|
- showCancelButton: true,
|
|
|
- confirmButtonText: '确认删除',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- callback: (action) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- //removeContractTreeNode()
|
|
|
- }
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ if (rows.length > 0) {
|
|
|
+ delMessage(() => {
|
|
|
+ const ids = rowsToId(rows)
|
|
|
+ removeDataApi(ids)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('请先勾选需要删除的记录')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//请求删除
|
|
|
+const removeLoading = ref(false)
|
|
|
+const removeDataApi = async (ids) => {
|
|
|
+ //请求数据
|
|
|
+ removeLoading.value = true
|
|
|
+ const { error, code, msg } = await dataApi.removeData({
|
|
|
+ ids: ids
|
|
|
+ },false)
|
|
|
+ //处理数据
|
|
|
+ removeLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message?.success('删除成功')
|
|
|
+ searchClick()
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//批量打印
|
|
|
+const printPdfLoading = ref(false)
|
|
|
+const printPdfClick = async () => {
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ if (rows.length > 0) {
|
|
|
+ const ids = rowsToId(rows)
|
|
|
+ //请求数据
|
|
|
+ printPdfLoading.value = true
|
|
|
+ const { error, code, msg, data } = await dataApi.printPdf({
|
|
|
+ ids: ids
|
|
|
+ },false)
|
|
|
+ //处理数据
|
|
|
+ const pdfUrl = isString(data) ? data || '' : ''
|
|
|
+ printPdfLoading.value = false
|
|
|
+ if (!error && code === 200 && pdfUrl) {
|
|
|
+ window.open(pdfUrl,'_blank')
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg || '文件异常')
|
|
|
}
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('请先勾选需要批量打印的记录')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//打印空表
|
|
|
+const printNullPdfLoading = ref(false)
|
|
|
+const printNullPdfClick = async () => {
|
|
|
+ const rows = tableCheckedKeys.value;
|
|
|
+ if (rows.length > 0) {
|
|
|
+ const ids = rowsToId(rows)
|
|
|
+ //请求数据
|
|
|
+ printNullPdfLoading.value = true
|
|
|
+ const { error, code, msg, data } = await dataApi.printNullPdf({
|
|
|
+ ids: ids
|
|
|
+ },false)
|
|
|
+ //处理数据
|
|
|
+ const pdfUrl = isString(data) ? data || '' : ''
|
|
|
+ printNullPdfLoading.value = false
|
|
|
+ if (!error && code === 200 && pdfUrl) {
|
|
|
+ window.open(pdfUrl,'_blank')
|
|
|
+ } else {
|
|
|
+ window.$message?.error(msg || '文件异常')
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ window.$message?.warning('请先勾选需要打印空表的记录')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//查看附件
|
|
|
const viewAttachmentModal = ref(false)
|
|
|
-const viewAttachmentModalClick = (row) => {
|
|
|
+const viewAttachmentLoading = ref(false)
|
|
|
+const viewAttachmentData = ref([])
|
|
|
+const viewAttachmentModalClick = async ({id}) => {
|
|
|
viewAttachmentModal.value = true
|
|
|
+ viewAttachmentLoading.value = true
|
|
|
+ const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id})
|
|
|
+ //处理数据
|
|
|
+ viewAttachmentLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ viewAttachmentData.value = getArrValue(data)
|
|
|
+ } else {
|
|
|
+ viewAttachmentData.value = []
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const attachmentPdfUrl = ref('')
|
|
|
|
|
|
//类型tab数据和相关处理
|
|
|
-const tabTypeKey = ref('tab1')
|
|
|
+const tabTypeKey = ref('productionCertificate')
|
|
|
const tabTypeTab = ref([
|
|
|
- {key:'tab1', name: '生产合格证'},
|
|
|
- {key:'tab2', name: '厂家质检报告'},
|
|
|
- {key:'tab3', name: '其他文件'},
|
|
|
+ {key:'productionCertificate', name: '生产合格证'},
|
|
|
+ {key:'qualityInspectionReport', name: '厂家质检报告'},
|
|
|
+ {key:'otherAccessories', name: '其他文件'},
|
|
|
]);
|
|
|
const tabTypeChange = (item) => {
|
|
|
tabTypeKey.value = item?.key
|
|
@@ -381,38 +526,42 @@ const viewAttachmentModalClose = () => {
|
|
|
viewAttachmentModal.value = false
|
|
|
}
|
|
|
|
|
|
-//取样记录
|
|
|
-const samplingRecordModal = ref(false)
|
|
|
-const samplingRecordModalClick = (row) => {
|
|
|
- samplingRecordModal.value = true
|
|
|
-}
|
|
|
-
|
|
|
//样品信息数据
|
|
|
const samplingTableColumn = ref([
|
|
|
- {key:'key1', name: '样品名称'},
|
|
|
- {key:'key2', name: '取样时间'},
|
|
|
- {key:'key3', name: '样品编号'},
|
|
|
- {key:'key4', name: '规格型号'},
|
|
|
- {key:'key5', name: '试样数量'},
|
|
|
- {key:'key6', name: '计算单位'},
|
|
|
- {key:'key7', name: '拟用部位'},
|
|
|
- {key:'key8', name: '代表数量'},
|
|
|
- {key:'key9', name: '取样人'},
|
|
|
+ {key:'materialName', name: '样品名称'},
|
|
|
+ {key:'samplingDate', name: '取样时间'},
|
|
|
+ {key:'specificationNumber', name: '样品编号'},
|
|
|
+ {key:'specificationModel', name: '规格型号'},
|
|
|
+ {key:'materialCount', name: '试样数量'},
|
|
|
+ {key:'calculationUnit', name: '计算单位'},
|
|
|
+ {key:'proposedPosition', name: '拟用部位'},
|
|
|
+ {key:'representativeCount', name: '代表数量'},
|
|
|
+ {key:'userName', name: '取样人'},
|
|
|
])
|
|
|
const samplingTableData = ref([])
|
|
|
const samplingTableLoading = ref(false)
|
|
|
|
|
|
+//取样记录
|
|
|
+const samplingRecordModal = ref(false)
|
|
|
+const samplingRecordModalClick = async ({id}) => {
|
|
|
+ samplingRecordModal.value = true
|
|
|
+ samplingTableLoading.value = true
|
|
|
+ const { error, code, data } = await dataApi.getSampleList({
|
|
|
+ id: id
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ samplingTableLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ samplingTableData.value = getArrValue(data)
|
|
|
+ } else {
|
|
|
+ samplingTableData.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//关闭样品信息
|
|
|
const samplingRecordModalClose = () => {
|
|
|
samplingRecordModal.value = false
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//拼接ID
|
|
|
-const rowsToId = (rows) => {
|
|
|
- return rows.map((obj) => {
|
|
|
- return obj.id;
|
|
|
- }).join(",")
|
|
|
+ samplingTableData.value = []
|
|
|
}
|
|
|
|
|
|
//左右拖动,改变树形结构宽度
|