wbs.vue 81 KB

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