index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. <template>
  2. <div class="audit-project-manage">
  3. <!-- 搜索区域 -->
  4. <div class="search-container">
  5. <el-form :inline="true" :model="searchForm" class="demo-form-inline">
  6. <el-form-item label="计划年度:">
  7. <el-date-picker
  8. v-model="searchForm.year"
  9. type="year"
  10. placeholder="请选择计划年度"
  11. format="yyyy"
  12. value-format="yyyy"
  13. ></el-date-picker>
  14. </el-form-item>
  15. <el-form-item label="地区:" prop="areaCode">
  16. <el-cascader
  17. v-model="searchForm.areaCode"
  18. :options="districtTree"
  19. :props="districtTreeCascaderProps"
  20. :show-all-levels="false"
  21. clearable
  22. placeholder="请选择地区"
  23. ></el-cascader>
  24. </el-form-item>
  25. <el-form-item label="监审项目名称:">
  26. <el-input
  27. v-model="searchForm.projectName"
  28. placeholder="请输入监审项目名称"
  29. clearable
  30. />
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button icon="el-icon-search" type="primary" @click="handleSearch">
  34. 搜索
  35. </el-button>
  36. <el-button
  37. plain
  38. type="primary"
  39. icon="el-icon-refresh"
  40. @click="handleReset"
  41. >
  42. 重置
  43. </el-button>
  44. </el-form-item>
  45. </el-form>
  46. </div>
  47. <div class="button-container">
  48. <el-button
  49. plain
  50. type="success"
  51. icon="el-icon-circle-plus"
  52. style="margin-bottom: 10px"
  53. @click="handleAdd"
  54. >
  55. 添加
  56. </el-button>
  57. </div>
  58. <!-- 数据表格 -->
  59. <el-table
  60. v-loading="loading"
  61. :data="projectList"
  62. border
  63. style="width: 100%"
  64. >
  65. <el-table-column label="序号" width="80" align="center">
  66. <template slot-scope="scope">
  67. {{ scope.$index + 1 }}
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. prop="planYear"
  72. label="计划年度"
  73. width="100"
  74. align="center"
  75. />
  76. <el-table-column
  77. prop="areaCode"
  78. label="监审地区"
  79. width="100"
  80. align="center"
  81. >
  82. <template slot-scope="scope">
  83. {{ regionNameMap[scope.row.areaCode] }}
  84. </template>
  85. </el-table-column>
  86. <el-table-column
  87. prop="projectName"
  88. label="成本监审项目名称"
  89. align="center"
  90. show-overflow-tooltip
  91. >
  92. <template slot-scope="scope">
  93. <a href="#" class="link-text" @click.prevent="handleView(scope.row)">
  94. {{ scope.row.projectName }}
  95. </a>
  96. </template>
  97. </el-table-column>
  98. <el-table-column
  99. prop="auditedUnitId"
  100. label="被监审单位"
  101. align="center"
  102. show-overflow-tooltip
  103. >
  104. <template slot-scope="scope">
  105. {{ getUnitName(scope.row.auditedUnitId) }}
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. prop="auditTime"
  110. label="监审时间"
  111. width="100"
  112. align="center"
  113. />
  114. <el-table-column
  115. prop="auditType"
  116. label="监审形式"
  117. width="100"
  118. align="center"
  119. >
  120. <template slot-scope="scope">
  121. {{ getDictName('auditType', scope.row.auditType) }}
  122. </template>
  123. </el-table-column>
  124. <el-table-column
  125. prop="orgId"
  126. label="监审主体"
  127. align="center"
  128. show-overflow-tooltip
  129. >
  130. <template slot-scope="scope">
  131. {{ orgNameMap[scope.row.orgId] }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="操作" width="180" align="center">
  135. <template slot-scope="scope">
  136. <el-button size="mini" type="text" @click="handleEdit(scope.row)">
  137. 修改
  138. </el-button>
  139. <el-button size="mini" type="text" @click="handleDelete(scope.row)">
  140. 删除
  141. </el-button>
  142. <el-button
  143. size="mini"
  144. type="text"
  145. @click="handleEstablish(scope.row)"
  146. >
  147. 立项
  148. </el-button>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. <!-- 分页 -->
  153. <div class="pagination-container">
  154. <el-pagination
  155. :current-page="pagination.currentPage"
  156. :page-sizes="[50, 100]"
  157. :page-size="pagination.pageSize"
  158. layout="total, sizes, prev, pager, next, jumper"
  159. :total="pagination.total"
  160. @size-change="handleSizeChange"
  161. @current-change="handleCurrentChange"
  162. ></el-pagination>
  163. </div>
  164. <!-- 查看/编辑/新增对话框 -->
  165. <el-dialog
  166. :title="dialogTitle"
  167. :visible.sync="dialogVisible"
  168. width="700px"
  169. z-index="8000"
  170. :close-on-click-modal="false"
  171. @close="handleDialogClose"
  172. >
  173. <div class="dialog-content">
  174. <el-form
  175. ref="projectForm"
  176. :model="currentProject"
  177. :rules="rules"
  178. label-width="140px"
  179. :disabled="dialogTitle == '查看项目'"
  180. >
  181. <el-row :gutter="20">
  182. <el-col :span="24">
  183. <el-form-item label="成本监审项目名称" prop="projectName">
  184. <el-input
  185. v-model="currentProject.projectName"
  186. placeholder="请输入成本监审项目名称"
  187. clearable
  188. />
  189. </el-form-item>
  190. </el-col>
  191. <el-col :span="24">
  192. <el-form-item label="关联成本监审目录" prop="catalogId">
  193. <CatalogCascader
  194. ref="catalogCascader"
  195. :form-item="{ placeholder: '请选择监审目录' }"
  196. style="width: 100%"
  197. :value="currentProject.catalogId"
  198. @change="handleCatalogChange"
  199. />
  200. </el-form-item>
  201. </el-col>
  202. <el-col :span="24">
  203. <el-form-item label="被监审单位" prop="auditedUnitId">
  204. <el-select
  205. v-model="currentProject.auditedUnitId"
  206. placeholder="请选择单位"
  207. clearable
  208. multiple
  209. style="width: 80%"
  210. @change="handleUnitChange"
  211. >
  212. <el-option
  213. v-for="unit in unitList"
  214. :key="unit.unitId"
  215. :label="unit.unitName"
  216. :value="unit.unitId"
  217. />
  218. </el-select>
  219. <!-- <el-input
  220. v-model="currentProject.auditedUnitName"
  221. style="width: 76%"
  222. placeholder="请输入被监审单位"
  223. readonly
  224. />
  225. <el-button
  226. type="primary"
  227. class="ml10"
  228. @click="showUnitDialog = true"
  229. >
  230. 选择单位
  231. </el-button>
  232. <UnitSelectDialog
  233. :visible.sync="showUnitDialog"
  234. @unit-selected="handleUnitSelected"
  235. /> -->
  236. <el-button
  237. type="primary"
  238. class="ml10"
  239. @click="dialogAddUnitVisible = true"
  240. >
  241. 新增单位
  242. </el-button>
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="24">
  246. <el-form-item label="计划年度" prop="planYear">
  247. <el-date-picker
  248. v-model="currentProject.planYear"
  249. style="width: 100%"
  250. type="year"
  251. placeholder="请选择计划年度"
  252. format="yyyy"
  253. value-format="yyyy"
  254. clearable
  255. ></el-date-picker>
  256. </el-form-item>
  257. </el-col>
  258. <el-col :span="24">
  259. <el-form-item label="监审时间" prop="auditTime">
  260. <el-input
  261. v-model="currentProject.auditTime"
  262. placeholder="请输入监审时间,例如:上半年/下半年"
  263. clearable
  264. ></el-input>
  265. <!-- <el-select
  266. v-model="currentProject.auditTime"
  267. style="width: 100%"
  268. placeholder="请选择监审形式"
  269. >
  270. <el-option
  271. v-for="(item, index) in auditTimeList"
  272. :key="index"
  273. :label="item.dictLabel"
  274. :value="item.dictValue"
  275. ></el-option>
  276. </el-select> -->
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="24">
  280. <el-form-item label="监审形式" prop="auditType">
  281. <el-select
  282. v-model="currentProject.auditType"
  283. style="width: 100%"
  284. placeholder="请选择监审形式"
  285. clearable
  286. >
  287. <el-option
  288. v-for="item in dictData['auditType']"
  289. :key="item.key"
  290. :label="item.name"
  291. :value="item.key"
  292. ></el-option>
  293. <!-- <el-option
  294. v-for="(item, index) in auditTypeList"
  295. :key="index"
  296. :label="item.dictLabel"
  297. :value="item.dictValue"
  298. ></el-option> -->
  299. </el-select>
  300. </el-form-item>
  301. </el-col>
  302. <!-- 监审地区 -->
  303. <el-col :span="24">
  304. <el-form-item label="监审地区" prop="areaCode">
  305. <RegionSelector
  306. :initial-area-code="currentProject.areaCode"
  307. :disabled="false"
  308. @region-change="handleRegionChange"
  309. ></RegionSelector>
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="24">
  313. <el-form-item label="监审主体" prop="orgId">
  314. <el-select
  315. v-model="currentProject.orgId"
  316. placeholder="请选择监审主体"
  317. style="width: 100%"
  318. clearable
  319. >
  320. <el-option
  321. v-for="Org in areaOrgList"
  322. :key="Org.id"
  323. :label="Org.name"
  324. :value="Org.id"
  325. />
  326. </el-select>
  327. <!-- <el-input
  328. v-model="currentProject.orgName"
  329. style="width: 76%"
  330. placeholder="请输入监审主体"
  331. readonly
  332. /> -->
  333. <!-- <el-button
  334. type="primary"
  335. class="ml10"
  336. style="width: 22%"
  337. @click="showOrgDialog = true"
  338. >
  339. 选择部门
  340. </el-button>
  341. <OrgSelectDialog
  342. :visible.sync="showOrgDialog"
  343. @org-selected="handleOrgSelected"
  344. /> -->
  345. </el-form-item>
  346. </el-col>
  347. </el-row>
  348. </el-form>
  349. </div>
  350. <div
  351. slot="footer"
  352. class="dialog-footer"
  353. style="text-align: center; display: flex; justify-content: flex-end"
  354. >
  355. <el-button
  356. v-if="dialogTitle !== '查看项目'"
  357. type="primary"
  358. @click="submitForm"
  359. >
  360. 确认
  361. </el-button>
  362. <el-button plain type="primary" @click="dialogVisible = false">
  363. {{ dialogTitle == '查看项目' ? '关闭' : '取消' }}
  364. </el-button>
  365. </div>
  366. </el-dialog>
  367. <!-- 立项弹窗 -->
  368. <EstablishmentDialog
  369. :title="dialogTitle"
  370. :visible="isEstablish"
  371. :provinces="provinces"
  372. :initial-data="establishRow"
  373. :type="3"
  374. @save="handleEstablishSave"
  375. @cancel="handleEstablishCancel"
  376. @close="handleEstablishClose"
  377. />
  378. <!-- 选择被监审单位弹窗 -->
  379. <el-dialog
  380. title="选择单位"
  381. :visible.sync="dialogUnitVisible"
  382. width="500px"
  383. @close="handleDialogClose"
  384. ></el-dialog>
  385. <!-- 新增监审单位 -->
  386. <AuditEntityFormtDialog
  387. :dialog-visible="dialogAddUnitVisible"
  388. dialog-title="新增被监审单位"
  389. :is-view-mode="isViewMode"
  390. @confirm="handleDialogSuccess"
  391. @update:dialogVisible="dialogAddUnitVisible = $event"
  392. />
  393. </div>
  394. </template>
  395. <script>
  396. import { Message, MessageBox } from 'element-ui'
  397. import RegionSelector from './RegionSelector.vue'
  398. import CatalogCascader from './CatalogCascader.vue'
  399. import EstablishmentDialog from '@/components/costAudit/EstablishmentDialog.vue'
  400. // import UnitSelectDialog from '@/components/costAudit/UnitSelectDialog.vue'
  401. // import OrgSelectDialog from '@/components/costAudit/OrgSelectDialog.vue'
  402. import AuditEntityFormtDialog from '@/components/costAudit/AuditEntityFormtDialog.vue'
  403. import {
  404. getDataList,
  405. getDetailById,
  406. addProjectApproval,
  407. delProjectApprovalById,
  408. editProjectApproval,
  409. getOrgById,
  410. getDefaultDem,
  411. getOrgListByDemId,
  412. } from '@/api/annualReviewPlan'
  413. import { getAllUnitListByRegionCode } from '@/api/auditEntityManage'
  414. import { dictMixin, regionMixin } from '@/mixins/useDict'
  415. export default {
  416. name: 'AuditProjectManage',
  417. components: {
  418. EstablishmentDialog, // 注册组件
  419. RegionSelector, //选择地区
  420. CatalogCascader, //选择监审目录级联
  421. // UnitSelectDialog, //选择被监审单位,
  422. AuditEntityFormtDialog, //新增监审单位
  423. // OrgSelectDialog, //选择监审主体
  424. },
  425. mixins: [dictMixin, regionMixin],
  426. data() {
  427. return {
  428. dictData: {
  429. auditType: [], //监审形式
  430. },
  431. loading: false,
  432. // 搜索表单
  433. searchForm: {
  434. year: '',
  435. areaCode: [],
  436. projectName: '',
  437. },
  438. // 项目列表
  439. projectList: [],
  440. // 分页信息
  441. pagination: {
  442. currentPage: 1,
  443. pageSize: 50,
  444. total: 0,
  445. },
  446. // 地区名称映射
  447. regionNameMap: {},
  448. //监审主体名称映射
  449. orgNameMap: {},
  450. //监审目录
  451. categoryList: [],
  452. OrgList: [],
  453. unitList: [],
  454. establishRow: {},
  455. currentProject: {
  456. projectName: '',
  457. catalogId: '',
  458. auditedUnitId: [],
  459. auditedUnitName: '',
  460. planYear: '',
  461. auditTime: '',
  462. auditType: '',
  463. areaCode: '',
  464. orgId: '',
  465. provinceId: '',
  466. cityId: '',
  467. districtId: '',
  468. provinceName: '',
  469. cityName: '',
  470. districtName: '',
  471. orgName: '',
  472. },
  473. areaCode: '',
  474. provinces: [],
  475. cities: [],
  476. districts: [],
  477. formCities: [],
  478. formDistricts: [],
  479. // 对话框相关
  480. dialogVisible: false,
  481. dialogTitle: '',
  482. isEdit: false,
  483. isView: false,
  484. isEstablish: false,
  485. //被监审单位
  486. dialogUnitVisible: false, //选择单位弹窗
  487. isViewMode: false,
  488. showUnitDialog: false, //选择被监审单位弹窗
  489. dialogAddUnitVisible: false, //新增被监审单位弹窗
  490. showOrgDialog: false, //选择监审主体弹窗
  491. // 表单验证规则
  492. rules: {
  493. projectName: [
  494. {
  495. required: true,
  496. message: '请输入成本监审项目名称',
  497. trigger: 'blur',
  498. },
  499. ],
  500. catalogId: [
  501. {
  502. required: true,
  503. message: '请输入关联成本监审目录',
  504. trigger: 'blur',
  505. },
  506. ],
  507. auditedUnitId: [
  508. { required: true, message: '请选择被监审单位', trigger: 'change' },
  509. ],
  510. planYear: [
  511. { required: true, message: '请选择计划年度', trigger: 'change' },
  512. ],
  513. auditTime: [
  514. { required: true, message: '请输入监审时间', trigger: 'blur' },
  515. ],
  516. auditType: [
  517. { required: true, message: '请选择监审形式', trigger: 'change' },
  518. ],
  519. // areaCode: [
  520. // { required: true, message: '请选择监审地区', trigger: 'change' },
  521. // ],
  522. orgId: [
  523. { required: true, message: '请输入监审主体', trigger: 'blur' },
  524. ],
  525. },
  526. formData: {
  527. projectName: '',
  528. catalogId: '',
  529. province: '',
  530. city: '',
  531. district: '',
  532. auditedUnit: '',
  533. auditBody: '',
  534. planYear: '',
  535. initiationType: '',
  536. auditType: '',
  537. provinceId: '',
  538. cityId: '',
  539. districtId: '',
  540. province: '',
  541. city: '',
  542. district: '',
  543. costYears: [{ value: '2022' }, { value: '2023' }, { value: '2024' }],
  544. needAudit: false,
  545. needEvaluation: false,
  546. initiationReason: '',
  547. // 修改为与图片一致的立项依据文件列表
  548. initiationBasisFiles: [
  549. { name: '太原市电力公司关于电网输配电价格调整申请表.pdf' },
  550. { name: '******依据文件.pdf' },
  551. ],
  552. // 修改为与图片一致的其他材料文件列表
  553. otherFiles: [{ name: '立项审批表.pdf' }],
  554. auditLeader: '',
  555. auditTeamMembers: '',
  556. otherRequirements: '',
  557. },
  558. establishRules: {
  559. projectName: [
  560. {
  561. required: true,
  562. message: '请输入成本监审项目名称',
  563. trigger: 'blur',
  564. },
  565. ],
  566. catalogId: [
  567. {
  568. required: true,
  569. message: '请输入关联成本监审目录',
  570. trigger: 'blur',
  571. },
  572. ],
  573. auditedUnit: [
  574. { required: true, message: '请输入被监审单位', trigger: 'blur' },
  575. ],
  576. auditBody: [
  577. { required: true, message: '请输入监审主体', trigger: 'blur' },
  578. ],
  579. planYear: [
  580. { required: true, message: '请选择计划年度', trigger: 'change' },
  581. ],
  582. initiationType: [
  583. { required: true, message: '请选择立项类型', trigger: 'change' },
  584. ],
  585. auditType: [
  586. { required: true, message: '请选择监审形式', trigger: 'change' },
  587. ],
  588. auditLeader: [
  589. {
  590. required: true,
  591. message: '请选择监审任务负责人',
  592. trigger: 'change',
  593. },
  594. ],
  595. auditTeamMembers: [
  596. {
  597. required: true,
  598. message: '请选择监审任务组成员',
  599. trigger: 'change',
  600. },
  601. ],
  602. },
  603. }
  604. },
  605. computed: {
  606. areaOrgList() {
  607. // 过滤出区域单位
  608. let user = this.$permission.getUserInfo()
  609. let arr = []
  610. if (this.$permission.isAdminOrProvince()) {
  611. // 管理员或省级权限,显示所有数据
  612. arr = this.OrgList
  613. } else {
  614. console.log('this.OrgList', this.OrgList)
  615. // 非管理员且数据范围为区域时,筛选出当前用户区域下的市区数据
  616. arr = this.OrgList
  617. }
  618. return arr
  619. },
  620. },
  621. mounted() {
  622. this.handleSearch() //加载数据
  623. this.getDefaultDem()
  624. this.getAllUnitList()
  625. },
  626. methods: {
  627. handleReset() {
  628. this.searchForm = {
  629. year: '',
  630. areaCode: [],
  631. projectName: '',
  632. }
  633. this.pagination.currentPage = 1
  634. this.handleSearch()
  635. },
  636. getAllUnitList() {
  637. getAllUnitListByRegionCode().then((res) => {
  638. this.unitList = res.value || []
  639. // 过滤掉状态为停用的数据
  640. this.unitList = this.unitList.filter((item) => item.status == 1)
  641. })
  642. },
  643. getUnitName(unitId) {
  644. // 直接处理unitId值,而不是row对象
  645. if (unitId && typeof unitId === 'string' && unitId.includes(',')) {
  646. // 如果包含逗号,分割成数组并查找对应的unitName
  647. const unitIds = unitId.split(',')
  648. return unitIds
  649. .map((id) => {
  650. const unit = this.unitList.find((item) => item.unitId == id)
  651. return unit ? unit.unitName : ''
  652. })
  653. .filter((name) => name) // 过滤空值
  654. .join(',')
  655. } else {
  656. // 单个unitId的情况
  657. const unit = this.unitList.find((item) => item.unitId == unitId)
  658. return unit ? unit.unitName : ''
  659. }
  660. },
  661. // 获取默认维度
  662. getDefaultDem() {
  663. getDefaultDem().then((res) => {
  664. if (res && res.code === 200) {
  665. const demId = res.value ? res.value.id : null
  666. if (demId) {
  667. this.getOrgListByDemId(demId)
  668. }
  669. }
  670. })
  671. },
  672. // 根据维度ID获取单位列表
  673. getOrgListByDemId(demId) {
  674. getOrgListByDemId({ demId }).then((res) => {
  675. if (res && res.code === 200) {
  676. this.OrgList = res.value || []
  677. }
  678. })
  679. },
  680. // 获取监审主体名称
  681. batchGetOrgNames() {
  682. this.projectList.forEach((row) => {
  683. const orgId = row.orgId
  684. getOrgById({ id: orgId })
  685. .then((res) => {
  686. if (res && res.value && res.value.name) {
  687. // 缓存名称
  688. this.$set(this.orgNameMap, orgId, res.value.name)
  689. }
  690. })
  691. .catch((err) => {
  692. console.error('获取监审主体名称失败', err)
  693. this.$set(this.orgNameMap, orgId, '获取失败')
  694. })
  695. .finally(() => {})
  696. })
  697. },
  698. // 处理地区选择变化
  699. handleRegionChange(region) {
  700. this.areaCode = region.code
  701. this.currentProject.areaLevel = region.level
  702. },
  703. handleSearch() {
  704. this.loading = true
  705. const params = {
  706. areaCode:
  707. this.searchForm.areaCode[this.searchForm.areaCode.length - 1] || '',
  708. planYear: this.searchForm.year,
  709. projectName: this.searchForm.projectName,
  710. page: this.pagination.currentPage,
  711. pageSize: this.pagination.pageSize,
  712. }
  713. getDataList(params)
  714. .then(async (res) => {
  715. this.loading = false
  716. this.projectList = res.rows || []
  717. this.pagination.total = res.total || 0
  718. await this.fetchRegionNames(this.projectList, 'areaCode')
  719. this.batchGetOrgNames() //获取监审主体名称
  720. })
  721. .catch((error) => {
  722. this.loading = false
  723. })
  724. },
  725. handleUnitChange(value) {
  726. // this.currentProject.auditedUnitId = value
  727. console.log('选择的被监审单位:', value)
  728. },
  729. // 处理选择被监审单位后的回调
  730. handleUnitSelected(selectedUnit) {
  731. this.currentProject.auditedUnitId = selectedUnit.unitId
  732. this.currentProject.auditedUnitName = selectedUnit.unitName
  733. },
  734. // 处理选择监审主体后的回调
  735. handleOrgSelected(selectedOrg) {
  736. console.log('选择的监审主体:', selectedOrg)
  737. this.currentProject.orgId = selectedOrg.id
  738. this.currentProject.orgName = selectedOrg.name
  739. },
  740. // 处理监审目录选择后的回调
  741. handleCatalogChange(value) {
  742. this.currentProject.catalogId = value
  743. },
  744. // 处理新增
  745. handleAdd() {
  746. this.dialogTitle = '新增年度监审项目'
  747. this.isEdit = false
  748. this.isView = false
  749. this.currentProject = {
  750. projectName: '',
  751. catalogId: '',
  752. auditedUnitId: [],
  753. auditedUnitName: '',
  754. planYear: '',
  755. auditTime: '',
  756. auditType: '',
  757. areaCode: '',
  758. orgId: '',
  759. provinceId: '',
  760. cityId: '',
  761. districtId: '',
  762. provinceName: '',
  763. cityName: '',
  764. districtName: '',
  765. }
  766. if (this.$permission.getUserInfo()) {
  767. let user = this.$permission.getUserInfo()
  768. if (user.dataScope === 0) {
  769. this.currentProject.areaCode = user.provinceCode
  770. } else if (user.dataScope === 1) {
  771. this.currentProject.areaCode = user.cityCode
  772. } else if (user.dataScope === 2) {
  773. this.currentProject.areaCode = user.countyCode
  774. }
  775. }
  776. this.dialogVisible = true
  777. },
  778. // 处理查看
  779. handleView(row) {
  780. this.dialogTitle = '查看项目'
  781. this.isView = true
  782. this.currentProject = {
  783. ...row,
  784. auditedUnitId: row.auditedUnitId ? row.auditedUnitId.split(',') : [],
  785. }
  786. this.currentProject.orgName = this.orgNameMap[row.orgId] || ''
  787. this.dialogVisible = true
  788. },
  789. // 处理编辑
  790. handleEdit(row) {
  791. this.dialogTitle = '年度监审项目维护'
  792. this.isEdit = true
  793. this.isView = false
  794. this.currentProject = {
  795. ...row,
  796. auditedUnitId: row.auditedUnitId ? row.auditedUnitId.split(',') : [],
  797. }
  798. this.currentProject.orgName = this.orgNameMap[row.orgId] || ''
  799. this.dialogVisible = true
  800. },
  801. // 处理删除
  802. handleDelete(row) {
  803. MessageBox.confirm(
  804. `确定要删除"${row.projectName}"这个监审项目吗?`,
  805. '删除确认',
  806. {
  807. confirmButtonText: '确定',
  808. cancelButtonText: '取消',
  809. type: 'warning',
  810. }
  811. )
  812. .then(() => {
  813. delProjectApprovalById(row.planId).then((res) => {
  814. if (res.code !== 200) {
  815. Message.error(res.msg || '删除失败')
  816. return
  817. }
  818. Message.success('删除成功')
  819. // 删除后刷新列表
  820. this.handleSearch()
  821. })
  822. })
  823. .catch(() => {
  824. Message.info('已取消删除')
  825. })
  826. },
  827. handleEstablishDialogClose() {},
  828. // 处理分页大小变化
  829. handleSizeChange(val) {
  830. this.pageSize = val
  831. // 这里可以添加分页逻辑
  832. },
  833. // 处理当前页变化
  834. handleCurrentChange(val) {
  835. this.currentPage = val
  836. // 这里可以添加分页逻辑
  837. },
  838. // 提交表单
  839. submitForm() {
  840. this.currentProject.areaCode =
  841. this.areaCode || this.currentProject.areaCode
  842. const data = {
  843. ...this.currentProject,
  844. auditedUnitId: this.currentProject.auditedUnitId
  845. ? this.currentProject.auditedUnitId.join(',')
  846. : '',
  847. }
  848. this.$refs.projectForm.validate((valid) => {
  849. if (valid) {
  850. if (this.currentProject.areaCode == '') {
  851. Message.error('请选择地区!')
  852. return
  853. }
  854. if (this.isEdit) {
  855. editProjectApproval(data).then((res) => {
  856. if (res.code !== 200) {
  857. Message.error(res.msg || '编辑失败')
  858. return
  859. }
  860. Message.success('编辑成功')
  861. this.handleSearch()
  862. })
  863. } else {
  864. addProjectApproval(data).then((res) => {
  865. if (res.code !== 200) {
  866. Message.error(res.msg || '新增失败')
  867. return
  868. }
  869. Message.success('新增成功')
  870. this.handleSearch()
  871. })
  872. }
  873. this.dialogVisible = false
  874. }
  875. })
  876. },
  877. // 关闭对话框时重置表单
  878. handleDialogClose() {
  879. if (this.$refs.projectForm) {
  880. this.$refs.projectForm.resetFields()
  881. }
  882. this.currentProject = {
  883. projectName: '',
  884. catalogId: '',
  885. auditedUnitId: [],
  886. auditedUnitName: '',
  887. planYear: '',
  888. auditTime: '',
  889. auditType: '',
  890. areaCode: '',
  891. orgId: '',
  892. provinceId: '',
  893. cityId: '',
  894. districtId: '',
  895. provinceName: '',
  896. cityName: '',
  897. districtName: '',
  898. }
  899. },
  900. // 立项
  901. handleEstablish(row) {
  902. this.dialogTitle = '成本监审立项'
  903. this.establishRow = row
  904. console.log('立项项目:', row)
  905. this.isEstablish = true
  906. },
  907. // 立项保存
  908. handleEstablishSave(formData) {
  909. this.isEstablish = false
  910. },
  911. // 立项取消
  912. handleEstablishCancel() {
  913. this.isEstablish = false
  914. },
  915. // 立项弹窗关闭
  916. handleEstablishClose() {
  917. this.isEstablish = false
  918. },
  919. // 新增被监审单位
  920. selectUnit() {
  921. this.dialogUnitVisible = true
  922. this.dialogTitle = '新增被监审单位'
  923. },
  924. // 新增被监审单位弹窗操作成功回调
  925. handleDialogSuccess(data, value) {
  926. this.dialogAddUnitVisible = false
  927. this.getAllUnitList()
  928. this.currentProject.auditedUnitId.push(value)
  929. this.currentProject.areaCode = data.areaCode[data.areaCode.length - 1]
  930. // this.currentProject.areaLevel = data.areaLevel
  931. },
  932. },
  933. }
  934. </script>
  935. <style lang="scss" scoped>
  936. @import '@/styles/costAudit.scss';
  937. .audit-project-manage {
  938. padding: 20px;
  939. }
  940. h2 {
  941. margin-bottom: 20px;
  942. font-size: 18px;
  943. color: #303133;
  944. }
  945. .search-container {
  946. /* padding: 10px; */
  947. border-radius: 4px;
  948. }
  949. .demo-form-inline {
  950. display: flex;
  951. align-items: center;
  952. flex-wrap: wrap;
  953. }
  954. .pagination-container {
  955. margin-top: 20px;
  956. text-align: right;
  957. }
  958. /* 对话框样式 */
  959. .dialog-content h3 {
  960. margin-bottom: 20px;
  961. font-size: 16px;
  962. color: #303133;
  963. }
  964. </style>