wbs.vue 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296
  1. <template>
  2. <div class="h-full">
  3. <div v-if="wbsTypeTabKey === 'tree'" v-loading="nodeSaveLoading" class="hc-layout-box" element-loading-text="批量保存数据中...">
  4. <div
  5. id="wbs-left-tree" :class="[isWbsTreeShow ? 'show' : '', isMouseTree ? 'on-transition' : '']"
  6. :style="`width:${isWbsTreeShow ? leftWidth : 0}px; ${isWbsTreeShow ? '' : 'display: none'}`"
  7. class="hc-layout-left-box bg-white"
  8. >
  9. <div class="hc-project-box">
  10. <div class="hc-project-icon-box">
  11. <HcIcon name="stack" />
  12. </div>
  13. <div class="ml-2 project-name-box">
  14. <div class="project-alias">{{ projectInfo.projectName }}</div>
  15. </div>
  16. </div>
  17. <div class="hc-tree-box">
  18. <div class="hc-tree-back-to">
  19. <el-link type="primary" @click="gobackHistory">回到上一次填报部位</el-link>
  20. <el-link type="warning" class="ml-4" @click="wbsMapTypeTab">导图结构填报</el-link>
  21. </div>
  22. <div class="hc-search-tree-val">
  23. <el-input v-model="searchTreeVal" block clearable placeholder="请输入名称关键词检索" @keyup="searchTreeKeyUp">
  24. <template #suffix>
  25. <HcIcon name="search-2" ui="text-xl iscusor" @click="searchTreeClick" />
  26. </template>
  27. </el-input>
  28. </div>
  29. <div v-if="isShowLeft" id="hc-tree-scrollbar" v-loading="treeLoading" class="hc-tree-scrollbar" element-loading-text="获取数据中...">
  30. <el-scrollbar v-show="isSearchTree" class="scroll-bar-right-16">
  31. <HcDataTree
  32. is-load-menu
  33. :datas="searchTreeData"
  34. :is-mark="TreeMark"
  35. :menus="ElTreeMenu"
  36. is-counts
  37. is-type
  38. :auto-expand-keys="TreeAutoExpandKeys"
  39. default-expand-all
  40. @node-tap="wbsElTreeClick"
  41. @menu-tap="ElTreeMenuClick"
  42. @load-menu="loadMenu"
  43. />
  44. </el-scrollbar>
  45. <el-scrollbar v-show="!isSearchTree" class="scroll-bar-right-16">
  46. <HcLazyTree
  47. ref="wbstree"
  48. is-load-menu
  49. :auto-expand-keys="TreeAutoExpandKeys"
  50. :is-mark="TreeMark"
  51. :menus="ElTreeMenu"
  52. is-counts
  53. is-type
  54. show-checkbox
  55. check-strictly
  56. @load="treeLoadNode"
  57. @menu-tap="ElTreeMenuClick"
  58. @node-loading="ElTreeNodeLoading"
  59. @node-tap="wbsElTreeClick"
  60. @check="ElTreeNodeCheck"
  61. @load-menu="loadMenu"
  62. />
  63. </el-scrollbar>
  64. </div>
  65. </div>
  66. <div class="hc-tree-foot-tip-box">
  67. <div class="dot-view green">已审批</div>
  68. <div class="dot-view black">未填报</div>
  69. <div class="dot-view orange">已填报-待审批</div>
  70. <div class="dot-view blue">已填报-未上报</div>
  71. </div>
  72. <!-- 左右拖动 -->
  73. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  74. </div>
  75. <div id="wbs-content-box" v-loading="ListItemLoading" class="hc-layout-content-box">
  76. <!---展开收缩树 -->
  77. <div class="hc-expansion-contraction-tree" @click="setWbsTreeShow">
  78. <HcIcon v-show="isWbsTreeShow" name="arrow-left-s" />
  79. <HcIcon v-show="!isWbsTreeShow" name="arrow-right-s" />
  80. </div>
  81. <hc-tab-card :tabs="authBtnTabdata" :tab-key="authBtnTabKey" @change="authBtnTabClick">
  82. <template #extra>
  83. <el-button :loading="nodeSaveLoading" hc-btn type="primary" @click="NodeSaveClick">辅助保存</el-button>
  84. <HcTooltip keys="wbs_views_drawings">
  85. <el-button :disabled="nodeDataInfo?.drawingsId === -1 || nodeDataInfo?.drawingsId === null" hc-btn color="#e03997" @click="viewsDrawings">图纸</el-button>
  86. </HcTooltip>
  87. <HcTooltip keys="wbs_preview">
  88. <el-button :disabled="NodeStatus === '1'" :loading="bussPdfsLoading" hc-btn color="#A16222" @click="bussPdfsClick">预览</el-button>
  89. </HcTooltip>
  90. <el-button hc-btn color="#A16222" @click="attachmentModalShow">查看附件</el-button>
  91. <el-button hc-btn :disabled="isCanadd" color="#567722" @click="addFilelist">上传附件</el-button>
  92. <HcTooltip v-if="NodeStatus !== '3'" keys="wbs_report">
  93. <el-button :disabled="NodeStatus === '3' || NodeStatus === '1'" :loading="reportLoading" hc-btn color="#FF976A" style="color: white;" @click="reportModalClick">上报</el-button>
  94. </HcTooltip>
  95. <HcTooltip v-if="NodeStatus === '3'" keys="wbs_abolish">
  96. <el-button hc-btn :laoding="abolishLoaing" color="#FF976A" style="color: white;" @click="abolishOneClick">撤回上报流程</el-button>
  97. </HcTooltip>
  98. <el-button v-if="authBtnTabKey === '2'" hc-btn color="#37c0fe" style="color: white;" :loading="syncdataloading" @click="syncdata">同步质检资料</el-button>
  99. <HcTooltip v-if="NodeStatus !== '3'" keys="wbs_save">
  100. <el-button
  101. :disabled="NodeStatus === '3' || ListItemDatas.length <= 0"
  102. :loading="tableFormSaveLoading" hc-btn color="#12C060"
  103. style="color: white; font-weight: bold"
  104. @click="tableFormSaveClick"
  105. >
  106. 保存数据
  107. </el-button>
  108. </HcTooltip>
  109. </template>
  110. <el-scrollbar v-if="ListItemDatas.length > 0" ref="ListItemScrollRef">
  111. <CollapseForm
  112. ref="ListItemRef"
  113. :tree-auto-expand-keys="TreeAutoExpandKeys"
  114. :classify="authBtnTabKey"
  115. :contract-id="contractId"
  116. :datas="ListItemDatas"
  117. :draw-type="!isDrawType"
  118. :primary-key-id="primaryKeyId"
  119. :status="NodeStatus"
  120. :tenant-id="userInfo?.tenant_id"
  121. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
  122. :wbs-type="2"
  123. :treenode-data-info="nodeDataInfo"
  124. :newlistdata="newlistdata"
  125. @offset-top="ListItemOffsetTop"
  126. @renew="getTableDataAll"
  127. @get-list="searchNodeAllTable1"
  128. />
  129. </el-scrollbar>
  130. <HcStatus v-else text="暂无表单" />
  131. </hc-tab-card>
  132. </div>
  133. </div>
  134. <HcNewCard v-if="wbsTypeTabKey === 'map'" id-ref="wbs-node-tree-card-target">
  135. <template #header>
  136. <HcTooltip keys="wbs_views_division_btn">
  137. <el-button class="mr-10" hc-btn type="primary" @click="divisionClick">
  138. <HcIcon :line="false" name="node-tree" />
  139. <span>划分变更</span>
  140. </el-button>
  141. </HcTooltip>
  142. <HcNewSwitch v-if="isDrawer" :datas="authBtnTabdata" :keys="authBtnTabKey" :round="false" size="default" @change="authBtnTabClick" />
  143. </template>
  144. <template #extra>
  145. <HcNewSwitch :datas="wbsTypeTab" :keys="wbsTypeTabKey" size="default" @change="wbsTypeTabChange" />
  146. </template>
  147. <NodeTree
  148. ref="NodeTreeRef"
  149. :accordion="NodeTreeAccordion"
  150. :auto-expand-keys="TreeAutoExpandKeys"
  151. :contract-id="contractId"
  152. :is-mark="TreeMark"
  153. :menus="ElTreeMenu"
  154. :project-id="projectId"
  155. @menu-click="NodeTreeMenuClick"
  156. @node-click="NodeTreeClick"
  157. @node-dbl-click="NodeTreeDblClick"
  158. />
  159. <template #action>
  160. <div class="hc-tree-mp-tip-box">
  161. <div class="dot-view green">已审批</div>
  162. <div class="dot-view black">未填报</div>
  163. <div class="dot-view orange">已填报-待审批</div>
  164. <div class="dot-view blue">已填报-未上报</div>
  165. </div>
  166. </template>
  167. <HcDrawer :show="isDrawer" action-ui="text-center" to-id="wbs-node-tree-card-target" @close="drawerClose">
  168. <!-- 清表列表 -->
  169. <el-scrollbar v-if="ListItemDatas.length > 0" ref="ListItemScrollRef">
  170. <CollapseForm
  171. ref="ListItemsRef"
  172. :classify="authBtnTabKey"
  173. :contract-id="contractId"
  174. :datas="ListItemDatas"
  175. :draw-type="isDrawType"
  176. :primary-key-id="primaryKeyId"
  177. :status="NodeStatus"
  178. :tenant-id="userInfo?.tenant_id"
  179. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
  180. :wbs-type="2"
  181. @offset-top="ListItemOffsetTop"
  182. @renew="getTableDataAll"
  183. />
  184. </el-scrollbar>
  185. <hc-status v-else text="暂无表单" />
  186. <!-- 底部按钮区域 -->
  187. <template #action>
  188. <hc-tooltip v-if="NodeStatus !== '3'" keys="wbs_save">
  189. <el-button
  190. :disabled="NodeStatus === '3' || ListItemDatas.length <= 0"
  191. :loading="tableFormSaveLoading"
  192. hc-btn
  193. type="primary"
  194. @click="tableFormSaveClick"
  195. >
  196. <HcIcon name="save" />
  197. <span>保存</span>
  198. </el-button>
  199. </hc-tooltip>
  200. <hc-tooltip v-if="NodeStatus !== '3'" keys="wbs_report">
  201. <el-button
  202. :disabled="NodeStatus === '3' || NodeStatus === '1'"
  203. :loading="reportLoading"
  204. hc-btn
  205. @click="reportModalClick"
  206. >
  207. <HcIcon name="send-plane-2" />
  208. <span>上报</span>
  209. </el-button>
  210. </hc-tooltip>
  211. <hc-tooltip keys="wbs_preview">
  212. <el-button
  213. :disabled="NodeStatus === '1'"
  214. :loading="bussPdfsLoading"
  215. hc-btn
  216. @click="bussPdfsClick"
  217. >
  218. <HcIcon name="eye" />
  219. <span>预览</span>
  220. </el-button>
  221. </hc-tooltip>
  222. <hc-tooltip v-if="NodeStatus === '3'" keys="wbs_abolish">
  223. <el-button hc-btn>
  224. <HcIcon name="arrow-go-back" />
  225. <span>撤回上报流程</span>
  226. </el-button>
  227. </hc-tooltip>
  228. <hc-tooltip keys="wbs_views_drawings">
  229. <el-button :disabled="!nodeDataInfo?.fileUrl" hc-btn @click="viewsDrawings">
  230. <HcIcon name="image" />
  231. <span>图纸</span>
  232. </el-button>
  233. </hc-tooltip>
  234. <el-button hc-btn @click="attachmentModalShow">
  235. <HcIcon name="file" />
  236. <span>附件</span>
  237. </el-button>
  238. <el-button hc-btn @click="drawerClose">
  239. <HcIcon name="close" />
  240. <span>关闭填报页面</span>
  241. </el-button>
  242. </template>
  243. </HcDrawer>
  244. </HcNewCard>
  245. <!-- 上传文件 -->
  246. <hc-upload-file
  247. ref="HcUploadFileRef"
  248. :options="uploadFileOptions"
  249. :params="uploadFileParams"
  250. :echo-params="uploadFileEchoParams"
  251. @success="uploadFileSuccess"
  252. @item="uploadFileItem"
  253. @finish="uploadFileFinish"
  254. />
  255. <!-- 查看图纸 -->
  256. <hc-drag-modal
  257. :is-show="drawingsShow" close-icon lefts="145" title="查看图纸" tops="100" ui="hc-image-preview-box"
  258. widths="380px" @close="drawingsClose"
  259. >
  260. <div class="hc-image-preview-view">
  261. <!-- <el-image-viewer :url-list="[nodeDataInfo.fileUrl]" /> -->
  262. <el-image :src="drawList" />
  263. </div>
  264. </hc-drag-modal>
  265. <!-- 编辑节点 -->
  266. <hc-new-dialog v-model="editNodeModal" :loading="editNodeLoading" title="编辑节点" widths="600px" @save="editNodeClick">
  267. <el-form ref="formEditNodeRef" :model="formEditNodeModel" :rules="formEditNodeRules" label-width="auto" size="large">
  268. <el-form-item label="节点名称" prop="title">
  269. <el-input v-model="formEditNodeModel.title" placeholder="请输入节点名称" />
  270. </el-form-item>
  271. <el-form-item label="上级节点">
  272. <el-input v-model="formEditNodeModel.parent.title" disabled />
  273. </el-form-item>
  274. <el-form-item label="节点类型">
  275. <el-select v-model="formEditNodeModel.nodeType" block disabled>
  276. <el-option v-for="item in nodeTypeData" :key="item.value" :label="item.label" :value="item.value" />
  277. </el-select>
  278. </el-form-item>
  279. <el-form-item label="划分编号">
  280. <el-input v-model="formEditNodeModel.partitionCode" placeholder="请输入划分编号" />
  281. </el-form-item>
  282. <el-form-item class="hc-position-input-icon" label="模板位置">
  283. <el-input v-model="formEditNodeModel.position" :autosize="{ minRows: 3, maxRows: 6 }" type="textarea" />
  284. <el-tooltip content="一键复制模板位置">
  285. <HcIcon name="file-copy-2" @click="copyPositionText(formEditNodeModel.position)" />
  286. </el-tooltip>
  287. </el-form-item>
  288. </el-form>
  289. </hc-new-dialog>
  290. <!-- 复制节点 -->
  291. <hc-new-dialog v-model="copyNodeModal" :loading="copyNodeLoading" :widths="copyNodeTabKey === '1' ? '600px' : '1200px'" loading-text="复制节点中,请耐心等待..." title="复制节点">
  292. <div class="header-new-switch">
  293. <el-form ref="formCopyNodeModelRef" :model="formCopyNodeModel" label-position="left" :rules="formCopyNodeModelRules" label-width="auto" size="large">
  294. <el-form-item label="是否复制数据" prop="isCopyData" style="margin-bottom: 0;">
  295. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  296. <el-radio-group v-model="isCopyData">
  297. <el-radio :value="1">是</el-radio>
  298. <el-radio :value="0">否</el-radio>
  299. </el-radio-group>
  300. </el-form-item>
  301. <el-form-item v-if="isCopyData === 1" label="所属方" prop="classify" style="margin-bottom: 0;">
  302. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  303. <el-checkbox-group v-model="classifyList">
  304. <el-checkbox value="施工">施工</el-checkbox>
  305. <el-checkbox value="监理">监理</el-checkbox>
  306. </el-checkbox-group>
  307. </el-form-item>
  308. </el-form>
  309. <!-- HcNewSwitch :datas="authBtnTabdata" :keys="classifyType" :round="false" size="default"
  310. @change="classifyTypeTabClick"/ -->
  311. </div>
  312. <div v-if="copyNodeTabKey === '1'" class="copy-node-form-box">
  313. <el-form ref="formCopyNodeModelRef" :model="formCopyNodeModel" :rules="formCopyNodeModelRules" label-width="auto" size="large">
  314. <el-form-item v-if="copyNodeTabKey === '1'" label="节点名称" prop="title" style="margin-bottom: 0;">
  315. <el-input v-model="formCopyNodeModel.title" placeholder="请输入节点名称" />
  316. </el-form-item>
  317. <el-form-item v-if="copyNodeTabKey === '1'" label="划分编号" prop="partitionCode" style="margin-top: 10px;">
  318. <el-input v-model="formCopyNodeModel.partitionCode" placeholder="请输入划分编号" />
  319. </el-form-item>
  320. </el-form>
  321. </div>
  322. <div v-if="copyNodeTabKey === '3'" class="copy-node-form-box">
  323. <el-form ref="formCopyNodeModelRef" :model="formCopyNodeModel" :rules="formCopyNodeModelRules" label-width="auto" size="large">
  324. <el-form-item label="所属方" prop="classify" style="margin-bottom: 0;">
  325. <!-- <el-input v-model="formCopyNodeModel.classify" placeholder="请输入节点名称"/> -->
  326. <el-checkbox-group v-model="classifyList">
  327. <el-checkbox value="施工">施工</el-checkbox>
  328. <el-checkbox value="监理">监理</el-checkbox>
  329. </el-checkbox-group>
  330. </el-form-item>
  331. </el-form>
  332. </div>
  333. <div v-if="copyNodeTabKey !== '1'" class="copy-node-many-box">
  334. <div class="copy-node-many-tree">
  335. <el-scrollbar>
  336. <hc-lazy-tree :auto-expand-keys="TreeAutoExpandKeys" is-type @load="treeLoadNode" @node-tap="copyNodeElTreeClick" />
  337. </el-scrollbar>
  338. </div>
  339. <div class="copy-node-many-table">
  340. <el-scrollbar>
  341. <el-table :data="copyNodeTable" border>
  342. <el-table-column label="复制到的位置" prop="title" />
  343. <el-table-column v-if="copyNodeTabKey === '2'" label="节点名称" prop="nodeName">
  344. <template #default="{ row }">
  345. <el-form ref="copyNodeTableRef" :model="row" :rules="copyNodeTableRules" label-width="0" size="large">
  346. <el-form-item prop="nodeName" style="margin-bottom: 0;">
  347. <el-input v-model="row.nodeName" placeholder="请输入节点名称" />
  348. </el-form-item>
  349. </el-form>
  350. </template>
  351. </el-table-column>
  352. <el-table-column v-if="copyNodeTabKey === '2'" label="划分编号" prop="partitionCode">
  353. <template #default="{ row }">
  354. <el-form ref="copyNodeTableRef" :model="row" :rules="copyNodeTableRules" label-width="0" size="large">
  355. <el-form-item prop="partitionCode" style="margin-bottom: 0;">
  356. <el-input v-model="row.partitionCode" placeholder="请输入划分编号" />
  357. </el-form-item>
  358. </el-form>
  359. </template>
  360. </el-table-column>
  361. <el-table-column align="center" label="操作" prop="action" width="120">
  362. <template #default="{ _, $index }">
  363. <el-button plain type="danger" @click="copyNodeTableDel($index)">删除</el-button>
  364. </template>
  365. </el-table-column>
  366. </el-table>
  367. </el-scrollbar>
  368. </div>
  369. </div>
  370. <template #footer>
  371. <div class="lr-dialog-footer">
  372. <div class="left">
  373. <template v-for="(item, index) in copyNodeTab" :key="index">
  374. <el-button v-if="item?.key === copyNodeTabKey" plain size="large" type="primary" @click="copyNodeTabChange(item?.key)">{{ item.name }}</el-button>
  375. <el-button v-else bg size="large" text @click="copyNodeTabChange(item?.key)">{{ item.name }}</el-button>
  376. </template>
  377. </div>
  378. <div class="right">
  379. <el-button :disabled="copyNodeLoading" size="large" @click="copyNodeModal = false">取消</el-button>
  380. <el-button :loading="copyNodeLoading" hc-btn type="primary" @click="copyNodeClick">提交</el-button>
  381. </div>
  382. </div>
  383. </template>
  384. </hc-new-dialog>
  385. <!-- 新增子节点 -->
  386. <hc-new-dialog v-model="addNodeModal" :loading="addNodeLoading" loading-text="新增节点中,请耐心等待..." title="新增子节点" widths="720px">
  387. <el-alert :closable="false" title="双击节点,可编辑节点名称,编辑完成后,请按回车或输入框消失后,再点提交" type="warning" />
  388. <HcTreeNode
  389. v-if="addTreeNodeType === '1'"
  390. :node-id="addTreeNodeId"
  391. :old-id="addTreeNodeOldId"
  392. :contract-id="contractId"
  393. :wbs-id="projectInfo.referenceWbsTemplateId"
  394. :project-id="projectId"
  395. :is-custom="isCustom"
  396. @check-change="addTreeNodeCheckChange"
  397. />
  398. <HcTreeNode
  399. v-if="addTreeNodeType === '2'"
  400. :node-id="addTreeNodeId"
  401. :old-id="addTreeNodeOldId"
  402. :contract-id="contractId"
  403. :wbs-id="projectInfo.referenceWbsTemplateId"
  404. :project-id="projectId"
  405. strictly :is-custom="isCustom"
  406. @check-change="addTreeNodeCheckChange"
  407. />
  408. <template #footer>
  409. <div class="lr-dialog-footer">
  410. <div class="left flex items-center">
  411. <div class="mr-4">选中方式:</div>
  412. <el-radio-group v-model="addTreeNodeType">
  413. <el-radio label="1">当前及子节点</el-radio>
  414. <el-radio class="ml-4" label="2">仅当前节点</el-radio>
  415. </el-radio-group>
  416. </div>
  417. <div class="right">
  418. <el-button size="large" @click="addNodeModal = false">取消</el-button>
  419. <el-button :loading="addNodeLoading" hc-btn type="primary" @click="addNodeClick">提交</el-button>
  420. </div>
  421. </div>
  422. </template>
  423. </hc-new-dialog>
  424. <!-- 新增自定义节点 -->
  425. <hc-new-dialog v-model="addNodeModalCus" :loading="addNodeLoadingCus" loading-text="新增节点中,请耐心等待..." title="新增自定义节点" widths="720px" @save="addNodeClickCur">
  426. <div>节点名称:</div>
  427. <el-input v-model="nodeNameinput" placeholder="请输入节点名称" size="large" style="margin-top: 15px;" />
  428. </hc-new-dialog>
  429. <!-- 调整排序 -->
  430. <hc-new-dialog v-model="sortNodeModal" :loading="sortNodeLoading" title="调整排序" widths="700px" @save="sortNodeClick">
  431. <el-alert :closable="false" title="可拖动排序,也可在后面点击图标,切换排序" type="warning" />
  432. <div class="sort-node-body-box list-group header">
  433. <div class="list-group-item">
  434. <div class="index-box">序号</div>
  435. <div class="title-box">节点名称</div>
  436. <div class="icon-box">排序</div>
  437. </div>
  438. </div>
  439. <Draggable :list="sortNodeData" class="sort-node-body-box list-group" ghost-class="ghost" item-key="id" @end="sortNodeDrag = false" @start="sortNodeDrag = true">
  440. <template #item="{ element, index }">
  441. <div class="list-group-item">
  442. <div class="index-box">{{ index + 1 }}</div>
  443. <div class="title-box">{{ element.title }}</div>
  444. <div class="icon-box">
  445. <span class="icon" @click="downSortClick(index)">
  446. <HcIcon name="arrow-down" ui="text-lg" />
  447. </span>
  448. <span class="icon" @click="upSortClick(index)">
  449. <HcIcon name="arrow-up" ui="text-lg" />
  450. </span>
  451. </div>
  452. </div>
  453. </template>
  454. </Draggable>
  455. </hc-new-dialog>
  456. <!-- 批量上报审批 -->
  457. <hc-report-modal
  458. :addition="reportAddition"
  459. :contract-id="contractInfo?.contractType == 2 ? nodeDataInfo?.contractIdRelation : contractId"
  460. :ids="reportIds"
  461. :table-owner="authBtnTabKey"
  462. :classify-type="classType"
  463. :project-id="projectId"
  464. :show="showReportModal"
  465. :task-name="reportTaskName"
  466. :type-data="reportTypeData"
  467. title="批量上报审批" type="wbs" url="informationWriteQuery/taskOne"
  468. @finish="showReportFinish" @hide="showReportModal = false"
  469. />
  470. <!-- 查看附件 -->
  471. <hc-new-dialog v-model="attachmentModal" :footer="false" is-table title="附件列表" widths="780px">
  472. <div v-if="attachmentList.length > 0" v-loading="attachmentListLoaing">
  473. <div v-for="item in attachmentList " :key="item.id" class="hc-attachment-card">
  474. <div class="hc-attachment-header">{{ item?.nodeName }}</div>
  475. <div class="hc-attachment-content">
  476. <div v-for="item1 in item.fileList " :key="item1.id" class="hc-attachment-item">
  477. <div class="hc-attachment-file-name">
  478. <HcIcon name="attachment" />
  479. <div class="name">{{ item1?.name }}</div>
  480. </div>
  481. <div class="hc-attachment-btn-box">
  482. <el-button plain size="small" type="primary" @click="previewFile(item1)">
  483. <HcIcon name="eye" />
  484. <span>预览</span>
  485. </el-button>
  486. <el-button v-if="NodeStatus != 3" plain size="small" style="margin-left: 16px" type="danger" :loading="item1?.loading" @click="delFile(item1)">
  487. <HcIcon name="close" />
  488. <span>删除</span>
  489. </el-button>
  490. </div>
  491. </div>
  492. </div>
  493. </div>
  494. </div>
  495. <div v-else style="height: 100%;width: 100%;">
  496. <hc-no-data />
  497. </div>
  498. </hc-new-dialog>
  499. <!-- 上传文件 -->
  500. <hc-new-dialog v-model="uploadModal" :footer="false" title="上传文件" widths="38rem" @close="uploadModalClose">
  501. <div class="mb-4">
  502. <span style="color: red;">*</span> 选择附件类型:
  503. <el-select
  504. v-model="typevalue"
  505. placeholder="请选择"
  506. style="width: 240px"
  507. clearable
  508. @change="changeType"
  509. >
  510. <el-option
  511. v-for="item in typeoptions"
  512. :key="item.value"
  513. :label="item.label"
  514. :value="item.value"
  515. />
  516. </el-select>
  517. </div>
  518. <HcUpload
  519. :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-manager/exceltab/add-bussfile-node" accept="application/pdf" accept-tip="允许格式:pdf"
  520. :auto-upload="false"
  521. :typevalue="typevalue"
  522. @change="uploadChange"
  523. @close="uploadModalClose"
  524. />
  525. </hc-new-dialog>
  526. </div>
  527. </template>
  528. <script setup>
  529. import { nextTick, onMounted, ref, watch } from 'vue'
  530. import { useRoute, useRouter } from 'vue-router'
  531. import { useAppStore } from '~src/store'
  532. import { HcIsButton } from '~src/plugins/IsButtons'
  533. import CollapseForm from './collapse-form/index.vue'
  534. import NodeTree from './components/nodeTree/index.vue'
  535. import HcTreeNode from './components/HcTreeNode.vue'
  536. import { getHeader } from 'hc-vue3-ui'
  537. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  538. import {
  539. arrDelKey,
  540. deepClone,
  541. formValidate,
  542. getArrValue,
  543. getObjVal,
  544. getObjValue,
  545. isNullES,
  546. isString,
  547. setCopyText,
  548. } from 'js-fast-way'
  549. import { eVisaTaskCheckApi, getDictionary, getDictionaryBiz } from '~api/other'
  550. import wbsApi from '~api/data-fill/wbs'
  551. import queryApi from '~api/data-fill/query'
  552. import Draggable from 'vuedraggable'
  553. import { HcDelMsg } from 'hc-vue3-ui'
  554. import HcUpload from './components/HcUpload.vue'
  555. import { toPdfPage } from '~uti/btn-auth'
  556. //初始变量
  557. const router = useRouter()
  558. const useRoutes = useRoute()
  559. const useAppState = useAppStore()
  560. //全局变量
  561. const projectId = ref(useAppState.projectId)
  562. const contractId = ref(useAppState.contractId)
  563. const projectInfo = ref(useAppState.projectInfo)
  564. const contractInfo = ref(useAppState.contractInfo)
  565. const isCollapse = ref(useAppState.getCollapse)
  566. const userInfo = ref(useAppState.getUserInfo)
  567. //路由参数
  568. const routerQuery = useRoutes?.query
  569. // const typeName = routerQuery?.type || 'map'
  570. const typeName = routerQuery?.type || 'tree'
  571. //是否是抽屉
  572. const isDrawType = ref(true)
  573. //自动展开缓存
  574. const TreeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  575. //树搜索
  576. const isSearchTree = ref(false)
  577. const wbstreeKey = ref(Math.random())
  578. const searchElTreeLoadNode = ref(true)
  579. const searchTreeHeight = ref()
  580. const getSearchTreeData = async () => {
  581. treeLoading.value = true
  582. const { error, code, data } = await queryApi.getTreeNodeByQueryValueAndContractId({
  583. contractId: contractId.value,
  584. queryValue: searchTreeVal.value,
  585. tableOwner:authBtnTabKey.value,
  586. })
  587. //判断状态
  588. if (!error && code === 200) {
  589. let treedata = getArrValue(data)
  590. searchTreeData.value = treedata
  591. treeLoading.value = false
  592. } else {
  593. treeLoading.value = false
  594. searchTreeData.value = []
  595. }
  596. }
  597. //监听
  598. const searchTreeVal = ref('')
  599. watch(() => [
  600. useAppState.getCollapse, searchTreeVal.value,
  601. ], ([Collapse, search]) => {
  602. isCollapse.value = Collapse
  603. if (search.length == 0) {
  604. isSearchTree.value = false
  605. }
  606. })
  607. //加载树需要的classType
  608. const classType = ref('')
  609. watch(() => [
  610. classType.value,
  611. ], ([classify]) => {
  612. if (classify) {
  613. //重新加载左边树
  614. isShowLeft.value = false
  615. setTimeout(()=>{
  616. isShowLeft.value = true
  617. }, 500)
  618. }
  619. })
  620. //渲染完成
  621. onMounted(() => {
  622. console.log(projectInfo.value)
  623. treeLoading.value = typeName === 'tree'
  624. setContractType(contractInfo.value?.contractType)
  625. getDictionaryApi()
  626. })
  627. //身份按钮切换数据
  628. const authBtnTabKey = ref('1')
  629. //变量
  630. const wbstree = ref(null)
  631. const isShowLeft = ref(true)
  632. const authBtnTabClick = (val) => {
  633. if (!primaryKeyId.value) {
  634. window?.$message?.warning('请先在左侧项目树选择一个节点')
  635. } else if (val['key'] !== authBtnTabKey.value) {
  636. authBtnTabKey.value = val['key']
  637. //重新加载左边树
  638. isShowLeft.value = false
  639. setTimeout(()=>{
  640. isShowLeft.value = true
  641. }, 500)
  642. getTableDataAll()
  643. }
  644. }
  645. //contractType, 1施工,2监理
  646. const setContractType = (contractType) => {
  647. if (contractType <= 0) {
  648. authBtnTabKey.value = '1'
  649. classType.value = '1'
  650. } else if (contractType === 3) {
  651. authBtnTabKey.value = '1'
  652. classType.value = '1'
  653. } else {
  654. authBtnTabKey.value = contractType + ''
  655. classType.value = contractType + ''
  656. }
  657. setElTreeMenu(contractType)
  658. }
  659. const getTableDataAll = async (key) => {
  660. await searchNodeAllTable()
  661. await queryNodeStatus()
  662. // wbstree.value.resetNode().then((res)=>{
  663. // if(res){
  664. // searchNodeAllTable()
  665. // queryNodeStatus()
  666. // }
  667. // })
  668. //保存后自动展开到当前表单
  669. if (!isNullES(key)) {
  670. console.log(key)
  671. await nextTick(() => {
  672. ListItemRef.value?.setCollapseKey(key)
  673. })
  674. }
  675. }
  676. //结构类型tab数据和相关处理
  677. const wbsTypeTabKey = ref(typeName)
  678. const wbsTypeTab = ref([
  679. { key: 'map', name: '导图结构填报' },
  680. { key: 'tree', name: '树形结构填报' },
  681. ])
  682. const authBtnTabdata = ref([
  683. { key: '1', name: '施工质检' },
  684. { key: '2', name: '监理质检' },
  685. ])
  686. const wbsTypeTabChange = (item) => {
  687. wbsTypeTabKey.value = item?.key
  688. ListItemDatas.value = []
  689. isDrawer.value = false
  690. treeLoading.value = typeName === 'tree'
  691. setStoreValue('classifyType', classType.value)
  692. setStoreValue('tableOwner', authBtnTabKey.value)
  693. //路由跳转
  694. router.push({
  695. path: useRoutes.path,
  696. query: {
  697. type: item?.key,
  698. classifyType:classType.value,
  699. tableOwner:authBtnTabKey.value,
  700. },
  701. })
  702. getSearchTreeData()
  703. }
  704. //切换导图结构
  705. const wbsMapTypeTab = () => {
  706. wbsTypeTabChange({ key: 'map', name: '导图结构填报' })
  707. }
  708. //上传文件的
  709. const HcUploadFileRef = ref(null)
  710. const uploadFileOptions = ref({})
  711. const uploadFileParams = ref({})
  712. const uploadFileEchoParams = ref({})
  713. //上传成功
  714. const uploadFileSuccess = ({ echoParams, resData }) => {
  715. if (echoParams['type'] === 'upload-drawing' && resData?.link) {
  716. setUploadDrawingsData(echoParams, resData?.link)
  717. } else if (echoParams['type'] === 'add-fileList' && resData?.link) {
  718. console.log(echoParams, 'echoParams', ' resData?.link')
  719. } else {
  720. window?.$message?.error('文件上传失败')
  721. }
  722. }
  723. //上传完成
  724. const uploadFileFinish = ()=>{
  725. nextTick(()=>{
  726. HcUploadFileRef?.value.setModalShow(false)
  727. })
  728. }
  729. //点击使用文件
  730. const uploadFileItem = ({ item }) => {
  731. const { echoParams, resData } = item
  732. if (echoParams['type'] === 'upload-drawing' && resData?.link) {
  733. setUploadDrawingsData(echoParams, resData?.link)
  734. } else if (echoParams['type'] === 'add-fileList' && resData?.link) {
  735. console.log(echoParams, 'echoParams111', ' resData?.link111')
  736. } else {
  737. window?.$message?.error('文件上传失败')
  738. }
  739. }
  740. //设置图纸数据
  741. const setUploadDrawingsData = async (echoParams, link) => {
  742. const info = nodeDataInfo.value
  743. const { error, code, data } = await wbsApi.saveContractTreeDrawings({
  744. fileUrl: link,
  745. id: echoParams['drawingsId'],
  746. primaryKeyId: echoParams['primaryKeyId'],
  747. }, false)
  748. //处理数据
  749. if (!error && code === 200) {
  750. if (info['primaryKeyId'] === echoParams['primaryKeyId']) {
  751. nodeDataInfo.value['drawingsId'] = data
  752. nodeDataInfo.value['fileUrl'] = link
  753. window?.$message?.success('图纸上传成功')
  754. } else {
  755. window?.$message?.success('图纸上传成功,由于您切换了其他节点,需要手动刷新才能查看到图纸')
  756. }
  757. } else {
  758. window?.$message?.error('图纸保存失败')
  759. }
  760. }
  761. const NodeTreeAccordion = ref(true)
  762. //设置树菜单数据
  763. const ElTreeMenu = ref([])
  764. const TreeMark = ref(false)
  765. const setElTreeMenu = (contractType) => {
  766. let newArr = []
  767. if (contractType === 1) {
  768. if (HcIsButton('wbs_tree_add')) {
  769. newArr.push({ icon: 'add-circle', label: '新增节点', key: 'add' })
  770. }
  771. if (HcIsButton('wbs_tree_edit')) {
  772. newArr.push({ icon: 'draft', label: '编辑节点', key: 'edit' })
  773. }
  774. if (HcIsButton('wbs_tree_copy')) {
  775. newArr.push({ icon: 'file-copy-2', label: '复制节点', key: 'copy' })
  776. }
  777. if (HcIsButton('wbs_tree_mark')) {
  778. newArr.push({ icon: 'star', label: '标记为首件', key: 'mark' })
  779. TreeMark.value = true
  780. }
  781. if (HcIsButton('wbs_tree_upload')) {
  782. newArr.push({ icon: 'file-upload', label: '上传图纸', key: 'upload' })
  783. }
  784. if (HcIsButton('wbs_tree_sort')) {
  785. newArr.push({ icon: 'sort-asc', label: '调整排序', key: 'sort' })
  786. }
  787. if (HcIsButton('wbs_tree_del')) {
  788. newArr.push({ icon: 'delete-bin', label: '删除节点', key: 'del' })
  789. }
  790. if (HcIsButton('wbs_views_division_btn')) {
  791. newArr.push({ icon: 'folder-shared', label: '工程划分', key: 'nodetree' })
  792. }
  793. } else if (contractType === 2) {
  794. if (HcIsButton('wbs_tree_add')) {
  795. newArr.push({ icon: 'add-circle', label: '新增节点', key: 'add' })
  796. }
  797. if (HcIsButton('wbs_tree_copy')) {
  798. newArr.push({ icon: 'file-copy-2', label: '复制节点', key: 'copy' })
  799. }
  800. }
  801. ElTreeMenu.value = newArr
  802. }
  803. //树相关变量
  804. const primaryKeyId = ref('')
  805. const nodeItemInfo = ref({})
  806. const nodeDataInfo = ref({})
  807. const searchTreeData = ref([])
  808. //回车
  809. const searchTreeKeyUp = (e) => {
  810. if (e.key === 'Enter') {
  811. searchTreeClick()
  812. }
  813. }
  814. const treeLoading = ref(true)
  815. const searchTreeClick = async () => {
  816. if (searchTreeVal.value) {
  817. searchTreeHeight.value = document.getElementById('hc-tree-scrollbar').offsetHeight
  818. isSearchTree.value = true
  819. //treeLoading.value = true
  820. getSearchTreeData()
  821. } else {
  822. isSearchTree.value = false
  823. }
  824. }
  825. //懒加载的数据
  826. const treeLoadNode = async ({ node, item, level }, resolve) => {
  827. let contractIdRelation = '', parentId = '', primaryKeyId = ''
  828. if (level !== 0) {
  829. const nodeData = getObjValue(item)
  830. contractIdRelation = nodeData?.contractIdRelation || ''
  831. parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
  832. primaryKeyId = nodeData?.id || ''
  833. }
  834. //获取数据
  835. const { data } = await queryApi.queryWbsTreeData({
  836. contractId: contractId.value || '',
  837. contractIdRelation,
  838. primaryKeyId,
  839. parentId,
  840. // classifyType: authBtnTabKey.value,
  841. classifyType: classType.value,
  842. tableOwner:authBtnTabKey.value,
  843. })
  844. treeLoading.value = false
  845. resolve(getArrValue(data))
  846. }
  847. //树被点击
  848. const wbsElTreeClick = ({ node, data, keys }) => {
  849. nodeItemInfo.value = node
  850. nodeDataInfo.value = data
  851. primaryKeyId.value = data?.primaryKeyId || ''
  852. const { notExsitChild } = data
  853. const { hasChildren } = data
  854. if (notExsitChild || !hasChildren) {
  855. isCanadd.value = false
  856. getTableDataAll()
  857. } else {
  858. isCanadd.value = true
  859. ListItemDatas.value = []
  860. NodeStatus.value = '1'
  861. }
  862. setStoreValue('wbsTreeExpandKeys', keys)
  863. TreeAutoExpandKeys.value = keys || []
  864. saveHistory(keys.join(','))
  865. // getTableDataAll()
  866. }
  867. //树加载完成
  868. const ElTreeNodeLoading = () => {
  869. treeLoading.value = false
  870. }
  871. //保存用户填报历史
  872. const saveHistory = async (endNode)=>{
  873. await wbsApi.saveUserHistory({
  874. contractId: contractId.value,
  875. projectId: projectId.value,
  876. endNode,
  877. })
  878. }
  879. //回到上次填报历史
  880. const gobackHistory = async ()=>{
  881. isSearchTree.value = false
  882. const { error, code, data, msg } = await wbsApi.getUserHistory({
  883. contractId: contractId.value,
  884. projectId: projectId.value,
  885. })
  886. if (!error && code === 200) {
  887. TreeAutoExpandKeys.value = data['endNode'].split(',') || []
  888. //重新加载左边树
  889. isShowLeft.value = false
  890. setTimeout(()=>{
  891. isShowLeft.value = true
  892. }, 500)
  893. } else {
  894. window.$message.warning(msg)
  895. }
  896. }
  897. //树菜单被点击
  898. const ElTreeMenuClick = async ({ key, node, data, keys }) => {
  899. nodeItemInfo.value = node
  900. nodeDataInfo.value = data
  901. setStoreValue('wbsTreeExpandKeys', keys)
  902. TreeAutoExpandKeys.value = keys || []
  903. setTreeMenuDataClick({ key, node, data })
  904. }
  905. const treeMenuClick = (data)=>{
  906. console.log(data, 'data1')
  907. }
  908. //导图结构数据
  909. const NodeTreeRef = ref(null)
  910. //鼠标左键单击事件
  911. const NodeTreeClick = ({ keys }) => {
  912. setStoreValue('wbsTreeExpandKeys', keys)
  913. TreeAutoExpandKeys.value = keys || []
  914. }
  915. //双击事件
  916. const isDrawer = ref(false)
  917. const NodeTreeDblClick = ({ node, data }) => {
  918. nodeItemInfo.value = node
  919. nodeDataInfo.value = data
  920. primaryKeyId.value = data?.primaryKeyId || ''
  921. isDrawer.value = true
  922. getTableDataAll()
  923. }
  924. const drawerClose = () => {
  925. isDrawer.value = false
  926. ListItemDatas.value = []
  927. }
  928. //导图树菜单被点击
  929. const NodeTreeMenuClick = async ({ key, node, data }) => {
  930. nodeItemInfo.value = node
  931. nodeDataInfo.value = data
  932. setTreeMenuDataClick({ key, node, data })
  933. }
  934. //处理菜单被点击数据
  935. const setTreeMenuDataClick = ({ key, node, data }) => {
  936. const tabKey = wbsTypeTabKey.value
  937. if (key === 'mark' || key === 'cancel_mark') {
  938. firstItemBox()
  939. } else if (key === 'edit') {
  940. console.log(data, 'data')
  941. let form = {}
  942. if (tabKey === 'tree') {
  943. const parent = deepClone(node?.parent?.data || {})
  944. form = { ...deepClone(data), parent: parent }
  945. } else if (tabKey === 'map') {
  946. const parent = deepClone(node?.parentNodes?.data || {})
  947. form = { ...deepClone(data), parent: parent }
  948. }
  949. formEditNodeModel.value = form
  950. editNodeModal.value = true
  951. //处理路径
  952. let pathArr = []
  953. getPathName(node, pathArr)
  954. form.position = pathArr.join('\\')
  955. formEditNodeModel.value = form
  956. } else if (key === 'copy') {
  957. if (tabKey === 'tree') {
  958. const parent = deepClone(node?.parent?.data || {})
  959. formCopyNodeModel.value = { ...deepClone(data), parent: parent }
  960. } else if (tabKey === 'map') {
  961. const parent = deepClone(node?.parentNodes?.data || {})
  962. formCopyNodeModel.value = { ...deepClone(data), parent: parent }
  963. }
  964. classifyType.value = authBtnTabKey.value
  965. copyNodeTabKey.value = '1'
  966. copyNodeTable.value = []
  967. copyNodeLoading.value = false
  968. copyNodeModal.value = true
  969. } else if (key === 'add') {
  970. const { childNodes } = node
  971. console.log(childNodes, 'childNodes')
  972. isCustom.value = data?.isCustom
  973. addTreeNodeId.value = data?.primaryKeyId
  974. addTreeNodeOldId.value = data?.oldId
  975. addNodeLoading.value = false
  976. addNodeModal.value = true
  977. } else if (key === 'add1') {
  978. addTreeNodeId.value = data?.primaryKeyId
  979. addTreeNodeOldId.value = data?.oldId
  980. addNodeLoading.value = false
  981. nodeNameinput.value = ''
  982. addNodeModalCus.value = true
  983. } else if (key === 'upload') {
  984. const info = nodeDataInfo.value
  985. //上传的配置
  986. uploadFileOptions.value = {
  987. url: '/api/blade-resource/oss/endpoint/put-file',
  988. accept: 'image/png,image/jpg,image/jpeg',
  989. accept_tip: 'png、jpg、jpeg',
  990. headers: getHeader(),
  991. multiple: false,
  992. }
  993. uploadFileEchoParams.value = {
  994. type: 'upload-drawing',
  995. drawingsId: info['drawingsId'],
  996. primaryKeyId: info['primaryKeyId'],
  997. }
  998. uploadFileParams.value = {}
  999. HcUploadFileRef.value?.selectFile()
  1000. } else if (key === 'del') {
  1001. console.log(data, 'data')
  1002. if (data['colorStatus'] === 1 || data['colorStatus'] === 2 || data['colorStatus'] === null || data['colorStatus'] === -1) {
  1003. delModalClick()
  1004. } else {
  1005. window?.$message?.warning('该节点已存在上报数据,不允许删除')
  1006. }
  1007. } else if (key === 'sort') {
  1008. let nodes = [], childNodes = []
  1009. if (tabKey === 'tree') {
  1010. childNodes = node?.parent?.childNodes || node?.parent?.children || []
  1011. } else if (tabKey === 'map') {
  1012. childNodes = node?.parentNodes?.childrenNodes || []
  1013. }
  1014. for (let i = 0; i < childNodes.length; i++) {
  1015. const res = childNodes[i]?.data
  1016. nodes.push({
  1017. id: res?.primaryKeyId,
  1018. title: res?.title,
  1019. })
  1020. }
  1021. sortNodeData.value = nodes
  1022. sortNodeModal.value = true
  1023. } else if (key === 'nodetree') {
  1024. divisionClick()
  1025. }
  1026. }
  1027. //获取节点的路径名字
  1028. const getPathName = (node, pathArr) => {
  1029. if (node.parent?.parent) {
  1030. pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
  1031. getPathName(node.parent, pathArr)
  1032. } else {
  1033. //根节点结束
  1034. pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, '')) //去掉头尾空格
  1035. return pathArr
  1036. }
  1037. }
  1038. //确认标记为首件
  1039. const firstItemBox = () => {
  1040. const info = nodeDataInfo.value
  1041. window?.$messageBox?.alert(`<div class="text-base font-bold">
  1042. <span>请确认将</span>
  1043. <span class="text-main">【${info['title']}】</span>
  1044. <span>${info['isFirst'] ? '取消' : ''}标记为首件</span>
  1045. </div>`, '标记首件制', {
  1046. showCancelButton: true,
  1047. dangerouslyUseHTMLString: true,
  1048. callback: (action) => {
  1049. if (action === 'confirm') {
  1050. firstItemHttp(info)
  1051. }
  1052. },
  1053. })
  1054. }
  1055. //首件请求
  1056. const firstItemHttp = async (info) => {
  1057. const { error, code } = await wbsApi.wbsTreeFirstSave({
  1058. primaryKeyId: info['primaryKeyId'],
  1059. saveOrDeleted: info['isFirst'] ? 1 : 0,
  1060. })
  1061. //处理数据
  1062. if (!error && code === 200) {
  1063. window?.$message?.success('操作成功')
  1064. window?.location?.reload() //刷新页面
  1065. }
  1066. }
  1067. //编辑节点
  1068. const editNodeModal = ref(false)
  1069. //获取节点类型
  1070. const nodeTypeData = ref([])
  1071. const getDictionaryApi = async () => {
  1072. const { data } = await getDictionary({
  1073. code: 'wbs_node_type',
  1074. })
  1075. //处理数据
  1076. let newArr = []
  1077. const newData = getArrValue(data)
  1078. for (let i = 0; i < newData.length; i++) {
  1079. newArr.push({
  1080. label: newData[i]['dictValue'],
  1081. value: Number(newData[i]['dictKey']),
  1082. })
  1083. }
  1084. nodeTypeData.value = newArr
  1085. }
  1086. const formEditNodeRef = ref(null)
  1087. const formEditNodeModel = ref({
  1088. title: '',
  1089. parent: {
  1090. title: '',
  1091. },
  1092. nodeType: null,
  1093. partitionCode: '',
  1094. position: '',
  1095. })
  1096. const formEditNodeRules = {
  1097. title: {
  1098. required: true,
  1099. trigger: 'blur',
  1100. message: '请输入节点名称',
  1101. },
  1102. }
  1103. const editNodeLoading = ref(false)
  1104. //保存编辑节点数据
  1105. const editNodeClick = async () => {
  1106. const validate = await formValidate(formEditNodeRef.value)
  1107. if (validate) {
  1108. //发起请求
  1109. editNodeLoading.value = true
  1110. const { primaryKeyId, title, partitionCode } = formEditNodeModel.value
  1111. const { error, code } = await wbsApi.wbsTreeUpdateNode({
  1112. nodeName: title || '',
  1113. pKeyId: primaryKeyId || '',
  1114. partitionCode: partitionCode || '',
  1115. })
  1116. //处理数据
  1117. editNodeLoading.value = false
  1118. if (!error && code === 200) {
  1119. window?.$message?.success('修改成功')
  1120. nodeDataInfo.value['title'] = title || ''
  1121. nodeDataInfo.value['partitionCode'] = partitionCode || ''
  1122. editNodeModal.value = false
  1123. window?.location?.reload() //刷新页面
  1124. }
  1125. }
  1126. }
  1127. //复制节点
  1128. const copyNodeModal = ref(false)
  1129. //复制节点类型tab数据和相关处理
  1130. const copyNodeTabKey = ref('')
  1131. const copyNodeTab = ref([
  1132. { key: '1', name: '单份复制' },
  1133. { key: '2', name: '多份复制' },
  1134. //{key: '3', name: '复制数据'}
  1135. ])
  1136. const copyNodeTabChange = (key) => {
  1137. if (key !== copyNodeTabKey.value) {
  1138. copyNodeTabKey.value = key
  1139. copyNodeTable.value = []
  1140. copyNodeLoading.value = false
  1141. }
  1142. }
  1143. //复制节点变量
  1144. const copyNodeLoading = ref(false)
  1145. const formCopyNodeModel = ref({})
  1146. const classifyList = ref([])
  1147. const copyNodeTable = ref([])
  1148. const isCopyData = ref(0)
  1149. //复制树被点击
  1150. const copyNodeElTreeClick = ({ data, node }) => {
  1151. const TabKey = copyNodeTabKey.value
  1152. const { title, type, partitionCode } = formCopyNodeModel.value
  1153. if (TabKey === '2') {
  1154. // setCopyNodeTable(data, title, partitionCode)
  1155. //1 单位工程,2 分部工程,3 子分部工程,4 分项工程, 5 子分项工程,6 工序
  1156. // //不能复制到本身节点下
  1157. // //只能往上一级点击,不能跨层级点击
  1158. // //已上报的工序节点不能点击选择
  1159. // //如果选择的是父级节点,那不能复制到子级节点
  1160. const { hasChildren } = data
  1161. if (hasChildren === 0) {
  1162. if (data['colorStatus'] === 2 || data['colorStatus'] == 1 || data['colorStatus'] === null || data['colorStatus'] === -1) {//已上报的工序不能点击
  1163. if (data['id'] !== formCopyNodeModel.value.id) {//不能复制到本身节点下
  1164. //只能往上一级点击,不能跨层级点击
  1165. //如果选择的是父级节点,那不能复制到子级节点
  1166. if (type === 6 && (data['type'] === 4 || data['type'] === 5 || data['type'] == 6)) {
  1167. setCopyNodeTable(data, title)
  1168. }
  1169. if (type === 5 && data['type'] === 4) {
  1170. setCopyNodeTable(data, title, partitionCode)
  1171. }
  1172. if (type === 4 && (data['type'] === 2 || data['type'] === 3)) {
  1173. setCopyNodeTable(data, title, partitionCode)
  1174. }
  1175. if (type === 3 && data['type'] === 2) {
  1176. setCopyNodeTable(data, title, partitionCode)
  1177. }
  1178. if (type === 2 && data['type'] === 1) {
  1179. setCopyNodeTable(data, title, partitionCode)
  1180. }
  1181. if (type === 1 && data['type'] === 1) {
  1182. setCopyNodeTable(data, title, partitionCode)
  1183. }
  1184. }
  1185. } else {
  1186. window?.$message?.warning('该节点已存在上报数据,不允许复制')
  1187. }
  1188. } else {
  1189. if (data['id'] !== formCopyNodeModel.value.id) {//不能复制到本身节点下
  1190. //只能往上一级点击,不能跨层级点击
  1191. //如果选择的是父级节点,那不能复制到子级节点
  1192. if (type === 6 && (data['type'] === 4 || data['type'] === 5 || data['type'] == 6)) {
  1193. setCopyNodeTable(data, title)
  1194. }
  1195. if (type === 5 && data['type'] === 4) {
  1196. setCopyNodeTable(data, title, partitionCode)
  1197. }
  1198. if (type === 4 && (data['type'] === 2 || data['type'] === 3)) {
  1199. setCopyNodeTable(data, title, partitionCode)
  1200. }
  1201. if (type === 3 && data['type'] === 2) {
  1202. setCopyNodeTable(data, title, partitionCode)
  1203. }
  1204. if (type === 2 && data['type'] === 1) {
  1205. setCopyNodeTable(data, title, partitionCode)
  1206. }
  1207. if (type === 1 && data['type'] === 1) {
  1208. setCopyNodeTable(data, title, partitionCode)
  1209. }
  1210. }
  1211. }
  1212. } else if (TabKey === '3') {
  1213. console.log(1111111)
  1214. setCopyNodeTable(data, data?.title)
  1215. }
  1216. }
  1217. const setCopyNodeTable = (data, title) => {
  1218. copyNodeTable.value.push({
  1219. title: data?.title || '',
  1220. nodeName: title || '',
  1221. primaryKeyId: data?.primaryKeyId || '',
  1222. parentId: data?.parentId || '',
  1223. id: data?.id || '',
  1224. })
  1225. }
  1226. //节点表单
  1227. const formCopyNodeModelRef = ref(null)
  1228. const formCopyNodeModelRules = {
  1229. title: {
  1230. required: true,
  1231. trigger: 'blur',
  1232. message: '请输入节点名称',
  1233. },
  1234. }
  1235. //表格节点表单
  1236. const copyNodeTableRef = ref(null)
  1237. const copyNodeTableRules = {
  1238. nodeName: {
  1239. required: true,
  1240. trigger: 'blur',
  1241. message: '请输入节点名称',
  1242. },
  1243. }
  1244. //删除选中的节点
  1245. const copyNodeTableDel = (index) => {
  1246. copyNodeTable.value.splice(index, 1)
  1247. }
  1248. const classifyType = ref(authBtnTabKey.value)
  1249. const classifyTypeTabClick = ({ key }) => {
  1250. classifyType.value = key
  1251. }
  1252. //复制节点
  1253. const copyNodeClick = async () => {
  1254. const type = copyNodeTabKey.value
  1255. const form = formCopyNodeModel.value
  1256. const table = copyNodeTable.value
  1257. let classify = ''
  1258. let arr = []
  1259. if (classifyList.value.length > 0) {
  1260. classifyList.value.forEach((item) => {
  1261. if (item === '施工') {
  1262. arr.push(1)
  1263. } else if (item === '监理') {
  1264. arr.push(2)
  1265. }
  1266. })
  1267. classify = arr.join(',')
  1268. }
  1269. //isSameNode 是否同节点 1=同节点,0=跨节点
  1270. if (table.length > 0) {
  1271. table.forEach((ele) => {
  1272. if (ele.parentId === formCopyNodeModel.value.parentId || ele.id === formCopyNodeModel.value.parentId) {
  1273. ele.isSameNode = 1
  1274. } else {
  1275. ele.isSameNode = 0
  1276. }
  1277. })
  1278. }
  1279. if (isCopyData.value === 1) {
  1280. if (classify) {
  1281. //效验数据
  1282. if (type === '1') {
  1283. const validate = await formValidate(formCopyNodeModelRef.value)
  1284. if (validate) await copyContractTreeNode(type, form, [], classify)
  1285. } else if (type === '2') {
  1286. if (table.length > 0) {
  1287. const validate = await formValidate(copyNodeTableRef.value)
  1288. if (validate) await copyContractTreeNode(type, form, table, classify)
  1289. } else {
  1290. window?.$message?.warning('请先在左侧选择要复制到的节点')
  1291. }
  1292. }
  1293. } else {
  1294. window?.$message?.warning('请选择所属方')
  1295. }
  1296. } else {
  1297. if (type === '1') {
  1298. const validate = await formValidate(formCopyNodeModelRef.value)
  1299. if (validate) await copyContractTreeNode(type, form, [], classify)
  1300. } else if (type === '2') {
  1301. if (table.length > 0) {
  1302. const validate = await formValidate(copyNodeTableRef.value)
  1303. if (validate) await copyContractTreeNode(type, form, table, classify)
  1304. } else {
  1305. window?.$message?.warning('请先在左侧选择要复制到的节点')
  1306. }
  1307. }
  1308. }
  1309. }
  1310. //单个复制、多份复制请求
  1311. const copyContractTreeNode = async (type, form, table, classify) => {
  1312. copyNodeLoading.value = true
  1313. if (type === '1') {
  1314. const { error, code } = await wbsApi.copyContractTreeNode({
  1315. copyType: type,
  1316. needCopyNodeName: form?.title || '',
  1317. partitionCode: form?.partitionCode || '',
  1318. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  1319. parentPrimaryKeyId: form?.parent?.primaryKeyId || '',
  1320. copyBatchToPaths: table,
  1321. classifyType: classify,
  1322. isCopyData:isCopyData.value,
  1323. })
  1324. //判断状态
  1325. copyNodeLoading.value = false
  1326. if (!error && code === 200) {
  1327. window?.$message?.success('复制成功')
  1328. copyNodeModal.value = false
  1329. window?.location?.reload() //刷新页面
  1330. }
  1331. } else {
  1332. const { error, code } = await wbsApi.copyContractTreeNode({
  1333. copyType: type,
  1334. needCopyNodeName: form?.title || '',
  1335. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  1336. parentPrimaryKeyId: form?.parent?.primaryKeyId || '',
  1337. copyBatchToPaths: table,
  1338. classifyType: classify,
  1339. isCopyData:isCopyData.value,
  1340. })
  1341. //判断状态
  1342. copyNodeLoading.value = false
  1343. if (!error && code === 200) {
  1344. window?.$message?.success('复制成功')
  1345. copyNodeModal.value = false
  1346. window?.location?.reload() //刷新页面
  1347. }
  1348. }
  1349. }
  1350. //复制数据
  1351. const copyContractNodeSubmitBusinessData = async (form, table, classify) => {
  1352. copyNodeLoading.value = true
  1353. const { error, code } = await wbsApi.copyContractNodeSubmitBusinessData({
  1354. needCopyPrimaryKeyId: form?.primaryKeyId || '',
  1355. copyBatchToPaths: table,
  1356. classify: classify,
  1357. })
  1358. //判断状态
  1359. copyNodeLoading.value = false
  1360. if (!error && code === 200) {
  1361. window?.$message?.success('复制成功')
  1362. copyNodeModal.value = false
  1363. window?.location?.reload() //刷新页面
  1364. }
  1365. }
  1366. //新增节点
  1367. const addNodeModal = ref(false)
  1368. const addTreeNodeId = ref('')
  1369. const addTreeNodeOldId = ref('')
  1370. const addTreeNodeType = ref('1')
  1371. const isCustom = ref(null)
  1372. //新增自定义节点
  1373. const addNodeModalCus = ref(false)
  1374. const addNodeLoadingCus = ref(false)
  1375. const nodeNameinput = ref('')
  1376. //选中的节点
  1377. const allSelectedList = ref([])
  1378. const halfSelectedList = ref([])
  1379. const addTreeNodeCheckChange = (nodes) => {
  1380. let NodesArr = [], halfArr = []
  1381. //全选数据
  1382. const keys = nodes.checkedNodes || []
  1383. console.log(keys, 'keys')
  1384. for (let i = 0; i < keys.length; i++) {
  1385. NodesArr.push({
  1386. nodeName: keys[i].nodeName,
  1387. primaryKeyId: keys[i].pKeyId,
  1388. isPeer:keys[i].isPeer || 2,
  1389. })
  1390. }
  1391. allSelectedList.value = NodesArr
  1392. console.log( allSelectedList.value, ' allSelectedList.value')
  1393. //半选数据
  1394. const halfNodes = nodes.halfCheckedNodes || []
  1395. for (let i = 0; i < halfNodes.length; i++) {
  1396. halfArr.push({
  1397. nodeName: halfNodes[i].nodeName,
  1398. primaryKeyId: halfNodes[i].pKeyId,
  1399. isPeer:halfNodes[i].isPeer || 2,
  1400. })
  1401. }
  1402. halfSelectedList.value = halfArr
  1403. console.log( halfSelectedList.value, ' halfSelectedList.value')
  1404. }
  1405. //新增节点
  1406. const addNodeLoading = ref(false)
  1407. const addNodeClick = async () => {
  1408. const keys = allSelectedList.value || []
  1409. if (keys.length <= 0) {
  1410. window?.$message?.warning('请先选择节点')
  1411. } else {
  1412. //发起请求
  1413. addNodeLoading.value = true
  1414. const primaryKeyId = nodeDataInfo.value?.primaryKeyId || ''
  1415. const { error, code } = await wbsApi.saveContractTreeNode({
  1416. projectId: projectId.value,
  1417. contractId: contractId.value,
  1418. saveType: addTreeNodeType.value,
  1419. allSelectedList: allSelectedList.value,
  1420. halfSelectedList: halfSelectedList.value,
  1421. currentNodePrimaryKeyId: primaryKeyId,
  1422. })
  1423. //判断状态
  1424. addNodeLoading.value = false
  1425. if (!error && code === 200) {
  1426. window?.$message?.success('新增成功')
  1427. addNodeModal.value = false
  1428. window?.location?.reload() //刷新页面
  1429. }
  1430. }
  1431. }
  1432. const addNodeClickCur = async ()=>{
  1433. //发起请求
  1434. addNodeLoadingCus.value = true
  1435. const { error, code } = await wbsApi.saveCustomAddContractNode({
  1436. nodeName: nodeNameinput.value,
  1437. nodeType: nodeDataInfo.value?.nodeType || '',
  1438. partitionCode: nodeDataInfo.value?.partitionCode || '',
  1439. primaryKeyId: nodeDataInfo.value?.primaryKeyId || '',
  1440. })
  1441. //判断状态
  1442. addNodeLoadingCus.value = false
  1443. if (!error && code === 200) {
  1444. window?.$message?.success('新增成功')
  1445. addNodeModalCus.value = false
  1446. window?.location?.reload() //刷新页面
  1447. }
  1448. }
  1449. //删除节点
  1450. const delModalClick = () => {
  1451. HcDelMsg({}, async (instance, resolve) => {
  1452. instance.confirmButtonLoading = true
  1453. instance.confirmButtonText = '删除中...'
  1454. await removeContractTreeNode()
  1455. resolve() //关闭弹窗的回调
  1456. instance.confirmButtonLoading = false
  1457. })
  1458. }
  1459. const removeContractTreeNode = async () => {
  1460. const loadingInstance = window.$loading.service({
  1461. fullscreen: true,
  1462. text: '删除节点中,请耐心等待...',
  1463. background: 'rgba(0, 0, 0, 0.7)',
  1464. })
  1465. const { error, code } = await wbsApi.removeContractTreeNode({
  1466. ids: nodeDataInfo.value?.primaryKeyId || '',
  1467. })
  1468. //处理结果
  1469. loadingInstance.close()
  1470. if (!error && code === 200) {
  1471. window?.$message?.success('删除成功')
  1472. window?.location?.reload() //刷新页面
  1473. }
  1474. }
  1475. //调整排序
  1476. const sortNodeModal = ref(false)
  1477. const sortNodeLoading = ref(false)
  1478. const sortNodeData = ref([])
  1479. const sortNodeDrag = ref(false)
  1480. //向下
  1481. const downSortClick = (index) => {
  1482. const indexs = index + 1
  1483. const data = sortNodeData.value || []
  1484. if (indexs !== data.length) {
  1485. const tmp = data.splice(indexs, 1)
  1486. sortNodeData.value.splice(index, 0, tmp[0])
  1487. } else {
  1488. window?.$message?.warning('已经处于置底,无法下移')
  1489. }
  1490. }
  1491. //向上
  1492. const upSortClick = (index) => {
  1493. const data = sortNodeData.value || []
  1494. if (index !== 0) {
  1495. const tmp = data.splice(index - 1, 1)
  1496. sortNodeData.value.splice(index, 0, tmp[0])
  1497. } else {
  1498. window?.$message?.warning('已经处于置顶,无法上移')
  1499. }
  1500. }
  1501. //确认排序
  1502. const sortNodeClick = async () => {
  1503. const sortList = []
  1504. const nodes = sortNodeData.value || []
  1505. nodes.forEach(item => {
  1506. sortList.push(item?.id)
  1507. })
  1508. //发起请求
  1509. sortNodeLoading.value = true
  1510. const { error, code } = await wbsApi.diySortTreeNode({ sortList })
  1511. sortNodeLoading.value = false
  1512. //判断状态
  1513. if (!error && code === 200) {
  1514. window?.$message?.success('保存成功')
  1515. sortNodeModal.value = false
  1516. window?.location?.reload() //刷新页面
  1517. }
  1518. }
  1519. //查看图纸
  1520. const drawList = ref('')
  1521. const drawingsShow = ref(false)
  1522. const viewsDrawings = () => {
  1523. const { primaryKeyId, drawingsId } = nodeDataInfo.value
  1524. if (!primaryKeyId) {
  1525. window?.$message?.warning('请先选择树节点')
  1526. } else if (drawingsId === -1 || drawingsId === null) {
  1527. window?.$message?.warning('该节点暂未上传图纸')
  1528. } else {
  1529. drawingsShow.value = true
  1530. getDrawList(drawingsId)
  1531. }
  1532. }
  1533. const drawingsClose = (res) => {
  1534. drawingsShow.value = res
  1535. }
  1536. const getDrawList = async (primaryKeyId)=>{
  1537. const { error, code, data } = await wbsApi.getTreeDrawings({ primaryKeyId })
  1538. //判断状态
  1539. if (!error && code === 200) {
  1540. drawList.value = data
  1541. } else {
  1542. drawList.value = data
  1543. }
  1544. }
  1545. //设置滚动条位置
  1546. const ListItemScrollRef = ref(null)
  1547. const ListItemOffsetTop = (offsetTop) => {
  1548. if (offsetTop > 0) {
  1549. setTimeout(() => {
  1550. ListItemScrollRef.value?.setScrollTop(offsetTop)
  1551. }, 350)
  1552. } else {
  1553. ListItemScrollRef.value?.setScrollTop(offsetTop)
  1554. }
  1555. }
  1556. //获取数据列表
  1557. const ListItemDatas = ref([])
  1558. const ListItemLoading = ref(false)
  1559. const searchNodeAllTable = async () => {
  1560. ListItemLoading.value = true
  1561. ListItemDatas.value = []
  1562. const info = nodeDataInfo.value
  1563. const { data } = await wbsApi.searchNodeAllTable({
  1564. projectId: projectId.value,
  1565. contractId: contractId.value,
  1566. primaryKeyId: info['primaryKeyId'],
  1567. type: authBtnTabKey.value,
  1568. })
  1569. ListItemDatas.value = getArrValue(data)
  1570. ListItemLoading.value = false
  1571. }
  1572. const newlistdata = ref([])
  1573. const searchNodeAllTable1 = async () => {
  1574. console.log('重新获取表单列表')
  1575. const info = nodeDataInfo.value
  1576. const { data } = await wbsApi.searchNodeAllTable({
  1577. projectId: projectId.value,
  1578. contractId: contractId.value,
  1579. primaryKeyId: info['primaryKeyId'],
  1580. type: authBtnTabKey.value,
  1581. })
  1582. newlistdata.value = getArrValue(data)
  1583. }
  1584. //查询状态
  1585. const NodeStatus = ref('1')
  1586. const queryNodeStatus = async () => {
  1587. const info = nodeDataInfo.value
  1588. if (contractInfo.value?.contractType == 1) {
  1589. const { error, code, data } = await wbsApi.queryNodeStatus({
  1590. primaryKeyId: info['primaryKeyId'],
  1591. //classify:1
  1592. classify: authBtnTabKey.value,
  1593. })
  1594. //1 未填报,2待上报,3已上报
  1595. if (!error && code === 200) {
  1596. NodeStatus.value = data ?? '1'
  1597. } else {
  1598. NodeStatus.value = '1'
  1599. }
  1600. } else {
  1601. const { error, code, data } = await wbsApi.queryNodeStatusJl({
  1602. // primaryKeyId: info['contractIdRelation'] ? info['id'] : info['primaryKeyId'],
  1603. primaryKeyId: info['primaryKeyId'],
  1604. //classify: 1
  1605. classify: authBtnTabKey.value,
  1606. })
  1607. //1 未填报,2待上报,3已上报
  1608. if (!error && code === 200) {
  1609. NodeStatus.value = data ?? '1'
  1610. } else {
  1611. NodeStatus.value = '1'
  1612. }
  1613. }
  1614. }
  1615. //批量上报
  1616. const reportIds = ref('')
  1617. const reportTaskName = ref('')
  1618. const reportAddition = ref({})
  1619. const showReportModal = ref(false)
  1620. const reportLoading = ref(false)
  1621. const reportTypeData = ref([])
  1622. const reportModalClick = async () => {
  1623. const info = nodeDataInfo.value
  1624. const rows = ListItemDatas.value
  1625. if (rows.length > 0) {
  1626. reportLoading.value = true
  1627. const taskCheck = await eVisaTaskCheckApi({
  1628. projectId: projectId.value,
  1629. contractId: contractInfo.value?.contractType == 2 ? info?.contractIdRelation : contractId.value,
  1630. // contractId: contractId.value
  1631. })
  1632. //处理数据
  1633. let newArr = []
  1634. for (let i = 0; i < rows.length; i++) {
  1635. newArr.push(rows[i]['isTypePrivatePid'])
  1636. }
  1637. reportTypeData.value = newArr
  1638. reportLoading.value = false
  1639. if (taskCheck) {
  1640. //初始弹出弹窗,防呆
  1641. reportIds.value = info['primaryKeyId']
  1642. reportAddition.value = {
  1643. classify: authBtnTabKey.value,
  1644. contractIdRelation: info['contractIdRelation'],
  1645. }
  1646. showReportModal.value = true
  1647. //请求文件题名
  1648. const { data } = await wbsApi.queryDocumentTitle({
  1649. primaryKeyId: info['primaryKeyId'],
  1650. classify: authBtnTabKey.value,
  1651. })
  1652. reportTaskName.value = isString(data) ? data : ''
  1653. }
  1654. } else {
  1655. window.$message?.warning('暂无相关数据')
  1656. }
  1657. }
  1658. //上报完成
  1659. const showReportFinish = () => {
  1660. showReportModal.value = false
  1661. getTableDataAll()
  1662. // window?.location?.reload() //刷新页面
  1663. }
  1664. //表单变量
  1665. const ListItemRef = ref(null)
  1666. const ListItemsRef = ref(null)
  1667. //保存
  1668. const tableFormSaveLoading = ref(false)
  1669. const tableFormSaveClick = async () => {
  1670. //获取数据
  1671. let FormData = [], FormRegExpJson = {}
  1672. if (isDrawer.value) {
  1673. FormData = await ListItemsRef.value?.getFormData()
  1674. FormRegExpJson = await ListItemsRef.value?.getFormRegExpJson()
  1675. } else {
  1676. FormData = await ListItemRef.value?.getFormData()
  1677. FormRegExpJson = await ListItemRef.value?.getFormRegExpJson()
  1678. }
  1679. //效验数据
  1680. if (getObjVal(FormRegExpJson)) {
  1681. setFormRegExpJson(FormRegExpJson)
  1682. } else if (FormData.length > 0) {
  1683. console.log('保存')
  1684. tableFormSaveLoading.value = true
  1685. console.log('FormData', FormData)
  1686. const { error, code } = await wbsApi.saveExcelBussData({
  1687. dataInfo: { orderList: FormData },
  1688. })
  1689. tableFormSaveLoading.value = false
  1690. if (!error && code === 200) {
  1691. window?.$message?.success('保存成功')
  1692. // await bussPdfsClick()
  1693. const activeKey = ListItemRef.value?.getActiveKey()
  1694. getTableDataAll(activeKey)
  1695. }
  1696. } else {
  1697. console.log('预览')
  1698. // await bussPdfsClick()
  1699. }
  1700. }
  1701. //效验数据
  1702. const setFormRegExpJson = (FormRegExpJson) => {
  1703. let nodeName = '', itemId = ''
  1704. Object.keys(FormRegExpJson).forEach(key => {
  1705. const name = FormRegExpJson[key]?.nodeName ?? ''
  1706. if (name) {
  1707. if (nodeName) {
  1708. nodeName += ',' + name
  1709. } else {
  1710. nodeName = name
  1711. itemId = FormRegExpJson[key]?.itemId
  1712. }
  1713. }
  1714. })
  1715. //const activeKey = ListItemRef.value?.getActiveKey()
  1716. //弹出提示
  1717. const val = '<div style="font-size: 16px;">请先完善 <span style="color:#1ECC95;">' + nodeName + '</span> 的数据内容</div>'
  1718. window?.$messageBox?.alert(val, '表单完善提醒', {
  1719. confirmButtonText: '确定',
  1720. dangerouslyUseHTMLString: true,
  1721. callback: (action) => {
  1722. if (action === 'confirm') {
  1723. ListItemRef.value?.setActiveKey(itemId)
  1724. ListItemOffsetTop(0)
  1725. setTimeout(() => {
  1726. const offsetTop = document.getElementById(itemId)?.offsetTop
  1727. ListItemOffsetTop(offsetTop)
  1728. }, 350)
  1729. }
  1730. },
  1731. })
  1732. }
  1733. //多表预览
  1734. const bussPdfsLoading = ref(false)
  1735. const bussPdfsClick = async () => {
  1736. const info = nodeDataInfo.value
  1737. bussPdfsLoading.value = true
  1738. const { error, code, data } = await wbsApi.getBussPdfs({
  1739. nodeId: info?.primaryKeyId || '',
  1740. classify: authBtnTabKey.value,
  1741. projectId: projectId.value,
  1742. // contractId: contractId.value
  1743. contractId: contractInfo.value?.contractType == 2 ? info?.contractIdRelation : contractId.value,
  1744. })
  1745. tableFormSaveLoading.value = false
  1746. bussPdfsLoading.value = false
  1747. if (!error && code === 200) {
  1748. toPdfPage(data)
  1749. //window.open(data, '_blank')
  1750. } else {
  1751. window.$message?.warning('获取PDF失败')
  1752. }
  1753. }
  1754. //撤回上报流程
  1755. const abolishLoaing = ref(false)
  1756. const abolishOneClick = () => {
  1757. window?.$messageBox?.alert('请谨慎考虑后,是否确定撤回?', '撤回上报', {
  1758. showCancelButton: true,
  1759. confirmButtonText: '确定撤回',
  1760. cancelButtonText: '取消',
  1761. callback: (action) => {
  1762. if (action === 'confirm') {
  1763. abolishOneSave()
  1764. }
  1765. },
  1766. })
  1767. }
  1768. //撤回请求
  1769. const abolishOneSave = async () => {
  1770. const info = nodeDataInfo.value
  1771. abolishLoaing.value = true
  1772. const { error, code } = await wbsApi.abolishOne({
  1773. primaryKeyId: info?.primaryKeyId || '',
  1774. classify: authBtnTabKey.value,
  1775. projectId:projectId.value,
  1776. contractId:contractId.value,
  1777. })
  1778. abolishLoaing.value = false
  1779. if (!error && code === 200) {
  1780. window.$message?.success('撤回成功')
  1781. getTableDataAll()
  1782. window?.location?.reload() //刷新页面
  1783. }
  1784. }
  1785. //附件列表
  1786. const attachmentModal = ref(false)
  1787. const attachmentModalShow = () => {
  1788. attachmentModal.value = true
  1789. getAttachmentList()
  1790. }
  1791. const attachmentListLoaing = ref(false)
  1792. const attachmentList = ref([])
  1793. const getAttachmentList = async ()=>{
  1794. attachmentListLoaing.value = true
  1795. const info = nodeDataInfo.value
  1796. const { error, code, data } = await wbsApi.tablesAndFile({
  1797. primaryKeyId: info?.primaryKeyId || '',
  1798. type: authBtnTabKey.value,
  1799. contractId:contractId.value,
  1800. projectId:projectId.value,
  1801. })
  1802. attachmentListLoaing.value = false
  1803. if (!error && code === 200) {
  1804. attachmentList.value = getArrValue(data)
  1805. } else {
  1806. attachmentList.value = []
  1807. }
  1808. }
  1809. //预览
  1810. const previewFile = (item)=>{
  1811. toPdfPage(item['domainPdfUrl'])
  1812. //window.open(item['domainPdfUrl'], '_blank')
  1813. }
  1814. //删除
  1815. const delFile = async (item)=>{
  1816. item.loading = true
  1817. const { error, code } = await wbsApi.removeBussFile({
  1818. ids: item.id,
  1819. })
  1820. item.loading = false
  1821. if (!error && code === 200) {
  1822. window?.$message?.success('删除成功')
  1823. getAttachmentList()
  1824. getTableDataAll()
  1825. return true
  1826. } else {
  1827. return false
  1828. }
  1829. }
  1830. //划分变更
  1831. const divisionClick = () => {
  1832. router.push({
  1833. path: '/data-fill/division',
  1834. })
  1835. }
  1836. //树展开和收起
  1837. const isWbsTreeShow = ref(true)
  1838. const setWbsTreeShow = () => {
  1839. isWbsTreeShow.value = !isWbsTreeShow.value
  1840. }
  1841. //拷贝内容
  1842. const copyPositionText = (val) => {
  1843. if (val) {
  1844. //navigator.clipboard.writeText(val);
  1845. setCopyText(val).then(() => {
  1846. window.$message?.success('复制成功')
  1847. }).catch(() => {
  1848. window.$message?.error('复制失败,请手动复制')
  1849. })
  1850. } else {
  1851. window.$message?.warning('没有可复制的数据')
  1852. }
  1853. }
  1854. //左右拖动,改变树形结构宽度
  1855. const leftWidth = ref(382)
  1856. const isMouseTree = ref(false)
  1857. const onmousedown = () => {
  1858. const leftNum = isCollapse.value ? 142 : 272
  1859. isMouseTree.value = true
  1860. document.onmousemove = (ve) => {
  1861. let diffVal = ve.clientX - leftNum
  1862. if (diffVal >= 310 && diffVal <= 900) {
  1863. leftWidth.value = diffVal
  1864. }
  1865. }
  1866. document.onmouseup = () => {
  1867. document.onmousemove = null
  1868. document.onmouseup = null
  1869. isMouseTree.value = false
  1870. }
  1871. }
  1872. //同步质检资料
  1873. const syncdataloading = ref(false)
  1874. const syncdata = async ()=>{
  1875. ListItemRef.value?.setActiveKey('')
  1876. const info = nodeDataInfo.value
  1877. syncdataloading.value = true
  1878. const { error, code, msg } = await wbsApi.syncTbadata({
  1879. pKeyId: info?.primaryKeyId || '',
  1880. })
  1881. syncdataloading.value = false
  1882. if (!error && code === 200) {
  1883. window.$message?.success(msg)
  1884. getTableDataAll()
  1885. // window?.location?.reload() //刷新页面
  1886. }
  1887. }
  1888. //附件添加
  1889. const typeoptions = ref([
  1890. {
  1891. value: '1',
  1892. label: '模板1',
  1893. },
  1894. {
  1895. value: '2',
  1896. label: '模板2',
  1897. },
  1898. ])
  1899. const getFileTypeApi = async () => {
  1900. const { data } = await getDictionaryBiz({
  1901. code: 'table_file_type',
  1902. })
  1903. //处理数据
  1904. let newArr = []
  1905. const newData = getArrValue(data)
  1906. for (let i = 0; i < newData.length; i++) {
  1907. newArr.push({
  1908. label: newData[i]['dictValue'],
  1909. value: Number(newData[i]['dictKey']),
  1910. })
  1911. }
  1912. typeoptions.value = newArr
  1913. }
  1914. const typevalue = ref('')
  1915. const isCanadd = ref(true)
  1916. const uploadModal = ref(false)
  1917. const fileListData = ref([])
  1918. const uploadData = ref({})
  1919. const uploadModalClose = ()=>{
  1920. uploadModal.value = false
  1921. }
  1922. //获取附件添加列表
  1923. const getBussFileList = async (pkeyId) => {
  1924. const { error, code, data } = await wbsApi.selectTableFileListByTen({
  1925. pkeyid: pkeyId,
  1926. })
  1927. if (!error && code === 200) {
  1928. fileListData.value = getArrValue(data)
  1929. } else {
  1930. fileListData.value = []
  1931. }
  1932. }
  1933. const addFilelist = async ()=>{
  1934. getBussFileList(primaryKeyId.value)
  1935. uploadModal.value = true
  1936. await getFileTypeApi()
  1937. //上传的配置
  1938. uploadData.value = {
  1939. classify:authBtnTabKey.value,
  1940. nodeId: primaryKeyId.value,
  1941. type:typevalue.value,
  1942. contractId:contractId.value,
  1943. }
  1944. }
  1945. const changeType = (val)=>{
  1946. uploadData.value.type = val
  1947. }
  1948. //上传文件
  1949. const uploadChange = async ({ type }) => {
  1950. if (type === 'success') {
  1951. getBussFileList(primaryKeyId.value)
  1952. } else if (type === 'del') {
  1953. getBussFileList(primaryKeyId.value)
  1954. }
  1955. }
  1956. //树节点被选中
  1957. const treeSelectNode = ref([])
  1958. const ElTreeNodeCheck = (_, { checkedKeys }) => {
  1959. treeSelectNode.value = getArrValue(checkedKeys)
  1960. }
  1961. const loadMenu = ({ node, item, level }, resolve)=>{
  1962. setElTreeMenu(contractInfo.value?.contractType)
  1963. let menusArr = ElTreeMenu.value
  1964. const { isCustomChild, notExsitChild } = item //isCustomChild===1//代表子级是自定义节点
  1965. const { isCustom } = item
  1966. if (isCustom === 1 && isCustomChild === 0 && notExsitChild) {//无子级,显示两个按钮
  1967. menusArr.unshift( { icon: 'add-circle', label: '新增自定义节点', key: 'add1' })
  1968. resolve(menusArr)
  1969. } else if (isCustom === 1 && isCustomChild === 1) {//自定义节点类型下如果有自定义节点,就不允许新增节点
  1970. menusArr.unshift( { icon: 'add-circle', label: '新增自定义节点', key: 'add1' })
  1971. let menusArr1 = arrDelKey(menusArr, 'label', '新增节点') // [{id:1}]
  1972. resolve(menusArr1)
  1973. } else if (isCustom === 1 && isCustomChild === 0 && !notExsitChild) { //自定义节点类型下如果有划分节点,就不允许新增自定义节点
  1974. resolve(menusArr)
  1975. } else if (level === 1) {
  1976. menusArr = [ { icon: 'add-circle', label: '新增自定义节点', key: 'add1' }]
  1977. resolve(menusArr)
  1978. } else {
  1979. resolve(menusArr)
  1980. }
  1981. }
  1982. //批量保存
  1983. const nodeSaveLoading = ref(false)
  1984. const NodeSaveClick = async () => {
  1985. const keys = treeSelectNode.value
  1986. if (keys.length <= 0) {
  1987. window?.$message?.warning('请先在左侧项目树选择节点')
  1988. return
  1989. }
  1990. //发起请求
  1991. nodeSaveLoading.value = true
  1992. const { error, code } = await wbsApi.save_nodeId({
  1993. projectId: projectId.value,
  1994. contractId: contractId.value,
  1995. classify: authBtnTabKey.value,
  1996. nodeIds: keys.join(),
  1997. }, false)
  1998. nodeSaveLoading.value = false
  1999. if (!error && code === 200) {
  2000. window?.$message?.success('批量保存成功')
  2001. window?.location?.reload() //刷新页面
  2002. }
  2003. }
  2004. </script>
  2005. <style lang="scss" scoped>
  2006. @import "../../styles/data-fill/wbs.scss";
  2007. .hc-add-node-modal-foot-box {
  2008. position: relative;
  2009. display: flex;
  2010. align-items: center;
  2011. .left-box {
  2012. position: relative;
  2013. flex: 1;
  2014. display: flex;
  2015. align-items: center;
  2016. }
  2017. .right-box {
  2018. position: relative;
  2019. }
  2020. }
  2021. .hc-expansion-contraction-tree {
  2022. position: absolute;
  2023. left: -13px;
  2024. top: 0;
  2025. width: 10px;
  2026. height: 100%;
  2027. user-select: none;
  2028. cursor: pointer;
  2029. display: flex;
  2030. justify-content: center;
  2031. align-items: center;
  2032. color: #8c9099;
  2033. font-size: 22px;
  2034. border-radius: 5px;
  2035. transition: background 0.2s;
  2036. background: rgba(255, 255, 255, 0);
  2037. &:hover {
  2038. background: #f1f5f8;
  2039. color: var(--el-color-primary);
  2040. }
  2041. }
  2042. .hc-table-form-action-tip {
  2043. position: absolute;
  2044. bottom: 77px;
  2045. width: 100%;
  2046. }
  2047. html.theme-dark {
  2048. .bg-svg-xml {
  2049. background-color: initial;
  2050. background-image: initial;
  2051. }
  2052. .hc-layout-box .hc-layout-content-box .hc-card-max-h-box.node-tree .hc-tree-foot-tip-box {
  2053. border-top: 1px solid #303030;
  2054. }
  2055. }
  2056. </style>
  2057. <style lang="scss">
  2058. .hc-tree-box .el-tree-node {
  2059. .el-checkbox {
  2060. margin-right: 0;
  2061. .el-checkbox__inner {
  2062. display: none;
  2063. }
  2064. }
  2065. .is-leaf + .el-checkbox {
  2066. margin-right: 8px;
  2067. .el-checkbox__inner {
  2068. display: inline-block;
  2069. }
  2070. }
  2071. }
  2072. .data-fill-wbs-content {
  2073. position: relative;
  2074. height: 100%;
  2075. .n-drawer-container {
  2076. margin: -20px -24px;
  2077. }
  2078. .n-drawer.n-drawer--top-placement {
  2079. height: auto !important;
  2080. background-color: initial;
  2081. pointer-events: none;
  2082. bottom: 0;
  2083. }
  2084. .drawer-data-fill-content-box {
  2085. position: relative;
  2086. height: 100%;
  2087. padding: 24px;
  2088. .n-card {
  2089. pointer-events: auto;
  2090. height: 100%;
  2091. overflow: auto;
  2092. }
  2093. .data-fill-content {
  2094. position: relative;
  2095. height: 100%;
  2096. overflow-y: auto;
  2097. scroll-behavior: smooth;
  2098. .data-fill-list-box .data-fill-list-item-content {
  2099. height: calc(100vh - 470px);
  2100. .data-fill-table-form-box {
  2101. height: 100%;
  2102. }
  2103. }
  2104. }
  2105. .data-fill-foot {
  2106. position: relative;
  2107. text-align: center;
  2108. }
  2109. }
  2110. }
  2111. .n-card.hc-card-overflow-box .n-card__content {
  2112. padding: 24px;
  2113. }
  2114. .n-card.hc-custom-card > .n-card-header {
  2115. padding: 15px 24px;
  2116. }
  2117. .n-card.hc-custom-card.copy {
  2118. width: 1200px;
  2119. max-height: 90vh;
  2120. overflow: auto;
  2121. .n-card-header .n-card-header__close {
  2122. display: none;
  2123. }
  2124. &.one {
  2125. width: 600px;
  2126. }
  2127. &.many {
  2128. width: 1200px;
  2129. }
  2130. }
  2131. .img-preview-box {
  2132. position: relative;
  2133. height: 100%;
  2134. width: 100%;
  2135. }
  2136. .hc-layout-content-box {
  2137. position: relative;
  2138. }
  2139. .iscusor {
  2140. cursor: pointer;
  2141. }
  2142. .hc-table-form-action-tip .hc-alert {
  2143. background-color: #f1f5f8;
  2144. display: inline;
  2145. vertical-align: middle;
  2146. box-shadow: -2px 0 10px 0 rgba(32, 37, 50, 0.03), 0 10px 21px 20px rgba(32, 37, 50, 0.03);
  2147. }
  2148. .copy-node-form-box {
  2149. margin-top: 24px;
  2150. padding-top: 24px;
  2151. border-top: 1px solid #efeff5;
  2152. }
  2153. .hc-position-input-icon {
  2154. position: relative;
  2155. margin-bottom: 0;
  2156. .el-form-item__content {
  2157. position: relative;
  2158. .el-textarea .el-textarea__inner {
  2159. padding-right: 30px;
  2160. }
  2161. .hc-icon-i {
  2162. position: absolute;
  2163. right: 10px;
  2164. bottom: 0;
  2165. font-size: 20px;
  2166. cursor: pointer;
  2167. color: #0081ff;
  2168. opacity: 1;
  2169. transition: opacity 0.2s;
  2170. &:hover {
  2171. opacity: .5;
  2172. }
  2173. }
  2174. }
  2175. }
  2176. </style>