test.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458
  1. <template>
  2. <div class="hc-page-layout-box">
  3. <div
  4. :style="`width:${isWbsTreeShow ? leftWidth : 0}px; ${isWbsTreeShow ? '' : 'display: none'}`"
  5. class="hc-layout-left-box bg-white" :class="[isWbsTreeShow ? 'show' : '']"
  6. >
  7. <div class="hc-project-box">
  8. <div class="hc-project-icon-box">
  9. <hc-icon name="stack" />
  10. </div>
  11. <div class="project-name-box ml-2">
  12. <div class="project-alias">{{ projectInfo.projectName }}</div>
  13. </div>
  14. </div>
  15. <div class="hc-tree-box">
  16. <el-scrollbar>
  17. <TestTree
  18. :auto-expand-keys="treeAutoExpandKeys"
  19. :project-id="projectId"
  20. :tenant-id="userInfo?.tenant_id"
  21. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
  22. :wbs-type="2"
  23. :entrust="1"
  24. @node-tap="wbsElTreeClick"
  25. />
  26. </el-scrollbar>
  27. </div>
  28. <!-- 左右拖动 -->
  29. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  30. </div>
  31. <div class="hc-page-content-box">
  32. <!---展开收缩树 -->
  33. <div class="hc-expansion-contraction-tree" @click="setWbsTreeShow">
  34. <hc-icon v-show="isWbsTreeShow" name="arrow-left-s" />
  35. <hc-icon v-show="!isWbsTreeShow" name="arrow-right-s" />
  36. </div>
  37. <HcTabCard :tabs="authBtnTabdata" :tab-key="authBtnTabKey" @change="authBtnTabClick">
  38. <template #extra>
  39. <HcTooltip keys="tentative_detect_test_add">
  40. <el-button
  41. :disabled="!primaryKeyId" hc-btn color="#37c0fe" style="color: white;"
  42. @click="addFormModalClick"
  43. >
  44. <hc-icon name="add-circle" />
  45. <span>新增</span>
  46. </el-button>
  47. </HcTooltip>
  48. <!-- <HcTooltip keys="tentative_detect_test_copy">
  49. <el-button
  50. :disabled="tableCheckedKeys.length <= 0" :loading="copyLoading" hc-btn
  51. color="#A16222" @click="copyDataClick"
  52. >
  53. <hc-icon name="file-copy-2" />
  54. <span>复制</span>
  55. </el-button>
  56. </HcTooltip> -->
  57. <HcTooltip keys="tentative_detect_test_report">
  58. <el-button
  59. :disabled="tableCheckedKeys.length <= 0" :loading="reportPdfLoading" hc-btn
  60. color="#FF976A" style="color: white;" @click="reportPdfClick"
  61. >
  62. <hc-icon name="send-plane-2" />
  63. <span>批量上报</span>
  64. </el-button>
  65. </HcTooltip>
  66. <!-- <HcTooltip keys="tentative_detect_test_print">
  67. <el-button
  68. :disabled="tableCheckedKeys.length <= 0" :loading="printPdfLoading" hc-btn
  69. color="#567722" @click="printPdfClick"
  70. >
  71. <hc-icon name="printer" />
  72. <span>批量打印</span>
  73. </el-button>
  74. </HcTooltip> -->
  75. <!-- <HcTooltip keys="tentative_detect_test_quit">
  76. <el-button
  77. :disabled="tableCheckedKeys.length <= 0" :loading="quitPdfLoading" hc-btn
  78. color="#e54d42" @click="quitPdfClick"
  79. >
  80. <hc-icon name="delete-bin-3" />
  81. <span>批量废除</span>
  82. </el-button>
  83. </HcTooltip> -->
  84. <!-- <HcTooltip keys="tentative_detect_test_null">
  85. <el-button
  86. :disabled="tableCheckedKeys.length <= 0" :loading="printNullPdfLoading" hc-btn
  87. color="#567722" @click="printNullPdfClick"
  88. >
  89. <hc-icon name="printer" />
  90. <span>打印空表</span>
  91. </el-button>
  92. </HcTooltip> -->
  93. <el-dropdown trigger="click">
  94. <el-button hc-btn type="success" :loading="dataBtnLoad">
  95. <span>综合功能</span>
  96. <hc-icon name="arrow-down-s" />
  97. </el-button>
  98. <template #dropdown>
  99. <el-dropdown-menu>
  100. <template v-for="item in dataSyncMenu" :key="item.key">
  101. <el-dropdown-item :disabled="tableCheckedKeys.length <= 0" @click="dataSyncMenuClick(item)">{{ item.name }}</el-dropdown-item>
  102. </template>
  103. </el-dropdown-menu>
  104. </template>
  105. </el-dropdown>
  106. <HcTooltip keys="tentative_detect_test_del">
  107. <el-button
  108. :disabled="tableCheckedKeys.length <= 0" :loading="removeLoading" hc-btn
  109. color="#e03997" class="ml-2" @click="delModalClick"
  110. >
  111. <hc-icon name="delete-bin-2" />
  112. <span>删除</span>
  113. </el-button>
  114. </HcTooltip>
  115. <el-button class="ml-2" :disabled="tableCheckedKeys.length <= 0" :loading="signLoading" hc-btn type="primary" @click="resignClick">re-sign</el-button>
  116. </template>
  117. <template #search>
  118. <div class="w-40">
  119. <el-input
  120. v-model="searchForm.trialUserName" clearable placeholder="请输入试验人员"
  121. @keyup="keyUpEvent"
  122. />
  123. </div>
  124. <div class="ml-2 w-200px">
  125. <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable block>
  126. <el-option
  127. v-for="item in contractData" :key="item.id" :label="item.contractName"
  128. :value="item.id"
  129. />
  130. </el-select>
  131. </div>
  132. <div class="ml-2 w-32">
  133. <el-select v-model="searchForm.queryStatus" clearable placeholder="是否合格">
  134. <el-option
  135. v-for="item in qualifiedData" :key="item.value" :label="item.label"
  136. :value="item.value"
  137. />
  138. </el-select>
  139. </div>
  140. <div class="ml-2 w-250px">
  141. <hc-date-picker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
  142. </div>
  143. <div class="ml-2 w-72">
  144. <el-input v-model="searchForm.queryValue" clearable placeholder="请输入项目名称关键字" @keyup="keyUpEvent" />
  145. </div>
  146. <div class="ml-2">
  147. <el-button type="primary" @click="searchClick">
  148. <hc-icon name="search-2" />
  149. <span>搜索</span>
  150. </el-button>
  151. </div>
  152. </template>
  153. <HcTable
  154. ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"
  155. is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
  156. @selection-change="tableSelection"
  157. >
  158. <template #recordNo="{ row }">
  159. <span class="text-link" @click="tableRowEdit(row, '1')">{{ row?.recordNo }}</span>
  160. </template>
  161. <template #reportNo="{ row }">
  162. <span class="text-link" @click="tableRowEdit(row, '2')">{{ row?.reportNo }}</span>
  163. </template>
  164. <template #trialProjectName="{ row }">
  165. <span class="text-link font-bold" @click="tableRowPdf(row)">{{ row?.trialProjectName }}</span>
  166. </template>
  167. <template #taskStatus="{ row }">
  168. <!-- <el-tag :type="`${row.status === 2 ? 'success' : row.status === 0 ? 'warning' : row.status === 1 ? 'danger' : 'info'}`" -->
  169. <el-tag
  170. v-if="row.taskStatus"
  171. :type="`${row.taskStatus === '已审批' ? 'success' : row.taskStatus === '待审批' ? 'warning' : row.taskStatus === '已废除' ? 'danger' : 'info'}`"
  172. class="mx-1" effect="dark"
  173. >
  174. {{ row.taskStatus }}
  175. </el-tag>
  176. </template>
  177. <template #detectionCategory="{ row }">
  178. <!-- <span>{{arrKeyValue(categoryData, 'dictKey', 'dictValue', row.detectionCategory)}}</span> -->
  179. <span>{{ row.detectionCategoryName }}</span>
  180. </template>
  181. <template #isUploadCertificate="{ row }">
  182. <!-- <span>{{row.isUploadCertificate == 0 ? '是':row.isUploadCertificate == -1?'' : '否'}}</span> -->
  183. <span>{{ row.isUploadCertificateName }}</span>
  184. </template>
  185. <template #contractId="{ row }">
  186. <span>{{ contractInfo?.name }}</span>
  187. </template>
  188. <template #detectionResult="{ row }">
  189. <span>{{ row?.reportNo && row?.reportNo.length > 0 ? row.detectionResultName : '' }}</span>
  190. </template>
  191. <template #action="{ row }">
  192. <HcTooltip keys="tentative_detect_test_annex">
  193. <el-link type="primary" @click="viewAttachmentModalClick(row)">附件</el-link>
  194. </HcTooltip>
  195. <el-link type="primary" @click="relatedSearchClick(row)">关联查阅</el-link>
  196. <!-- HcTooltip keys="tentative_detect_test_info">
  197. <el-link type="primary" @click="samplingRecordModalClick(row)">样品信息</el-link>
  198. </HcTooltip -->
  199. </template>
  200. </HcTable>
  201. <template #action>
  202. <HcPages :pages="searchForm" @change="pageChange" />
  203. </template>
  204. </HcTabCard>
  205. </div>
  206. <!-- 查看附件 -->
  207. <hc-new-dialog
  208. :footer="false" :show="viewAttachmentModal" is-table title="查看附件" widths="70rem"
  209. @close="viewAttachmentModalClose"
  210. >
  211. <template #extra>
  212. <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" size="default" @change="tabTypeChange" />
  213. </template>
  214. <div v-loading="viewAttachmentLoading" class="hc-switch-tab-content">
  215. <div class="h-full w-full flex">
  216. <div v-if="viewAttachmentData.length > 0" class="pdf-file-list-box">
  217. <template v-for="item in viewAttachmentData">
  218. <div :class="[item.isCheck ? 'cur' : '']" class="file-item" @click="viewCurFile(item)">
  219. {{ item.fileName || '' }}
  220. </div>
  221. </template>
  222. </div>
  223. <div v-else class="pdf-file-list-box">
  224. <hc-empty />
  225. </div>
  226. <iframe v-if="attachmentPdfUrl" :src="attachmentPdfUrl" frameborder="1" height="100%" width="80%" />
  227. <div class="hc-no-table-form">
  228. <div class="table-form-no">
  229. <HcDragUpload
  230. :datas="uploadData" :file-list="fileListData" @del-file="delFileData"
  231. @finished="uploadFinished" @progress="uploadprogress" @close="viewAttachmentModalClose"
  232. />
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. </hc-new-dialog>
  238. <!-- 查看样品信息 -->
  239. <hc-new-dialog
  240. :footer="false" :show="samplingRecordModal" is-table title="查看样品信息" widths="60%"
  241. @close="samplingRecordModalClose"
  242. >
  243. <HcTable
  244. :column="samplingTableColumn" :datas="samplingTableData" :is-index="false"
  245. :loading="samplingTableLoading" is-new
  246. />
  247. </hc-new-dialog>
  248. <!-- 关联查阅 -->
  249. <hc-dialog
  250. v-model="isRelatedSearch" :footer="false" is-table title="关联查阅" widths="80%" :padding="false"
  251. @close="relatedSearchModalClose"
  252. >
  253. <div class="hc-related-search-box relative mt-10px">
  254. <hc-card-item title="样品信息">
  255. <template #extra>
  256. <el-button :disabled="relatedData1.length <= 0" type="primary" size="small" @click="rowDispose">
  257. 样品处理
  258. </el-button>
  259. </template>
  260. <hc-table :column="relatedColumn1" :datas="relatedData1" :is-index="false" />
  261. </hc-card-item>
  262. <hc-card-item title="委托单信息" class="mt-14px">
  263. <hc-table :column="relatedColumn2" :datas="relatedData2" :is-index="false">
  264. <template #status="{ row }">
  265. <el-tag v-if="row.status === 1" type="info" effect="dark">未上报</el-tag>
  266. <el-tag v-if="row.status === 2" type="warning" effect="dark">已上报-待审批</el-tag>
  267. <el-tag v-if="row.status === 3" type="primary" effect="dark">待试验</el-tag>
  268. <el-tag v-if="row.status === 4" type="success" effect="dark">委托完成</el-tag>
  269. </template>
  270. </hc-table>
  271. </hc-card-item>
  272. <hc-card-item title="设备采集信息" class="mt-14px">
  273. <hc-table :column="relatedColumn3" :datas="relatedData3" :is-index="false" />
  274. </hc-card-item>
  275. </div>
  276. </hc-dialog>
  277. <!-- 样品处理 -->
  278. <hc-new-dialog v-model="disposeModal" is-footer-center title="样品处理" widths="40rem" @close="disposeClose">
  279. <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="left" label-width="auto">
  280. <el-form-item label="处理方式:" prop="repealType">
  281. <el-radio-group v-model="formModel.repealType">
  282. <el-radio :value="1">处理</el-radio>
  283. <el-radio :value="2">留样</el-radio>
  284. </el-radio-group>
  285. </el-form-item>
  286. <el-form-item v-if="formModel.repealType === 1" label="处理原因:" prop="repealReason">
  287. <el-input v-model="formModel.repealReason" type="textarea" :rows="5" resize="none" />
  288. </el-form-item>
  289. <el-form-item v-if="formModel.repealType === 2" label="留样时间:" prop="resamStartTime">
  290. <hc-date-picker :dates="formTime" clearable @change="formTimeUpdate" />
  291. </el-form-item>
  292. </el-form>
  293. <template #footer>
  294. <el-button @click="disposeClose">取消</el-button>
  295. <el-button hc-btn type="primary" :loading="saveLoading" @click="disposeSave">确定</el-button>
  296. </template>
  297. </hc-new-dialog>
  298. <!-- 批量上报审批 -->
  299. <HcReportModal
  300. :classify-type="authBtnTabKey"
  301. :addition="reportAddition" :contract-id="contractId" :ids="reportIds"
  302. :project-id="projectId" :show="showReportModal" :task-name="reportTaskName"
  303. :trial-self-inspection-record-id="1"
  304. :type-data="reportTypeData" title="批量上报审批" type="wbs"
  305. url="informationWriteQuery/batchTask" @finish="showReportFinish"
  306. @hide="showReportModal = false"
  307. />
  308. <!-- 一键重签弹窗 -->
  309. <hc-new-dialog v-model="resignModal" title="一键重签" widths="38rem" :loading="signLoading" @close="cancelresign" @save="signClick">
  310. <div>
  311. 是否重新生成pdf:
  312. <el-radio-group v-model="resignModalRadio">
  313. <el-radio :value="2">否</el-radio>
  314. <el-radio :value="1">是</el-radio>
  315. </el-radio-group>
  316. </div>
  317. </hc-new-dialog>
  318. </div>
  319. </template>
  320. <script setup>
  321. import { onActivated, onMounted, ref, watch } from 'vue'
  322. import { useRoute, useRouter } from 'vue-router'
  323. import { useAppStore } from '~src/store'
  324. import TestTree from '../material/components/TestTree.vue'
  325. import { delStoreValue, getStoreValue, setStoreValue } from '~src/utils/storage'
  326. import HcDragUpload from './components/HcDragUpload.vue'
  327. import { getDictionary } from '~api/other'
  328. import { eVisaTaskCheckApi } from '~api/other'
  329. import { getErtractInfo } from '~api/other'
  330. import wbsApi from '~api/data-fill/wbs'
  331. import dataApi from '~api/tentative/detect/test'
  332. import testSampleApi from '~api/tentative/material/testSample'
  333. import commissionApi from '~api/tentative/detect/commission'
  334. import acquisitionApi from '~api/tentative/acquisition/data'
  335. import { arrToId, arrToKey, formValidate, getArrValue, getObjVal, getObjValue, isNullES, isString } from 'js-fast-way'
  336. import { HcDelMsg } from 'hc-vue3-ui'
  337. import { toPdfPage } from '~uti/btn-auth'
  338. //变量
  339. const router = useRouter()
  340. const useRoutes = useRoute()
  341. const useAppState = useAppStore()
  342. const userInfo = ref(useAppState.getUserInfo)
  343. const projectId = ref(useAppState.getProjectId)
  344. const contractId = ref(useAppState.getContractId)
  345. const projectInfo = ref(useAppState.getProjectInfo)
  346. const contractInfo = ref(useAppState.getContractInfo)
  347. const isCollapse = ref(useAppState.getCollapse)
  348. const isBubble = ref(useAppState.getBubble)
  349. //监听
  350. watch(() => [useAppState.getCollapse, useAppState.getBubble], ([Collapse, bubble]) => {
  351. isCollapse.value = Collapse
  352. isBubble.value = bubble
  353. })
  354. //获取气泡数据
  355. const getButtonsVal = (value) => {
  356. return useAppState.getButtonsVal(value)
  357. }
  358. //自动展开缓存
  359. const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
  360. const btn_edit = ref(false)
  361. //渲染完成
  362. onMounted(() => {
  363. btn_edit.value = getButtonsVal('tentative_detect_test_edit')
  364. setContractType(contractInfo.value?.contractType)
  365. getCategoryData()
  366. getContractData()
  367. })
  368. //缓存被激活时,重新获取表格数据
  369. onActivated(() => {
  370. getDataApi()
  371. })
  372. const isFirstTime = ref(false)
  373. const getDataApi = async () => {
  374. isFirstTime.value = true
  375. const routerQuery = useRoutes?.query
  376. let currentPage = routerQuery?.current
  377. if (isNullES(currentPage)) {
  378. searchForm.value.current = 1
  379. } else {
  380. searchForm.value.current = Number(currentPage)
  381. }
  382. console.log(searchForm.value)
  383. // setMountOnEventKey()
  384. getTableData().then()
  385. }
  386. //获取合同段信息
  387. const contractData = ref([])
  388. const getContractData = async () => {
  389. const { data } = await getErtractInfo({
  390. projectId: projectId.value,
  391. contractId: contractId.value,
  392. })
  393. const res = getArrValue(data)
  394. contractData.value = res
  395. if (res.length <= 0) return
  396. let cid
  397. for (let i = 0; i < res.length; i++) {
  398. if (contractId.value == res[i].id) {
  399. cid = res[i].id
  400. }
  401. }
  402. searchForm.value.contractId = isNullES(cid) ? res[0].id : cid
  403. }
  404. const qualifiedData = ref([
  405. { label: '不合格', value: '0' },
  406. { label: '合格', value: '1' },
  407. ])
  408. //树展开和收起
  409. const isWbsTreeShow = ref(true)
  410. const setWbsTreeShow = () => {
  411. isWbsTreeShow.value = !isWbsTreeShow.value
  412. }
  413. //获取检测类别类型
  414. const categoryData = ref([])
  415. const getCategoryData = async () => {
  416. const { data } = await getDictionary({
  417. code: 'trial_detection_category',
  418. })
  419. const arrData = getArrValue(data)
  420. arrData.forEach(item => {
  421. item.dictKey = Number(item.dictKey)
  422. })
  423. categoryData.value = arrData
  424. }
  425. //搜索表单
  426. const searchForm = ref({
  427. trialUserName: null, queryStatus: null, queryValue: null, type: '1',
  428. current: 1, size: 20, total: 0,
  429. })
  430. //树相关的变量
  431. const primaryKeyId = ref('')
  432. const nodeDataInfo = ref({})
  433. //树被点击
  434. const wbsElTreeClick = ({ data, keys }) => {
  435. nodeDataInfo.value = data
  436. primaryKeyId.value = data['primaryKeyId'] || ''
  437. setStoreValue('testTreeItem', data)
  438. //缓存自动展开
  439. treeAutoExpandKeys.value = keys
  440. setStoreValue('testTreeExpandKeys', keys)
  441. //改变搜索表单数据
  442. searchForm.value.nodeId = data['primaryKeyId']
  443. if (!isFirstTime.value) {
  444. searchForm.value.current = 1
  445. } else {
  446. isFirstTime.value = false
  447. }
  448. getTableData()
  449. }
  450. //身份按钮切换数据
  451. const authBtnTabKey = ref('1')
  452. const authBtnTabdata = ref([
  453. { key: '1', name: '施工自检' },
  454. { key: '2', name: '监理抽检' },
  455. { key: '3', name: '业主抽检' },
  456. ])
  457. const authBtnTabClick = (item) => {
  458. tableData.value = []
  459. if (item.key !== authBtnTabKey.value && item.key < 3) {
  460. authBtnTabKey.value = item.key
  461. searchForm.value.type = item.key
  462. searchForm.value.current = 1
  463. getTableData()
  464. } else if (item.key === '3') {
  465. authBtnTabKey.value = item.key
  466. searchForm.value.type = item.key
  467. searchForm.value.current = 1
  468. getTableData()
  469. }
  470. }
  471. //contractType, 1施工,2监理, 3业主
  472. const setContractType = (contractType) => {
  473. let typeValue = '1'
  474. if (contractType > 0) {
  475. typeValue = contractType + ''
  476. }
  477. authBtnTabKey.value = typeValue
  478. searchForm.value.type = typeValue
  479. searchForm.value.current = 1
  480. }
  481. //日期时间被选择
  482. const betweenTime = ref(null)
  483. const betweenTimeUpdate = ({ arr }) => {
  484. betweenTime.value = arr
  485. if (arr.length > 0) {
  486. searchForm.value.startTime = arr[0]
  487. searchForm.value.endTime = arr[1]
  488. } else {
  489. searchForm.value.startTime = ''
  490. searchForm.value.endTime = ''
  491. }
  492. }
  493. //回车搜索
  494. const keyUpEvent = (e) => {
  495. if (e.key === 'Enter') {
  496. searchForm.value.current = 1
  497. getTableData()
  498. }
  499. }
  500. //搜索
  501. const searchClick = () => {
  502. searchForm.value.current = 1
  503. getTableData()
  504. }
  505. //分页被点击
  506. const pageChange = ({ current, size }) => {
  507. searchForm.value.current = current
  508. searchForm.value.size = size
  509. getTableData()
  510. }
  511. const dataBtnLoad = ref(false)
  512. //综合功能菜单
  513. const dataSyncMenu = [
  514. { key: 'copy', name: '复制', load: true },
  515. { key: 'print', name: '批量打印', load: true },
  516. { key: 'delete', name: '批量废除', load: true },
  517. { key: 'printExcel', name: '打印空表', load: true },
  518. ]
  519. const dataSyncMenuClick = (item) => {
  520. const { key } = item
  521. if (key === 'copy') {
  522. copyDataClick()
  523. } else if (key === 'print') {
  524. printPdfClick()
  525. } else if (key === 'delete') {
  526. quitPdfClick()
  527. } else if (key === 'printExcel') {
  528. printNullPdfClick()
  529. }
  530. }
  531. //表格数据
  532. const tableRef = ref(null)
  533. const tableColumn = ref([
  534. { key: 'recordNo', name: '记录编号', width: 190 },
  535. { key: 'reportNo', name: '报告编号', width: 190, autoWidth: true },
  536. { key: 'trialProjectName', name: '试验项目名称', width: 100, autoWidth: true },
  537. { key: 'detectionResult', name: '检测结果', width: 140, autoWidth: true },
  538. { key: 'taskStatus', name: '任务状态', width: 120, autoWidth: true },
  539. { key: 'reportDate', name: '报告日期', width: 120, autoWidth: true },
  540. { key: 'trialUserName', name: '试验人员', width: 170, autoWidth: true },
  541. { key: 'samplingLocation', name: '取样地点', width: 180, autoWidth: true },
  542. { key: 'detectionCategory', name: '检测类别', width: 100, autoWidth: true },
  543. { key: 'isUploadCertificate', name: '是否上传合格证', width: 120, autoWidth: true },
  544. { key: 'contractId', name: '合同段', width: 140, autoWidth: true },
  545. { key: 'company', name: '单位', width: 160, autoWidth: true },
  546. { key: 'entrustName', name: '委托单名称', autoWidth: true },
  547. { key: 'entrustNo', name: '委托单编号', autoWidth: true },
  548. { key: 'specificationNumber', name: '样品编号', width: 220, autoWidth: true },
  549. { key: 'specificationModel', name: '规格类型', width: 200, autoWidth: true },
  550. //{key:'projectPosition', name: '工程部位及用途', width: 160},
  551. { key: 'projectPositionName', name: '工程部位及用途', width: 160, autoWidth: true },
  552. { key: 'action', name: '操作', width: 120, fixed: 'right', align: 'center' },
  553. ])
  554. const tableData = ref([])
  555. //获取数据
  556. const tableLoading = ref(false)
  557. const getTableData = async () => {
  558. tableLoading.value = true
  559. const { error, code, data } = await dataApi.queryPage({
  560. ...searchForm.value,
  561. projectId: projectId.value,
  562. //contractId: contractId.value,
  563. })
  564. //处理数据
  565. tableLoading.value = false
  566. if (!error && code === 200) {
  567. tableData.value = getArrValue(data?.records)
  568. searchForm.value.total = data?.total || 0
  569. } else {
  570. tableData.value = []
  571. searchForm.value.total = 0
  572. }
  573. }
  574. //多选
  575. const tableCheckedKeys = ref([])
  576. const tableSelection = (rows) => {
  577. tableCheckedKeys.value = rows
  578. }
  579. //新增
  580. const addFormModalClick = () => {
  581. delStoreValue('test-form')
  582. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  583. const obj = getObjValue(searchForm.value)
  584. router.push({
  585. path: '/tentative/detect/test-form',
  586. query: {
  587. nodeId: primaryKeyId.value,
  588. dataType: authBtnTabKey.value,
  589. cid: obj?.contractId,
  590. isaddType: true,
  591. current: obj?.current,
  592. },
  593. })
  594. }
  595. //编辑
  596. const tableRowEdit = (row, tabTypeKey) => {
  597. setStoreValue('test-form', row)
  598. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  599. const obj = getObjValue(searchForm.value)
  600. router.push({
  601. path: '/tentative/detect/test-form',
  602. query: {
  603. id: row.id,
  604. nodeId: row.nodeId,
  605. dataType: row.type,
  606. tabTypeKey: tabTypeKey,
  607. cid: obj?.contractId,
  608. current: obj?.current,
  609. // prenodeDataInfo:JSON.stringify(nodeDataInfo.value)
  610. },
  611. })
  612. }
  613. //预览PDF
  614. const tableRowPdf = ({ pdfUrl }) => {
  615. if (pdfUrl) {
  616. toPdfPage(pdfUrl)
  617. //window.open(pdfUrl, '_blank')
  618. } else {
  619. window.$message?.warning('该数据暂无PDF')
  620. }
  621. }
  622. //复制
  623. const copyDataClick = () => {
  624. const rows = tableCheckedKeys.value
  625. if (rows.length > 0) {
  626. const ids = arrToId(rows)
  627. copyDataApi(ids)
  628. } else {
  629. window.$message?.warning('请先勾选需要复制的记录')
  630. }
  631. }
  632. //请求复制
  633. const copyLoading = ref(false)
  634. const copyDataApi = async (ids) => {
  635. //请求数据
  636. copyLoading.value = true
  637. dataBtnLoad.value = true
  638. const { error, code, msg } = await dataApi.copyData({
  639. projectId: projectId.value,
  640. ids: ids,
  641. }, false)
  642. //处理数据
  643. copyLoading.value = false
  644. dataBtnLoad.value = false
  645. if (!error && code === 200) {
  646. window.$message?.success('复制成功')
  647. searchClick()
  648. }
  649. }
  650. //删除
  651. const delModalClick = () => {
  652. const rows = tableCheckedKeys.value
  653. if (rows.length > 0) {
  654. const ids = arrToId(rows)
  655. HcDelMsg(async (resolve) => {
  656. await removeDataApi(ids)
  657. resolve() //关闭弹窗的回调
  658. })
  659. } else {
  660. window.$message?.warning('请先勾选需要删除的记录')
  661. }
  662. }
  663. //请求删除
  664. const removeLoading = ref(false)
  665. const removeDataApi = async (ids) => {
  666. //请求数据
  667. removeLoading.value = true
  668. const { error, code, msg } = await dataApi.removeData({
  669. projectId: projectId.value,
  670. ids: ids,
  671. }, false)
  672. //处理数据
  673. removeLoading.value = false
  674. if (!error && code === 200) {
  675. window.$message?.success('删除成功')
  676. searchClick()
  677. }
  678. }
  679. //批量打印
  680. const printPdfLoading = ref(false)
  681. const printPdfClick = async () => {
  682. const rows = tableCheckedKeys.value
  683. if (rows.length > 0) {
  684. const ids = arrToId(rows)
  685. //请求数据
  686. printPdfLoading.value = true
  687. dataBtnLoad.value = true
  688. const { error, code, msg, data } = await dataApi.printPdf({
  689. projectId: projectId.value,
  690. ids: ids,
  691. }, false)
  692. //处理数据
  693. const pdfUrl = isString(data) ? data || '' : ''
  694. printPdfLoading.value = false
  695. dataBtnLoad.value = false
  696. if (!error && code === 200 && pdfUrl) {
  697. toPdfPage(pdfUrl)
  698. //window.open(pdfUrl, '_blank')
  699. } else {
  700. window.$message?.error(msg || '文件异常')
  701. }
  702. } else {
  703. window.$message?.warning('请先勾选需要批量打印的记录')
  704. }
  705. }
  706. //批量废除
  707. const quitPdfLoading = ref(false)
  708. const quitPdfClick = async () => {
  709. const rows = tableCheckedKeys.value
  710. if (rows.length > 0) {
  711. const ids = arrToId(rows)
  712. const res1 = rows.some(item => item.taskStatus === '未上报')
  713. const res2 = rows.some(item => item.taskStatus === '已废除')
  714. if (res1) {
  715. window.$message?.warning('未上报的文件不能废除')
  716. } else if (res2) {
  717. window.$message?.warning('已废除的文件不能再次废除')
  718. } else {
  719. //请求数据
  720. quitPdfLoading.value = true
  721. dataBtnLoad.value = true
  722. const { error, code, msg } = await dataApi.batchAbolish({
  723. projectId: projectId.value,
  724. contractId: contractId.value,
  725. primaryKeyId: primaryKeyId.value,
  726. ids: ids,
  727. }, false)
  728. dataBtnLoad.value = false
  729. //处理数据
  730. if (!error && code === 200) {
  731. window.$message?.success('废除成功')
  732. quitPdfLoading.value = false
  733. searchClick()
  734. } else {
  735. quitPdfLoading.value = false
  736. // window.$message?.error(msg)
  737. }
  738. }
  739. } else {
  740. window.$message?.warning('请先勾选需要批量打印的记录')
  741. }
  742. }
  743. //批量上报
  744. const reportPdfLoading = ref(false)
  745. //批量上报
  746. const reportIds = ref('')
  747. const reportTaskName = ref('')
  748. const reportAddition = ref({})
  749. const showReportModal = ref(false)
  750. const reportLoading = ref(false)
  751. const reportTypeData = ref([])
  752. const reportPdfClick = async () => {
  753. const rows = tableCheckedKeys.value
  754. if (rows.length > 0) {
  755. const info = getStoreValue('prenodeDataInfo') || {}
  756. const res1 = rows.some(item => item.pdfUrl.length < 1)
  757. const res2 = rows.some(item => item.taskStatus === '待审批' || item.taskStatus === '已审批')
  758. if (res1) {
  759. window.$message?.warning('当前数据暂无pdf无法上报')
  760. } else if (res2) {
  761. window.$message?.warning('已上报的数据无法再次上报')
  762. } else {
  763. reportLoading.value = true
  764. const ids = arrToId(rows)
  765. reportIds.value = ids
  766. const taskCheck = await eVisaTaskCheckApi({
  767. projectId: projectId.value,
  768. contractId: contractId.value,
  769. })
  770. //处理数据
  771. let newArr = []
  772. for (let i = 0; i < rows.length; i++) {
  773. newArr.push(rows[i]['tableIds'])
  774. }
  775. reportTypeData.value = [...newArr]
  776. console.log(reportTypeData.value, ' reportTypeData.value')
  777. reportLoading.value = false
  778. if (taskCheck) {
  779. //初始弹出弹窗,防呆
  780. reportAddition.value = {
  781. classify: authBtnTabKey.value,
  782. contractIdRelation: info['contractIdRelation'],
  783. }
  784. showReportModal.value = true
  785. //请求文件题名
  786. const { data } = await wbsApi.queryDocumentTitle({
  787. // primaryKeyId: info['primaryKeyId'],
  788. primaryKeyId: rows[0].id,
  789. classify: authBtnTabKey.value,
  790. })
  791. reportTaskName.value = isString(data) ? data : ''
  792. } else {
  793. window.$message?.warning('暂无相关数据')
  794. }
  795. }
  796. } else {
  797. window.$message?.warning('请先勾选需要批量上报的记录')
  798. }
  799. }
  800. //上报完成
  801. const showReportFinish = () => {
  802. showReportModal.value = false
  803. getTableData()
  804. }
  805. //打印空表
  806. const printNullPdfLoading = ref(false)
  807. const printNullPdfClick = async () => {
  808. const rows = tableCheckedKeys.value
  809. if (rows.length > 0) {
  810. const ids = arrToId(rows)
  811. //请求数据
  812. printNullPdfLoading.value = true
  813. dataBtnLoad.value = true
  814. const { error, code, msg, data } = await dataApi.printNullPdf({
  815. projectId: projectId.value,
  816. ids: ids,
  817. }, false)
  818. //处理数据
  819. const pdfUrl = isString(data) ? data || '' : ''
  820. printNullPdfLoading.value = false
  821. dataBtnLoad.value = false
  822. if (!error && code === 200 && pdfUrl) {
  823. toPdfPage(pdfUrl)
  824. //window.open(pdfUrl, '_blank')
  825. } else {
  826. window.$message?.error(msg || '文件异常')
  827. }
  828. } else {
  829. window.$message?.warning('请先勾选需要打印空表的记录')
  830. }
  831. }
  832. //查看附件
  833. const viewAttachmentModal = ref(false)
  834. const viewAttachmentLoading = ref(false)
  835. const viewAttachmentId = ref('')
  836. const viewAttachmentData = ref([])
  837. const viewAttachmentModalClick = async ({ id }) => {
  838. viewAttachmentId.value = id
  839. viewAttachmentModal.value = true
  840. getAttachmentModalClick(viewAttachmentId.value, '1')
  841. }
  842. const getCaption = (obj) => {
  843. const index = obj.lastIndexOf('pdf')
  844. return index
  845. }
  846. //获取附件
  847. const getAttachmentModalClick = async (id, type) => {
  848. viewAttachmentLoading.value = true
  849. const { error, code, data } = await dataApi.ancillaryDocumentsList({ id: id, type: type })
  850. console.log(data, 'data')
  851. viewAttachmentLoading.value = false
  852. if (!error && code === 200) {
  853. viewAttachmentData.value = getArrValue(data)
  854. curFileData.value = viewAttachmentData.value[0]
  855. viewCurFile(curFileData.value)
  856. } else {
  857. viewAttachmentData.value = []
  858. }
  859. }
  860. const refeshAttachmentModalClick = async (id, type) => {
  861. const { error, code, data } = await dataApi.ancillaryDocumentsList({ id: id, type: type })
  862. //处理数据
  863. viewAttachmentLoading.value = false
  864. if (!error && code === 200) {
  865. viewAttachmentData.value = getArrValue(data)
  866. if (viewAttachmentData.value.length < 1) {
  867. // window.$message?.warning('该条记录不存在附件')
  868. } else {
  869. viewCurFile(viewAttachmentData.value[0])
  870. }
  871. } else {
  872. viewAttachmentData.value = []
  873. }
  874. }
  875. const attachmentPdfUrl = ref('')
  876. const curFileData = ref({})
  877. //类型tab数据和相关处理
  878. const tabTypeKey = ref('1')
  879. const tabTypeTab = ref([
  880. { key: '1', name: '生产合格证' },
  881. { key: '2', name: '厂家质检报告' },
  882. { key: '3', name: '其他文件' },
  883. ])
  884. const tabTypeChange = (item) => {
  885. console.log(1111111111)
  886. tabTypeKey.value = item?.key
  887. getAttachmentModalClick(viewAttachmentId.value, item?.key)
  888. fileListData.value = []
  889. refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  890. }
  891. //关闭查看附件
  892. const viewAttachmentModalClose = () => {
  893. viewAttachmentModal.value = false
  894. curFileData.value = ''
  895. attachmentPdfUrl.value = ''
  896. }
  897. const uploadData = ref({})
  898. const fileListData = ref([])
  899. const listuploadref = ref('1')
  900. //截取文件名称
  901. const splitFileName = (str) => {
  902. // if(str.indexOf("https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload") != -1){
  903. if (str.indexOf('https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload') != -1) {
  904. let a = str.split('//')[2].split('/')[2]
  905. return a
  906. } else {
  907. return str
  908. }
  909. }
  910. //查看当前文件pdf
  911. const viewCurFile = (item) => {
  912. console.log(item, 'item')
  913. if (item) {
  914. curFileData.value = item
  915. let arr = []
  916. arr.push({ name: item.fileName, url: item.url })
  917. fileListData.value = getArrValue(arr)
  918. viewAttachmentData.value.forEach((ele) => {
  919. ele.isCheck = false
  920. })
  921. item.isCheck = true
  922. }
  923. }
  924. //上传进度
  925. const uploadprogress = (res) => {
  926. console.log('进度')
  927. }
  928. //上传完成
  929. const uploadFinished = async (res) => {
  930. const { error, code, data } = await dataApi.updateAncillaryDocument(
  931. {
  932. selfId: viewAttachmentId.value,
  933. url: res.link,
  934. type: tabTypeKey.value,
  935. })
  936. console.log(data, 'data')
  937. if (!error && code === 200) {
  938. refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  939. }
  940. }
  941. //上传文件delFileData
  942. const delFileData = async (res) => {
  943. console.log('删除文件', curFileData.value)
  944. if (curFileData.value.isDel == 0) {
  945. window.$message.warning('该文件不可删除')
  946. } else {
  947. const { error, code, data } = await dataApi.removedocuments({
  948. projectId: projectId.value,
  949. id: curFileData.value.id,
  950. })
  951. if (!error && code === 200) {
  952. window.$message.success('删除成功')
  953. refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  954. }
  955. }
  956. }
  957. //样品信息数据
  958. const samplingTableColumn = ref([
  959. { key: 'materialName', name: '样品名称' },
  960. { key: 'samplingDate', name: '取样时间' },
  961. { key: 'specificationNumber', name: '样品编号' },
  962. { key: 'specificationModel', name: '规格型号' },
  963. { key: 'materialCount', name: '试样数量' },
  964. { key: 'calculationUnit', name: '计算单位' },
  965. { key: 'proposedPosition', name: '拟用部位' },
  966. { key: 'representativeCount', name: '代表数量' },
  967. { key: 'userName', name: '取样人' },
  968. ])
  969. const samplingTableData = ref([])
  970. const samplingTableLoading = ref(false)
  971. //取样记录
  972. const samplingRecordModal = ref(false)
  973. const samplingRecordModalClick = async ({ id }) => {
  974. samplingRecordModal.value = true
  975. samplingTableLoading.value = true
  976. const { error, code, data } = await dataApi.getSampleList({
  977. projectId: projectId.value,
  978. id: id,
  979. })
  980. //处理数据
  981. samplingTableLoading.value = false
  982. if (!error && code === 200) {
  983. samplingTableData.value = getArrValue(data)
  984. } else {
  985. samplingTableData.value = []
  986. }
  987. }
  988. //关闭样品信息
  989. const samplingRecordModalClose = () => {
  990. samplingRecordModal.value = false
  991. samplingTableData.value = []
  992. }
  993. //左右拖动,改变树形结构宽度
  994. const leftWidth = ref(382)
  995. const onmousedown = () => {
  996. const leftNum = isCollapse.value ? 142 : 272
  997. document.onmousemove = (ve) => {
  998. let diffVal = ve.clientX - leftNum
  999. if (diffVal >= 310 && diffVal <= 900) {
  1000. leftWidth.value = diffVal
  1001. }
  1002. }
  1003. document.onmouseup = () => {
  1004. document.onmousemove = null
  1005. document.onmouseup = null
  1006. }
  1007. }
  1008. //关联查阅
  1009. const isRelatedSearch = ref(false)
  1010. const relatedSearchClick = (row) => {
  1011. isRelatedSearch.value = true
  1012. //获取样品信息
  1013. getSampleList(row.id)
  1014. //获取委托单
  1015. getCommissionData(row.entrustId)
  1016. //获取关联设备
  1017. getAcquisitionData(row.loadDataId)
  1018. }
  1019. //样品信息
  1020. const relatedColumn1 = [
  1021. { key: 'materialName', name: '样品名称' },
  1022. { key: 'samplingDate', name: '取样日期' },
  1023. { key: 'specificationNumber', name: '样品编号' },
  1024. { key: 'specificationModel', name: '规格型号' },
  1025. { key: 'materialCount', name: '试样数量' },
  1026. { key: 'calculationUnit', name: '计算单位' },
  1027. { key: 'proposedPosition', name: '拟用部位' },
  1028. { key: 'representativeCount', name: '代表数量' },
  1029. { key: 'userName', name: '取样人' },
  1030. { key: 'carryTime', name: '入库时间', align: 'center' },
  1031. { key: 'createTime', name: '试验时间', align: 'center' },
  1032. { key: 'no-key', name: '样品处理' },
  1033. { key: 'no-key', name: '时间(或处理原因)' },
  1034. ]
  1035. const relatedData1 = ref([])
  1036. const getSampleList = async (id) => {
  1037. relatedData1.value = []
  1038. if (isNullES(id) || id == 0) return
  1039. const { data } = await dataApi.getSampleList({ id })
  1040. relatedData1.value = getArrValue(data)
  1041. }
  1042. //委托单信息
  1043. const relatedColumn2 = [
  1044. { key: 'entrustInfo', name: '委托单位' },
  1045. { key: 'entrustNo', name: '委托单编号' },
  1046. { key: 'entrustName', name: '委托单名称' },
  1047. { key: 'status', name: '委托单状态', width: 120, align: 'center' },
  1048. ]
  1049. const relatedData2 = ref([])
  1050. const getCommissionData = async (id) => {
  1051. relatedData2.value = []
  1052. if (isNullES(id) || id == 0) return
  1053. const { data } = await commissionApi.detail(id)
  1054. const res = getObjVal(data)
  1055. relatedData2.value = res ? [res] : []
  1056. }
  1057. //设备采集信息
  1058. const relatedColumn3 = [
  1059. { key: 'engineInfo', name: '工程部位' },
  1060. { key: 'deviceName', name: '设备名称' },
  1061. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1062. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1063. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1064. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1065. { key: 'beArea', name: '承压面积(mm2)', width: 100, align: 'center' },
  1066. { key: 'specimenSize', name: '试件尺寸(mm)', width: 100, align: 'center' },
  1067. { key: 'desStrength', name: '设计强度(MPa)', width: 100, align: 'center' },
  1068. { key: 'ageDate', name: '龄期(d)', width: 100, align: 'center' },
  1069. { key: 'load1', name: '荷载1(KN)', width: 100, align: 'center' },
  1070. { key: 'load2', name: '荷载2(KN)', width: 100, align: 'center' },
  1071. { key: 'load3', name: '荷载3(KN)', width: 100, align: 'center' },
  1072. { key: 'no-key', name: '荷载4(KN)', width: 100, align: 'center' },
  1073. { key: 'no-key', name: '荷载5(KN)', width: 100, align: 'center' },
  1074. { key: 'no-key', name: '荷载6(KN)', width: 100, align: 'center' },
  1075. { key: 'strengthAVG', name: '强度代表值(MPa)', width: 100, align: 'center' },
  1076. {
  1077. name: '最大力总延伸(%)',
  1078. children: [
  1079. { key: 'maxConceal1', name: '1', width: 100, align: 'center' },
  1080. { key: 'maxConceal2', name: '2', width: 100, align: 'center' },
  1081. { key: 'maxConceal3', name: '3', width: 100, align: 'center' },
  1082. ],
  1083. },
  1084. //{ key: 'dataQualified', name: '试验结果是否合格', width: 100, align: 'center' },
  1085. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1086. ]
  1087. const relatedData3 = ref([])
  1088. const getAcquisitionData = async (id) => {
  1089. relatedData3.value = []
  1090. if (isNullES(id) || id == 0) return
  1091. const { data } = await acquisitionApi.selectDataInfoById(id)
  1092. const res = getObjVal(data)
  1093. if (res) {
  1094. relatedData3.value = res ? [res] : []
  1095. setRelatedColumn3(res.testTypePId)
  1096. }
  1097. }
  1098. //设置表头
  1099. const setRelatedColumn3 = (type) => {
  1100. //压力机
  1101. if (type === '1') {
  1102. relatedColumn3.value = [
  1103. { key: 'engineInfo', name: '工程部位' },
  1104. { key: 'deviceName', name: '设备名称' },
  1105. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1106. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1107. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1108. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1109. { key: 'beArea', name: '承压面积(mm2)', width: 100, align: 'center' },
  1110. { key: 'specimenSize', name: '试件尺寸(mm)', width: 100, align: 'center' },
  1111. { key: 'desStrength', name: '设计强度(MPa)', width: 100, align: 'center' },
  1112. { key: 'no-key', name: '龄期(d)', width: 100, align: 'center' },
  1113. { key: 'load1', name: '荷载1(KN)', width: 100, align: 'center' },
  1114. { key: 'load2', name: '荷载2(KN)', width: 100, align: 'center' },
  1115. { key: 'load3', name: '荷载3(KN)', width: 100, align: 'center' },
  1116. { key: 'no-key', name: '荷载4(KN)', width: 100, align: 'center' },
  1117. { key: 'no-key', name: '荷载5(KN)', width: 100, align: 'center' },
  1118. { key: 'no-key', name: '荷载6(KN)', width: 100, align: 'center' },
  1119. { key: 'no-key', name: '强度代表值(MPa)', width: 100, align: 'center' },
  1120. {
  1121. name: '最大力总延伸(%)',
  1122. children: [
  1123. { key: 'maxConceal1', name: '1', width: 100, align: 'center' },
  1124. { key: 'maxConceal2', name: '2', width: 100, align: 'center' },
  1125. { key: 'maxConceal3', name: '3', width: 100, align: 'center' },
  1126. ],
  1127. },
  1128. //{ key: 'dataQualified', name: '试验结果是否合格', width: 100, align: 'center' },
  1129. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1130. ]
  1131. } else if (type === '2') {
  1132. //万能机
  1133. relatedColumn3.value = [
  1134. { key: 'engineInfo', name: '工程部位' },
  1135. { key: 'deviceName', name: '设备名称' },
  1136. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1137. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1138. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1139. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1140. { key: 'no-key', name: '牌号', width: 100, align: 'center' },
  1141. { key: 'no-key', name: '公称直径(mm)', width: 100, align: 'center' },
  1142. { key: 'no-key', name: '规格', width: 100, align: 'center' },
  1143. {
  1144. name: '最大力/荷载(KN)',
  1145. children: [
  1146. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1147. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1148. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1149. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1150. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1151. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1152. ],
  1153. },
  1154. {
  1155. name: '抗拉强度/强度代表值(MPa)',
  1156. children: [
  1157. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1158. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1159. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1160. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1161. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1162. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1163. ],
  1164. },
  1165. {
  1166. name: '上屈服力(KN)',
  1167. children: [
  1168. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1169. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1170. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1171. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1172. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1173. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1174. ],
  1175. },
  1176. {
  1177. name: '下屈服力(KN)',
  1178. children: [
  1179. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1180. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1181. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1182. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1183. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1184. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1185. ],
  1186. },
  1187. {
  1188. name: '上屈服强度(MPa)',
  1189. children: [
  1190. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1191. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1192. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1193. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1194. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1195. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1196. ],
  1197. },
  1198. {
  1199. name: '下屈服强度(MPa)',
  1200. children: [
  1201. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1202. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1203. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1204. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1205. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1206. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1207. ],
  1208. },
  1209. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1210. ]
  1211. }
  1212. }
  1213. //关闭关联查阅
  1214. const relatedSearchModalClose = () => {
  1215. isRelatedSearch.value = false
  1216. relatedData1.value = []
  1217. relatedData2.value = []
  1218. relatedData3.value = []
  1219. }
  1220. //表单数据
  1221. const formRef = ref(null)
  1222. const formModel = ref({})
  1223. const formRules = {
  1224. repealType: {
  1225. required: true,
  1226. trigger: 'blur',
  1227. message: '请选择处理方式',
  1228. },
  1229. repealReason: {
  1230. required: true,
  1231. trigger: 'blur',
  1232. message: '请填写处理原因',
  1233. },
  1234. resamStartTime: {
  1235. required: true,
  1236. trigger: 'blur',
  1237. message: '请选择留样时间',
  1238. },
  1239. }
  1240. //样品处理
  1241. const disposeModal = ref(false)
  1242. const rowDispose = () => {
  1243. disposeModal.value = true
  1244. const rows = relatedData1.value
  1245. formModel.value = {
  1246. id: arrToId(rows),
  1247. repealType: 1,
  1248. }
  1249. }
  1250. //日期时间被选择
  1251. const formTime = ref(null)
  1252. const formTimeUpdate = ({ arr }) => {
  1253. formTime.value = arr
  1254. if (arr.length > 0) {
  1255. formModel.value.resamStartTime = arr[0]
  1256. formModel.value.resamEndTime = arr[1]
  1257. } else {
  1258. formModel.value.resamStartTime = ''
  1259. formModel.value.resamEndTime = ''
  1260. }
  1261. }
  1262. //确定提交
  1263. const saveLoading = ref(false)
  1264. const disposeSave = async () => {
  1265. const isForm = await formValidate(formRef.value)
  1266. if (!isForm) return
  1267. const { error, code, msg } = await testSampleApi.update(formModel.value)
  1268. saveLoading.value = false
  1269. if (!error && code === 200) {
  1270. window.$message.success('提交成功')
  1271. disposeClose()
  1272. getTableData().then()
  1273. } else {
  1274. window.$message.error(msg || '操作失败')
  1275. }
  1276. }
  1277. //关闭弹窗
  1278. const disposeClose = () => {
  1279. disposeModal.value = false
  1280. formModel.value = {}
  1281. }
  1282. //一键重签
  1283. const signLoading = ref(false)
  1284. const resignModal = ref(false)
  1285. const resignModalRadio = ref(0)
  1286. const resignClick = async ()=>{
  1287. const rows = tableCheckedKeys.value
  1288. if (rows.length <= 0) {
  1289. window.$message?.warning('请先勾选已审批的数据')
  1290. return
  1291. }
  1292. resignModal.value = true
  1293. }
  1294. const signClick = async () => {
  1295. const rows = tableCheckedKeys.value
  1296. //获取任务id
  1297. const taskIds = arrToKey(rows, 'id')
  1298. //发起请求
  1299. signLoading.value = true
  1300. const { error, code, msg } = await dataApi.reSigningTrial({
  1301. projectId: projectId.value,
  1302. trialIds: taskIds,
  1303. type:resignModalRadio.value,
  1304. })
  1305. //处理数据
  1306. signLoading.value = false
  1307. if (!error && code === 200) {
  1308. window.$message?.success(msg ?? '提交成功,请请耐心等待重签,可继续操作其它的功能。')
  1309. getTableData().then()
  1310. } else {
  1311. window.$message?.error(msg ?? '操作失败')
  1312. }
  1313. resignModal.value = false
  1314. }
  1315. const cancelresign = ()=>{
  1316. resignModalRadio.value = 0
  1317. resignModal.value = false
  1318. }
  1319. </script>
  1320. <style lang="scss" scoped>
  1321. @import "../../../styles/tentative/detect/test.scss";
  1322. .hc-switch-tab-content {
  1323. .pdf-file-list-box {
  1324. position: relative;
  1325. border-right: 1px solid #e9e9e9;
  1326. padding: 5px 0;
  1327. overflow-y: auto;
  1328. height: 100%;
  1329. flex: 1;
  1330. .file-item {
  1331. position: relative;
  1332. cursor: pointer;
  1333. padding: 6px 10px;
  1334. &:hover {
  1335. color: var(--el-color-primary);
  1336. background-color: var(--el-color-primary-light-8);
  1337. }
  1338. &.cur {
  1339. color: var(--el-color-primary);
  1340. background-color: var(--el-color-primary-light-8);
  1341. }
  1342. }
  1343. }
  1344. .hc-no-table-form {
  1345. flex: 1;
  1346. }
  1347. }
  1348. </style>
  1349. <style lang="scss">
  1350. .hc-related-search-box .hc-card-item-box {
  1351. background: #f5f5f5;
  1352. .hc-card-item-header {
  1353. color: #101010;
  1354. padding-bottom: 14px;
  1355. border-bottom: 1px solid #d6d6d6;
  1356. }
  1357. .hc-card-item-header .item-header {
  1358. font-size: 16px;
  1359. }
  1360. }
  1361. </style>