index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <div class="audit-task-deployment-container">
  3. <div v-if="activeView === 'list'">
  4. <!-- 搜索区域 -->
  5. <div class="search-container">
  6. <el-form :inline="true" :model="searchForm" class="search-form">
  7. <el-form-item label="年度:">
  8. <el-date-picker
  9. v-model="searchForm.projectYear"
  10. type="year"
  11. placeholder="请选择年度"
  12. format="yyyy"
  13. value-format="yyyy"
  14. ></el-date-picker>
  15. </el-form-item>
  16. <el-form-item label="监审项目名称:">
  17. <el-input
  18. v-model="searchForm.projectName"
  19. placeholder="请输入监审项目名称"
  20. style="width: 300px"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button
  25. icon="el-icon-search"
  26. type="primary"
  27. @click="handleSearch"
  28. >
  29. 搜索
  30. </el-button>
  31. <el-button
  32. plain
  33. type="primary"
  34. icon="el-icon-refresh"
  35. @click="handleReset"
  36. >
  37. 重置
  38. </el-button>
  39. </el-form-item>
  40. </el-form>
  41. </div>
  42. <!-- 数据表格 -->
  43. <div class="table-container">
  44. <CostAuditTable
  45. :table-data="taskList"
  46. :columns="tableColumns"
  47. :show-index="true"
  48. :show-pagination="true"
  49. :pagination="pagination"
  50. @pagination-change="handlePaginationChange"
  51. >
  52. <template #projectName="{ row }">
  53. <span class="link-text" @click="handleView(row)">
  54. {{ row.projectName }}
  55. </span>
  56. </template>
  57. <template #auditedUnitId="{ row }">
  58. {{ getUnitName(row.auditedUnitId) }}
  59. </template>
  60. <template #status="{ row }">
  61. {{ row.status | statusFilter }}
  62. </template>
  63. <template #action="{ row }">
  64. <el-button
  65. v-if="row.status != '2'"
  66. type="text"
  67. @click="handleTaskFormulate(row)"
  68. >
  69. 任务制定
  70. </el-button>
  71. <el-button
  72. v-if="row.status != '2'"
  73. type="text"
  74. @click="handleTaskPublish(row)"
  75. >
  76. 任务发布
  77. </el-button>
  78. <el-button type="text" @click="handleView(row)">查看</el-button>
  79. <el-button type="text " @click="handleMemo(row)">备忘录</el-button>
  80. </template>
  81. </CostAuditTable>
  82. </div>
  83. </div>
  84. <div v-if="activeView === 'taskFormulate'">
  85. <taskFormulate
  86. :project="project"
  87. :is-view="isView"
  88. @backToList="handleBackToList"
  89. ></taskFormulate>
  90. </div>
  91. <!-- 任务发布弹窗 -->
  92. <el-dialog
  93. title="任务发布"
  94. :visible.sync="publishDialogVisible"
  95. width="30%"
  96. :before-close="handleClosePublishDialog"
  97. >
  98. <el-form
  99. ref="publishForm"
  100. :model="publishForm"
  101. label-width="150px"
  102. style="margin-top: 20px"
  103. :rules="publishFormRules"
  104. >
  105. <el-form-item label="被监审单位:" prop="auditedUnitName">
  106. <el-input
  107. v-model="publishForm.auditedUnitName"
  108. placeholder="请输入被监审单位"
  109. style="width: 100%"
  110. disabled
  111. ></el-input>
  112. </el-form-item>
  113. <el-form-item label="监审组人员:" prop="auditGroup">
  114. <el-select
  115. v-model="publishForm.auditGroup"
  116. placeholder="请选择成员"
  117. style="width: 100%"
  118. multiple
  119. >
  120. <el-option
  121. v-for="(item, index) in userList"
  122. :key="index"
  123. :label="item.fullname"
  124. :value="item.userId"
  125. ></el-option>
  126. </el-select>
  127. </el-form-item>
  128. <el-form-item label="监审任务发布通知:" prop="content">
  129. <el-input
  130. v-model="publishForm.content"
  131. type="textarea"
  132. rows="6"
  133. placeholder="请输入监审任务发布通知"
  134. style="width: 100%"
  135. ></el-input>
  136. </el-form-item>
  137. <el-form-item label="发送方式:" prop="sendType">
  138. <el-checkbox-group v-model="publishForm.sendType" style="width: 100%">
  139. <el-checkbox label="1" style="margin-right: 20px">
  140. 站内消息
  141. </el-checkbox>
  142. <el-checkbox label="2">短信通知</el-checkbox>
  143. </el-checkbox-group>
  144. </el-form-item>
  145. </el-form>
  146. <div slot="footer" class="dialog-footer">
  147. <el-button type="primary" @click="confirmTaskPublish">确认</el-button>
  148. <el-button @click="handleClosePublishDialog">取消</el-button>
  149. </div>
  150. </el-dialog>
  151. </div>
  152. </template>
  153. <script>
  154. import { Message } from 'element-ui'
  155. import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
  156. import taskFormulate from './tabs.vue'
  157. import { publishCostProjectApproval } from '@/api/auditInitiation'
  158. import { getAllUnitList } from '@/api/auditEntityManage'
  159. import { taskMixin } from './index.js'
  160. import { getAllUserList } from '@/api/uc'
  161. import {
  162. getData,
  163. getDataList,
  164. getDetail,
  165. getDetailById,
  166. delProjectApprovalById,
  167. addProjectApproval,
  168. editProjectApproval,
  169. delProjectApproval,
  170. } from '@/api/auditInitiation'
  171. export default {
  172. name: 'TaskCustomizedRelease',
  173. components: {
  174. CostAuditTable,
  175. taskFormulate,
  176. },
  177. filters: {
  178. statusFilter(value) {
  179. if (!value) return ''
  180. switch (value) {
  181. case '1':
  182. return '未发布'
  183. case '2':
  184. return '已发布'
  185. default:
  186. return '未知状态'
  187. }
  188. },
  189. },
  190. mixins: [taskMixin],
  191. data() {
  192. return {
  193. activeView: 'list',
  194. isView: false,
  195. // 搜索表单
  196. searchForm: {
  197. projectYear: '',
  198. projectName: '',
  199. },
  200. //被监审单位主体名称映射
  201. UnitNameMap: {},
  202. // 任务列表数据
  203. taskList: [],
  204. // 分页信息
  205. pagination: {
  206. currentPage: 1,
  207. pageSize: 50,
  208. total: 0,
  209. },
  210. project: {},
  211. // 任务发布弹窗相关
  212. publishDialogVisible: false,
  213. selectedTask: null,
  214. publishForm: {
  215. auditedUnit: '',
  216. auditTeam: '',
  217. noticeContent: '',
  218. sendType: ['1', '2'],
  219. },
  220. publishFormRules: {
  221. content: [
  222. {
  223. required: true,
  224. message: '请输入任务发布通知',
  225. trigger: 'blur',
  226. },
  227. ],
  228. sendType: [
  229. {
  230. required: true,
  231. message: '请选择发送方式',
  232. trigger: 'blur',
  233. },
  234. ],
  235. },
  236. userList: [],
  237. unitList: [],
  238. }
  239. },
  240. computed: {
  241. tableColumns() {
  242. return [
  243. {
  244. prop: 'projectYear',
  245. label: '立项年度',
  246. width: 120,
  247. align: 'center',
  248. formatter: (row) => `${row.projectYear}年`,
  249. },
  250. {
  251. prop: 'projectName',
  252. label: '成本监审项目名称',
  253. slotName: 'projectName',
  254. },
  255. {
  256. prop: 'auditedUnitId',
  257. label: '被监审单位',
  258. slotName: 'auditedUnitId',
  259. },
  260. {
  261. prop: 'auditPeriod',
  262. label: '监审期间',
  263. align: 'center',
  264. },
  265. {
  266. prop: 'sourceType',
  267. label: '立项来源',
  268. align: 'center',
  269. formatter: (row) => {
  270. return this.getDictName('projectProposal', row.sourceType)
  271. },
  272. },
  273. {
  274. prop: 'auditType',
  275. label: '监审形式',
  276. align: 'center',
  277. formatter: (row) => {
  278. return this.getDictName('auditType', row.auditType)
  279. },
  280. },
  281. {
  282. prop: 'status',
  283. label: '任务状态',
  284. width: 100,
  285. align: 'center',
  286. slotName: 'status',
  287. },
  288. {
  289. prop: 'action',
  290. label: '操作',
  291. width: 300,
  292. align: 'center',
  293. slotName: 'action',
  294. },
  295. ]
  296. },
  297. },
  298. mounted() {
  299. this.handleSearch()
  300. },
  301. methods: {
  302. // 获取用户信息
  303. getUser() {
  304. getAllUserList().then((res) => {
  305. this.userList = res.value || []
  306. })
  307. },
  308. getAllUnitList() {
  309. getAllUnitList().then((res) => {
  310. this.unitList = res.value || []
  311. // 过滤掉状态为停用的数据
  312. // this.unitList = this.unitList.filter((item) => item.status == 1)
  313. })
  314. },
  315. getUnitName(unitId) {
  316. // 直接处理unitId值,而不是row对象
  317. if (unitId && typeof unitId === 'string' && unitId.includes(',')) {
  318. // 如果包含逗号,分割成数组并查找对应的unitName
  319. const unitIds = unitId.split(',')
  320. return unitIds
  321. .map((id) => {
  322. const unit = this.unitList.find((item) => item.unitId == id)
  323. return unit ? unit.unitName : '无'
  324. })
  325. .filter((name) => name) // 过滤空值
  326. .join(',')
  327. } else {
  328. // 单个unitId的情况
  329. const unit = this.unitList.find((item) => item.unitId == unitId)
  330. return unit ? unit.unitName : '无'
  331. }
  332. },
  333. // 查询
  334. handleSearch() {
  335. getDataList({
  336. ...this.searchForm,
  337. pageNum: this.pagination.currentPage,
  338. pageSize: this.pagination.pageSize,
  339. }).then((res) => {
  340. this.taskList = res.value.value.records
  341. this.pagination.total = res.value.value.total
  342. this.getAllUnitList()
  343. })
  344. },
  345. handleReset() {
  346. this.searchForm = {
  347. projectYear: '',
  348. projectName: '',
  349. }
  350. this.pagination.currentPage = 1
  351. this.pagination.pageSize = 10
  352. this.handleSearch()
  353. },
  354. // 任务制定
  355. handleTaskFormulate(row) {
  356. this.activeView = 'taskFormulate'
  357. this.isView = false
  358. this.project = {
  359. ...row,
  360. auditedUnitName: this.UnitNameMap[row.auditedUnitId],
  361. }
  362. },
  363. // 任务发布 - 打开弹窗
  364. handleTaskPublish(row) {
  365. this.getUser()
  366. this.selectedTask = row
  367. // 初始化表单数据
  368. this.publishForm = {
  369. projectId: row.projectId || '',
  370. auditedUnit: row.auditedUnit || '',
  371. auditedUnitName: this.UnitNameMap[row.auditedUnitId] || '',
  372. auditGroup: row.projectMembers ? row.projectMembers.split(',') : [],
  373. content: `${row.projectYear}年${row.projectName}已发布,请及时办理。`,
  374. sendType: row.sendType ? row.sendType.split(',') : [],
  375. }
  376. this.publishDialogVisible = true
  377. },
  378. // 关闭任务发布弹窗
  379. handleClosePublishDialog() {
  380. this.publishDialogVisible = false
  381. this.selectedTask = null
  382. },
  383. // 确认任务发布
  384. confirmTaskPublish() {
  385. publishCostProjectApproval({
  386. projectId: this.publishForm.projectId,
  387. auditGroup: this.publishForm.auditGroup.join(','),
  388. content: this.publishForm.content,
  389. sendType: this.publishForm.sendType.join(','),
  390. }).then(() => {
  391. Message.success('任务发布成功')
  392. this.publishDialogVisible = false
  393. this.selectedTask = null
  394. // 刷新列表
  395. this.handleSearch()
  396. })
  397. },
  398. // 查看
  399. handleView(row) {
  400. this.activeView = 'taskFormulate'
  401. this.isView = true
  402. this.project = {
  403. ...row,
  404. }
  405. },
  406. // 备忘录
  407. handleMemo(row) {
  408. this.$router.push({
  409. name: 'memoManage',
  410. // params: { projectId: project.id }
  411. })
  412. },
  413. // 分页变化事件处理
  414. handlePaginationChange({ currentPage, pageSize }) {
  415. this.pagination.currentPage = currentPage
  416. this.pagination.pageSize = pageSize
  417. this.handleSearch()
  418. },
  419. handleBackToList() {
  420. this.activeView = 'list'
  421. this.isView = false
  422. this.handleSearch()
  423. },
  424. },
  425. }
  426. </script>
  427. <style scoped lang="scss">
  428. @import '@/styles/costAudit.scss';
  429. .audit-task-deployment-container {
  430. padding: 20px;
  431. }
  432. </style>