index.vue 30 KB

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