ListItem.vue 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796
  1. <template>
  2. <div class="data-fill-list-box">
  3. <el-collapse v-model="ActiveKey" @change="CollapseChange">
  4. <template v-for="(item,index) in listDatas" :key="item?.pkeyId">
  5. <el-collapse-item :name="`item-${index}-${item?.pkeyId}`" :disabled="item['isBussShow'] === 2" :id="`item-${index}-${item?.pkeyId}`">
  6. <template #title>
  7. <div class="hc-collapse-item-header">
  8. <div class="text-lg truncate item-title">{{item.nodeName}}</div>
  9. <div class="hc-extra-text-box">
  10. <HcTooltip keys="wbs_del_table" v-if="item['isCopeTab'] === 2">
  11. <el-button type="danger" plain :disabled="item['isBussShow'] === 2" @click.stop="delClick(item,index)">删除本表</el-button>
  12. </HcTooltip>
  13. <HcTooltip keys="wbs_copy_table">
  14. <el-button type="primary" plain :disabled="item['isBussShow'] === 2" @click.stop="copyClick(item,index)">复制本表</el-button>
  15. </HcTooltip>
  16. <HcTooltip keys="wbs_hide_table">
  17. <el-button type="primary" plain @click.stop="hideClick(item,index)">
  18. <template v-if="item['isBussShow'] === 1">隐藏本表</template>
  19. <template v-else>显示本表</template>
  20. </el-button>
  21. </HcTooltip>
  22. <HcTooltip keys="wbs_preview_table" v-if="isStatus != 3">
  23. <el-button type="info" plain disabled v-if="item['isBussShow'] === 2 || item['isTabPdf'] === 1">预览</el-button>
  24. <el-button type="primary" plain @click.stop="previewClick(item,index)" v-else>预览</el-button>
  25. </HcTooltip>
  26. <HcTooltip keys="wbs_upload_table">
  27. <el-button :type="item['tabFileType'] === 2?'success':'primary'" plain :disabled="item['isBussShow'] === 2" @click.stop="uploadClick(item,index)">
  28. <template v-if="item['tabFileType'] === 2">已上传</template>
  29. <template v-else>上传</template>
  30. </el-button>
  31. </HcTooltip>
  32. </div>
  33. </div>
  34. </template>
  35. <div class="data-fill-list-item-content">
  36. <div class="data-fill-table-form-box">
  37. <div class="hc-excel-table-form-view" :id="`table-form-${item?.pkeyId}`"/>
  38. <div class="hc-no-table-form" v-if="item?.isTableForm === false">
  39. <div class="table-form-no">
  40. <img :src="notableform" alt=""/>
  41. <div class="desc">暂无表单数据</div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="data-fill-table-tip-box">
  46. <div class="text-orange tip-title">
  47. <HcIcon name="error" fill ui="text-2xl"/>
  48. <span class="ml-1">提示</span>
  49. </div>
  50. <div class="text-gray-400 tip-item">1、灰色框代表可通过系统识别计算,公式自动引用,可通过公式计算少量数据,(表头数据及简单),也可只填写白色框数据</div>
  51. <div class="text-gray-400 tip-item">2、系统支持键盘中,shift + tab键向上一个填报框切换,tab向下一个填报框切换。暂不支持上下按键切换输入框</div>
  52. <div class="table-tip-foot">
  53. <div class="tip-left-btn">
  54. <HcTooltip keys="wbs_import_table">
  55. <div class="text-gray-400 dow-text">
  56. <HcIcon name="publish" ui="text-lg"/>
  57. <span class="ml-1">导入列表数据</span>
  58. </div>
  59. </HcTooltip>
  60. <HcTooltip keys="wbs_download_table">
  61. <div class="text-main dow-text">
  62. <HcIcon name="file_download" ui="text-lg"/>
  63. <span class="ml-1">下载导入模板</span>
  64. </div>
  65. </HcTooltip>
  66. </div>
  67. <div class="tip-right-btn">
  68. <HcTooltip keys="wbs_save_table">
  69. <el-button type="primary" hc-btn :disabled="item?.isTableForm === false" :loading="tableFormSaveLoading" @click="tableFormSaveClick(item,index)">
  70. <HcIcon name="save"/>
  71. <span>保存</span>
  72. </el-button>
  73. </HcTooltip>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </el-collapse-item>
  79. </template>
  80. </el-collapse>
  81. </div>
  82. <!--右键菜单-->
  83. <HcContextMenu ref="contextMenuRef" :datas="tableFormMenu" @item-click="handleMenuSelect"/>
  84. <!--上传文件-->
  85. <HcDialog :show="uploadModal" title="上传文件" widths="38rem" :footer="false" @close="uploadModal = false">
  86. <HcUpload :fileList="fileListData" :datas="uploadData" @change='uploadChange'/>
  87. </HcDialog>
  88. <!--插入设计值/频率-->
  89. <HcDialog :show="IDVFModal" title="插入设计值/频率" widths="600px" saveText="确认插入" @close="IDVFModal = false" @save="IDVFModalSaveClick">
  90. <el-alert title="填写完设计值和频率,系统自动计算实测值" type="warning" :closable="false"/>
  91. <el-form ref="formIDVFRef" :model="formIDVFModel" label-width="auto" size="large">
  92. <div class="form-item-div text-center mb-3">
  93. <el-radio-group size="large" v-model="formIDVFModel.type">
  94. <el-radio :label="1">公路工程</el-radio>
  95. <el-radio :label="2" class="ml-4">水利水电</el-radio>
  96. </el-radio-group>
  97. </div>
  98. <el-form-item label="设计值">
  99. <!-- onkeyup="value = value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g,'$1')" -->
  100. <el-input v-model="formIDVFModel.design" placeholder="如果设计值存在两个,则使用 '*',或者 '/' 连接,例如45*78,12/23"/>
  101. </el-form-item>
  102. <el-form-item label="频率" v-if="formIDVFModel.type === 1">
  103. <!-- onkeyup="value = value.replace(/^(0+)|[^\d]+/g,'')" -->
  104. <el-input v-model="formIDVFModel.size" placeholder="如果频率存在两个,则使用 '*',或者 '/' 连接例如2*4,5/7"/>
  105. </el-form-item>
  106. <el-form-item label="容量" v-if="formIDVFModel.type === 2">
  107. <!-- onkeyup="value = value.replace(/^(0+)|[^\d]+/g,'')" -->
  108. <el-input v-model="formIDVFModel.capacity" placeholder="如果容量存在两个,则使用 '*',或者 '/' 连接例如2*4,5/7"/>
  109. </el-form-item>
  110. <el-form-item label="合格点数">
  111. <el-input v-model="formIDVFModel.fail" placeholder="请填写合格点数(不填写则默认全部合格)" onkeyup="value = value.replace(/^(0+)|[^\d]+/g,'')"/>
  112. </el-form-item>
  113. <el-form-item label="偏差范围">
  114. <el-input v-model="formIDVFModel.dev" placeholder="请填写偏差范围" />
  115. </el-form-item>
  116. </el-form>
  117. </HcDialog>
  118. <!--插入特殊字符-->
  119. <HcDialog :show="specialModal" title="插入特殊字符" widths="600px" saveText="确认插入" @close="specialModal = false" @save="specialNodeClick">
  120. <el-form ref="specialFormRef" :model="specialFormModel" :rules="specialFormRules" label-width="0px" size="large" class="mb-6">
  121. <el-form-item prop="val" class="special-form-item">
  122. <el-input v-model="specialFormModel.val" ref="specialRef" id="specialId" placeholder="请选择特殊字符代码" clearable @blur="specialInputBlur"/>
  123. </el-form-item>
  124. </el-form>
  125. <el-row :gutter="20" style="margin: -10px;">
  126. <el-col :span="3" style="padding: 10px;" v-for="item in specialCharacters">
  127. <div class="special-box" @click="specialClick">
  128. <span class="font-EUDC" :title="`字符代码(C):${item !== 'K̅'?item.slice(2,7):'K̅'}`" v-html="item"/>
  129. </div>
  130. </el-col>
  131. </el-row>
  132. </HcDialog>
  133. <!--关联试验数据-->
  134. <HcDialog :show="CTDModal" title="关联试验数据" widths="84%" :footer="false" @close="CTDModal = false">
  135. <div class="adding-form-dialog-box">
  136. <div class="dialog-tree-box">
  137. <el-scrollbar>
  138. <ElTree class="hc-tree-node tree-line"
  139. ref="ElTreeRef"
  140. :props="ElTreeProps"
  141. :load="ElTreeLoadNode"
  142. lazy
  143. highlight-current
  144. accordion
  145. node-key="primaryKeyId"
  146. :default-expanded-keys="defaultExpandedCids"
  147. :autoExpandKeys="CTDTreeAutoExpandKeys"
  148. @node-click="CTDElTreeClick"
  149. :indent="0"
  150. >
  151. </ElTree>
  152. </el-scrollbar>
  153. </div>
  154. <div class="dialog-table-box">
  155. <div class="dialog-search">
  156. <div class="w-64 ml-2">
  157. <HcDatePicker :dates="CTDbetweenTime" clearable @change="CTDbetweenTimeUpdate"/>
  158. </div>
  159. <div class="ml-2">
  160. <el-button type="primary" @click="CTDsearchClick">
  161. <HcIcon name="search-2"/>
  162. <span>搜索</span>
  163. </el-button>
  164. </div>
  165. </div>
  166. <div class="dialog-table">
  167. <HcTable :loading="CTDdialogTableLoading" :column="CTDdialogTableColumn" :datas="CTDdialogTableData1" >
  168. <template #recordNo="{row}">
  169. <span class="text-link" @click="CTDtableRowName(row)" >{{row?.recordNo}}</span>
  170. </template>
  171. </HcTable>
  172. </div>
  173. <div class="dialog-pages">
  174. <HcPages :pages="CTDsearchFormPage" @change="CTDsearchFormPageChange"/>
  175. </div>
  176. </div>
  177. </div>
  178. </HcDialog>
  179. <!-- 选择要插入的数据 -->
  180. <HcDialog :show="insertDataShow" title="选择需要插入的数据" widths="84%" saveText="保存" @close="cancelinsertData" @save="submitinsertData">
  181. <div>
  182. <div class="flex-1" style="padding-left:20px">
  183. <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange" size="default" :round="false"/>
  184. <el-select v-model="testReportId" :placeholder="placeholderType" clearable class="ml-2 w-80" @change="testReportIdchange" :loading="insertDataSelectoading">
  185. <el-option v-for="item in testReportData" :key="item.id" :label="item['fullName']" :value="item['id']"/>
  186. </el-select>
  187. </div>
  188. <div class="dialog-table-box">
  189. <!-- <div class="dialog-table">
  190. <HcTable :column="insertDataTableColumn" :datas="insertDataTable" :loading="insertDataTableLoading">
  191. <template #tempLow="{row}">{{row['tempLow']}} ~ {{row['tempHigh']}}</template>
  192. <template #action="{row}">
  193. <el-checkbox size="large" @change="insertDataTableCheck(row)"/>
  194. </template>
  195. </HcTable>
  196. </div> -->
  197. <!-- <div class="dialog-pages">
  198. <HcPages :pages="insertDataPage" @change="insertDataPageChange"/>
  199. </div> -->
  200. <div class="copy-node-many-table">
  201. <el-scrollbar v-loading="insertDataTableLoading" >
  202. <el-table :data="insertDataTable" border stripe @selection-change="insertDataTableCheck">
  203. <el-table-column type="selection" width="55" />
  204. <el-table-column prop="key_12__3_1" label="数据名称"/>
  205. <!-- <el-table-column prop="action" label="操作" width="120" align="center">
  206. <template #default="{row}">
  207. <el-checkbox size="large" @change="insertDataTableCheck(row)"/>
  208. </template> -->
  209. <!-- </el-table-column> -->
  210. </el-table>
  211. </el-scrollbar>
  212. </div>
  213. </div>
  214. </div>
  215. </HcDialog>
  216. <!-- 复制本表 -->
  217. <HcDialog :show="CopyModal" title="复制本表" widths="1200px" saveText="确认复制" @close="CopyModal = false" @save="CopyModal = false">
  218. <el-alert title="复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面" type="warning" :closable="false"/>
  219. <el-alert title="本节点复制:在当前节点内复制本表及数据" type="warning" :closable="false"/>
  220. <div class="radio-group-box">
  221. <el-radio-group v-model="CopyModalType">
  222. <el-radio label="1">跨节点复制</el-radio>
  223. <el-radio label="2" class="ml-4">本节点复制</el-radio>
  224. </el-radio-group>
  225. </div>
  226. <div class="copy-node-many-box" v-if="CopyModalType=== '1'">
  227. <div class="copy-node-many-tree">
  228. <el-scrollbar>
  229. <WbsTree
  230. :projectId="projectId"
  231. :contractId="contractId"
  232. @nodeTap="wbsElTreeClick"
  233. @nodeLoading="ElTreeNodeLoading"
  234. />
  235. </el-scrollbar>
  236. </div>
  237. <div class="copy-node-many-table">
  238. <el-scrollbar v-loading="ListItemLoading" >
  239. <el-table :data="copyModalTable" border stripe>
  240. <el-table-column prop="fullName" label="表格名称"/>
  241. <el-table-column prop="action" label="操作" width="120" align="center">
  242. <template #default="{row}">
  243. <el-checkbox v-model="row.isCheck" size="large" @change="copyModalTableCheck(row)"/>
  244. </template>
  245. </el-table-column>
  246. </el-table>
  247. </el-scrollbar>
  248. </div>
  249. </div>
  250. </HcDialog>
  251. <!--关联试验文件-->
  252. <HcDialog :show="fileModal" title="关联试验文件" widths="84%" saveText="保存" @close="fileModal = false" @save="savefileModal">
  253. <div class="radio-box">
  254. <el-radio-group v-model="fileModalradio" @change="radioChange">
  255. <el-radio :label="1">试验检测</el-radio>
  256. <el-radio :label="2">第三方检测</el-radio>
  257. <el-radio :label="3">外委检测</el-radio>
  258. </el-radio-group>
  259. </div>
  260. <div class="adding-form-dialog-box">
  261. <div class="dialog-tree-box">
  262. <el-scrollbar>
  263. <!-- 试验检测树 -->
  264. <ElTree class="hc-tree-node tree-line"
  265. ref="ElTreeRef1"
  266. :props="ElTreeProps"
  267. :load="ElTreeLoadNode"
  268. lazy
  269. highlight-current
  270. accordion
  271. node-key="primaryKeyId"
  272. @node-click="fileModalElTreeClick"
  273. :indent="0"
  274. v-if="fileModalradio==1"
  275. >
  276. </ElTree>
  277. <!-- 第三方树 -->
  278. <ElTree
  279. v-else
  280. class="hc-tree-node" ref="ElTreeRef2" :props="thirdElTreeProps" :data="thirdtreeDatas" highlight-current accordion node-key="id"
  281. @node-click="thirdtreeDatasElTreeClick" :indent="0">
  282. </ElTree>
  283. </el-scrollbar>
  284. </div>
  285. <div class="dialog-table-box">
  286. <div class="dialog-search">
  287. <div class="w-64 ml-2">
  288. <HcDatePicker :dates="filebetweenTime" clearable @change="filebetweenTimeUpdate"/>
  289. </div>
  290. <div class="ml-2">
  291. <el-button type="primary" @click="filesearchClick">
  292. <HcIcon name="search-2"/>
  293. <span>搜索</span>
  294. </el-button>
  295. </div>
  296. </div>
  297. <div class="dialog-table">
  298. <HcTable ref="dialogTableRef" :loading="filedialogTableLoading" :column="filedialogTableColumn" :datas="filedialogTableData" isCheck @selection-change="filedialogTableSelection" v-if="fileModalradio==1">
  299. <template #recordNo="{row}">
  300. <span :class="[row?.isSelectedStatus==1?'text-green':'']" @click="filetableRowName(row)">{{row?.recordNo}}</span>
  301. </template>
  302. </HcTable>
  303. <HcTable ref="dialogTableRef" :loading="filedialogTableLoading" :column="filedialogTableColumn1" :datas="filedialogTableData" isCheck @selection-change="filedialogTableSelection" v-else>
  304. <template #recordNo="{row}">
  305. <span :class="[row?.isSelectedStatus==1?'text-green':'']" @click="filetableRowName(row)">{{row?.recordNo}}</span>
  306. </template>
  307. </HcTable>
  308. </div>
  309. <div class="dialog-pages">
  310. <HcPages :pages="filesearchFormPage" @change="filesearchFormPageChange"/>
  311. </div>
  312. </div>
  313. </div>
  314. </HcDialog>
  315. </template>
  316. <script setup>
  317. import {ref,watch,nextTick} from "vue";
  318. import {getStoreData, setStoreData} from '~src/utils/storage'
  319. import notableform from '~src/assets/view/notableform.svg';
  320. import HTableForm from "~src/plugins/HTableForm"
  321. import WbsTree from "../components/WbsTree.vue"
  322. import wbsApi from "~api/data-fill/wbs"
  323. import dataApi from "~api/tentative/detect/test";
  324. import thirdApi from "~api/tentative/detect/third";
  325. import {getTreeAll} from "~api/tentative/detect"
  326. import HcUpload from "./HcUpload.vue"
  327. import {utilsText, isType, formValidate, deepClone, getObjValue} from "vue-utils-plus"
  328. import {useAppStore} from "~src/store";
  329. import samplingApi from "~api/tentative/material/sampling"
  330. //初始
  331. const props = defineProps({
  332. datas: {
  333. type: Array,
  334. default: () => ([])
  335. },
  336. classify: {
  337. type: [String,Number],
  338. default: ''
  339. },
  340. status: {
  341. type: [String,Number],
  342. default: ''
  343. },
  344. primaryKeyId: {
  345. type: [String,Number],
  346. default: ''
  347. },
  348. contractId: {
  349. type: [String,Number],
  350. default: ''
  351. },
  352. projectInfo: {
  353. type: Object,
  354. default: () => ({})
  355. },
  356. authBtnTabKey: {
  357. type: [String,Number],
  358. default: ''
  359. },
  360. drawType:{
  361. type:Boolean,
  362. default:false
  363. },
  364. wbsTempId: {
  365. type: [String,Number],
  366. default: ''
  367. },
  368. tenantId: {
  369. type: [String,Number],
  370. default: ''
  371. },
  372. wbsType: {
  373. type: [String,Number],
  374. default: ''
  375. },
  376. })
  377. const {isString, getObjNullValue, getArrValue} = isType()
  378. const {setPosInsert, setPosRange} = utilsText()
  379. const listDatas = ref(props.datas)
  380. const classify = ref(props.classify)
  381. const isStatus = ref(props.status)
  382. const isPrimaryKeyId = ref(props.primaryKeyId)
  383. const contractId = ref(props.contractId)
  384. const projectInfo = ref(props.projectInfo)
  385. const useAppState = useAppStore()
  386. const authBtnTabKey = ref(props.authBtnTabKey)
  387. const drawType = ref(props.drawType)
  388. const wbsTempId = ref(props.wbsTempId);
  389. const tenantId = ref(props.tenantId);
  390. const wbsType = ref(props.wbsType);
  391. //全局变量
  392. const projectId = ref(useAppState.getProjectId);
  393. //监听
  394. watch(() => [
  395. props.datas,
  396. props.classify,
  397. props.primaryKeyId,
  398. props.contractId,
  399. props.projectInfo,
  400. ], ([datas, classifyVal, primaryKeyId, cid, pInfo]) => {
  401. listDatas.value = datas
  402. classify.value = classifyVal
  403. isPrimaryKeyId.value = primaryKeyId
  404. contractId.value = cid
  405. projectInfo.value = pInfo
  406. setFormDataNum(datas)
  407. })
  408. //监听
  409. // watch(() => [
  410. // props.status
  411. // ], ([val]) => {
  412. // //1 未填报,2待上报,3已上报
  413. // isStatus.value = val
  414. // })
  415. //监听
  416. watch(() => [
  417. props.autoExpandKeys,
  418. props.projectId,
  419. props.contractId,
  420. props.wbsTempId,
  421. props.tenantId,
  422. props.wbsType,
  423. props.status
  424. ], ([expandKeys, UserProjectId, UserContractId, UserWbsTempId, UserTenantId, UserIdPrefix, wbs_type,val]) => {
  425. projectId.value = UserProjectId
  426. contractId.value = UserContractId
  427. wbsTempId.value = UserWbsTempId
  428. tenantId.value = UserTenantId
  429. wbsType.value = wbs_type
  430. isStatus.value = val
  431. })
  432. //渲染完成
  433. nextTick(() => {
  434. setFormDataNum(props.datas)
  435. })
  436. //获取表单初始数据
  437. const getFormDataInit = (item, pkeyId) => {
  438. return {
  439. projectId: item?.projectId,
  440. contractId: item?.contractId,
  441. classify: classify.value,
  442. pkeyId: pkeyId ? pkeyId + '' : '',
  443. nodeId: isPrimaryKeyId.value
  444. }
  445. }
  446. //设置表单对象的数量
  447. const formData = ref([])
  448. const setFormDataNum = (datas) => {
  449. ActiveKey.value = []
  450. let newArr = [];
  451. for (let i = 0; i < datas.length; i++) {
  452. newArr.push({
  453. ...getFormDataInit(datas[i], datas[i].pkeyId),
  454. isCollapseLoad: false,
  455. })
  456. }
  457. formData.value = newArr
  458. setTableFormMenu(projectInfo.value)
  459. }
  460. //展开事件
  461. const ActiveKey = ref([])
  462. const formKeyIds = ref('')
  463. const CollapseChange = async (name) => {
  464. ActiveKey.value = name
  465. console.log(name,'name');
  466. let names=[]
  467. if(name.length>0){
  468. names = name[0] ? name[name.length-1].split('-') : name[0]
  469. }
  470. console.log(names,'names');
  471. if (names.length > 0) {
  472. getOffsetTop(name);
  473. const index = names[1]
  474. const item = listDatas.value[index]
  475. formKeyIds.value = item.pkeyId ? item.pkeyId + '' : ''
  476. if (!item.isTableFormRender) {
  477. //获取已填写的数据
  478. await getBussDataInfo(item,item.pkeyId, index)
  479. //渲染表单
  480. await getExcelHtml(item,index)
  481. }
  482. } else {
  483. getOffsetTop()
  484. formKeyIds.value = ''
  485. }
  486. }
  487. //获取模板标签数据
  488. const formRegExpJson = ref({})
  489. const getExcelHtml = async (item,index) => {
  490. const pkeyIds = item.pkeyId ? item.pkeyId + '' : ''
  491. if (pkeyIds) {
  492. const {error, code, data} = await wbsApi.getExcelHtml({pkeyId: pkeyIds}, false)
  493. const resData = isString(data) ? data || '' : ''
  494. if (!error && code === 200 && resData) {
  495. item.isTableForm = true
  496. //渲染表单
  497. HTableForm.createForm({
  498. template: resData,
  499. tableForm: formData.value[index],
  500. appId: `#table-form-${pkeyIds}`,
  501. onRight: (event, KeyName) => {
  502. onRightClick(event, KeyName, index)
  503. },
  504. //表单正则效验
  505. onBlur: (event, key, reg, val, msg, leng) => {
  506. setTableFormBlurReg(pkeyIds, event, key, reg, val, msg, item, index, leng)
  507. }
  508. })
  509. item.isTableFormRender = true
  510. item.isRenderTableForm = true
  511. } else {
  512. item.isTableForm = false
  513. item.isRenderTableForm = true
  514. window?.$message?.warning('暂无表单')
  515. }
  516. } else {
  517. item.isTableForm = false
  518. item.isRenderTableForm = false
  519. window?.$message?.warning('pkeyId为空')
  520. }
  521. }
  522. //正则效验
  523. const setTableFormBlurReg = (pkeyId, event, key, reg, val, msg, item, index, leng) => {
  524. const dom = document.getElementById(key)?.parentElement ?? ''
  525. if (dom) {
  526. if (val && reg) {
  527. let regx = new RegExp(reg);
  528. let state = regx.test(val);
  529. if (state) {
  530. delete formRegExpJson.value[pkeyId]
  531. dom.style = ''
  532. } else {
  533. formRegExpJson.value[pkeyId] = {key, reg, val, msg, state, nodeName: item.nodeName, itemId: `item-${index}-${item?.pkeyId}`}
  534. dom.style = '--el-input-border-color: #fe0000; box-shadow: 0 0 0 2px #fe0000 inset;'
  535. window?.$message?.warning(msg)
  536. }
  537. } else {
  538. delete formRegExpJson.value[pkeyId]
  539. dom.style = ''
  540. }
  541. /*let efficacyRegState = true, efficacyLengState = true;
  542. //正则效验
  543. if (val && reg) {
  544. let regx = new RegExp(reg);
  545. let state = regx.test(val);
  546. console.log('reg:', reg)
  547. console.log('val:', val)
  548. console.log('state:', state)
  549. if (!state) {
  550. efficacyRegState = true
  551. } else {
  552. efficacyRegState = false
  553. window?.$message?.warning(msg)
  554. }
  555. } else {
  556. efficacyRegState = true
  557. }
  558. //校验字符长度
  559. if (val && leng) {
  560. const num = val.toString().length;
  561. if (num > leng) {
  562. efficacyLengState = false
  563. window?.$message?.warning('长度不能超过' + leng)
  564. } else {
  565. efficacyLengState = true
  566. }
  567. } else {
  568. efficacyLengState = true
  569. }
  570. //处理效验结果
  571. if (efficacyRegState && efficacyLengState) {
  572. delete formRegExpJson.value[pkeyId]
  573. dom.style = ''
  574. } else {
  575. formRegExpJson.value[pkeyId] = {key, reg, val, msg, leng, state: efficacyRegState, lengState: efficacyLengState, nodeName: item.nodeName, itemId: `item-${index}-${item?.pkeyId}`}
  576. dom.style = '--el-input-border-color: #fe0000; box-shadow: 0 0 0 2px #fe0000 inset;'
  577. }*/
  578. }
  579. }
  580. //获取已填写的数据
  581. const getBussDataInfo = async (item, pkeyId, index) => {
  582. const pkeyIds = pkeyId ? pkeyId + '' : ''
  583. if (pkeyIds) {
  584. const {error, code, data} = await wbsApi.getBussDataInfo({
  585. pkeyId: pkeyIds
  586. }, false)
  587. const resData = getObjNullValue(data)
  588. if (!error && code === 200 && resData) {
  589. HTableForm.setPickerKey(resData)
  590. const InitObj = getFormDataInit(item, pkeyId) //有数据,关联数据
  591. formData.value[index] = {...resData, ...InitObj, isCollapseLoad: true}
  592. } else {
  593. formData.value[index] = {...getFormDataInit(item, pkeyId), isCollapseLoad: true}
  594. }
  595. } else {
  596. window?.$message?.warning('pkeyId为空')
  597. }
  598. }
  599. //单个保存
  600. const tableFormSaveLoading = ref(false)
  601. const tableFormSaveClick = async (item,index) => {
  602. if (isStatus.value !== '3') {
  603. const res = await saveExcelBussData(item,index)
  604. if (res) {
  605. await getBussPdfInfo(item)
  606. renewData()
  607. }
  608. } else {
  609. window?.$message?.warning('已上报的资料,不允许保存。')
  610. }
  611. }
  612. //保存表单数据
  613. const saveExcelBussData = async (item, index, showTip = true) => {
  614. const isRegExp = !!getObjNullValue(formRegExpJson.value)
  615. if (!isRegExp) {
  616. tableFormSaveLoading.value = true
  617. const InitObj = getFormDataInit(item, item.pkeyId)
  618. const {error, code} = await wbsApi.saveExcelBussData({
  619. ...formData.value[index],
  620. ...InitObj
  621. })
  622. //处理数据
  623. tableFormSaveLoading.value = false
  624. if (!error && code === 200) {
  625. if(showTip) window?.$message?.success('保存成功')
  626. return true
  627. } else {
  628. return false
  629. }
  630. } else {
  631. window?.$message?.warning('请先修改完红色输入框的数据')
  632. return false
  633. }
  634. }
  635. //预览PDF
  636. const getBussPdfInfo = async (item, showTip = true) => {
  637. const pkeyIds = item.pkeyId ? item.pkeyId + '' : ''
  638. if (pkeyIds) {
  639. const {error, code, data} = await wbsApi.getBussPdfInfo({
  640. pkeyId: pkeyIds
  641. },false)
  642. if (!error && code === 200) {
  643. if (data) {
  644. window.open(data, '_blank')
  645. } else if(showTip) {
  646. window?.$message?.warning('PDF错误')
  647. }
  648. } else {
  649. if(showTip) {
  650. window?.$message?.warning(data.msg || '获取PDF失败')
  651. }
  652. }
  653. } else {
  654. window?.$message?.warning('pkeyId为空')
  655. }
  656. }
  657. //删除本表
  658. const delClick = async (item) => {
  659. const pkeyIds = item.pkeyId ? item.pkeyId + '' : ''
  660. if (pkeyIds) {
  661. if (isStatus.value !== '3') {
  662. const {error, code} = await wbsApi.removeBussTabInfo({
  663. pkeyid: pkeyIds,
  664. classify: classify.value,
  665. })
  666. if (!error && code === 200) {
  667. window?.$message?.success('操作成功')
  668. renewData()
  669. }
  670. } else {
  671. window?.$message?.warning('已上报的资料,不允许删除')
  672. }
  673. } else {
  674. window?.$message?.warning('pkeyId为空')
  675. }
  676. }
  677. //复制本表弹窗
  678. const CopyModal = ref(false);
  679. const CopyModalType=ref('1');
  680. const treeLoading = ref(false);
  681. const copyModalTable=ref([])
  682. const insertDataShow = ref(false);
  683. //类型tab数据和相关处理
  684. const tabTypeKey = ref('2')
  685. const tabTypeTab = ref([
  686. {key:'1', name: '试验记录表'},
  687. {key:'2', name: '试验报告单'},
  688. ]);
  689. let placeholderType=ref('试验报告单')
  690. const tabTypeChange = ({key}) => {
  691. tabTypeKey.value = key
  692. if( tabTypeKey.value==='1'){
  693. placeholderType='试验记录表'
  694. }else{
  695. placeholderType='试验报告单'
  696. }
  697. getSearchNodeTables()
  698. }
  699. const insertDataTableLoading=ref(false)
  700. const insertDataTableColumn = ref(
  701. [{key:'key_12__3_1', name: '数据名称'}],
  702. )
  703. const insertDataTable=ref([])
  704. const multipleSelection = ref([])
  705. const insertDataTableCheck = (val) => {
  706. multipleSelection.value = val
  707. }
  708. //分页
  709. const insertDataPage = ref({current: 1, size: 20, total: 0})
  710. const insertDataPageChange = ({current, size}) => {
  711. insertDataPage.value.current = current
  712. insertDataPage.value.size = size
  713. // getDialogTableData()
  714. }
  715. const testReportId=ref('');
  716. const testReportData=ref([])
  717. let checPkd=ref([])
  718. const testReportIdchange = (key) => {
  719. testReportData.value.forEach((item)=>{
  720. if(item.id=key){
  721. checPkd.value.push(item)
  722. }
  723. })
  724. console.log(checPkd,'checPkd');
  725. getBussddataInfotrialData()
  726. }
  727. //树相关变量
  728. // const primaryKeyId = ref('')
  729. const nodeItemInfo = ref({})
  730. const nodeDataInfo = ref({})
  731. //树加载完成
  732. const ElTreeNodeLoading = () => {
  733. treeLoading.value = false
  734. }
  735. //获取数据列表
  736. const ListItemLoading = ref(false);
  737. const checked1=ref(true)
  738. const searchNodeAllTable = async () => {
  739. copyModalTable.value = []
  740. const info = nodeDataInfo.value;
  741. ListItemLoading.value = true
  742. const {error, code, data} = await wbsApi.searchNodeAllTable({
  743. projectId: projectId.value,
  744. contractId: contractId.value,
  745. primaryKeyId: info['primaryKeyId'],
  746. type: authBtnTabKey.value
  747. })
  748. //处理数据
  749. ListItemLoading.value = false
  750. if (!error && code === 200) {
  751. copyModalTable.value = getArrValue(data);
  752. copyModalTable.value.forEach((item)=>{
  753. item.isCheck=false
  754. })
  755. } else {
  756. copyModalTable.value = []
  757. }
  758. }
  759. const getTableDataAll = () => {
  760. searchNodeAllTable()
  761. }
  762. //树被点击
  763. const wbsElTreeClick = ({node, data, keys}) => {
  764. nodeItemInfo.value = node
  765. nodeDataInfo.value = data
  766. getTableDataAll();
  767. }
  768. //复制本表
  769. const copyClick = async (item,index) => {
  770. // CopyModal.value=true;
  771. // const copyModalTable=ref([])
  772. if (item.pkeyId) {
  773. if (isStatus.value !== '3') {
  774. if (!item.isRenderTableForm) {
  775. await copeBussTab(item.pkeyId + '')
  776. } else if (!item.isTableForm) {
  777. window?.$message?.warning('暂无表单数据')
  778. } else if (item.isRenderTableForm) {
  779. const res = await saveExcelBussData(item,index,false)
  780. if (res) {
  781. await copeBussTab(item.pkeyId + '')
  782. } else {
  783. window?.$message?.warning('复制本表操作失败')
  784. }
  785. } else {
  786. window?.$message?.warning(`数据异常了, isRenderTableForm: ${item.isRenderTableForm}, isTableForm: ${item.isTableForm}, pkeyIds:${item.pkeyId}`)
  787. }
  788. } else {
  789. window?.$message?.warning('已上报的资料,不允许复制')
  790. }
  791. } else {
  792. window?.$message?.warning('pkeyId为空')
  793. }
  794. }
  795. //勾选复制本表
  796. const copyModalTableCheck = async (item) => {
  797. console.log('复制本表',item);
  798. }
  799. const copeBussTab = async (pkeyIds) => {
  800. const {error, code} = await wbsApi.copeBussTab({
  801. pkeyId: pkeyIds
  802. })
  803. if (!error && code === 200) {
  804. window?.$message?.success('操作成功')
  805. renewData()
  806. }
  807. }
  808. //隐藏本表
  809. const hideClick = async (item) => {
  810. const pkeyIds = item.pkeyId ? item.pkeyId + '' : ''
  811. if (pkeyIds) {
  812. if (isStatus.value !== '3') {
  813. const isBussShow = item['isBussShow'] === 2 ? 1 : 2 //状态(1显示 2隐藏)
  814. const {error, code} = await wbsApi.showBussTab({
  815. pkeyId: pkeyIds,
  816. status: isBussShow
  817. })
  818. if (!error && code === 200) {
  819. window?.$message?.success('操作成功')
  820. renewData()
  821. }
  822. } else {
  823. window?.$message?.warning('已上报的资料,不允许隐藏')
  824. }
  825. } else {
  826. window?.$message?.warning('pkeyId为空')
  827. }
  828. }
  829. //预览
  830. const previewClick = async (item,index) => {
  831. await getBussPdfInfo(item)
  832. }
  833. //上传变量
  834. const uploadModal = ref(false)
  835. const fileListData = ref([]);
  836. const uploadData = ref({})
  837. //上传被点击
  838. const uploadClick = (item,index) => {
  839. const pkeyIds = item.pkeyId ? item.pkeyId + '' : ''
  840. const keyName = `item-${index}-${pkeyIds}`
  841. if (pkeyIds) {
  842. if (isStatus.value !== '3' && item.isTableForm) {
  843. uploadModal.value = true
  844. uploadData.value = getFormDataInit(item,pkeyIds)
  845. //获取文件列表
  846. getBussFileList(pkeyIds)
  847. } else if (!item.isRenderTableForm) {
  848. CollapseChange(keyName)
  849. window?.$message?.warning('请再次点击上传')
  850. } else if (!item.isTableForm) {
  851. window?.$message?.warning('暂无表单数据')
  852. } else {
  853. window?.$message?.warning('已上报的资料,不允许上传')
  854. }
  855. } else {
  856. window?.$message?.warning('pkeyId为空')
  857. }
  858. }
  859. //获取文件列表
  860. const getBussFileList = async (pkeyId) => {
  861. const {error, code, data} = await wbsApi.getBussFileList({
  862. pkeyid: pkeyId
  863. })
  864. if (!error && code === 200) {
  865. fileListData.value = getArrValue(data)
  866. } else {
  867. fileListData.value = []
  868. }
  869. }
  870. //上传文件
  871. const uploadChange = async ({type}) => {
  872. if(type === 'success') {
  873. uploadModal.value = false
  874. renewData()
  875. } else if (type === 'del') {
  876. renewData()
  877. }
  878. }
  879. //相关变量
  880. const tableFormItemNode = ref({})
  881. //菜单数据
  882. const tableFormMenu = ref([])
  883. //设置菜单权限数据
  884. const setTableFormMenu = (info) => {
  885. const infos = getObjValue(info)
  886. const isOpen = infos['isOpenRandomNumber'] ?? 0
  887. let newArr = []
  888. if (isOpen === 1) {
  889. newArr.push({label: '插入设计值/频率', key: "IDVF"})
  890. }
  891. //newArr.push({label: '插入设计值/频率', key: "IDVF"})
  892. newArr.push({label: '插入特殊字符', key: "special"})
  893. newArr.push({label: '关联试验数据', key: "CTD"}),
  894. newArr.push({label: '关联试文件', key: "file"})
  895. tableFormMenu.value = newArr
  896. }
  897. //鼠标右键事件
  898. const contextMenuRef = ref(null)
  899. const onRightClick = (event, KeyName, index) => {
  900. //取光标位置
  901. const specialDom = document.getElementById(KeyName + "")
  902. const startPos = specialDom?.selectionStart || 0
  903. const endPos = specialDom?.selectionEnd || 0
  904. //存储临时信息
  905. tableFormItemNode.value = {KeyName, index, startPos, endPos, pkeyId: formKeyIds.value}
  906. contextMenuRef.value?.showMenu(event) //展开菜单
  907. }
  908. //鼠标右键菜单被点击
  909. const handleMenuSelect = ({key}) => {
  910. if (key === 'IDVF') {
  911. IDVFModal.value = true
  912. } else if (key === 'special') {
  913. specialModalShow()
  914. } else if (key === 'CTD') {
  915. CTDModal.value = true
  916. CTDbetweenTime.value=[]
  917. CTDdialogTableData1.value=[]
  918. }else if(key === 'file'){
  919. fileModal.value=true;
  920. fileModalradio.value=1
  921. filedialogTableData.value=[]
  922. }
  923. }
  924. //插入设计值
  925. const IDVFModal = ref(false)
  926. const formIDVFRef = ref(null)
  927. const formIDVFModel = ref({type: 1, design: '', size: '', dev: '', key: '', capacity: '', fail: '', pkId: ''})
  928. //插入特殊字符
  929. const specialModal = ref(false)
  930. const specialCharacters = ref([
  931. '&#57344;', "&#57345;", "&#57346;", "&#57347;", '&#8804;', '&#8805;', '&#8451;',
  932. '&#9312;', '&#9313;', '&#9314;', '&#9315;', '&#9316;', '&#9317;', '&#9318;', '&#9319;', '&#9320;', '&#9321;', '&#9322;', '&#9323;',
  933. '&#9324;', '&#9325;', '&#9326;', '&#9327;', '&#9328;', '&#9329;', '&#9330;', '&#9331;',
  934. "&#8544;", "&#8545;", "&#8546;", "&#8547;", "&#8548;", "&#8549;", "&#8550;", "&#8551;", "&#8552;", "&#8553;", "&#8554;", "&#8555;","K̅"
  935. ])
  936. //输入框验证
  937. const specialFormRef = ref(null)
  938. const specialFormModel = ref({val: ''})
  939. const specialFormRules = {
  940. val: {
  941. required: true,
  942. trigger: "blur",
  943. message: "请选择特殊字符代码"
  944. }
  945. }
  946. //显示插入特殊字符
  947. const specialRef = ref(null)
  948. const specialModalShow = () => {
  949. specialFormModel.value.val = ''
  950. specialModal.value = true
  951. nextTick(() => {
  952. specialRef.value?.focus();
  953. })
  954. }
  955. //失去焦点
  956. const specialPos = ref({start: 0, end: 0})
  957. const specialInputBlur = (e) => {
  958. specialPos.value = {
  959. start: e?.target?.selectionStart || 0,
  960. end: e?.target?.selectionEnd || 0
  961. }
  962. }
  963. //点击符号
  964. const specialClick = (event) => {
  965. const text = event?.target?.innerText ?? ''
  966. const start = specialPos.value.start
  967. const end = specialPos.value.end
  968. const form = specialFormModel.value.val
  969. specialFormModel.value.val = setPosInsert(start, end, form, text)
  970. specialRef.value?.focus();
  971. let posVal = start + text.length;
  972. nextTick(() => {
  973. setPosRange('specialId', posVal)
  974. })
  975. }
  976. //确认插入
  977. const specialNodeClick = async () => {
  978. const res = await formValidate(specialFormRef.value)
  979. if (res) {
  980. const item = tableFormItemNode.value
  981. const form = formData.value[item.index]
  982. const val = specialFormModel.value.val ?? ''
  983. formData.value[item.index][item.KeyName] = setPosInsert(item.startPos, item.endPos, form[item.KeyName], val)
  984. specialModal.value = false
  985. specialRef.value?.focus();
  986. let posVal = item.startPos + val.length;
  987. nextTick(() => {
  988. setPosRange(item.KeyName, posVal)
  989. })
  990. }
  991. }
  992. //关联试验数据
  993. const CTDModal = ref(false)
  994. //树形结构异步加载数据
  995. const defaultExpandedCids = ref([])
  996. //自动展开缓存
  997. const CTDTreeAutoExpandKeys = ref(getStoreData('CTDElTreeExpandKeys') || [])
  998. const ElTreeProps = ref({
  999. label: 'title',
  1000. children: 'children',
  1001. isLeaf: 'hasChildren'
  1002. })
  1003. const ElTreeLoadNode = async (node, resolve) => {
  1004. let parentId = '0';
  1005. if (node.level !== 0) {
  1006. parentId = node?.data?.id
  1007. }
  1008. //获取数据
  1009. const {error, code, data} = await samplingApi.queryLazyTree({
  1010. wbsId: wbsTempId.value,
  1011. tenantId: tenantId.value,
  1012. projectId: projectId.value,
  1013. parentId,
  1014. wbsType: wbsType.value
  1015. })
  1016. //处理数据
  1017. if (!error && code === 200) {
  1018. let clickKey = '', defaultExpandedArr = [];
  1019. const keys = CTDTreeAutoExpandKeys.value || []
  1020. const resData = getArrValue(data)
  1021. for (let i = 0; i < resData.length; i++) {
  1022. resData[i].hasChildren = !resData[i].hasChildren
  1023. }
  1024. if (keys.length > 0) {
  1025. let lastKey = keys[keys.length-1];
  1026. for (const item of resData) {
  1027. //自动展开
  1028. if (isItem(keys,item?.primaryKeyId)) {
  1029. defaultExpandedArr.push(item?.primaryKeyId)
  1030. }
  1031. //最后一个,选中点击
  1032. if (item?.primaryKeyId === lastKey) {
  1033. clickKey = item?.primaryKeyId
  1034. }
  1035. }
  1036. } else if (node.level === 0) {
  1037. defaultExpandedArr.push(resData[0]?.primaryKeyId)
  1038. }
  1039. //自动展开
  1040. defaultExpandedCids.value = defaultExpandedArr
  1041. if (node.level === 0) {
  1042. emit('nodeLoading')
  1043. if(resData.length<=0){
  1044. window?.$message?.warning('该项目未使用试验系统,无法获取数据')
  1045. }
  1046. }
  1047. resolve(resData)
  1048. //最后一个,执行点击
  1049. if (clickKey) {
  1050. await nextTick(() => {
  1051. // document.getElementById(`${idPrefix.value}${clickKey}`)?.click()
  1052. })
  1053. }
  1054. } else {
  1055. if (node.level === 0) {
  1056. emit('nodeLoading')
  1057. }
  1058. resolve([])
  1059. }
  1060. }
  1061. //节点被点击
  1062. const CTDnodeItemInfo = ref({})
  1063. const CTDnodeDataInfo = ref({})
  1064. const CTDdialogTableData1=ref([])
  1065. const filedialogTableData=ref([])
  1066. //多选
  1067. const filetableCheckedKeys = ref([]);
  1068. const filedialogTableSelection = (rows) => {
  1069. filetableCheckedKeys.value = rows.filter((item) => {
  1070. return (item??'') !== '';
  1071. })
  1072. console.log( filetableCheckedKeys.value,' filetableCheckedKeys.value');
  1073. }
  1074. //确认关联试验文件
  1075. const savefileModal = ()=>{
  1076. const idarr=[]
  1077. filetableCheckedKeys.value.forEach((item)=>{
  1078. idarr.push(item.id)
  1079. })
  1080. const idval=idarr.join(',')
  1081. savesubmitRelationFile(idval)
  1082. fileModal.value=false
  1083. }
  1084. const CTDdialogTableColumn = ref([
  1085. {key:'recordNo', name: '报告编号'},
  1086. {key:'reportDate', name: '报告日期'},
  1087. {key:'projectPositionName', name: '工程用途及部位'},
  1088. {key:'detectionResultName', name: '检测结果'},
  1089. ])
  1090. const filedialogTableColumn = ref([
  1091. // reportNo
  1092. {key:'recordNo', name: '报告编号'},
  1093. {key:'reportDate', name: '报告日期'},
  1094. {key:'projectPositionName', name: '工程用途及部位'},
  1095. {key:'detectionResultName', name: '检测结果'},
  1096. ])
  1097. const filedialogTableColumn1 = ref([
  1098. // reportNo
  1099. {key:'reportNo', name: '报告编号'},
  1100. {key:'reportDate', name: '报告日期'},
  1101. {key:'projectPositionName', name: '工程用途及部位'},
  1102. {key:'detectionResultName', name: '检测结果'},
  1103. ])
  1104. const CTDElTreeClick = (data,node,keys) => {
  1105. CTDnodeItemInfo.value = node
  1106. CTDnodeDataInfo.value = data
  1107. getNodeData()
  1108. //缓存展开的节点
  1109. CTDTreeAutoExpandKeys.value = keys.value || []
  1110. setStoreData('CTDElTreeExpandKeys', keys.value)
  1111. }
  1112. //获取试验树节点下的记录信息
  1113. const getNodeData = async ()=>{
  1114. //获取数据
  1115. CTDdialogTableLoading.value = true
  1116. const {error, code, data} = await samplingApi.gettrialPage({
  1117. contractId: contractId.value,
  1118. nodeId: CTDnodeDataInfo.value.primaryKeyId,
  1119. current: CTDsearchFormPage.value.current,
  1120. size: CTDsearchFormPage.value.size,
  1121. startTime:CTDsearchFormPage.value.startTime,
  1122. endTime:CTDsearchFormPage.value.lastTime,
  1123. })
  1124. //处理数据
  1125. if (!error && code === 200) {
  1126. CTDdialogTableData1.value = getArrValue(data['records'])
  1127. CTDsearchFormPage.value.total = data.total || 0
  1128. CTDdialogTableLoading.value = false
  1129. } else {
  1130. CTDdialogTableData1.value = []
  1131. CTDsearchFormPage.value.total = 0
  1132. CTDdialogTableLoading.value = false
  1133. }
  1134. }
  1135. //试验文件节点下的数据
  1136. const getfileNodeData = async ()=>{
  1137. //获取数据
  1138. filedialogTableLoading.value = true
  1139. const {error, code, data} = await samplingApi.gettrialPage({
  1140. contractId: contractId.value,
  1141. nodeId: filenodeDataInfo.value.primaryKeyId,
  1142. current: filesearchFormPage.value.current,
  1143. size: filesearchFormPage.value.size,
  1144. startTime:filesearchFormPage.value.startTime,
  1145. endTime:filesearchFormPage.value.lastTime,
  1146. qualityTestPKeyId:isPrimaryKeyId.value
  1147. })
  1148. //处理数据
  1149. if (!error && code === 200) {
  1150. filedialogTableData.value = getArrValue(data['records'])
  1151. filesearchFormPage.value.total = data.total || 0
  1152. filedialogTableLoading.value = false
  1153. } else {
  1154. filedialogTableData.value = []
  1155. filesearchFormPage.value.total = 0
  1156. filesearchFormPage.value = false
  1157. }
  1158. }
  1159. //获取试验表中的data数据接口:
  1160. const getBussddataInfotrialData = async ()=>{
  1161. insertDataTableLoading.value=true;
  1162. const {error, code, data} = await dataApi.getBussddataInfotrial({
  1163. id:testReportId.value,
  1164. pkeyId:checPkd.value[0]['pKeyId'],
  1165. })
  1166. insertDataTableLoading.value = false
  1167. if (!error && code === 200) {
  1168. insertDataTable.value = getArrValue(data)
  1169. } else {
  1170. insertDataTable.value = []
  1171. }
  1172. }
  1173. //保存试验节点数据
  1174. //取消关联数据
  1175. const cancelinsertData = async () => {
  1176. insertDataShow.value=false
  1177. }
  1178. //确定关联试验数据数据
  1179. const submitinsertData = async () => {
  1180. if (multipleSelection.value.length>0) {
  1181. const item = tableFormItemNode.value
  1182. const form = formData.value[item.index]
  1183. const val =[]
  1184. multipleSelection.value.forEach((item)=>{
  1185. val.push(item['key_12__3_1'])
  1186. })
  1187. const newval=val.join('、')
  1188. formData.value[item.index][item.KeyName] = setPosInsert(item.startPos, item.endPos, form[item.KeyName], newval)
  1189. insertDataShow.value = false
  1190. CTDModal.value=false
  1191. let posVal = item.startPos + newval.length;
  1192. nextTick(() => {
  1193. setPosRange(item.KeyName, posVal)
  1194. })
  1195. }else{
  1196. window?.$message?.warning('请选择你要关联的数据')
  1197. }
  1198. }
  1199. //节点被点击
  1200. const ElTreeClick = async (data,node) => {
  1201. console.log(data,mode);
  1202. let autoKeysArr = []
  1203. await getNodeExpandKeys(node, autoKeysArr)
  1204. const autoKeys = autoKeysArr.reverse()
  1205. emit('nodeTap', {node, data, keys: autoKeys})
  1206. }
  1207. //处理自动展开的节点KEY
  1208. const getNodeExpandKeys = async (node, newKeys) => {
  1209. const parent = node?.parent ?? []
  1210. const primaryKeyId = node?.data?.primaryKeyId ?? ''
  1211. if (primaryKeyId) {
  1212. newKeys.push(primaryKeyId)
  1213. await getNodeExpandKeys(parent, newKeys)
  1214. }
  1215. }
  1216. const CTDbetweenTime = ref([])
  1217. const filebetweenTime = ref([])
  1218. //搜索表单
  1219. const CTDsearchFormPage = ref({
  1220. startTime: null,lastTime: null, wbsId: null, current: 1, size: 20, total: 0
  1221. })
  1222. const filesearchFormPage = ref({
  1223. startTime: null,lastTime: null, wbsId: null, current: 1, size: 20, total: 0
  1224. })
  1225. const CTDsearchFormPageChange = ({current, size}) => {
  1226. CTDsearchFormPage.value.current = current
  1227. CTDsearchFormPage.value.size = size
  1228. // getDialogTableData()
  1229. }
  1230. const filesearchFormPageChange = ({current, size}) => {
  1231. filesearchFormPage.value.current = current
  1232. filesearchFormPage.value.size = size
  1233. // getDialogTableData()
  1234. }
  1235. const CTDbetweenTimeUpdate = ({arr, query}) => {
  1236. CTDbetweenTime.value = arr
  1237. CTDsearchFormPage.value.startTime = arr[0]
  1238. CTDsearchFormPage.value.lastTime = arr[1]
  1239. }
  1240. const filebetweenTimeUpdate = ({arr, query}) => {
  1241. filebetweenTime.value = arr
  1242. filesearchFormPage.value.startTime = arr[0]
  1243. filesearchFormPage.value.lastTime = arr[1]
  1244. }
  1245. //搜索
  1246. const CTDsearchClick = () => {
  1247. CTDsearchFormPage.value.current = 1;
  1248. getNodeData()
  1249. }
  1250. const filesearchClick = () => {
  1251. filesearchFormPage.value.current = 1;
  1252. getfileNodeData()
  1253. }
  1254. const CTDdialogTableLoading = ref (false)
  1255. const filedialogTableLoading = ref (false)
  1256. const insertDataSelectoading=ref(false)
  1257. const CTDdialogTableKeys = ref ([])
  1258. let currowid=ref('')
  1259. //名称被点击
  1260. const CTDtableRowName = (row) => {
  1261. currowid=row.id
  1262. insertDataShow.value=true
  1263. getSearchNodeTables()
  1264. }
  1265. const getSearchNodeTables = async () => {
  1266. insertDataSelectoading.value = true
  1267. const { error, code, data } = await dataApi.searchNodeTables({
  1268. id: currowid,
  1269. projectId: projectId.value,
  1270. contractId: contractId.value,
  1271. primaryKeyId: CTDnodeDataInfo.value.primaryKeyId,
  1272. type: authBtnTabKey.value,
  1273. tableType: tabTypeKey.value
  1274. })
  1275. //处理数据
  1276. insertDataSelectoading.value = false
  1277. if (!error && code === 200) {
  1278. testReportData.value = getArrValue(data)
  1279. } else {
  1280. testReportData.value = []
  1281. }
  1282. }
  1283. //关联试验文件
  1284. const fileModal = ref(false)
  1285. const fileModalradio = ref(1)
  1286. const radioChange = (val)=>{
  1287. if(val!==1){
  1288. getthirdTreeDatas(val)
  1289. }
  1290. }
  1291. //获取试验文件树树数据
  1292. const fileModaltreeDatas = ref([])
  1293. //节点被点击
  1294. //节点被点击
  1295. const filenodeItemInfo = ref({})
  1296. const filenodeDataInfo = ref({})
  1297. const fileTableData1=ref([])
  1298. const fileTableColumn = ref([
  1299. {key:'recordNo', name: '报告编号'},
  1300. {key:'reportDate', name: '报告日期'},
  1301. {key:'projectPositionName', name: '工程用途及部位'},
  1302. {key:'detectionResultName', name: '检测结果'},
  1303. ])
  1304. const fileModalElTreeClick = async (data,node) => {
  1305. filenodeItemInfo.value = node
  1306. filenodeDataInfo.value = data
  1307. getfileNodeData()
  1308. }
  1309. //获取第三方树试验文件
  1310. //获取树数据
  1311. const thirdtreeDatas = ref([])
  1312. const thirdElTreeProps = ref({
  1313. label: 'nodeName',
  1314. children: 'children',
  1315. isLeaf: 'hasChildren'
  1316. })
  1317. const getthirdTreeDatas = async (type) => {
  1318. const { error, code, data } = await getTreeAll({
  1319. projectId: projectId.value,
  1320. contractId: contractId.value
  1321. })
  1322. if (!error && code === 200) {
  1323. if(type==2){
  1324. thirdtreeDatas.value = getArrValue(data['rightTree'])
  1325. }else{
  1326. thirdtreeDatas.value = getArrValue(data['leftTree'])
  1327. }
  1328. console.log(thirdtreeDatas,'thirdtreeDatas');
  1329. } else {
  1330. thirdtreeDatas.value = []
  1331. }
  1332. }
  1333. const thirdfilenodeItemInfo = ref({})
  1334. const thirdfilenodeDataInfo = ref({})
  1335. //获取第三方树节点下的数据
  1336. const getthirdTreetavleDatas = async () => {
  1337. const { error, code, data } = await thirdApi.queryPage({
  1338. projectId: projectId.value,
  1339. contractId: contractId.value,
  1340. nodeId: thirdfilenodeDataInfo.value.id,
  1341. current: filesearchFormPage.value.current,
  1342. size: filesearchFormPage.value.size,
  1343. startTime:filesearchFormPage.value.startTime,
  1344. endTime:filesearchFormPage.value.lastTime,
  1345. })
  1346. //处理数据
  1347. if (!error && code === 200) {
  1348. filedialogTableData.value = getArrValue(data['records'])
  1349. filesearchFormPage.value.total = data.total || 0
  1350. filedialogTableLoading.value = false
  1351. } else {
  1352. filedialogTableData.value = []
  1353. filesearchFormPage.value.total = 0
  1354. filesearchFormPage.value = false
  1355. }
  1356. }
  1357. const thirdtreeDatasElTreeClick =(data,node)=>{
  1358. thirdfilenodeItemInfo.value = node
  1359. thirdfilenodeDataInfo.value = data
  1360. getthirdTreetavleDatas()
  1361. }
  1362. //关联试验文件
  1363. const savesubmitRelationFile =async (ids)=>{
  1364. console.log( isPrimaryKeyId.value,' isPrimaryKeyId.value');
  1365. const { error, code, data } = await samplingApi.submitRelationFile({
  1366. projectId: projectId.value,
  1367. contractId: contractId.value,
  1368. nodeId: isPrimaryKeyId.value,
  1369. type:fileModalradio.value,
  1370. ids
  1371. })
  1372. if (!error && code === 200) {
  1373. window?.$message?.success('操作成功')
  1374. }
  1375. }
  1376. //设计值频率计算
  1377. const IDVFModalSaveClick = async () => {
  1378. const {pkeyId, KeyName, index} = tableFormItemNode.value
  1379. if (pkeyId) {
  1380. const { design, size } = formIDVFModel.value
  1381. const { error, code, data } = await wbsApi.queryFormulaRange({
  1382. ...formIDVFModel.value,
  1383. // dev: (!design && !size) ? '±5': '',
  1384. key: KeyName,
  1385. pkId: pkeyId,
  1386. })
  1387. //处理数据
  1388. const res = getObjNullValue(data)
  1389. if (!error && code === 200 && res) {
  1390. Object.keys(data).forEach(key => {
  1391. formData.value[index][key] = data[key]
  1392. })
  1393. IDVFModal.value = false
  1394. }
  1395. } else {
  1396. window?.$message?.warning('pkeyId为空')
  1397. }
  1398. }
  1399. //事件
  1400. const emit = defineEmits(['renew','offsetTop'])
  1401. //被点击
  1402. const getOffsetTop = (key = '') => {
  1403. if (key) {
  1404. const dom = document.getElementById(key[key.length-1])
  1405. if(!drawType.value){
  1406. if(dom.offsetTop>=583&&ActiveKey.value.length>1){
  1407. emit('offsetTop', dom.offsetTop-583)
  1408. }else{
  1409. emit('offsetTop', dom.offsetTop)
  1410. }
  1411. }else {
  1412. if(dom.offsetTop>=424&&ActiveKey.value.length>1){
  1413. emit('offsetTop', dom.offsetTop-424)
  1414. }else{
  1415. emit('offsetTop', dom.offsetTop)
  1416. }
  1417. }
  1418. } else {
  1419. emit('offsetTop', 0)
  1420. }
  1421. ActiveKey.value = ActiveKey.value[ActiveKey.value.length-1]
  1422. }
  1423. //通知数据更新
  1424. const renewData = () => {
  1425. emit('renew')
  1426. ActiveKey.value = []
  1427. }
  1428. //获取表单数据
  1429. const getFormData = () => {
  1430. const formArr = formData.value;
  1431. return formArr.filter((item) => {
  1432. return (item.pkeyId??'') !== '' && item.isCollapseLoad;
  1433. })
  1434. }
  1435. //获取表单效验数据
  1436. const getFormRegExpJson = () => {
  1437. return deepClone(formRegExpJson.value);
  1438. }
  1439. //获取当前展开项
  1440. const getActiveKey = () => {
  1441. return ActiveKey.value;
  1442. }
  1443. //设置当前展开项
  1444. const setActiveKey = (key) => {
  1445. return ActiveKey.value = key;
  1446. }
  1447. //名称被点击
  1448. const tableRowName = (row) => {
  1449. console.log(row,'row');
  1450. //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
  1451. // if (row['evisaPdfUrl']) {
  1452. // window.open(row['evisaPdfUrl'],'_blank')
  1453. // } else if (row['pdfUrl']) {
  1454. // window.open(row['pdfUrl'],'_blank')
  1455. // } else {
  1456. // window.$message?.warning('文件不存在')
  1457. // }
  1458. }
  1459. // 暴露出去
  1460. defineExpose({
  1461. getFormData,
  1462. getFormRegExpJson,
  1463. getActiveKey,
  1464. setActiveKey
  1465. })
  1466. </script>
  1467. <style lang="scss" scoped>
  1468. .data-fill-list-box {
  1469. position: relative;
  1470. //margin-bottom: 25%;
  1471. .hc-collapse-item-header {
  1472. flex: 1;
  1473. position: relative;
  1474. margin-left: 46px;
  1475. display: flex;
  1476. align-items: center;
  1477. .item-title {
  1478. flex: 1;
  1479. position: relative;
  1480. user-select: none;
  1481. color: #50545E;
  1482. font-size: 16px;
  1483. font-weight: 400;
  1484. cursor: pointer;
  1485. }
  1486. .hc-extra-text-box {
  1487. position: relative;
  1488. padding-right: 24px;
  1489. }
  1490. }
  1491. .data-fill-list-item-content {
  1492. position: relative;
  1493. display: flex;
  1494. height: calc(100vh - 386px);
  1495. .data-fill-table-form-box {
  1496. position: relative;
  1497. padding: 24px 20px;
  1498. height: 100%;
  1499. overflow: auto;
  1500. flex: 1;
  1501. .hc-no-table-form {
  1502. position: relative;
  1503. height: 100%;
  1504. display: flex;
  1505. justify-content: center;
  1506. align-items: center;
  1507. .table-form-no {
  1508. position: relative;
  1509. img {
  1510. width: 350px;
  1511. }
  1512. .desc {
  1513. text-align: center;
  1514. font-size: 20px;
  1515. color: #aaa;
  1516. }
  1517. }
  1518. }
  1519. }
  1520. .data-fill-table-tip-box {
  1521. width: 240px;
  1522. position: relative;
  1523. border-left: 1px solid #E9E9E9;
  1524. padding: 20px 15px 80px;
  1525. .tip-title {
  1526. font-size: 16px;
  1527. margin-bottom: 10px;
  1528. display: flex;
  1529. align-items: center;
  1530. }
  1531. .tip-item {
  1532. margin-bottom: 20px;
  1533. }
  1534. .table-tip-foot {
  1535. position: absolute;
  1536. bottom: 15px;
  1537. right: 0;
  1538. left: 0;
  1539. display: flex;
  1540. align-items: center;
  1541. padding: 0 15px;
  1542. .tip-left-btn {
  1543. flex: 1;
  1544. .dow-text {
  1545. cursor: pointer;
  1546. display: flex;
  1547. align-items: center;
  1548. }
  1549. }
  1550. }
  1551. }
  1552. }
  1553. }
  1554. .special-box {
  1555. position: relative;
  1556. display: flex;
  1557. justify-content: center;
  1558. align-items: center;
  1559. border: 1px solid #eee;
  1560. border-radius: 3px;
  1561. height: 52px;
  1562. width: 52px;
  1563. cursor: pointer;
  1564. user-select: none;
  1565. transition: color .3s, background-color .3s;
  1566. &:hover {
  1567. color: var(--el-color-primary);
  1568. background-color: var(--el-color-primary-light-8);
  1569. }
  1570. .font-EUDC {
  1571. font-size: 22px;
  1572. }
  1573. }
  1574. .radio-group-box{
  1575. text-align: center;
  1576. }
  1577. </style>
  1578. <style lang="scss">
  1579. .data-fill-list-box {
  1580. .el-collapse {
  1581. --el-collapse-header-height: 60px;
  1582. border: 0;
  1583. .el-collapse-item {
  1584. margin: 0 0 16px;
  1585. background-color: #f1f5f8;
  1586. border: 1px solid #E9E9E9;
  1587. border-radius: 4px;
  1588. }
  1589. .el-collapse-item__header {
  1590. background-color: transparent;
  1591. font-weight: 400;
  1592. border-bottom: 0;
  1593. cursor: default;
  1594. font-size: 14px;
  1595. .el-collapse-item__arrow {
  1596. position: absolute;
  1597. color: #50545E;
  1598. cursor: pointer;
  1599. left: 20px;
  1600. margin: 0;
  1601. }
  1602. }
  1603. .el-collapse-item.is-active .el-collapse-item__header.is-active {
  1604. background-color: #E7EEF4;
  1605. }
  1606. .el-collapse-item__wrap {
  1607. background-color: transparent;
  1608. border-bottom: 0;
  1609. .el-collapse-item__content {
  1610. position: relative;
  1611. padding-bottom: 0;
  1612. font-size: 14px;
  1613. color: #50545E;
  1614. line-height: initial;
  1615. }
  1616. }
  1617. }
  1618. }
  1619. //插入特殊字符弹窗的输入框
  1620. .data-fill-list-box .data-fill-table-form-box td,
  1621. .data-fill-list-box .data-fill-table-form-box td .el-input .el-input__wrapper .el-input__inner,
  1622. .el-form-item.special-form-item .el-form-item__content .el-input .el-input__wrapper .el-input__inner {
  1623. font-family: "EUDC", 宋体, v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  1624. }
  1625. //复制本表弹窗
  1626. .copy-node-many-box {
  1627. position: relative;
  1628. height: 53vh;
  1629. display: flex;
  1630. margin-top: 24px;
  1631. margin-bottom: -30px;
  1632. border-top: 1px solid #efeff5;
  1633. .copy-node-many-tree {
  1634. position: relative;
  1635. flex: 1;
  1636. height: 100%;
  1637. padding: 20px 20px 20px 0;
  1638. border-right: 1px solid #efeff5;
  1639. }
  1640. .copy-node-many-table {
  1641. position: relative;
  1642. flex: 1;
  1643. height: 100%;
  1644. padding: 20px 0 20px 20px;
  1645. }
  1646. }
  1647. //关联试验数据
  1648. .adding-form-dialog-box {
  1649. position: relative;
  1650. height: 100%;
  1651. display: flex;
  1652. .dialog-tree-box {
  1653. position: relative;
  1654. border-right: 1px solid #EEEEEE;
  1655. width: 500px;
  1656. height: 100%
  1657. }
  1658. .dialog-table-box {
  1659. position: relative;
  1660. flex: 1;
  1661. height: 100%;
  1662. padding: 18px;
  1663. .dialog-search {
  1664. position: relative;
  1665. display: flex;
  1666. }
  1667. .dialog-table {
  1668. position: relative;
  1669. height: calc(100% - 68px);
  1670. padding: 18px 0;
  1671. }
  1672. .dialog-pages {
  1673. position: relative;
  1674. }
  1675. }
  1676. }
  1677. .copy-node-many-table {
  1678. position: relative;
  1679. flex: 1;
  1680. height: 100%;
  1681. padding: 20px 0 20px 20px;
  1682. }
  1683. .dialog-table-box {
  1684. position: relative;
  1685. flex: 1;
  1686. height: 100%;
  1687. padding: 18px;
  1688. .dialog-search {
  1689. position: relative;
  1690. display: flex;
  1691. }
  1692. .dialog-table {
  1693. position: relative;
  1694. height: calc(100% - 68px);
  1695. padding: 18px 0;
  1696. }
  1697. .dialog-pages {
  1698. position: relative;
  1699. }
  1700. }
  1701. .text-blue{
  1702. color: blue;
  1703. }
  1704. .text-green{
  1705. color:green
  1706. }
  1707. </style>