index.vue 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239
  1. <template>
  2. <div class="catalog-manage-container">
  3. <!-- 列表视图 -->
  4. <div v-if="!showInfoMaintain" class="list-view">
  5. <div class="search-panel">
  6. <el-form :inline="true" :model="searchForm" class="search-form">
  7. <el-form-item label="目录类别:">
  8. <el-select
  9. v-model="searchForm.categoryId"
  10. placeholder="请选择目录类别"
  11. clearable
  12. filterable
  13. >
  14. <el-option
  15. v-for="item in catalogNmaes"
  16. :key="item.catalogId"
  17. :label="item.catalogName"
  18. :value="item.catalogId"
  19. ></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="监审形式:">
  23. <el-select
  24. v-model="searchForm.auditType"
  25. placeholder="请选择监审形式"
  26. clearable
  27. >
  28. <el-option
  29. v-for="item in dictData['auditType']"
  30. :key="item.id"
  31. :label="item.name"
  32. :value="item.key"
  33. ></el-option>
  34. </el-select>
  35. </el-form-item>
  36. <!-- <el-form-item label="监审内容:">
  37. <el-input
  38. v-model="searchForm.catalogName"
  39. placeholder="请输入监审内容"
  40. clearable
  41. ></el-input>
  42. </el-form-item> -->
  43. <el-form-item>
  44. <el-button type="primary" icon="el-icon-search" @click="fetchData">
  45. 搜索
  46. </el-button>
  47. <el-button
  48. plain
  49. type="primary"
  50. icon="el-icon-refresh"
  51. @click="handleReset"
  52. >
  53. 重置
  54. </el-button>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. <div class="operation-bar">
  59. <el-button
  60. plain
  61. type="success"
  62. icon="el-icon-circle-plus"
  63. @click="handleAdd()"
  64. >
  65. 添加类别
  66. </el-button>
  67. </div>
  68. <el-table
  69. v-loading="loading"
  70. :data="tableData"
  71. border
  72. style="width: 100%"
  73. row-key="id"
  74. :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
  75. default-expand-all
  76. :row-class-name="getRowClassName"
  77. >
  78. <el-table-column
  79. prop="name"
  80. label="成本监审目录"
  81. show-overflow-tooltip
  82. header-align="center"
  83. align="left"
  84. min-width="200"
  85. >
  86. <template slot-scope="scope">
  87. <span
  88. class="link-text"
  89. :class="{ 'disabled-text': scope.row.status == 0 }"
  90. @click="handleViewDetail(scope.row)"
  91. >
  92. {{ scope.row.catalogName }}
  93. </span>
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. prop="code"
  98. label="目录编码"
  99. show-overflow-tooltip
  100. align="center"
  101. width="120"
  102. >
  103. <template slot-scope="scope">
  104. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  105. {{ scope.row.code }}
  106. </span>
  107. </template>
  108. </el-table-column>
  109. <!-- <el-table-column
  110. prop="nodeType"
  111. label="nodeType"
  112. show-overflow-tooltip
  113. align="center"
  114. width="120"
  115. >
  116. <template slot-scope="scope">
  117. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  118. {{ scope.row.nodeType }}
  119. </span>
  120. </template>
  121. </el-table-column> -->
  122. <el-table-column
  123. prop="auditType"
  124. label="成本监审形式"
  125. show-overflow-tooltip
  126. align="center"
  127. width="180"
  128. >
  129. <template slot-scope="scope">
  130. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  131. {{ getDictName('auditType', scope.row.auditType) }}
  132. </span>
  133. </template>
  134. </el-table-column>
  135. <!-- <el-table-column
  136. prop="keyword"
  137. label="监审内容"
  138. show-overflow-tooltip
  139. align="center"
  140. width="180"
  141. >
  142. <template slot-scope="scope">
  143. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  144. {{ scope.row.catalogName }}
  145. </span>
  146. </template>
  147. </el-table-column> -->
  148. <el-table-column
  149. prop="pricingDept"
  150. label="定价部门"
  151. show-overflow-tooltip
  152. align="center"
  153. width="150"
  154. >
  155. <template slot-scope="scope">
  156. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  157. {{ scope.row.pricingDept }}
  158. </span>
  159. </template>
  160. </el-table-column>
  161. <el-table-column
  162. prop="remark"
  163. label="备注"
  164. header-align="center"
  165. show-overflow-tooltip
  166. align="left"
  167. width="150"
  168. >
  169. <template slot-scope="scope">
  170. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  171. {{ scope.row.remark }}
  172. </span>
  173. </template>
  174. </el-table-column>
  175. <el-table-column
  176. prop="status"
  177. label="状态"
  178. show-overflow-tooltip
  179. align="center"
  180. width="100"
  181. >
  182. <template slot-scope="scope">
  183. <span :class="{ 'disabled-text': scope.row.status == 0 }">
  184. {{ scope.row.status == 0 ? '停用' : '启用' }}
  185. </span>
  186. </template>
  187. </el-table-column>
  188. <el-table-column label="操作" width="360" fixed="right" align="center">
  189. <template slot-scope="scope">
  190. <div>
  191. <el-button
  192. v-if="scope.row.status != 0 && scope.row.nodeType !== 'nr'"
  193. type="text"
  194. size="mini"
  195. @click="handleEdit(scope.row)"
  196. >
  197. 修改类别
  198. </el-button>
  199. <el-button
  200. v-if="scope.row.status != 0 && scope.row.nodeType !== 'nr'"
  201. type="text"
  202. size="mini"
  203. @click="handleAddChild(scope.row)"
  204. >
  205. 添加子类
  206. </el-button>
  207. <el-button
  208. v-if="
  209. !scope.row.auditType &&
  210. scope.row.status != 0 &&
  211. scope.row.nodeType !== 'nr'
  212. "
  213. type="text"
  214. size="mini"
  215. @click="handleAddContent(scope.row)"
  216. >
  217. 添加内容
  218. </el-button>
  219. <el-button
  220. v-if="scope.row.nodeType == 'nr' && scope.row.status != 0"
  221. type="text"
  222. size="mini"
  223. @click="handleEditContent(scope.row)"
  224. >
  225. 修改内容
  226. </el-button>
  227. <el-button
  228. v-if="scope.row.nodeType == 'nr' && scope.row.status != 0"
  229. type="text"
  230. size="mini"
  231. @click="handleDropdownCommand('infoMaintain', scope.row)"
  232. >
  233. 信息维护
  234. </el-button>
  235. <el-button
  236. v-if="scope.row.nodeType == 'nr'"
  237. type="text"
  238. @click.native="handleDropdownCommand('status', scope.row)"
  239. >
  240. {{ scope.row.status === 1 ? '停用' : '启用' }}
  241. </el-button>
  242. <el-button
  243. v-if="scope.row.nodeType == 'nr'"
  244. type="text"
  245. class="delete-btn"
  246. @click.native="handleDropdownCommand('delete', scope.row)"
  247. >
  248. 删除
  249. </el-button>
  250. <!-- 第四个以后的按钮放入更多下拉菜单 -->
  251. <el-dropdown
  252. v-if="scope.row.status != 0 && scope.row.nodeType !== 'nr'"
  253. trigger="click"
  254. class="ml10"
  255. >
  256. <el-button type="text" size="mini">
  257. 更多
  258. <i class="el-icon-arrow-down el-icon--right"></i>
  259. </el-button>
  260. <el-dropdown-menu slot="dropdown">
  261. <el-dropdown-item
  262. v-if="scope.row.nodeType == 'nr'"
  263. @click.native="
  264. handleDropdownCommand('infoMaintain', scope.row)
  265. "
  266. >
  267. 信息维护
  268. </el-dropdown-item>
  269. <el-dropdown-item
  270. divided
  271. @click.native="handleDropdownCommand('status', scope.row)"
  272. >
  273. {{ scope.row.status === 1 ? '停用' : '启用' }}
  274. </el-dropdown-item>
  275. <el-dropdown-item
  276. @click.native="handleDropdownCommand('delete', scope.row)"
  277. >
  278. 删除
  279. </el-dropdown-item>
  280. </el-dropdown-menu>
  281. </el-dropdown>
  282. </div>
  283. </template>
  284. </el-table-column>
  285. </el-table>
  286. <!--添加、修改类别弹窗 -->
  287. <el-dialog
  288. v-loading="submitting"
  289. :title="title"
  290. :visible.sync="editDialogVisible"
  291. width="600px"
  292. append-to-body
  293. :close-on-click-modal="false"
  294. >
  295. <el-form
  296. ref="editForm"
  297. :model="editForm"
  298. :rules="rules"
  299. label-width="120px"
  300. class="edit-form"
  301. >
  302. <el-form-item label="上级类别:">
  303. <el-cascader
  304. v-model="editForm.parentId"
  305. :options="tableListData"
  306. placeholder=" 请选择上级类别"
  307. v-bind="catalogProps"
  308. style="width: 100%"
  309. ></el-cascader>
  310. </el-form-item>
  311. <el-form-item label="节点类型:" prop="nodeType">
  312. <el-radio-group v-model="editForm.nodeType">
  313. <el-radio
  314. v-for="item in dictData['nodeType']"
  315. :key="item.id"
  316. :label="item.key"
  317. >
  318. {{ item.name }}
  319. </el-radio>
  320. </el-radio-group>
  321. </el-form-item>
  322. <el-form-item label="类别名称:" prop="catalogName">
  323. <el-input
  324. v-model="editForm.catalogName"
  325. clearable
  326. @change="changeName(editForm)"
  327. ></el-input>
  328. </el-form-item>
  329. <el-form-item label="备注:">
  330. <el-input
  331. v-model="editForm.remark"
  332. type="textarea"
  333. :rows="3"
  334. maxlength="500"
  335. clearable
  336. ></el-input>
  337. </el-form-item>
  338. </el-form>
  339. <div slot="footer" class="dialog-footer">
  340. <el-button
  341. type="primary"
  342. :loading="submitting"
  343. @click="submitForm('editForm')"
  344. >
  345. 确 认
  346. </el-button>
  347. <el-button class="ml10" @click="editDialogVisible = false">
  348. 取 消
  349. </el-button>
  350. </div>
  351. </el-dialog>
  352. <!-- 添加/修改成本监审内容弹窗 -->
  353. <el-dialog
  354. :title="editContentDialogTitle"
  355. :visible.sync="contentDialogVisible"
  356. width="600px"
  357. append-to-body
  358. :close-on-click-modal="false"
  359. >
  360. <el-form
  361. ref="contentForm"
  362. :model="contentForm"
  363. :rules="contentRules"
  364. label-width="120px"
  365. class="edit-form"
  366. :disabled="editContentDialogTitle == '查看成本监审内容(项目)'"
  367. >
  368. <el-form-item label="上级目录类别:" prop="parentId">
  369. <el-cascader
  370. v-model="contentForm.parentId"
  371. :options="tableListData"
  372. placeholder=" 请选择上级类别"
  373. v-bind="catalogProps"
  374. style="width: 100%"
  375. disabled
  376. ></el-cascader>
  377. </el-form-item>
  378. <el-form-item label="目录编码:">
  379. <el-input v-model="contentForm.code" disabled></el-input>
  380. </el-form-item>
  381. <el-form-item label="类别名称:" prop="catalogName">
  382. <el-input
  383. v-model="contentForm.catalogName"
  384. maxlength="30"
  385. clearable
  386. ></el-input>
  387. </el-form-item>
  388. <el-form-item label="监审形式:" prop="auditType">
  389. <el-select
  390. v-model="contentForm.auditType"
  391. multiple
  392. placeholder="请选择监审形式"
  393. style="width: 100%"
  394. clearable
  395. >
  396. <el-option
  397. v-for="item in dictData['auditType']"
  398. :key="item.key"
  399. :label="item.name"
  400. :value="item.key"
  401. ></el-option>
  402. </el-select>
  403. </el-form-item>
  404. <el-form-item label="监审部门:" prop="pricingDept">
  405. <el-input
  406. v-model="contentForm.pricingDept"
  407. placeholder="请输入监审部门"
  408. style="width: 100%"
  409. clearable
  410. maxlength="30"
  411. ></el-input>
  412. </el-form-item>
  413. <el-form-item label="监审级别:" prop="priceLevel">
  414. <el-select
  415. v-model="contentForm.priceLevel"
  416. multiple
  417. placeholder="请选择监审级别"
  418. style="width: 100%"
  419. clearable
  420. >
  421. <el-option
  422. v-for="item in dictData['priceLevel']"
  423. :key="item.id"
  424. :label="item.name"
  425. :value="item.key"
  426. ></el-option>
  427. </el-select>
  428. </el-form-item>
  429. <el-form-item label="备注:">
  430. <el-input
  431. v-model="contentForm.remark"
  432. type="textarea"
  433. :rows="3"
  434. maxlength="500"
  435. clearable
  436. ></el-input>
  437. </el-form-item>
  438. </el-form>
  439. <div slot="footer" class="dialog-footer">
  440. <el-button
  441. v-if="editContentDialogTitle != '查看成本监审内容(项目)'"
  442. type="primary"
  443. @click="submitContentForm('contentForm')"
  444. >
  445. 确 认
  446. </el-button>
  447. <el-button @click="contentDialogVisible = false">
  448. {{
  449. editContentDialogTitle == '查看成本监审内容(项目)'
  450. ? '关 闭'
  451. : '取 消'
  452. }}
  453. </el-button>
  454. </div>
  455. </el-dialog>
  456. </div>
  457. <!-- 信息维护视图 -->
  458. <div v-else class="info-maintain-container">
  459. <div class="page-header">
  460. <el-button
  461. plain
  462. type="primary"
  463. size="small"
  464. icon="el-icon-arrow-left"
  465. @click="backToList"
  466. >
  467. 返回列表
  468. </el-button>
  469. <h3>{{ currentCatalogName || '监审目录' }}信息维护</h3>
  470. </div>
  471. <el-tabs
  472. v-model="activeTab"
  473. type="border-card"
  474. @tab-click="handleTabClick"
  475. >
  476. <el-tab-pane label="政策文件" name="policyFiles">
  477. <div class="tab-content">
  478. <div class="operation-bar">
  479. <el-button
  480. plain
  481. type="primary"
  482. size="small"
  483. icon="el-icon-circle-plus"
  484. @click="handleAddPolicy"
  485. >
  486. 关联政策文件
  487. </el-button>
  488. <el-button
  489. plain
  490. type="danger"
  491. size="small"
  492. icon="el-icon-delete"
  493. :disabled="!selectedPolicyFiles.length"
  494. @click="handleDeletePolicy"
  495. >
  496. 取消关联文件
  497. </el-button>
  498. </div>
  499. <cost-audit-table
  500. :table-data="policyFilesData"
  501. :columns="policyColumns"
  502. :show-selection="true"
  503. :show-pagination="true"
  504. :pagination="policyPagination"
  505. @pagination-change="policyPaginationChange"
  506. @selection-change="handlePolicySelectionChange"
  507. />
  508. </div>
  509. </el-tab-pane>
  510. <el-tab-pane label="监审对象提交资料清单" name="legalBasis">
  511. <div class="tab-content">
  512. <div class="operation-bar">
  513. <el-button
  514. plain
  515. type="success"
  516. size="small"
  517. icon="el-icon-circle-plus"
  518. @click="handleAddLegal"
  519. >
  520. 添加
  521. </el-button>
  522. </div>
  523. <cost-audit-table
  524. :table-data="legalBasisData"
  525. :columns="legalColumns"
  526. :show-pagination="true"
  527. :pagination="legalBasisPagination"
  528. @pagination-change="legalBasisPaginationChange"
  529. @selection-change="handleLegalSelectionChange"
  530. >
  531. <!-- 操作列插槽 -->
  532. <template #action="{ row }">
  533. <el-button
  534. type="text"
  535. size="mini"
  536. @click="handleEditLegal(row)"
  537. >
  538. 修改
  539. </el-button>
  540. <el-button
  541. type="text"
  542. size="mini"
  543. @click="handleDeleteSingleLegal(row)"
  544. >
  545. 删除
  546. </el-button>
  547. </template>
  548. </cost-audit-table>
  549. </div>
  550. </el-tab-pane>
  551. <el-tab-pane label="成本调查表" name="costSurvey">
  552. <div class="tab-content">
  553. <div class="operation-bar">
  554. <el-button
  555. plain
  556. type="primary"
  557. size="small"
  558. icon="el-icon-circle-plus"
  559. @click="handleAddCostSurvey"
  560. >
  561. 关联成本调查表
  562. </el-button>
  563. <el-button
  564. plain
  565. type="danger"
  566. size="small"
  567. icon="el-icon-delete"
  568. :disabled="!selectCostSurvey.length"
  569. @click="handleDeleteCostSurvey"
  570. >
  571. 取消关联成本调查表
  572. </el-button>
  573. </div>
  574. <cost-audit-table
  575. :table-data="costSurveyData"
  576. :columns="costSurveyColumns"
  577. :show-selection="true"
  578. :border="true"
  579. :show-pagination="true"
  580. :pagination="costSurveyPagination"
  581. @selection-change="handleCostSurveySelectionChange"
  582. @pagination-change="handlePaginationChange"
  583. >
  584. <!-- 操作列插槽 -->
  585. <template #action="{ row }">
  586. <el-button
  587. type="text"
  588. size="mini"
  589. @click="handleViewCostSurvey(row)"
  590. >
  591. 查看
  592. </el-button>
  593. </template>
  594. </cost-audit-table>
  595. </div>
  596. </el-tab-pane>
  597. </el-tabs>
  598. <!-- 政策文件表单 -->
  599. <el-dialog
  600. :title="policyDialogTitle"
  601. :visible.sync="policyDialogVisible"
  602. width="50%"
  603. :close-on-click-modal="false"
  604. >
  605. <el-form
  606. :inline="true"
  607. :model="selectPolicySearchForm"
  608. class="demo-form-inline"
  609. >
  610. <el-form-item label="文件标题:">
  611. <el-input
  612. v-model="selectPolicySearchForm.title"
  613. placeholder="请输入文件标题"
  614. clearable
  615. />
  616. </el-form-item>
  617. <el-form-item label="文号:">
  618. <el-input
  619. v-model="selectPolicySearchForm.documentNumber"
  620. placeholder="请输入文号"
  621. clearable
  622. />
  623. </el-form-item>
  624. <el-form-item>
  625. <el-button
  626. icon="el-icon-search"
  627. type="primary"
  628. @click="getSelectPolicyFilesData"
  629. >
  630. 搜索
  631. </el-button>
  632. <el-button
  633. plain
  634. type="primary"
  635. icon="el-icon-refresh"
  636. @click="handleResetPolicy"
  637. >
  638. 重置
  639. </el-button>
  640. </el-form-item>
  641. </el-form>
  642. <cost-audit-table
  643. :table-data="formatterSelectFilesData"
  644. :columns="selectPolicyColumns"
  645. :table-props="{
  646. maxHeight: '400',
  647. }"
  648. :show-selection="true"
  649. :show-pagination="true"
  650. :pagination="selectPolicyPagination"
  651. @pagination-change="selectPolicyPaginationChange"
  652. @selection-change="selectPolicySelectionChange"
  653. />
  654. <div slot="footer" class="dialog-footer">
  655. <el-button type="primary" @click="submitPolicyForm('policyForm')">
  656. 确认
  657. </el-button>
  658. <el-button @click="policyDialogVisible = false">取消</el-button>
  659. </div>
  660. </el-dialog>
  661. <!-- 监审对象提交资料清单表单 -->
  662. <el-dialog
  663. :title="legalDialogTitle"
  664. :visible.sync="legalDialogVisible"
  665. width="600px"
  666. :close-on-click-modal="false"
  667. >
  668. <el-form
  669. ref="legalForm"
  670. :model="legalForm"
  671. :rules="legalRules"
  672. label-width="100px"
  673. >
  674. <el-form-item label="资料类别:" prop="informationType">
  675. <el-select
  676. v-model="legalForm.informationType"
  677. placeholder="请选择资料类别"
  678. style="width: 100%"
  679. >
  680. <el-option
  681. v-for="item in dictData['materialType']"
  682. :key="item.id"
  683. :label="item.name"
  684. :value="item.key"
  685. ></el-option>
  686. </el-select>
  687. </el-form-item>
  688. <el-form-item label="资料名称:" prop="informationName">
  689. <el-input
  690. v-model="legalForm.informationName"
  691. placeholder="请输入资料名称"
  692. ></el-input>
  693. </el-form-item>
  694. <el-form-item label="资料要求:" prop="informationRequire">
  695. <el-input
  696. v-model="legalForm.informationRequire"
  697. placeholder="请输入资料要求"
  698. ></el-input>
  699. </el-form-item>
  700. <el-form-item label="格式要求:" prop="formatRequired">
  701. <el-select
  702. v-model="legalForm.formatRequired"
  703. placeholder="请选择格式要求"
  704. style="width: 100%"
  705. >
  706. <el-option
  707. v-for="item in dictData['formatAsk']"
  708. :key="item.id"
  709. :label="item.name"
  710. :value="item.key"
  711. ></el-option>
  712. </el-select>
  713. </el-form-item>
  714. <el-form-item
  715. v-if="legalForm.formatRequired === '3'"
  716. label="选择模板:"
  717. prop="templateId"
  718. >
  719. <el-input
  720. v-model="legalForm.surveyTemplateName"
  721. style="width: 80%"
  722. disabled
  723. ></el-input>
  724. <el-button type="primary" @click="handleTemplateClick">
  725. 选择模板
  726. </el-button>
  727. </el-form-item>
  728. <el-form-item label="资料排序:" prop="orderNum">
  729. <el-input-number
  730. v-model="legalForm.orderNum"
  731. controls-position="right"
  732. :min="1"
  733. style="width: 100%"
  734. ></el-input-number>
  735. </el-form-item>
  736. <el-form-item label="是否必填:" prop="isRequired">
  737. <el-radio-group v-model="legalForm.isRequired">
  738. <el-radio label="0">是</el-radio>
  739. <el-radio label="1">否</el-radio>
  740. </el-radio-group>
  741. </el-form-item>
  742. </el-form>
  743. <div slot="footer" class="dialog-footer">
  744. <el-button
  745. type="primary"
  746. :loading="submitting"
  747. @click="submitLegalForm('legalForm')"
  748. >
  749. 确认
  750. </el-button>
  751. <el-button @click="legalDialogVisible = false">取消</el-button>
  752. </div>
  753. </el-dialog>
  754. <el-dialog
  755. title="选择模板"
  756. :visible.sync="templateDialogVisible"
  757. width="50%"
  758. :close-on-click-modal="false"
  759. >
  760. <cost-audit-table
  761. :table-data="templateData"
  762. :columns="templateColumns"
  763. :show-selection="true"
  764. :show-pagination="true"
  765. :pagination="templatePagination"
  766. @pagination-change="templatePaginationChange"
  767. @selection-change="templateSelectionChange"
  768. >
  769. <!-- 创建时间自定义单元格 -->
  770. <template #createTime="{ row }">
  771. <div>{{ row.createTime ? row.createTime.split(' ')[0] : '-' }}</div>
  772. <div>{{ row.createTime ? row.createTime.split(' ')[1] : '-' }}</div>
  773. </template>
  774. </cost-audit-table>
  775. <div slot="footer" class="dialog-footer">
  776. <el-button type="primary" @click="submitTemplateForm('templateForm')">
  777. 确认
  778. </el-button>
  779. <el-button @click="templateDialogVisible = false">取消</el-button>
  780. </div>
  781. </el-dialog>
  782. <!-- 成本调查表表单 -->
  783. <el-dialog
  784. title="关联成本调查表"
  785. :visible.sync="costSurveyDialogVisible"
  786. width="50%"
  787. :close-on-click-modal="false"
  788. >
  789. <cost-audit-table
  790. :table-data="selectCostSurveyData"
  791. :columns="selectCostSurveyColumns"
  792. :show-selection="true"
  793. :show-pagination="true"
  794. :pagination="selectCostSurveyPagination"
  795. @pagination-change="selectCostSurveyPaginationChange"
  796. @selection-change="selectCostSurveySelectionChange"
  797. >
  798. <!-- 创建时间自定义单元格 -->
  799. <template #createTime="{ row }">
  800. <div>{{ row.createTime ? row.createTime.split(' ')[0] : '-' }}</div>
  801. <div>{{ row.createTime ? row.createTime.split(' ')[1] : '-' }}</div>
  802. </template>
  803. </cost-audit-table>
  804. <div slot="footer" class="dialog-footer">
  805. <el-button @click="costSurveyDialogVisible = false">取消</el-button>
  806. <el-button
  807. type="primary"
  808. @click="submitCostSurveyForm('costSurveyForm')"
  809. >
  810. 确认
  811. </el-button>
  812. </div>
  813. </el-dialog>
  814. <!-- 成本调查表查看弹窗 -->
  815. <SurveyDialog
  816. :dialog-visible="contentEditDialogVisible"
  817. :dialog-title="contentEditDialogTitle"
  818. :form-data="contentEditForm"
  819. :disabled="contentEditDisabled"
  820. @cancel="handleContentEditCancel"
  821. />
  822. </div>
  823. </div>
  824. </template>
  825. <script>
  826. import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
  827. import SurveyDialog from './surveyDialog.vue'
  828. import {
  829. getCategory,
  830. getCatalogList,
  831. validateName,
  832. changeCatalogstatus,
  833. getCatalogDetail,
  834. editCatalogCategory,
  835. deleteCatalog,
  836. editCatalogContent,
  837. addCatalogCategory,
  838. addCatalogContent,
  839. // 信息维护相关API
  840. getPolicyDoc,
  841. associatePolicyDoc,
  842. unassociatePolicyDoc,
  843. // 资料清单相关API
  844. getDocumentCatalog,
  845. addDocumentCatalog,
  846. updateDocumentCatalog,
  847. deleteDocumentCatalog,
  848. // 成本调查与模板相关API
  849. getCostSurveyForms,
  850. getallCurrentCostSurveyList,
  851. addCostSurvey,
  852. cleanByIds,
  853. // 文件管理相关API
  854. } from '@/api/catalogManage'
  855. import { getInfoList } from '@/api/auditDocManage'
  856. import { allcurrentCostSurveyList } from '@/api/financeSheetManage'
  857. import { getCostFormDetail } from '@/api/costFormManage'
  858. import { dictMixin } from '@/mixins/useDict'
  859. export default {
  860. name: 'CatalogManage',
  861. components: {
  862. CostAuditTable,
  863. SurveyDialog,
  864. },
  865. mixins: [dictMixin],
  866. props: {
  867. isLinkDialog: {
  868. type: Boolean,
  869. default: false,
  870. },
  871. },
  872. data() {
  873. return {
  874. dictData: {
  875. nodeType: [], //节点类型
  876. priceLevel: [], //监审级别
  877. auditType: [], //监审形式
  878. materialType: [], //资料类别
  879. formatAsk: [], //格式要求
  880. },
  881. // 列表视图相关数据
  882. loading: false,
  883. submitting: false,
  884. searchForm: {
  885. categoryId: '',
  886. auditType: '',
  887. catalogName: '',
  888. },
  889. total: 2,
  890. // 树形结构数据
  891. tableData: [],
  892. tableListData: [],
  893. catalogProps: {
  894. filterable: true,
  895. style: 'width: 100%',
  896. showAllLevels: false,
  897. props: {
  898. children: 'children',
  899. checkStrictly: true,
  900. label: 'catalogName',
  901. value: 'id',
  902. emitPath: false,
  903. },
  904. },
  905. title: '添加成本监审类别',
  906. editDialogVisible: false,
  907. contentDialogVisible: false,
  908. editContentDialogTitle: '添加成本监审内容(项目)',
  909. editForm: {
  910. id: '',
  911. parentId: '',
  912. parentName: '',
  913. code: '',
  914. catalogName: '',
  915. // auditType: [],
  916. // pricingDept: '',
  917. remark: '',
  918. // priceLevel: [],
  919. },
  920. contentForm: {
  921. parentName: '',
  922. code: '',
  923. catalogName: '',
  924. auditType: [],
  925. pricingDept: '',
  926. priceLevel: [],
  927. remark: '',
  928. },
  929. rules: {
  930. parentId: [
  931. { required: true, message: '请选择上级类别', trigger: 'change' },
  932. { max: 30, message: '长度不能超过30个字符', trigger: 'blur' },
  933. ],
  934. catalogName: [
  935. { required: true, message: '请输入类别名称', trigger: 'blur' },
  936. { max: 30, message: '长度不能超过30个字符', trigger: 'blur' },
  937. ],
  938. nodeType: [
  939. { required: true, message: '请选择节点类型', trigger: 'change' },
  940. ],
  941. },
  942. contentRules: {
  943. catalogName: [
  944. { required: true, message: '请输入监审内容', trigger: 'blur' },
  945. { max: 30, message: '长度不能超过30个字符', trigger: 'blur' },
  946. ],
  947. auditType: [
  948. { required: false, message: '请选择监审形式', trigger: 'change' },
  949. ],
  950. pricingDept: [
  951. { required: true, message: '请选择监审部门', trigger: 'change' },
  952. ],
  953. priceLevel: [
  954. { required: true, message: '请选择监审级别', trigger: 'change' },
  955. ],
  956. },
  957. isNameExist: false,
  958. IsEditContent: false,
  959. catalogNmaes: [],
  960. // 信息维护视图相关数据
  961. showInfoMaintain: false,
  962. currentCatalogId: '',
  963. currentCatalogName: '',
  964. activeTab: 'policyFiles',
  965. // 政策文件数据
  966. policyFilesData: [],
  967. selectedPolicyFiles: [],
  968. policyDialogVisible: false,
  969. policyDialogTitle: '关联政策文件',
  970. policyPagination: {
  971. currentPage: 1,
  972. pageSize: 10,
  973. total: 0,
  974. },
  975. selectPolicyFilesData: [],
  976. selectedDocFiles: [],
  977. selectPolicyPagination: {
  978. currentPage: 1,
  979. pageSize: 10,
  980. total: 0,
  981. },
  982. selectPolicySearchForm: {
  983. title: '',
  984. documentNumber: '',
  985. },
  986. selectPolicyColumns: [
  987. {
  988. prop: 'title',
  989. label: '文件标题',
  990. align: 'center',
  991. },
  992. {
  993. prop: 'documentNumber',
  994. label: '文号',
  995. align: 'center',
  996. },
  997. ],
  998. // 监审对象提交资料清单数据
  999. legalBasisData: [],
  1000. legalBasisPagination: {
  1001. currentPage: 1,
  1002. pageSize: 10,
  1003. total: 0,
  1004. },
  1005. selectLegalBasis: [],
  1006. legalDialogVisible: false,
  1007. legalDialogTitle: '提交资料清单',
  1008. legalForm: {
  1009. informationType: '',
  1010. informationName: '',
  1011. informationRequire: '',
  1012. formatRequired: '',
  1013. templateId: '',
  1014. isRequired: '0',
  1015. orderNum: 1,
  1016. },
  1017. templateDialogVisible: false,
  1018. templateData: [],
  1019. selectTemplateData: [],
  1020. templatePagination: {
  1021. currentPage: 1,
  1022. pageSize: 10,
  1023. total: 0,
  1024. },
  1025. templateColumns: [
  1026. {
  1027. prop: 'surveyTemplateName',
  1028. label: '财务数据表名称',
  1029. },
  1030. {
  1031. prop: 'templateType',
  1032. label: '模版类型',
  1033. width: '100px',
  1034. formatter: (row) => {
  1035. return row.templateType == '1'
  1036. ? '单记录'
  1037. : row.templateType == '2'
  1038. ? '固定表'
  1039. : '动态表'
  1040. },
  1041. },
  1042. {
  1043. prop: 'storageTable',
  1044. label: '财务数据表数据存储表名称',
  1045. },
  1046. {
  1047. prop: 'status',
  1048. label: '状态',
  1049. width: '100px',
  1050. formatter: (row) => {
  1051. return row.status == '-1'
  1052. ? '草稿'
  1053. : row.status == '0'
  1054. ? '启用'
  1055. : '停用'
  1056. },
  1057. },
  1058. {
  1059. prop: 'createTime',
  1060. label: '创建时间',
  1061. slotName: 'createTime',
  1062. width: '100px',
  1063. },
  1064. ],
  1065. legalRules: {
  1066. informationType: [
  1067. { required: true, message: '请选择资料类别', trigger: 'change' },
  1068. ],
  1069. informationName: [
  1070. { required: true, message: '请输入资料名称', trigger: 'blur' },
  1071. ],
  1072. formatRequired: [
  1073. { required: true, message: '请选择格式要求', trigger: 'change' },
  1074. ],
  1075. isRequired: [
  1076. { required: true, message: '请选择是否必填', trigger: 'change' },
  1077. ],
  1078. orderNum: [
  1079. { required: true, message: '请输入资料排序', trigger: 'blur' },
  1080. ],
  1081. informationRequire: [
  1082. { required: true, message: '请输入资料要求', trigger: 'blur' },
  1083. ],
  1084. // templateId: [
  1085. // { required: true, message: '请选择模板', trigger: 'change' },
  1086. // ],
  1087. },
  1088. surveyStatusOptions: [
  1089. { value: '-1', label: '草稿' },
  1090. { value: '0', label: '现行' },
  1091. { value: '1', label: '停用' },
  1092. ],
  1093. // 成本调查表数据
  1094. costSurveyData: [],
  1095. surveyDetailsData: [],
  1096. costSurveyPagination: {
  1097. currentPage: 1,
  1098. pageSize: 10,
  1099. total: 0,
  1100. },
  1101. costSurveyColumns: [
  1102. {
  1103. prop: 'surveyTemplateName',
  1104. label: '成本调查表',
  1105. align: 'center',
  1106. // slotName: 'surveyTemplateName',
  1107. },
  1108. {
  1109. prop: 'year',
  1110. label: '年度',
  1111. width: 100,
  1112. align: 'center',
  1113. },
  1114. {
  1115. prop: 'status',
  1116. label: '状态',
  1117. width: 100,
  1118. align: 'center',
  1119. formatter: (row) => {
  1120. return this.surveyStatusOptions.find(
  1121. (item) => item.value === row.status
  1122. ).label
  1123. },
  1124. },
  1125. {
  1126. label: '操作',
  1127. width: 200,
  1128. align: 'center',
  1129. slotName: 'action',
  1130. },
  1131. ],
  1132. selectCostSurvey: [],
  1133. costSurveyDialogVisible: false,
  1134. selectCostSurveyData: [],
  1135. selectCostSurveyRow: [],
  1136. selectCostSurveyPagination: {
  1137. currentPage: 1,
  1138. pageSize: 10,
  1139. total: 0,
  1140. },
  1141. // 内容编辑弹窗相关
  1142. contentEditDialogVisible: false,
  1143. contentEditDialogTitle: '内容维护',
  1144. contentEditDisabled: true,
  1145. policyFilesOptions: [],
  1146. policyColumns: [
  1147. {
  1148. prop: 'projectName',
  1149. label: '政策文件',
  1150. align: 'center',
  1151. },
  1152. {
  1153. prop: 'documentNumber',
  1154. label: '文号',
  1155. align: 'center',
  1156. },
  1157. ],
  1158. contentEditForm: {
  1159. tableName: '',
  1160. formStyle: '固定表',
  1161. // 单记录列表
  1162. tableHeaders: [],
  1163. // 固定表列表
  1164. fixedTable: [],
  1165. // 动态表列表
  1166. dynamicTable: [],
  1167. },
  1168. }
  1169. },
  1170. computed: {
  1171. legalColumns() {
  1172. return [
  1173. {
  1174. prop: 'informationType',
  1175. label: '资料类别',
  1176. width: 150,
  1177. align: 'center',
  1178. formatter: (row) => {
  1179. return this.getDictName('materialType', row.informationType)
  1180. },
  1181. },
  1182. {
  1183. prop: 'informationName',
  1184. label: '资料名称',
  1185. align: 'center',
  1186. },
  1187. {
  1188. prop: 'formatRequired',
  1189. label: '格式要求',
  1190. width: 150,
  1191. align: 'center',
  1192. formatter: (row) => {
  1193. return this.getDictName('formatAsk', row.formatRequired)
  1194. },
  1195. },
  1196. {
  1197. prop: 'orderNum',
  1198. label: '资料排序',
  1199. width: 150,
  1200. align: 'center',
  1201. },
  1202. {
  1203. prop: 'isRequired',
  1204. label: '是否必填',
  1205. width: 100,
  1206. align: 'center',
  1207. formatter: (row) => (row.isRequired == 0 ? '是' : '否'),
  1208. },
  1209. {
  1210. label: '操作',
  1211. width: 260,
  1212. align: 'center',
  1213. slotName: 'action',
  1214. },
  1215. ]
  1216. },
  1217. // 表格列配置
  1218. selectCostSurveyColumns() {
  1219. return [
  1220. // {
  1221. // prop: 'catalogId',
  1222. // label: '监审类别',
  1223. // },
  1224. {
  1225. prop: 'surveyTemplateName',
  1226. label: '调查表名称',
  1227. },
  1228. {
  1229. prop: 'templateType',
  1230. label: '模版类型',
  1231. width: '100px',
  1232. formatter: (row) => {
  1233. return row.templateType == '1'
  1234. ? '单记录'
  1235. : row.templateType == '2'
  1236. ? '固定表'
  1237. : '动态表'
  1238. },
  1239. },
  1240. {
  1241. prop: 'storageTable',
  1242. label: '调查表数据存储表',
  1243. },
  1244. {
  1245. prop: 'status',
  1246. label: '状态',
  1247. width: '100px',
  1248. formatter: (row) => {
  1249. return row.status == '-1'
  1250. ? '草稿'
  1251. : row.status == '0'
  1252. ? '启用'
  1253. : '停用'
  1254. },
  1255. },
  1256. {
  1257. prop: 'createTime',
  1258. label: '创建时间',
  1259. slotName: 'createTime',
  1260. width: '100px',
  1261. },
  1262. ]
  1263. },
  1264. formatterSelectFilesData() {
  1265. return this.distinct(
  1266. this.policyFilesData,
  1267. this.selectPolicyFilesData,
  1268. 'documentNumber'
  1269. )
  1270. },
  1271. },
  1272. mounted() {
  1273. this.getCategoryOpt()
  1274. this.fetchData()
  1275. },
  1276. methods: {
  1277. distinct(arr1, arr2, key) {
  1278. let result = []
  1279. arr1.forEach((item) => {
  1280. arr2.forEach((item2) => {
  1281. if (item[key] !== item2[key]) {
  1282. result.push(item2)
  1283. }
  1284. })
  1285. })
  1286. return result
  1287. },
  1288. // 列表视图相关方法
  1289. handleReset() {
  1290. this.searchForm = {
  1291. categoryId: '',
  1292. auditType: '',
  1293. catalogName: '',
  1294. pageNum: 1,
  1295. pageSize: 10,
  1296. }
  1297. this.total = 0
  1298. this.fetchData()
  1299. },
  1300. // 分页大小变化
  1301. handleSizeChange(val) {
  1302. this.searchForm.pageSize = val
  1303. this.fetchData()
  1304. },
  1305. // 当前页变化
  1306. handleCurrentChange(val) {
  1307. this.searchForm.pageNum = val
  1308. this.fetchData()
  1309. },
  1310. // 获取目录类别
  1311. getCategoryOpt() {
  1312. getCategory().then((res) => {
  1313. this.catalogNmaes = res.value || []
  1314. })
  1315. },
  1316. // 获取数据
  1317. // 获取数据
  1318. fetchData() {
  1319. this.loading = true
  1320. getCatalogList({ ...this.searchForm })
  1321. .then((res) => {
  1322. this.tableListData = res.value || []
  1323. // 确保 tableListData 是数组
  1324. if (!Array.isArray(this.tableListData)) {
  1325. this.tableListData = []
  1326. }
  1327. // 移除不需要的属性
  1328. this.tableListData = this.removeItemFromTree(this.tableListData)
  1329. this.tableData - []
  1330. // 直接返回所有顶级目录的子项元素,扁平化处理
  1331. // 先清空数组,避免数据积累
  1332. this.tableData = []
  1333. // 使用Set来跟踪已添加的ID,避免重复项
  1334. const addedIds = new Set()
  1335. this.tableListData.forEach((item) => {
  1336. if (
  1337. item.parentId === '0' &&
  1338. item.children &&
  1339. item.children.length > 0
  1340. ) {
  1341. // 处理顶级目录的子项
  1342. item.children.forEach((child) => {
  1343. if (child.id && !addedIds.has(child.id)) {
  1344. addedIds.add(child.id)
  1345. this.tableData.push(child)
  1346. }
  1347. })
  1348. } else if (item.parentId != '0') {
  1349. // 处理非顶级目录项
  1350. if (item.id && !addedIds.has(item.id)) {
  1351. addedIds.add(item.id)
  1352. this.tableData.push(item)
  1353. }
  1354. }
  1355. })
  1356. this.loading = false
  1357. })
  1358. .catch(() => {
  1359. this.loading = false
  1360. })
  1361. },
  1362. removeItemFromTree(treeData) {
  1363. // 边界条件检查
  1364. if (!treeData || !Array.isArray(treeData)) {
  1365. return []
  1366. }
  1367. // 创建新数组,避免修改原数据
  1368. return treeData.map((item) => {
  1369. // 创建当前节点的副本
  1370. const newItem = { ...item }
  1371. // 如果有hasChildren属性则删除
  1372. if ('hasChildren' in newItem) {
  1373. delete newItem.hasChildren
  1374. }
  1375. // 递归处理子节点 先检查children是否存在且为数组
  1376. if (
  1377. newItem.children &&
  1378. Array.isArray(newItem.children) &&
  1379. newItem.children.length > 0
  1380. ) {
  1381. newItem.children = this.removeItemFromTree(newItem.children)
  1382. }
  1383. return newItem
  1384. })
  1385. },
  1386. // 根据行数据的状态返回不同的类名
  1387. getRowClassName({ row }) {
  1388. if (row.status === 0) {
  1389. return 'disabled-text' // 停用状态的类名
  1390. } else if (row.status === 1) {
  1391. return 'info-text' // 启用状态的类名
  1392. }
  1393. return ''
  1394. },
  1395. changeName(row) {
  1396. if (!row.catalogName) return
  1397. validateName({ name: row.catalogName, parentId: row.parentId }).then(
  1398. (res) => {
  1399. this.isNameExist = res.value
  1400. }
  1401. )
  1402. },
  1403. // 查看详情
  1404. handleViewDetail(row) {
  1405. this.editContentDialogTitle = '查看成本监审内容(项目)'
  1406. getCatalogDetail(row.id).then((res) => {
  1407. this.contentForm = res.value
  1408. this.IsEditContent = true
  1409. // 确保 auditType 始终是数组
  1410. let auditTypeValue = []
  1411. if (Array.isArray(row.auditType)) {
  1412. auditTypeValue = row.auditType
  1413. } else if (typeof row.auditType === 'string') {
  1414. auditTypeValue = row.auditType ? row.auditType.split(',') : []
  1415. }
  1416. // 对 priceLevel 做同样处理
  1417. let priceLevelValue = []
  1418. if (Array.isArray(row.priceLevel)) {
  1419. priceLevelValue = row.priceLevel
  1420. } else if (typeof row.priceLevel === 'string') {
  1421. priceLevelValue = row.priceLevel ? row.priceLevel.split(',') : []
  1422. }
  1423. this.contentForm = {
  1424. ...this.contentForm,
  1425. catalogId: row.id,
  1426. parentName: this.getParentName(row.parentId),
  1427. auditType: auditTypeValue,
  1428. priceLevel: priceLevelValue,
  1429. }
  1430. // 重置表单验证状态
  1431. this.$nextTick(() => {
  1432. if (this.$refs.contentForm) {
  1433. this.$refs.contentForm.clearValidate()
  1434. }
  1435. })
  1436. this.contentDialogVisible = true
  1437. })
  1438. },
  1439. handleAdd(row) {
  1440. if (row) {
  1441. this.editForm = {
  1442. parentId: row.id,
  1443. parentName: row.catalogName || '根目录',
  1444. nodeType: 'lx',
  1445. catalogName: '',
  1446. remark: '',
  1447. }
  1448. } else {
  1449. this.editForm = {
  1450. parentId: this.tableListData[0].id || '', // 根目录的id,
  1451. parentName: '根目录',
  1452. nodeType: 'lx',
  1453. catalogName: '',
  1454. remark: '',
  1455. }
  1456. }
  1457. this.title = '添加成本监审类别'
  1458. this.editDialogVisible = true
  1459. },
  1460. // 修改类别
  1461. handleEdit(row) {
  1462. this.editForm = {
  1463. parentId: row.parentId,
  1464. catalogId: row.id,
  1465. nodeType: row.nodeType,
  1466. id: row.id,
  1467. code: row.code,
  1468. catalogName: row.catalogName,
  1469. remark: row.remark,
  1470. parentName: this.getParentName(row.parentId) || '根目录',
  1471. }
  1472. this.title = '修改成本监审类别'
  1473. this.editDialogVisible = true
  1474. },
  1475. // 获取父级名称的辅助方法
  1476. getParentName(parentId) {
  1477. if (!parentId) return '根目录'
  1478. const findParent = (data, visited = new Set()) => {
  1479. // 防止循环引用导致的无限递归
  1480. if (visited.has(parentId)) {
  1481. return null
  1482. }
  1483. for (let item of data) {
  1484. // 避免处理自身导致的循环
  1485. if (visited.has(item.id)) continue
  1486. if (item.id === parentId) {
  1487. return item.catalogName
  1488. }
  1489. if (item.children && item.children.length) {
  1490. visited.add(item.id)
  1491. const found = findParent(item.children, visited)
  1492. visited.delete(item.id)
  1493. if (found) return found
  1494. }
  1495. }
  1496. return null
  1497. }
  1498. // 从完整的树数据中查找
  1499. const result = findParent(this.tableListData)
  1500. return result || '根目录'
  1501. },
  1502. // 添加子类
  1503. handleAddChild(row) {
  1504. this.editForm = {
  1505. parentId: row.id,
  1506. parentName: row.catalogName || '根目录',
  1507. catalogName: '',
  1508. nodeType: 'lx',
  1509. remark: '',
  1510. auditType: row.auditType,
  1511. }
  1512. this.title = '添加成本监审类别'
  1513. this.editDialogVisible = true
  1514. },
  1515. // 添加内容
  1516. handleAddContent(row) {
  1517. this.editContentDialogTitle = '添加成本监审内容(项目)'
  1518. this.IsEditContent = false
  1519. this.contentForm = {
  1520. id: row.id,
  1521. parentId: row.parentId,
  1522. code: row.code,
  1523. parentName: this.getParentName(row.parentId),
  1524. catalogName: row.catalogName,
  1525. auditType: row.auditType ? row.auditType.split(',') : [],
  1526. pricingDept: '',
  1527. remark: '',
  1528. priceLevel: [],
  1529. }
  1530. // 重置表单验证状态
  1531. this.$nextTick(() => {
  1532. if (this.$refs.contentForm) {
  1533. this.$refs.contentForm.clearValidate()
  1534. }
  1535. })
  1536. this.contentDialogVisible = true
  1537. },
  1538. // 修改内容
  1539. handleEditContent(row) {
  1540. this.editContentDialogTitle = '修改成本监审内容(项目)'
  1541. getCatalogDetail(row.id).then((res) => {
  1542. this.contentForm = res.value
  1543. this.IsEditContent = true
  1544. // 确保 auditType 始终是数组
  1545. let auditTypeValue = []
  1546. if (Array.isArray(row.auditType)) {
  1547. auditTypeValue = row.auditType
  1548. } else if (typeof row.auditType === 'string') {
  1549. auditTypeValue = row.auditType ? row.auditType.split(',') : []
  1550. }
  1551. // 对 priceLevel 做同样处理
  1552. let priceLevelValue = []
  1553. if (Array.isArray(row.priceLevel)) {
  1554. priceLevelValue = row.priceLevel
  1555. } else if (typeof row.priceLevel === 'string') {
  1556. priceLevelValue = row.priceLevel ? row.priceLevel.split(',') : []
  1557. }
  1558. this.contentForm = {
  1559. ...this.contentForm,
  1560. catalogId: row.id,
  1561. parentName: this.getParentName(row.parentId),
  1562. auditType: auditTypeValue,
  1563. priceLevel: priceLevelValue,
  1564. }
  1565. // 重置表单验证状态
  1566. this.$nextTick(() => {
  1567. if (this.$refs.contentForm) {
  1568. this.$refs.contentForm.clearValidate()
  1569. }
  1570. })
  1571. this.contentDialogVisible = true
  1572. })
  1573. },
  1574. // 信息维护 - 切换视图
  1575. handleInfoMaintain(row) {
  1576. this.showInfoMaintain = true
  1577. this.currentCatalogId = row.id
  1578. this.currentCatalogName = row.catalogName
  1579. this.handleTabClick()
  1580. },
  1581. // 返回列表
  1582. backToList() {
  1583. this.showInfoMaintain = false
  1584. // 重置信息维护相关的数据
  1585. this.activeTab = 'policyFiles'
  1586. this.policyFilesData = []
  1587. this.legalBasisData = []
  1588. this.costSurveyData = []
  1589. },
  1590. // 启动/停用状态
  1591. handleStatus(row) {
  1592. const action = row.status === 1 ? '停用' : '启用'
  1593. this.$confirm(`确认要${action}该数据吗?`, '操作确认', {
  1594. confirmButtonText: '确定',
  1595. cancelButtonText: '取消',
  1596. type: 'warning',
  1597. })
  1598. .then(() => {
  1599. const statusValue = row.status === 1 ? 0 : 1
  1600. changeCatalogstatus({
  1601. id: row.id,
  1602. status: statusValue,
  1603. })
  1604. .then((res) => {
  1605. if (res.code === 200) {
  1606. this.$message.success(`${action}成功`)
  1607. this.fetchData()
  1608. } else {
  1609. this.$message.error(res.message || `${action}失败`)
  1610. }
  1611. })
  1612. .catch(() => {
  1613. this.$message({
  1614. type: 'error',
  1615. message: ` ${action}失败!`,
  1616. })
  1617. })
  1618. })
  1619. .catch(() => {
  1620. this.$message({
  1621. type: 'info',
  1622. message: '已取消操作',
  1623. })
  1624. })
  1625. },
  1626. // 添加处理下拉菜单命令的方法
  1627. handleDropdownCommand(command, row) {
  1628. switch (command) {
  1629. case 'editContent':
  1630. this.handleEditContent(row)
  1631. break
  1632. case 'infoMaintain':
  1633. this.handleInfoMaintain(row)
  1634. break
  1635. case 'status':
  1636. this.handleStatus(row)
  1637. break
  1638. case 'delete':
  1639. this.handleDelete(row)
  1640. break
  1641. }
  1642. },
  1643. // 删除
  1644. handleDelete(row) {
  1645. // 删除带子目录的类别,提示"请先删除所有子目录",末级目录可直接删除
  1646. if (row.children && row.children.length) {
  1647. this.$message({
  1648. type: 'warning',
  1649. message: '请先删除所有子目录!',
  1650. })
  1651. return
  1652. }
  1653. this.$confirm('确认删除该数据吗?', '删除确认', {
  1654. confirmButtonText: '确定',
  1655. cancelButtonText: '取消',
  1656. type: 'warning',
  1657. })
  1658. .then(() => {
  1659. deleteCatalog({ id: row.id })
  1660. .then(() => {
  1661. this.$message({
  1662. type: 'success',
  1663. message: '删除成功!',
  1664. })
  1665. // 重新加载数据
  1666. this.fetchData()
  1667. })
  1668. .catch(() => {
  1669. this.$message({
  1670. type: 'error',
  1671. message: '删除失败!',
  1672. })
  1673. })
  1674. })
  1675. .catch(() => {
  1676. this.$message({
  1677. type: 'info',
  1678. message: '已取消删除',
  1679. })
  1680. })
  1681. },
  1682. // 提交表单
  1683. submitForm(formName) {
  1684. if (this.submitting) return // 防止重复提交
  1685. this.$refs[formName].validate((valid) => {
  1686. if (valid) {
  1687. this.submitting = true
  1688. if (this.editForm.id) {
  1689. // 修改
  1690. editCatalogCategory(this.editForm)
  1691. .then(() => {
  1692. this.$message.success('修改成功')
  1693. this.editDialogVisible = false
  1694. this.fetchData()
  1695. })
  1696. .finally(() => {
  1697. this.submitting = false
  1698. })
  1699. } else {
  1700. // 添加
  1701. addCatalogCategory(this.editForm)
  1702. .then(() => {
  1703. this.$message.success('添加成功')
  1704. this.editDialogVisible = false
  1705. this.fetchData()
  1706. })
  1707. .finally(() => {
  1708. this.submitting = false
  1709. })
  1710. }
  1711. } else {
  1712. return false
  1713. }
  1714. })
  1715. },
  1716. // 提交内容表单
  1717. submitContentForm(formName) {
  1718. if (this.submitting) return // 防止重复提交
  1719. this.$refs[formName].validate((valid) => {
  1720. if (valid) {
  1721. let formData = {
  1722. ...this.contentForm,
  1723. }
  1724. // 确保是数组后再进行 join 操作
  1725. if (Array.isArray(formData.auditType)) {
  1726. formData.auditType = formData.auditType.join(',')
  1727. } else if (typeof formData.auditType === 'string') {
  1728. // 如果已经是字符串,则保持不变
  1729. } else {
  1730. formData.auditType = ''
  1731. }
  1732. if (Array.isArray(formData.priceLevel)) {
  1733. formData.priceLevel = formData.priceLevel.join(',')
  1734. } else if (typeof formData.priceLevel === 'string') {
  1735. // 如果已经是字符串,则保持不变
  1736. } else {
  1737. formData.priceLevel = ''
  1738. }
  1739. this.submitting = true
  1740. if (this.IsEditContent) {
  1741. // 修改
  1742. editCatalogContent(formData)
  1743. .then(() => {
  1744. this.$message.success('修改成功')
  1745. this.contentDialogVisible = false
  1746. this.fetchData()
  1747. })
  1748. .finally(() => {
  1749. this.submitting = false
  1750. this.IsEditContent = false
  1751. })
  1752. } else {
  1753. addCatalogContent(formData)
  1754. .then(() => {
  1755. this.$message.success('添加成功')
  1756. this.contentDialogVisible = false
  1757. this.fetchData()
  1758. })
  1759. .finally(() => {
  1760. this.submitting = false
  1761. this.IsEditContent = false
  1762. })
  1763. }
  1764. } else {
  1765. return false
  1766. }
  1767. })
  1768. },
  1769. // 信息维护视图相关方法
  1770. // 标签页切换
  1771. handleTabClick(tab) {
  1772. // 可添加标签页切换时的逻辑
  1773. switch (this.activeTab) {
  1774. case 'policyFiles':
  1775. this.loadPolicyFilesData()
  1776. break
  1777. case 'legalBasis':
  1778. this.loadLegalBasisData()
  1779. break
  1780. case 'costSurvey':
  1781. this.loadCostSurveyData()
  1782. break
  1783. default:
  1784. break
  1785. }
  1786. },
  1787. // 加载选项数据
  1788. async loadOptionData() {},
  1789. // 加载已关联政策文件数据
  1790. loadPolicyFilesData() {
  1791. getPolicyDoc({
  1792. catalogId: this.currentCatalogId,
  1793. page: this.policyPagination.currentPage,
  1794. pageSize: this.policyPagination.pageSize,
  1795. }).then((res) => {
  1796. this.policyFilesData = res.value.records
  1797. this.policyPagination.total = res.value.total
  1798. })
  1799. },
  1800. // 政策文件相关方法
  1801. handlePolicySelectionChange(val) {
  1802. this.selectedPolicyFiles = val
  1803. },
  1804. // 添加政策文件
  1805. handleAddPolicy() {
  1806. this.getSelectPolicyFilesData()
  1807. this.policyDialogTitle = '关联政策文件'
  1808. this.policyDialogVisible = true
  1809. },
  1810. // 获取可选择的政策文件数据
  1811. getSelectPolicyFilesData() {
  1812. const params = {
  1813. pageSize: this.selectPolicyPagination.pageSize,
  1814. pageNum: this.selectPolicyPagination.currentPage,
  1815. ...this.selectPolicySearchForm,
  1816. }
  1817. getInfoList(params).then((res) => {
  1818. this.selectPolicyFilesData = res.value.records
  1819. this.selectPolicyPagination.total = res.value.total
  1820. })
  1821. },
  1822. // 重置关联政策文件筛选
  1823. handleResetPolicy() {
  1824. this.selectPolicySearchForm = {
  1825. title: '',
  1826. documentNumber: '',
  1827. }
  1828. ;(this.selectPolicyPagination = {
  1829. currentPage: 1,
  1830. pageSize: 10,
  1831. total: 0,
  1832. }),
  1833. this.getSelectPolicyFilesData()
  1834. },
  1835. // 重置选择政策文件搜索
  1836. handleResetSelectPolicyFiles() {
  1837. this.selectPolicySearchForm = {
  1838. title: '',
  1839. documentNumber: '',
  1840. }
  1841. this.selectPolicyPagination = {
  1842. currentPage: 1,
  1843. pageSize: 10,
  1844. total: 0,
  1845. }
  1846. this.getSelectPolicyFilesData()
  1847. },
  1848. // 选择政策文件
  1849. selectPolicySelectionChange(val) {
  1850. if (val.length > 1) {
  1851. this.$message.warning('最多只能选择一个文件')
  1852. return
  1853. }
  1854. this.selectedDocFiles = val
  1855. },
  1856. // 政策文件分页切换
  1857. policyPaginationChange({ currentPage, pageSize }) {
  1858. this.policyPagination.currentPage = currentPage
  1859. this.policyPagination.pageSize = pageSize
  1860. this.loadPolicyFilesData()
  1861. },
  1862. selectPolicyPaginationChange({ currentPage, pageSize }) {
  1863. this.selectPolicyPagination.currentPage = currentPage
  1864. this.selectPolicyPagination.pageSize = pageSize
  1865. this.getSelectPolicyFilesData()
  1866. },
  1867. // 删除政策文件
  1868. handleDeletePolicy() {
  1869. if (this.selectedPolicyFiles.length === 0) {
  1870. this.$message.warning('请先选择要取消关联的文件')
  1871. return
  1872. }
  1873. this.$confirm(
  1874. `确认取消关联选中的${this.selectedPolicyFiles.length}个文件?`,
  1875. '提示',
  1876. {
  1877. confirmButtonText: '确定',
  1878. cancelButtonText: '取消',
  1879. type: 'warning',
  1880. }
  1881. )
  1882. .then(() => {
  1883. const ids = this.selectedPolicyFiles.map((row) => row.id)
  1884. unassociatePolicyDoc({ ids }).then((res) => {
  1885. this.$message.success('取消关联成功')
  1886. this.loadPolicyFilesData()
  1887. })
  1888. })
  1889. .catch(() => {
  1890. this.$message.info('已取消取消关联')
  1891. })
  1892. },
  1893. submitPolicyForm() {
  1894. if (this.selectedDocFiles.length == 1) {
  1895. associatePolicyDoc({
  1896. catalogId: this.currentCatalogId,
  1897. informationId: this.selectedDocFiles[0].id,
  1898. }).then((res) => {
  1899. if (res.code === 200) {
  1900. this.$message.success('关联成功')
  1901. this.policyDialogVisible = false
  1902. // 重新加载数据
  1903. this.loadPolicyFilesData()
  1904. }
  1905. })
  1906. } else {
  1907. this.$message.error('请选择一个文件')
  1908. }
  1909. },
  1910. // 监审对象提交资料清单相关方法
  1911. // 加载监审对象提交资料清单数据
  1912. loadLegalBasisData() {
  1913. getDocumentCatalog({
  1914. catalogId: this.currentCatalogId,
  1915. pageNum: this.legalBasisPagination.currentPage,
  1916. pageSize: this.legalBasisPagination.pageSize,
  1917. }).then((res) => {
  1918. this.legalBasisData = res.value.records
  1919. this.legalBasisPagination.total = res.value.total
  1920. })
  1921. },
  1922. // 监审对象提交资料清单分页切换
  1923. legalBasisPaginationChange({ currentPage, pageSize }) {
  1924. this.legalBasisPagination.currentPage = currentPage
  1925. this.legalBasisPagination.pageSize = pageSize
  1926. this.loadLegalBasisData()
  1927. },
  1928. // 监审对象提交资料清单选择
  1929. handleLegalSelectionChange(val) {
  1930. this.selectLegalBasis = val
  1931. },
  1932. // 添加提交资料清单
  1933. handleAddLegal() {
  1934. this.legalDialogTitle = '添加提交资料清单'
  1935. this.legalForm = {
  1936. informationType: '',
  1937. informationName: '',
  1938. formatRequired: '',
  1939. isRequired: '0',
  1940. orderNum: 1,
  1941. }
  1942. this.legalDialogVisible = true
  1943. },
  1944. // 获取模板选项
  1945. getTemplateOptions() {
  1946. allcurrentCostSurveyList({
  1947. pageNum: this.templatePagination.currentPage,
  1948. pageSize: this.templatePagination.pageSize,
  1949. }).then((res) => {
  1950. this.templateData = res.value.records
  1951. this.templatePagination.total = res.value.total
  1952. })
  1953. },
  1954. handleTemplateClick() {
  1955. this.getTemplateOptions()
  1956. this.templateDialogVisible = true
  1957. },
  1958. templatePaginationChange({ currentPage, pageSize }) {
  1959. this.templatePagination.currentPage = currentPage
  1960. this.templatePagination.pageSize = pageSize
  1961. this.getTemplateOptions()
  1962. },
  1963. templateSelectionChange(val) {
  1964. if (val.length > 1) {
  1965. this.$message.warning('最多只能选择一个模板')
  1966. return
  1967. }
  1968. this.selectTemplateData = val
  1969. },
  1970. submitTemplateForm() {
  1971. if (this.selectTemplateData.length == 1) {
  1972. this.legalForm.templateId =
  1973. this.selectTemplateData[0].surveyTemplateId
  1974. this.legalForm.surveyTemplateName =
  1975. this.selectTemplateData[0].surveyTemplateName
  1976. this.templateDialogVisible = false
  1977. } else {
  1978. this.$message.error('请选择一个模板')
  1979. }
  1980. },
  1981. // 修改提交资料清单
  1982. handleEditLegal(row) {
  1983. this.legalDialogTitle = '修改提交资料清单'
  1984. this.legalForm = JSON.parse(JSON.stringify(row))
  1985. this.legalDialogVisible = true
  1986. },
  1987. // 删除提交资料清单
  1988. handleDeleteSingleLegal(row) {
  1989. this.$confirm('确认删除该提交资料清单?', '提示', {
  1990. confirmButtonText: '确定',
  1991. cancelButtonText: '取消',
  1992. type: 'warning',
  1993. })
  1994. .then(() => {
  1995. deleteDocumentCatalog(row.id).then((res) => {
  1996. this.$message.success('删除成功')
  1997. this.loadLegalBasisData()
  1998. })
  1999. })
  2000. .catch(() => {
  2001. this.$message.info('已取消删除')
  2002. })
  2003. },
  2004. submitLegalForm(formName) {
  2005. this.$refs[formName].validate((valid) => {
  2006. if (valid) {
  2007. this.submitting = true
  2008. if (this.legalForm.id) {
  2009. updateDocumentCatalog({
  2010. catalogId: this.currentCatalogId,
  2011. ...this.legalForm,
  2012. }).then((res) => {
  2013. this.$message.success('修改成功')
  2014. this.legalDialogVisible = false
  2015. this.submitting = false
  2016. this.loadLegalBasisData()
  2017. })
  2018. } else {
  2019. addDocumentCatalog({
  2020. catalogId: this.currentCatalogId,
  2021. ...this.legalForm,
  2022. }).then((res) => {
  2023. this.$message.success('添加成功')
  2024. this.legalDialogVisible = false
  2025. this.submitting = false
  2026. this.loadLegalBasisData()
  2027. })
  2028. }
  2029. } else {
  2030. return false
  2031. }
  2032. })
  2033. },
  2034. // 成本调查表相关方法
  2035. // 加载成本调查表数据
  2036. loadCostSurveyData() {
  2037. getCostSurveyForms({
  2038. catalogId: this.currentCatalogId,
  2039. pageNum: this.costSurveyPagination.currentPage,
  2040. pageSize: this.costSurveyPagination.pageSize,
  2041. }).then((res) => {
  2042. this.costSurveyData = res.value.records
  2043. this.costSurveyPagination.total = res.value.total
  2044. })
  2045. },
  2046. // 获取成本调查表选项
  2047. getCostSurveyOptions() {
  2048. getallCurrentCostSurveyList({}).then((res) => {
  2049. this.selectCostSurveyData = res.value.records
  2050. this.selectCostSurveyPagination.total = res.value.total
  2051. })
  2052. },
  2053. handlePaginationChange({ currentPage, pageSize }) {
  2054. this.costSurveyPagination.currentPage = currentPage
  2055. this.costSurveyPagination.pageSize = pageSize
  2056. this.loadCostSurveyData()
  2057. },
  2058. selectCostSurveyPaginationChange({ currentPage, pageSize }) {
  2059. this.selectCostSurveyPagination.currentPage = currentPage
  2060. this.selectCostSurveyPagination.pageSize = pageSize
  2061. this.getCostSurveyOptions()
  2062. },
  2063. handleCostSurveySelectionChange(val) {
  2064. this.selectCostSurvey = val
  2065. },
  2066. selectCostSurveySelectionChange(val) {
  2067. if (val.length > 1) {
  2068. this.$message.warning('只能选择一个成本调查表')
  2069. return
  2070. }
  2071. this.selectCostSurveyRow = val
  2072. },
  2073. handleAddCostSurvey() {
  2074. this.getCostSurveyOptions()
  2075. this.costSurveyDialogVisible = true
  2076. },
  2077. handleDeleteCostSurvey() {
  2078. if (this.selectCostSurvey.length === 0) {
  2079. this.$message.warning('请先选择要删除的成本调查表')
  2080. return
  2081. }
  2082. this.$confirm(
  2083. `确认删除选中的${this.selectCostSurvey.length}个成本调查表?`,
  2084. '提示',
  2085. {
  2086. confirmButtonText: '确定',
  2087. cancelButtonText: '取消',
  2088. type: 'warning',
  2089. }
  2090. )
  2091. .then(() => {
  2092. cleanByIds({
  2093. ids: this.selectCostSurvey.map((item) => item.surveyId),
  2094. }).then((res) => {
  2095. this.$message.success('删除成功')
  2096. this.loadCostSurveyData()
  2097. })
  2098. })
  2099. .catch(() => {
  2100. this.$message.info('已取消删除')
  2101. })
  2102. },
  2103. submitCostSurveyForm() {
  2104. if (this.selectCostSurveyRow.length == 1) {
  2105. addCostSurvey({
  2106. catalogId: this.currentCatalogId,
  2107. surveyId: this.selectCostSurveyRow[0].surveyTemplateId,
  2108. }).then((res) => {
  2109. this.$message.success('关联成功')
  2110. this.costSurveyDialogVisible = false
  2111. this.loadCostSurveyData()
  2112. })
  2113. } else {
  2114. this.$message.warning('请选择一个成本调查表')
  2115. }
  2116. },
  2117. // 查看成本调查表内容弹窗
  2118. handleViewCostSurvey(data) {
  2119. // 设置表单数据
  2120. this.contentEditForm = {
  2121. surveyTemplateName: data.surveyTemplateName || '',
  2122. templateType: data.templateType || '',
  2123. data: data || {},
  2124. }
  2125. // 设置是否可编辑
  2126. this.contentEditDisabled =
  2127. data.disabled !== undefined ? data.disabled : true
  2128. // 设置弹窗标题
  2129. this.contentEditDialogTitle = data.title || '查看'
  2130. // 显示弹窗
  2131. this.contentEditDialogVisible = true
  2132. },
  2133. // 关闭内容编辑弹窗
  2134. handleContentEditCancel() {
  2135. this.contentEditDialogVisible = false
  2136. // 重置表单数据
  2137. this.contentEditForm = {
  2138. tableName: '',
  2139. formStyle: '单记录',
  2140. tableHeaders: [],
  2141. fixedTable: [],
  2142. dynamicTable: [],
  2143. }
  2144. },
  2145. // 文件下载方法
  2146. async handleDownloadFile(fileId) {
  2147. try {
  2148. const response = await downloadFile({ fileId })
  2149. // 创建下载链接并触发下载
  2150. const url = window.URL.createObjectURL(new Blob([response]))
  2151. const link = document.createElement('a')
  2152. link.href = url
  2153. link.setAttribute('download', `file_${fileId}`)
  2154. document.body.appendChild(link)
  2155. link.click()
  2156. document.body.removeChild(link)
  2157. } catch (error) {
  2158. console.error('文件下载失败:', error)
  2159. this.$message.error('文件下载失败')
  2160. }
  2161. },
  2162. handleSelectionChange(data) {
  2163. this.$emit('selection-change', data)
  2164. },
  2165. },
  2166. }
  2167. </script>
  2168. <style lang="scss" scoped>
  2169. @import '@/styles/costAudit.scss';
  2170. .catalog-manage-container {
  2171. padding: 20px;
  2172. .operation-bar {
  2173. margin-bottom: 20px;
  2174. }
  2175. .divider-space {
  2176. display: inline-block;
  2177. margin: 0 4px;
  2178. }
  2179. .edit-form {
  2180. padding: 0 20px;
  2181. }
  2182. }
  2183. /* 信息维护视图样式 */
  2184. .info-maintain-container {
  2185. padding: 20px;
  2186. .page-header {
  2187. margin-bottom: 10px;
  2188. display: flex;
  2189. align-items: center;
  2190. gap: 15px;
  2191. h3 {
  2192. font-size: 18px;
  2193. font-weight: 500;
  2194. color: #303133;
  2195. margin: 0;
  2196. }
  2197. }
  2198. }
  2199. </style>