ListItem.vue 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779
  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" >
  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 #name="{row}">
  300. <span class="text-link" @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 #name="{row}">
  305. <span class="text-link" @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. }else if(key === 'file'){
  917. fileModal.value=true;
  918. // getTreeDatas()
  919. }
  920. }
  921. //插入设计值
  922. const IDVFModal = ref(false)
  923. const formIDVFRef = ref(null)
  924. const formIDVFModel = ref({type: 1, design: '', size: '', dev: '', key: '', capacity: '', fail: '', pkId: ''})
  925. //插入特殊字符
  926. const specialModal = ref(false)
  927. const specialCharacters = ref([
  928. '&#57344;', "&#57345;", "&#57346;", "&#57347;", '&#8804;', '&#8805;', '&#8451;',
  929. '&#9312;', '&#9313;', '&#9314;', '&#9315;', '&#9316;', '&#9317;', '&#9318;', '&#9319;', '&#9320;', '&#9321;', '&#9322;', '&#9323;',
  930. '&#9324;', '&#9325;', '&#9326;', '&#9327;', '&#9328;', '&#9329;', '&#9330;', '&#9331;',
  931. "&#8544;", "&#8545;", "&#8546;", "&#8547;", "&#8548;", "&#8549;", "&#8550;", "&#8551;", "&#8552;", "&#8553;", "&#8554;", "&#8555;","K̅"
  932. ])
  933. //输入框验证
  934. const specialFormRef = ref(null)
  935. const specialFormModel = ref({val: ''})
  936. const specialFormRules = {
  937. val: {
  938. required: true,
  939. trigger: "blur",
  940. message: "请选择特殊字符代码"
  941. }
  942. }
  943. //显示插入特殊字符
  944. const specialRef = ref(null)
  945. const specialModalShow = () => {
  946. specialFormModel.value.val = ''
  947. specialModal.value = true
  948. nextTick(() => {
  949. specialRef.value?.focus();
  950. })
  951. }
  952. //失去焦点
  953. const specialPos = ref({start: 0, end: 0})
  954. const specialInputBlur = (e) => {
  955. specialPos.value = {
  956. start: e?.target?.selectionStart || 0,
  957. end: e?.target?.selectionEnd || 0
  958. }
  959. }
  960. //点击符号
  961. const specialClick = (event) => {
  962. const text = event?.target?.innerText ?? ''
  963. const start = specialPos.value.start
  964. const end = specialPos.value.end
  965. const form = specialFormModel.value.val
  966. specialFormModel.value.val = setPosInsert(start, end, form, text)
  967. specialRef.value?.focus();
  968. let posVal = start + text.length;
  969. nextTick(() => {
  970. setPosRange('specialId', posVal)
  971. })
  972. }
  973. //确认插入
  974. const specialNodeClick = async () => {
  975. const res = await formValidate(specialFormRef.value)
  976. if (res) {
  977. const item = tableFormItemNode.value
  978. const form = formData.value[item.index]
  979. const val = specialFormModel.value.val ?? ''
  980. formData.value[item.index][item.KeyName] = setPosInsert(item.startPos, item.endPos, form[item.KeyName], val)
  981. specialModal.value = false
  982. specialRef.value?.focus();
  983. let posVal = item.startPos + val.length;
  984. nextTick(() => {
  985. setPosRange(item.KeyName, posVal)
  986. })
  987. }
  988. }
  989. //关联试验数据
  990. const CTDModal = ref(false)
  991. //树形结构异步加载数据
  992. const defaultExpandedCids = ref([])
  993. //自动展开缓存
  994. const CTDTreeAutoExpandKeys = ref(getStoreData('CTDElTreeExpandKeys') || [])
  995. const ElTreeProps = ref({
  996. label: 'title',
  997. children: 'children',
  998. isLeaf: 'hasChildren'
  999. })
  1000. const ElTreeLoadNode = async (node, resolve) => {
  1001. let parentId = '0';
  1002. if (node.level !== 0) {
  1003. parentId = node?.data?.id
  1004. }
  1005. //获取数据
  1006. const {error, code, data} = await samplingApi.queryLazyTree({
  1007. wbsId: wbsTempId.value,
  1008. tenantId: tenantId.value,
  1009. projectId: projectId.value,
  1010. parentId,
  1011. wbsType: wbsType.value
  1012. })
  1013. //处理数据
  1014. if (!error && code === 200) {
  1015. let clickKey = '', defaultExpandedArr = [];
  1016. const keys = CTDTreeAutoExpandKeys.value || []
  1017. const resData = getArrValue(data)
  1018. for (let i = 0; i < resData.length; i++) {
  1019. resData[i].hasChildren = !resData[i].hasChildren
  1020. }
  1021. if (keys.length > 0) {
  1022. let lastKey = keys[keys.length-1];
  1023. for (const item of resData) {
  1024. //自动展开
  1025. if (isItem(keys,item?.primaryKeyId)) {
  1026. defaultExpandedArr.push(item?.primaryKeyId)
  1027. }
  1028. //最后一个,选中点击
  1029. if (item?.primaryKeyId === lastKey) {
  1030. clickKey = item?.primaryKeyId
  1031. }
  1032. }
  1033. } else if (node.level === 0) {
  1034. defaultExpandedArr.push(resData[0]?.primaryKeyId)
  1035. }
  1036. //自动展开
  1037. defaultExpandedCids.value = defaultExpandedArr
  1038. if (node.level === 0) {
  1039. emit('nodeLoading')
  1040. }
  1041. resolve(resData)
  1042. //最后一个,执行点击
  1043. if (clickKey) {
  1044. await nextTick(() => {
  1045. // document.getElementById(`${idPrefix.value}${clickKey}`)?.click()
  1046. })
  1047. }
  1048. } else {
  1049. if (node.level === 0) {
  1050. emit('nodeLoading')
  1051. }
  1052. resolve([])
  1053. }
  1054. }
  1055. //节点被点击
  1056. const CTDnodeItemInfo = ref({})
  1057. const CTDnodeDataInfo = ref({})
  1058. const CTDdialogTableData1=ref([])
  1059. const filedialogTableData=ref([])
  1060. //多选
  1061. const filetableCheckedKeys = ref([]);
  1062. const filedialogTableSelection = (rows) => {
  1063. filetableCheckedKeys.value = rows.filter((item) => {
  1064. return (item??'') !== '';
  1065. })
  1066. console.log( filetableCheckedKeys.value,' filetableCheckedKeys.value');
  1067. }
  1068. //确认关联试验文件
  1069. const savefileModal = ()=>{
  1070. console.log( filetableCheckedKeys.value,' filetableCheckedKeys.value');
  1071. const idarr=[]
  1072. filetableCheckedKeys.value.forEach((item)=>{
  1073. idarr.push(item.id)
  1074. })
  1075. const idval=idarr.join(',')
  1076. savesubmitRelationFile(idval)
  1077. fileModal.value=false
  1078. }
  1079. const CTDdialogTableColumn = ref([
  1080. {key:'recordNo', name: '报告编号'},
  1081. {key:'reportDate', name: '报告日期'},
  1082. {key:'projectPositionName', name: '工程用途及部位'},
  1083. {key:'detectionResultName', name: '检测结果'},
  1084. ])
  1085. const filedialogTableColumn = ref([
  1086. // reportNo
  1087. {key:'recordNo', name: '报告编号'},
  1088. {key:'reportDate', name: '报告日期'},
  1089. {key:'projectPositionName', name: '工程用途及部位'},
  1090. {key:'detectionResultName', name: '检测结果'},
  1091. ])
  1092. const filedialogTableColumn1 = ref([
  1093. // reportNo
  1094. {key:'reportNo', name: '报告编号'},
  1095. {key:'reportDate', name: '报告日期'},
  1096. {key:'projectPositionName', name: '工程用途及部位'},
  1097. {key:'detectionResultName', name: '检测结果'},
  1098. ])
  1099. const CTDElTreeClick = (data,node,keys) => {
  1100. CTDnodeItemInfo.value = node
  1101. CTDnodeDataInfo.value = data
  1102. getNodeData()
  1103. //缓存展开的节点
  1104. CTDTreeAutoExpandKeys.value = keys.value || []
  1105. setStoreData('CTDElTreeExpandKeys', keys.value)
  1106. }
  1107. //获取试验树节点下的记录信息
  1108. const getNodeData = async ()=>{
  1109. //获取数据
  1110. CTDdialogTableLoading.value = true
  1111. const {error, code, data} = await samplingApi.gettrialPage({
  1112. contractId: contractId.value,
  1113. nodeId: CTDnodeDataInfo.value.primaryKeyId,
  1114. current: CTDsearchFormPage.value.current,
  1115. size: CTDsearchFormPage.value.size,
  1116. startTime:CTDsearchFormPage.value.startTime,
  1117. endTime:CTDsearchFormPage.value.lastTime,
  1118. })
  1119. //处理数据
  1120. if (!error && code === 200) {
  1121. CTDdialogTableData1.value = getArrValue(data['records'])
  1122. CTDsearchFormPage.value.total = data.total || 0
  1123. CTDdialogTableLoading.value = false
  1124. } else {
  1125. CTDdialogTableData1.value = []
  1126. CTDsearchFormPage.value.total = 0
  1127. CTDdialogTableLoading.value = false
  1128. }
  1129. }
  1130. //试验文件节点下的数据
  1131. const getfileNodeData = async ()=>{
  1132. //获取数据
  1133. filedialogTableLoading.value = true
  1134. const {error, code, data} = await samplingApi.gettrialPage({
  1135. contractId: contractId.value,
  1136. nodeId: filenodeDataInfo.value.primaryKeyId,
  1137. current: filesearchFormPage.value.current,
  1138. size: filesearchFormPage.value.size,
  1139. startTime:filesearchFormPage.value.startTime,
  1140. endTime:filesearchFormPage.value.lastTime,
  1141. })
  1142. //处理数据
  1143. if (!error && code === 200) {
  1144. filedialogTableData.value = getArrValue(data['records'])
  1145. filesearchFormPage.value.total = data.total || 0
  1146. filedialogTableLoading.value = false
  1147. } else {
  1148. filedialogTableData.value = []
  1149. filesearchFormPage.value.total = 0
  1150. filesearchFormPage.value = false
  1151. }
  1152. }
  1153. //获取试验表中的data数据接口:
  1154. const getBussddataInfotrialData = async ()=>{
  1155. insertDataTableLoading.value=true;
  1156. const {error, code, data} = await dataApi.getBussddataInfotrial({
  1157. id:testReportId.value,
  1158. pkeyId:checPkd.value[0]['pKeyId'],
  1159. })
  1160. insertDataTableLoading.value = false
  1161. if (!error && code === 200) {
  1162. insertDataTable.value = getArrValue(data)
  1163. } else {
  1164. insertDataTable.value = []
  1165. }
  1166. }
  1167. //保存试验节点数据
  1168. //取消关联数据
  1169. const cancelinsertData = async () => {
  1170. insertDataShow.value=false
  1171. }
  1172. //确定关联试验数据数据
  1173. const submitinsertData = async () => {
  1174. if (multipleSelection.value.length>0) {
  1175. const item = tableFormItemNode.value
  1176. const form = formData.value[item.index]
  1177. const val =[]
  1178. multipleSelection.value.forEach((item)=>{
  1179. val.push(item['key_12__3_1'])
  1180. })
  1181. const newval=val.join('、')
  1182. formData.value[item.index][item.KeyName] = setPosInsert(item.startPos, item.endPos, form[item.KeyName], newval)
  1183. insertDataShow.value = false
  1184. CTDModal.value=false
  1185. let posVal = item.startPos + newval.length;
  1186. nextTick(() => {
  1187. setPosRange(item.KeyName, posVal)
  1188. })
  1189. }else{
  1190. window?.$message?.warning('请选择你要关联的数据')
  1191. }
  1192. }
  1193. //节点被点击
  1194. const ElTreeClick = async (data,node) => {
  1195. console.log(data,mode);
  1196. let autoKeysArr = []
  1197. await getNodeExpandKeys(node, autoKeysArr)
  1198. const autoKeys = autoKeysArr.reverse()
  1199. emit('nodeTap', {node, data, keys: autoKeys})
  1200. }
  1201. //处理自动展开的节点KEY
  1202. const getNodeExpandKeys = async (node, newKeys) => {
  1203. const parent = node?.parent ?? []
  1204. const primaryKeyId = node?.data?.primaryKeyId ?? ''
  1205. if (primaryKeyId) {
  1206. newKeys.push(primaryKeyId)
  1207. await getNodeExpandKeys(parent, newKeys)
  1208. }
  1209. }
  1210. const CTDbetweenTime = ref([])
  1211. const filebetweenTime = ref([])
  1212. //搜索表单
  1213. const CTDsearchFormPage = ref({
  1214. startTime: null,lastTime: null, wbsId: null, current: 1, size: 20, total: 0
  1215. })
  1216. const filesearchFormPage = ref({
  1217. startTime: null,lastTime: null, wbsId: null, current: 1, size: 20, total: 0
  1218. })
  1219. const CTDsearchFormPageChange = ({current, size}) => {
  1220. CTDsearchFormPage.value.current = current
  1221. CTDsearchFormPage.value.size = size
  1222. // getDialogTableData()
  1223. }
  1224. const filesearchFormPageChange = ({current, size}) => {
  1225. filesearchFormPage.value.current = current
  1226. filesearchFormPage.value.size = size
  1227. // getDialogTableData()
  1228. }
  1229. const CTDbetweenTimeUpdate = ({arr, query}) => {
  1230. CTDbetweenTime.value = arr
  1231. CTDsearchFormPage.value.startTime = arr[0]
  1232. CTDsearchFormPage.value.lastTime = arr[1]
  1233. }
  1234. const filebetweenTimeUpdate = ({arr, query}) => {
  1235. filebetweenTime.value = arr
  1236. filesearchFormPage.value.startTime = arr[0]
  1237. filesearchFormPage.value.lastTime = arr[1]
  1238. }
  1239. //搜索
  1240. const CTDsearchClick = () => {
  1241. CTDsearchFormPage.value.current = 1;
  1242. getNodeData()
  1243. }
  1244. const filesearchClick = () => {
  1245. filesearchFormPage.value.current = 1;
  1246. getfileNodeData()
  1247. }
  1248. const CTDdialogTableLoading = ref (false)
  1249. const filedialogTableLoading = ref (false)
  1250. const insertDataSelectoading=ref(false)
  1251. const CTDdialogTableKeys = ref ([])
  1252. let currowid=ref('')
  1253. //名称被点击
  1254. const CTDtableRowName = (row) => {
  1255. currowid=row.id
  1256. insertDataShow.value=true
  1257. getSearchNodeTables()
  1258. }
  1259. const getSearchNodeTables = async () => {
  1260. insertDataSelectoading.value = true
  1261. const { error, code, data } = await dataApi.searchNodeTables({
  1262. id: currowid,
  1263. projectId: projectId.value,
  1264. contractId: contractId.value,
  1265. primaryKeyId: CTDnodeDataInfo.value.primaryKeyId,
  1266. type: authBtnTabKey.value,
  1267. tableType: tabTypeKey.value
  1268. })
  1269. //处理数据
  1270. insertDataSelectoading.value = false
  1271. if (!error && code === 200) {
  1272. testReportData.value = getArrValue(data)
  1273. } else {
  1274. testReportData.value = []
  1275. }
  1276. }
  1277. //关联试验文件
  1278. const fileModal = ref(false)
  1279. const fileModalradio = ref(1)
  1280. const radioChange = (val)=>{
  1281. if(val!==1){
  1282. getthirdTreeDatas(val)
  1283. }
  1284. }
  1285. //获取试验文件树树数据
  1286. const fileModaltreeDatas = ref([])
  1287. //节点被点击
  1288. //节点被点击
  1289. const filenodeItemInfo = ref({})
  1290. const filenodeDataInfo = ref({})
  1291. const fileTableData1=ref([])
  1292. const fileTableColumn = ref([
  1293. {key:'recordNo', name: '报告编号'},
  1294. {key:'reportDate', name: '报告日期'},
  1295. {key:'projectPositionName', name: '工程用途及部位'},
  1296. {key:'detectionResultName', name: '检测结果'},
  1297. ])
  1298. const fileModalElTreeClick = async (data,node) => {
  1299. filenodeItemInfo.value = node
  1300. filenodeDataInfo.value = data
  1301. getfileNodeData()
  1302. }
  1303. //获取第三方树试验文件
  1304. //获取树数据
  1305. const thirdtreeDatas = ref([])
  1306. const thirdElTreeProps = ref({
  1307. label: 'nodeName',
  1308. children: 'children',
  1309. isLeaf: 'hasChildren'
  1310. })
  1311. const getthirdTreeDatas = async (type) => {
  1312. const { error, code, data } = await getTreeAll({
  1313. projectId: projectId.value,
  1314. contractId: contractId.value
  1315. })
  1316. if (!error && code === 200) {
  1317. if(type==2){
  1318. thirdtreeDatas.value = getArrValue(data['rightTree'])
  1319. }else{
  1320. thirdtreeDatas.value = getArrValue(data['leftTree'])
  1321. }
  1322. console.log(thirdtreeDatas,'thirdtreeDatas');
  1323. } else {
  1324. thirdtreeDatas.value = []
  1325. }
  1326. }
  1327. const thirdfilenodeItemInfo = ref({})
  1328. const thirdfilenodeDataInfo = ref({})
  1329. //获取第三方树节点下的数据
  1330. const getthirdTreetavleDatas = async () => {
  1331. const { error, code, data } = await thirdApi.queryPage({
  1332. projectId: projectId.value,
  1333. contractId: contractId.value,
  1334. nodeId: thirdfilenodeDataInfo.value.id,
  1335. current: filesearchFormPage.value.current,
  1336. size: filesearchFormPage.value.size,
  1337. startTime:filesearchFormPage.value.startTime,
  1338. endTime:filesearchFormPage.value.lastTime,
  1339. })
  1340. //处理数据
  1341. if (!error && code === 200) {
  1342. filedialogTableData.value = getArrValue(data['records'])
  1343. filesearchFormPage.value.total = data.total || 0
  1344. filedialogTableLoading.value = false
  1345. } else {
  1346. filedialogTableData.value = []
  1347. filesearchFormPage.value.total = 0
  1348. filesearchFormPage.value = false
  1349. }
  1350. }
  1351. const thirdtreeDatasElTreeClick =(data,node)=>{
  1352. thirdfilenodeItemInfo.value = node
  1353. thirdfilenodeDataInfo.value = data
  1354. getthirdTreetavleDatas()
  1355. }
  1356. //关联试验文件
  1357. const savesubmitRelationFile =async (ids)=>{
  1358. const { error, code, data } = await samplingApi.submitRelationFile({
  1359. projectId: projectId.value,
  1360. contractId: contractId.value,
  1361. nodeId: isPrimaryKeyId.value,
  1362. type:fileModalradio.value,
  1363. ids
  1364. })
  1365. }
  1366. //设计值频率计算
  1367. const IDVFModalSaveClick = async () => {
  1368. const {pkeyId, KeyName, index} = tableFormItemNode.value
  1369. if (pkeyId) {
  1370. const { design, size } = formIDVFModel.value
  1371. const { error, code, data } = await wbsApi.queryFormulaRange({
  1372. ...formIDVFModel.value,
  1373. // dev: (!design && !size) ? '±5': '',
  1374. key: KeyName,
  1375. pkId: pkeyId,
  1376. })
  1377. //处理数据
  1378. const res = getObjNullValue(data)
  1379. if (!error && code === 200 && res) {
  1380. Object.keys(data).forEach(key => {
  1381. formData.value[index][key] = data[key]
  1382. })
  1383. IDVFModal.value = false
  1384. }
  1385. } else {
  1386. window?.$message?.warning('pkeyId为空')
  1387. }
  1388. }
  1389. //事件
  1390. const emit = defineEmits(['renew','offsetTop'])
  1391. //被点击
  1392. const getOffsetTop = (key = '') => {
  1393. if (key) {
  1394. const dom = document.getElementById(key[key.length-1])
  1395. if(!drawType.value){
  1396. if(dom.offsetTop>=583&&ActiveKey.value.length>1){
  1397. emit('offsetTop', dom.offsetTop-583)
  1398. }else{
  1399. emit('offsetTop', dom.offsetTop)
  1400. }
  1401. }else {
  1402. if(dom.offsetTop>=424&&ActiveKey.value.length>1){
  1403. emit('offsetTop', dom.offsetTop-424)
  1404. }else{
  1405. emit('offsetTop', dom.offsetTop)
  1406. }
  1407. }
  1408. } else {
  1409. emit('offsetTop', 0)
  1410. }
  1411. ActiveKey.value = ActiveKey.value[ActiveKey.value.length-1]
  1412. }
  1413. //通知数据更新
  1414. const renewData = () => {
  1415. emit('renew')
  1416. ActiveKey.value = []
  1417. }
  1418. //获取表单数据
  1419. const getFormData = () => {
  1420. const formArr = formData.value;
  1421. return formArr.filter((item) => {
  1422. return (item.pkeyId??'') !== '' && item.isCollapseLoad;
  1423. })
  1424. }
  1425. //获取表单效验数据
  1426. const getFormRegExpJson = () => {
  1427. return deepClone(formRegExpJson.value);
  1428. }
  1429. //获取当前展开项
  1430. const getActiveKey = () => {
  1431. return ActiveKey.value;
  1432. }
  1433. //设置当前展开项
  1434. const setActiveKey = (key) => {
  1435. return ActiveKey.value = key;
  1436. }
  1437. //名称被点击
  1438. const tableRowName = (row) => {
  1439. console.log(row,'row');
  1440. //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
  1441. // if (row['evisaPdfUrl']) {
  1442. // window.open(row['evisaPdfUrl'],'_blank')
  1443. // } else if (row['pdfUrl']) {
  1444. // window.open(row['pdfUrl'],'_blank')
  1445. // } else {
  1446. // window.$message?.warning('文件不存在')
  1447. // }
  1448. }
  1449. // 暴露出去
  1450. defineExpose({
  1451. getFormData,
  1452. getFormRegExpJson,
  1453. getActiveKey,
  1454. setActiveKey
  1455. })
  1456. </script>
  1457. <style lang="scss" scoped>
  1458. .data-fill-list-box {
  1459. position: relative;
  1460. //margin-bottom: 25%;
  1461. .hc-collapse-item-header {
  1462. flex: 1;
  1463. position: relative;
  1464. margin-left: 46px;
  1465. display: flex;
  1466. align-items: center;
  1467. .item-title {
  1468. flex: 1;
  1469. position: relative;
  1470. user-select: none;
  1471. color: #50545E;
  1472. font-size: 16px;
  1473. font-weight: 400;
  1474. cursor: pointer;
  1475. }
  1476. .hc-extra-text-box {
  1477. position: relative;
  1478. padding-right: 24px;
  1479. }
  1480. }
  1481. .data-fill-list-item-content {
  1482. position: relative;
  1483. display: flex;
  1484. height: calc(100vh - 386px);
  1485. .data-fill-table-form-box {
  1486. position: relative;
  1487. padding: 24px 20px;
  1488. height: 100%;
  1489. overflow: auto;
  1490. flex: 1;
  1491. .hc-no-table-form {
  1492. position: relative;
  1493. height: 100%;
  1494. display: flex;
  1495. justify-content: center;
  1496. align-items: center;
  1497. .table-form-no {
  1498. position: relative;
  1499. img {
  1500. width: 350px;
  1501. }
  1502. .desc {
  1503. text-align: center;
  1504. font-size: 20px;
  1505. color: #aaa;
  1506. }
  1507. }
  1508. }
  1509. }
  1510. .data-fill-table-tip-box {
  1511. width: 240px;
  1512. position: relative;
  1513. border-left: 1px solid #E9E9E9;
  1514. padding: 20px 15px 80px;
  1515. .tip-title {
  1516. font-size: 16px;
  1517. margin-bottom: 10px;
  1518. display: flex;
  1519. align-items: center;
  1520. }
  1521. .tip-item {
  1522. margin-bottom: 20px;
  1523. }
  1524. .table-tip-foot {
  1525. position: absolute;
  1526. bottom: 15px;
  1527. right: 0;
  1528. left: 0;
  1529. display: flex;
  1530. align-items: center;
  1531. padding: 0 15px;
  1532. .tip-left-btn {
  1533. flex: 1;
  1534. .dow-text {
  1535. cursor: pointer;
  1536. display: flex;
  1537. align-items: center;
  1538. }
  1539. }
  1540. }
  1541. }
  1542. }
  1543. }
  1544. .special-box {
  1545. position: relative;
  1546. display: flex;
  1547. justify-content: center;
  1548. align-items: center;
  1549. border: 1px solid #eee;
  1550. border-radius: 3px;
  1551. height: 52px;
  1552. width: 52px;
  1553. cursor: pointer;
  1554. user-select: none;
  1555. transition: color .3s, background-color .3s;
  1556. &:hover {
  1557. color: var(--el-color-primary);
  1558. background-color: var(--el-color-primary-light-8);
  1559. }
  1560. .font-EUDC {
  1561. font-size: 22px;
  1562. }
  1563. }
  1564. .radio-group-box{
  1565. text-align: center;
  1566. }
  1567. </style>
  1568. <style lang="scss">
  1569. .data-fill-list-box {
  1570. .el-collapse {
  1571. --el-collapse-header-height: 60px;
  1572. border: 0;
  1573. .el-collapse-item {
  1574. margin: 0 0 16px;
  1575. background-color: #f1f5f8;
  1576. border: 1px solid #E9E9E9;
  1577. border-radius: 4px;
  1578. }
  1579. .el-collapse-item__header {
  1580. background-color: transparent;
  1581. font-weight: 400;
  1582. border-bottom: 0;
  1583. cursor: default;
  1584. font-size: 14px;
  1585. .el-collapse-item__arrow {
  1586. position: absolute;
  1587. color: #50545E;
  1588. cursor: pointer;
  1589. left: 20px;
  1590. margin: 0;
  1591. }
  1592. }
  1593. .el-collapse-item.is-active .el-collapse-item__header.is-active {
  1594. background-color: #E7EEF4;
  1595. }
  1596. .el-collapse-item__wrap {
  1597. background-color: transparent;
  1598. border-bottom: 0;
  1599. .el-collapse-item__content {
  1600. position: relative;
  1601. padding-bottom: 0;
  1602. font-size: 14px;
  1603. color: #50545E;
  1604. line-height: initial;
  1605. }
  1606. }
  1607. }
  1608. }
  1609. //插入特殊字符弹窗的输入框
  1610. .data-fill-list-box .data-fill-table-form-box td,
  1611. .data-fill-list-box .data-fill-table-form-box td .el-input .el-input__wrapper .el-input__inner,
  1612. .el-form-item.special-form-item .el-form-item__content .el-input .el-input__wrapper .el-input__inner {
  1613. font-family: "EUDC", 宋体, v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  1614. }
  1615. //复制本表弹窗
  1616. .copy-node-many-box {
  1617. position: relative;
  1618. height: 53vh;
  1619. display: flex;
  1620. margin-top: 24px;
  1621. margin-bottom: -30px;
  1622. border-top: 1px solid #efeff5;
  1623. .copy-node-many-tree {
  1624. position: relative;
  1625. flex: 1;
  1626. height: 100%;
  1627. padding: 20px 20px 20px 0;
  1628. border-right: 1px solid #efeff5;
  1629. }
  1630. .copy-node-many-table {
  1631. position: relative;
  1632. flex: 1;
  1633. height: 100%;
  1634. padding: 20px 0 20px 20px;
  1635. }
  1636. }
  1637. //关联试验数据
  1638. .adding-form-dialog-box {
  1639. position: relative;
  1640. height: 100%;
  1641. display: flex;
  1642. .dialog-tree-box {
  1643. position: relative;
  1644. border-right: 1px solid #EEEEEE;
  1645. width: 500px;
  1646. height: 100%
  1647. }
  1648. .dialog-table-box {
  1649. position: relative;
  1650. flex: 1;
  1651. height: 100%;
  1652. padding: 18px;
  1653. .dialog-search {
  1654. position: relative;
  1655. display: flex;
  1656. }
  1657. .dialog-table {
  1658. position: relative;
  1659. height: calc(100% - 68px);
  1660. padding: 18px 0;
  1661. }
  1662. .dialog-pages {
  1663. position: relative;
  1664. }
  1665. }
  1666. }
  1667. .copy-node-many-table {
  1668. position: relative;
  1669. flex: 1;
  1670. height: 100%;
  1671. padding: 20px 0 20px 20px;
  1672. }
  1673. .dialog-table-box {
  1674. position: relative;
  1675. flex: 1;
  1676. height: 100%;
  1677. padding: 18px;
  1678. .dialog-search {
  1679. position: relative;
  1680. display: flex;
  1681. }
  1682. .dialog-table {
  1683. position: relative;
  1684. height: calc(100% - 68px);
  1685. padding: 18px 0;
  1686. }
  1687. .dialog-pages {
  1688. position: relative;
  1689. }
  1690. }
  1691. </style>