discussionTab.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <!-- 集体审议内容(只读默认) -->
  3. <div class="meeting-section">
  4. <!-- 系统记录 -->
  5. <div class="system-records">
  6. <!-- <el-button
  7. v-if="!isView"
  8. style="margin-bottom: 20px"
  9. plain
  10. type="success"
  11. icon="el-icon-circle-plus"
  12. @click="addMeetingRecord"
  13. >
  14. 添加记录
  15. </el-button> -->
  16. <CostAuditTable
  17. :table-data="meetingRecords"
  18. :columns="tableColumns"
  19. :show-index="true"
  20. :border="true"
  21. style="width: 100%"
  22. :show-pagination="true"
  23. :pagination="pagination"
  24. @pagination-change="onPaginationChange"
  25. >
  26. <!-- 附件列自定义内容 -->
  27. <template #attachments="{ row }">
  28. <el-button
  29. type="text"
  30. size="small"
  31. @click="viewMeetingAttachment(row)"
  32. >
  33. 查看
  34. </el-button>
  35. </template>
  36. <!-- 操作列自定义内容 -->
  37. <template #action="{ row }">
  38. <el-button
  39. type="text"
  40. size="small"
  41. @click="handleViewMeetingRecord(row)"
  42. >
  43. 查看
  44. </el-button>
  45. <!-- <el-button v-if="!isView" :disabled="isView" type="text" size="small" @click="editMeetingRecord(row)">
  46. 修改
  47. </el-button>
  48. <el-button v-if="!isView" type="text" size="small" class="delete-btn" @click="deleteMeetingRecord(row.id)">
  49. 删除
  50. </el-button> -->
  51. </template>
  52. </CostAuditTable>
  53. </div>
  54. <!-- 集体审议记录表单 -->
  55. <el-dialog
  56. title="集体审议记录"
  57. :visible.sync="meetingDialogVisible"
  58. width="60%"
  59. class="meeting-form-section"
  60. :modal="false"
  61. append-to-body
  62. >
  63. <el-form
  64. ref="meetingForm"
  65. :model="meetingForm"
  66. label-width="120px"
  67. class="meeting-form"
  68. :disabled="isView"
  69. >
  70. <el-row :gutter="20">
  71. <el-col :span="24">
  72. <el-form-item label="审议形式">
  73. <el-input
  74. v-model="meetingForm.deliberationForm"
  75. placeholder="请填写"
  76. />
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="24">
  80. <el-form-item label="审议时间开始">
  81. <el-date-picker
  82. v-model="meetingForm.beginTime"
  83. type="datetime"
  84. placeholder="选择开始时间"
  85. style="width: 100%"
  86. format="yyyy-MM-dd HH:mm"
  87. value-format="yyyy-MM-dd HH:mm"
  88. />
  89. </el-form-item>
  90. </el-col>
  91. <el-col :span="24">
  92. <el-form-item label="审议时间结束">
  93. <el-date-picker
  94. v-model="meetingForm.endTime"
  95. type="datetime"
  96. placeholder="选择结束时间"
  97. style="width: 100%"
  98. format="yyyy-MM-dd HH:mm"
  99. value-format="yyyy-MM-dd HH:mm"
  100. />
  101. </el-form-item>
  102. </el-col>
  103. <el-col :span="24">
  104. <el-form-item label="地点">
  105. <el-input
  106. v-model="meetingForm.location"
  107. placeholder="请填写"
  108. style="width: 100%"
  109. />
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. <el-row :gutter="20">
  114. <el-col :span="12">
  115. <el-form-item label="主持人">
  116. <el-select
  117. v-model="meetingForm.hostPerson"
  118. placeholder="请选择人员"
  119. style="width: 100%"
  120. >
  121. <el-option
  122. v-for="person in personList"
  123. :key="person.id"
  124. :label="person.name"
  125. :value="person.name"
  126. ></el-option>
  127. </el-select>
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="12">
  131. <el-form-item label="记录人">
  132. <el-select
  133. v-model="meetingForm.recordPerson"
  134. placeholder="请选择人员"
  135. style="width: 100%"
  136. >
  137. <el-option
  138. v-for="person in personList"
  139. :key="person.id"
  140. :label="person.name"
  141. :value="person.name"
  142. ></el-option>
  143. </el-select>
  144. </el-form-item>
  145. </el-col>
  146. </el-row>
  147. <el-row>
  148. <el-col :span="24">
  149. <el-form-item label="参加人员">
  150. <el-input
  151. v-model="meetingForm.participants"
  152. placeholder="请填写"
  153. style="width: 100%"
  154. />
  155. </el-form-item>
  156. </el-col>
  157. </el-row>
  158. <el-row>
  159. <el-col :span="24">
  160. <el-form-item label="审议项目">
  161. <el-input
  162. v-model="meetingForm.projectName"
  163. placeholder="自动获取项目名称"
  164. style="width: 100%"
  165. disabled
  166. />
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col :span="24">
  172. <el-form-item label="监审单位id">
  173. <el-input
  174. v-model="meetingForm.enterpriseId"
  175. placeholder="自动获取监审单位id"
  176. style="width: 100%"
  177. disabled
  178. />
  179. </el-form-item>
  180. </el-col>
  181. </el-row>
  182. <el-row>
  183. <el-col :span="24">
  184. <el-form-item label="审议情况">
  185. <el-input
  186. v-model="meetingForm.deliberationContent"
  187. type="textarea"
  188. :rows="4"
  189. placeholder="填写"
  190. style="width: 100%"
  191. />
  192. </el-form-item>
  193. </el-col>
  194. </el-row>
  195. <el-row>
  196. <el-col :span="24">
  197. <el-form-item label="审议结论意见">
  198. <el-input
  199. v-model="meetingForm.conclusionOpinion"
  200. type="textarea"
  201. :rows="4"
  202. placeholder="填写"
  203. style="width: 100%"
  204. />
  205. </el-form-item>
  206. </el-col>
  207. </el-row>
  208. <el-row>
  209. <el-col :span="24">
  210. <el-form-item label="审议记录附件">
  211. <UploadComponent
  212. :upload-mode="'multiple'"
  213. :files-list="meetingAttachmentList"
  214. button-text="选择文件"
  215. :is-disabled="isView"
  216. />
  217. </el-form-item>
  218. </el-col>
  219. </el-row>
  220. </el-form>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button @click="meetingDialogVisible = false">关闭</el-button>
  223. </div>
  224. </el-dialog>
  225. </div>
  226. </template>
  227. <script>
  228. import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
  229. import UploadComponent from '@/components/costAudit/UploadComponent.vue'
  230. import { getDeliberatePageList } from '@/api/taskProgressManage'
  231. import { getCollectiveDeliberateList } from '@/api/audit/collective.js'
  232. export default {
  233. name: 'DiscussionTab',
  234. components: { CostAuditTable, UploadComponent },
  235. props: {
  236. project: { type: Object, default: () => ({}) },
  237. // 默认只读
  238. isView: { type: Boolean, default: true },
  239. },
  240. data() {
  241. return {
  242. meetingDialogVisible: false,
  243. // 集体审议相关数据
  244. meetingRecords: [],
  245. // 集体审议表单数据
  246. meetingForm: {
  247. deliberationForm: '',
  248. beginTime: '',
  249. endTime: '',
  250. location: '',
  251. hostPerson: '',
  252. recordPerson: '',
  253. participants: '',
  254. projectName: '',
  255. enterpriseId: '',
  256. deliberationContent: '',
  257. conclusionOpinion: '',
  258. attachmentName: '',
  259. attachmentIds: '',
  260. },
  261. // 附件列表
  262. meetingAttachmentList: [],
  263. // 分页相关
  264. pagination: {
  265. currentPage: 1,
  266. pageSize: 10,
  267. total: 0,
  268. },
  269. // 记录最近一次查询方式与参数(确保翻页时按相同条件重查)
  270. lastQuery: {
  271. mode: 'project', // 'project' | 'task'
  272. id: '',
  273. },
  274. // 表格列配置
  275. tableColumns: [
  276. {
  277. prop: 'deliberationForm',
  278. label: '审议形式',
  279. align: 'left',
  280. width: 100,
  281. },
  282. { prop: 'location', label: '地点', align: 'left' },
  283. { prop: 'hostPerson', label: '主持人', align: 'center', width: 120 },
  284. { prop: 'beginTime', label: '审议时间', align: 'center', width: 150 },
  285. {
  286. prop: 'attachments',
  287. label: '附件',
  288. align: 'center',
  289. width: 60,
  290. slotName: 'attachments',
  291. },
  292. {
  293. prop: 'action',
  294. label: '操作',
  295. align: 'center',
  296. width: 150,
  297. slotName: 'action',
  298. showOverflowTooltip: false,
  299. },
  300. ],
  301. // 人员选择列表(占位)
  302. personList: [
  303. { id: '1', name: '张**' },
  304. { id: '2', name: '李**' },
  305. { id: '3', name: '王**' },
  306. ],
  307. }
  308. },
  309. mounted() {
  310. this.getMeetingRecords()
  311. },
  312. methods: {
  313. addMeetingRecord() {
  314. this.meetingForm = {
  315. deliberationForm: '',
  316. beginTime: '',
  317. endTime: '',
  318. location: '',
  319. hostPerson: '',
  320. recordPerson: '',
  321. participants: '',
  322. projectName: '',
  323. enterpriseId: '',
  324. deliberationContent: '',
  325. conclusionOpinion: '',
  326. attachmentName: '',
  327. attachmentIds: '',
  328. }
  329. // 清空附件列表
  330. this.meetingAttachmentList = []
  331. this.meetingDialogVisible = true
  332. },
  333. getMeetingRecords() {
  334. const pid =
  335. (this.project && (this.project.projectId || this.project.id)) || ''
  336. if (!pid) return
  337. // 记录最近一次查询
  338. this.lastQuery = { mode: 'project', id: pid }
  339. getDeliberatePageList({
  340. projectId: pid,
  341. pageNum: this.pagination.currentPage,
  342. pageSize: this.pagination.pageSize,
  343. }).then((res) => {
  344. if (res.value && res.value.value) {
  345. this.meetingRecords = res.value.value.records || []
  346. this.pagination.total = res.value.value.total || 0
  347. }
  348. })
  349. },
  350. // 新增:按 taskId 加载集体审议记录(供父组件切换到“集体审议”时调用)
  351. loadRecordsByTask(taskId) {
  352. if (!taskId) return
  353. // 记录最近一次查询
  354. this.lastQuery = { mode: 'task', id: taskId }
  355. getCollectiveDeliberateList({
  356. pageNum: this.pagination.currentPage,
  357. pageSize: this.pagination.pageSize,
  358. taskId: taskId,
  359. }).then((res) => {
  360. const payload = res && res.value
  361. this.meetingRecords = (payload && payload.records) || []
  362. this.pagination.total = (payload && payload.total) || 0
  363. })
  364. },
  365. handleEditMeetingRecord(row) {
  366. this.meetingForm = { ...row }
  367. // 处理附件列表回显
  368. if (row.attachmentIds) {
  369. this.meetingAttachmentList = row.attachmentIds
  370. .split(',')
  371. .map((id) => ({
  372. id,
  373. fileName: row.attachmentName,
  374. status: 'success',
  375. }))
  376. } else {
  377. this.meetingAttachmentList = []
  378. }
  379. this.meetingDialogVisible = true
  380. },
  381. handleDeleteMeetingRecord(row) {},
  382. handleViewMeetingRecord(row) {
  383. this.meetingForm = { ...row }
  384. if (row.attachmentIds) {
  385. this.meetingAttachmentList = row.attachmentIds
  386. .split(',')
  387. .map((id) => ({
  388. id,
  389. fileName: row.attachmentName,
  390. status: 'success',
  391. }))
  392. } else {
  393. this.meetingAttachmentList = []
  394. }
  395. this.meetingDialogVisible = true
  396. },
  397. // 查看附件
  398. viewMeetingAttachment(row) {
  399. if (!row || !row.attachmentIds) {
  400. this.$message &&
  401. this.$message.warning &&
  402. this.$message.warning('没有附件可供查看')
  403. return
  404. }
  405. const ids = String(row.attachmentIds)
  406. .split(',')
  407. .map((s) => s && s.trim())
  408. .filter(Boolean)
  409. if (!ids.length) {
  410. this.$message &&
  411. this.$message.warning &&
  412. this.$message.warning('没有附件可供查看')
  413. return
  414. }
  415. // 逐个打开附件下载/预览链接
  416. const base = (this.$file && this.$file.downloadUrl) || ''
  417. ids.forEach((id) => {
  418. const url = base ? `${base}?fileId=${encodeURIComponent(id)}` : ''
  419. if (url) window.open(url, '_blank')
  420. })
  421. },
  422. // 统一处理分页变更(来自子组件 CostAuditTable 的 pagination-change 事件)
  423. onPaginationChange({ currentPage, pageSize }) {
  424. if (typeof currentPage === 'number') {
  425. this.pagination.currentPage = currentPage
  426. }
  427. if (typeof pageSize === 'number') {
  428. this.pagination.pageSize = pageSize
  429. }
  430. // 保持与上次查询方式一致
  431. if (this.lastQuery.mode === 'task' && this.lastQuery.id) {
  432. this.loadRecordsByTask(this.lastQuery.id)
  433. } else {
  434. this.getMeetingRecords()
  435. }
  436. },
  437. // 分页大小变化
  438. handlePageSizeChange(pageSize) {
  439. this.pagination.pageSize = pageSize
  440. this.pagination.currentPage = 1
  441. // 保持与上次查询方式一致
  442. if (this.lastQuery.mode === 'task' && this.lastQuery.id) {
  443. this.loadRecordsByTask(this.lastQuery.id)
  444. } else {
  445. this.getMeetingRecords()
  446. }
  447. },
  448. // 当前页码变化
  449. handleCurrentChange(currentPage) {
  450. this.pagination.currentPage = currentPage
  451. // 保持与上次查询方式一致
  452. if (this.lastQuery.mode === 'task' && this.lastQuery.id) {
  453. this.loadRecordsByTask(this.lastQuery.id)
  454. } else {
  455. this.getMeetingRecords()
  456. }
  457. },
  458. },
  459. }
  460. </script>
  461. <style lang="scss" scoped>
  462. @import '@/styles/costAudit.scss';
  463. </style>