collectiveMain.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283
  1. <template>
  2. <div class="collective">
  3. <div class="collective-header">
  4. <div class="collective-header-left">
  5. <span>集体审议</span>
  6. </div>
  7. <div class="collective-header-right">
  8. <el-button type="primary" @click="handlePrint">补充资料</el-button>
  9. <el-button type="primary" @click="handleAddRecord">新增记录</el-button>
  10. </div>
  11. </div>
  12. <!-- 集体审议记录列表 -->
  13. <div class="collective-list">
  14. <el-table :data="recordList" style="width: 100%" border>
  15. <el-table-column
  16. type="index"
  17. label="序号"
  18. width="80"
  19. header-align="center"
  20. align="center"
  21. />
  22. <el-table-column
  23. prop="deliberationForm"
  24. label="审议形式"
  25. header-align="center"
  26. align="center"
  27. />
  28. <el-table-column
  29. prop="location"
  30. label="地点"
  31. header-align="center"
  32. align="center"
  33. />
  34. <el-table-column
  35. prop="hostPerson"
  36. label="主持人"
  37. header-align="center"
  38. align="center"
  39. />
  40. <el-table-column
  41. prop="reviewTime"
  42. label="审议时间"
  43. header-align="center"
  44. align="center"
  45. />
  46. <el-table-column
  47. prop="attachments"
  48. label="附件"
  49. width="80"
  50. header-align="center"
  51. align="center"
  52. >
  53. <template slot-scope="scope">
  54. <el-tooltip
  55. v-if="scope.row.attachments && scope.row.attachments.length > 0"
  56. content="查看附件"
  57. placement="top"
  58. >
  59. <el-button type="text" @click="handleViewAttachment(scope.row)">
  60. <i class="el-icon-document"></i>
  61. </el-button>
  62. </el-tooltip>
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. label="操作"
  67. width="120"
  68. header-align="center"
  69. align="center"
  70. >
  71. <template slot-scope="scope">
  72. <el-button type="text" @click="handleEditRecord(scope.row)">
  73. 修改
  74. </el-button>
  75. <el-button
  76. type="text"
  77. style="color: #f56c6c"
  78. @click="handleDeleteRecord(scope.row)"
  79. >
  80. 删除
  81. </el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. </div>
  86. <!-- 新增/修改集体审议记录弹窗 -->
  87. <el-dialog
  88. :title="dialogTitle"
  89. :visible.sync="showRecordDialog"
  90. width="800px"
  91. :close-on-click-modal="false"
  92. :close-on-press-escape="false"
  93. :modal="false"
  94. append-to-body
  95. >
  96. <div class="record-form">
  97. <!-- 表单行:审议形式 -->
  98. <div class="form-row">
  99. <div class="form-item">
  100. <label class="form-label required">审议形式</label>
  101. <el-input
  102. v-model="formData.deliberationForm"
  103. placeholder="请输入审议形式"
  104. class="form-input"
  105. ></el-input>
  106. </div>
  107. </div>
  108. <!-- 表单行:时间 -->
  109. <div class="form-row">
  110. <div class="form-item">
  111. <label class="form-label required">时间</label>
  112. <div class="time-picker">
  113. <el-date-picker
  114. v-model="formData.startDate"
  115. type="datetime"
  116. placeholder="开始时间"
  117. value-format="yyyy-MM-dd HH:mm"
  118. :picker-options="startDateOptions"
  119. class="date-picker"
  120. ></el-date-picker>
  121. <span class="date-range-separator">至</span>
  122. <el-date-picker
  123. v-model="formData.endDate"
  124. type="datetime"
  125. placeholder="结束时间"
  126. value-format="yyyy-MM-dd HH:mm"
  127. :picker-options="endDateOptions"
  128. class="date-picker"
  129. ></el-date-picker>
  130. </div>
  131. </div>
  132. </div>
  133. <!-- 表单行:地点 -->
  134. <div class="form-row">
  135. <div class="form-item">
  136. <label class="form-label required">地点</label>
  137. <el-input
  138. v-model="formData.location"
  139. placeholder="请输入地点"
  140. class="form-input"
  141. ></el-input>
  142. </div>
  143. </div>
  144. <!-- 表单行:主持人和记录人 -->
  145. <div class="form-row">
  146. <div class="form-item form-item-compact">
  147. <label class="form-label required">主持人</label>
  148. <el-input
  149. v-model="formData.hostPerson"
  150. placeholder="请输入参加人员"
  151. class="form-input"
  152. ></el-input>
  153. <label class="required">记录人</label>
  154. <el-input
  155. v-model="formData.recordPerson"
  156. placeholder="请输入记录人"
  157. class="form-input"
  158. ></el-input>
  159. </div>
  160. </div>
  161. <!-- 表单行:参加人员 -->
  162. <div class="form-row">
  163. <div class="form-item">
  164. <label class="form-label required">参加人员</label>
  165. <el-input
  166. v-model="formData.participants"
  167. placeholder="请输入参加人员"
  168. class="form-input"
  169. ></el-input>
  170. </div>
  171. </div>
  172. <!-- 表单行:审议项目 -->
  173. <div class="form-row">
  174. <div class="form-item">
  175. <label class="form-label">审议项目</label>
  176. <el-input
  177. v-model="formData.reviewProject"
  178. placeholder="自动获取项目名称"
  179. readonly
  180. class="form-input readonly-input"
  181. ></el-input>
  182. </div>
  183. </div>
  184. <!-- 表单行:被审单位 -->
  185. <div class="form-row">
  186. <div class="form-item">
  187. <label class="form-label">被审单位</label>
  188. <el-input
  189. v-model="formData.auditedUnit"
  190. placeholder="自动获取被审单位名称"
  191. readonly
  192. class="form-input readonly-input"
  193. ></el-input>
  194. </div>
  195. </div>
  196. <!-- 表单行:审议情况 -->
  197. <div class="form-row">
  198. <div class="form-item">
  199. <label class="form-label required">审议情况</label>
  200. <el-input
  201. v-model="formData.reviewSituation"
  202. type="textarea"
  203. :rows="5"
  204. placeholder="填写"
  205. class="form-textarea"
  206. ></el-input>
  207. </div>
  208. </div>
  209. <!-- 表单行:审议结论意见 -->
  210. <div class="form-row">
  211. <div class="form-item">
  212. <label class="form-label required">审议结论意见</label>
  213. <el-input
  214. v-model="formData.reviewConclusion"
  215. type="textarea"
  216. :rows="5"
  217. placeholder="填写"
  218. class="form-textarea"
  219. ></el-input>
  220. </div>
  221. </div>
  222. <!-- 表单行:审议记录扫描件 -->
  223. <div class="form-row">
  224. <div class="form-item">
  225. <label class="form-label required">审议记录扫描件</label>
  226. <div class="upload-file">
  227. <el-upload
  228. class="upload-demo"
  229. :auto-upload="false"
  230. :on-change="handleFileChange"
  231. :file-list="fileList"
  232. accept=".doc,.docx,.pdf"
  233. >
  234. <el-button size="small" type="primary">选择文件</el-button>
  235. <div slot="tip" class="el-upload__tip">
  236. 只能上传doc、docx、pdf格式文件
  237. </div>
  238. </el-upload>
  239. <div v-if="fileList.length > 0" class="file-name">
  240. <a
  241. :href="fileList[0].url || '#'"
  242. target="_blank"
  243. class="file-link"
  244. >
  245. {{ fileList[0].name }}
  246. </a>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <!-- 弹窗底部按钮 -->
  253. <div slot="footer" class="dialog-footer">
  254. <el-button class="cancel-btn" @click="handleCancel">取消</el-button>
  255. <el-button type="primary" class="save-btn" @click="handleSave">
  256. 保存
  257. </el-button>
  258. </div>
  259. </el-dialog>
  260. <!-- 补充资料弹窗 -->
  261. <el-dialog
  262. :visible.sync="showSupplementDialog"
  263. title="补充资料"
  264. width="600px"
  265. :modal="false"
  266. custom-class="supplement-dialog"
  267. >
  268. <div class="supplement-dialog-content">
  269. <div class="supplement-form-item">
  270. <label class="supplement-form-label required">补充意见:</label>
  271. <el-input
  272. v-model="additionalParams.content"
  273. type="textarea"
  274. :rows="6"
  275. placeholder="请输入补充意见"
  276. maxlength="500"
  277. show-word-limit
  278. class="supplement-textarea"
  279. />
  280. </div>
  281. <div class="supplement-form-item">
  282. <label class="supplement-form-label required">选择子单位:</label>
  283. <el-select
  284. v-model="additionalParams.selectedSubUnits"
  285. multiple
  286. collapse-tags
  287. placeholder="请选择子单位"
  288. class="supplement-select"
  289. filterable
  290. >
  291. <el-option
  292. v-for="unit in subUnitList"
  293. :key="unit.id"
  294. :label="unit.name"
  295. :value="unit.id"
  296. />
  297. </el-select>
  298. </div>
  299. <div class="supplement-form-item">
  300. <label class="supplement-form-label required">发送方式:</label>
  301. <el-checkbox-group v-model="additionalParams.sendType">
  302. <el-checkbox label="site">站内消息</el-checkbox>
  303. <el-checkbox label="sms">短信通知</el-checkbox>
  304. </el-checkbox-group>
  305. </div>
  306. </div>
  307. <div slot="footer" class="supplement-dialog-footer">
  308. <el-button @click="showSupplementDialog = false">取消</el-button>
  309. <el-button type="primary" @click="submitSupplement">发送</el-button>
  310. </div>
  311. </el-dialog>
  312. </div>
  313. </template>
  314. <script>
  315. import {
  316. addCollectiveDeliberate,
  317. updateCollectiveDeliberate,
  318. deleteCollectiveDeliberate,
  319. getCollectiveDeliberateList,
  320. getSubUnitList,
  321. } from '@/api/audit/collective'
  322. import { getReviewTask } from '@/api/audit/reviewTask'
  323. export default {
  324. name: 'CollectiveMain',
  325. components: {},
  326. props: {
  327. visible: {
  328. type: Boolean,
  329. default: true,
  330. },
  331. id: {
  332. type: [String, Number],
  333. default: null,
  334. },
  335. currentNode: {
  336. type: String,
  337. default: '',
  338. },
  339. currentStatus: {
  340. type: String,
  341. default: '',
  342. },
  343. },
  344. data() {
  345. return {
  346. // 记录列表数据
  347. recordList: [],
  348. // 弹窗显示状态
  349. showRecordDialog: false,
  350. showSupplementDialog: false,
  351. // 表单数据
  352. formData: {
  353. id: '',
  354. deliberationForm: '',
  355. startDate: '',
  356. endDate: '',
  357. location: '',
  358. hostPerson: '',
  359. recordPerson: '',
  360. participants: '',
  361. reviewProject: '',
  362. auditedUnit: '',
  363. reviewSituation: '',
  364. reviewConclusion: '',
  365. attachments: [],
  366. },
  367. // 文件列表
  368. fileList: [],
  369. // 当前操作类型:add/edit
  370. operationType: 'add',
  371. // 补充资料弹窗数据
  372. additionalParams: {
  373. content: '',
  374. sendType: [],
  375. selectedSubUnits: [],
  376. },
  377. // 子单位列表
  378. subUnitList: [],
  379. // 模拟用户列表数据
  380. userList: [
  381. { id: 1, name: '张三' },
  382. { id: 2, name: '李四' },
  383. { id: 3, name: '王五' },
  384. ],
  385. // 开始时间选择器选项
  386. startDateOptions: {
  387. disabledDate: (time) => {
  388. if (this.formData.endDate) {
  389. return time.getTime() > new Date(this.formData.endDate).getTime()
  390. }
  391. return false
  392. },
  393. disabledTime: (date) => {
  394. if (this.formData.endDate) {
  395. const endDate = new Date(this.formData.endDate)
  396. if (
  397. date.getFullYear() === endDate.getFullYear() &&
  398. date.getMonth() === endDate.getMonth() &&
  399. date.getDate() === endDate.getDate()
  400. ) {
  401. return {
  402. disabledHours: () => {
  403. const hours = []
  404. const endHour = endDate.getHours()
  405. for (let i = endHour + 1; i < 24; i++) {
  406. hours.push(i)
  407. }
  408. return hours
  409. },
  410. disabledMinutes: (selectedHour) => {
  411. if (selectedHour === endHour) {
  412. const minutes = []
  413. const endMinute = endDate.getMinutes()
  414. for (let i = endMinute + 1; i < 60; i++) {
  415. minutes.push(i)
  416. }
  417. return minutes
  418. }
  419. return []
  420. },
  421. }
  422. }
  423. }
  424. return {}
  425. },
  426. },
  427. // 结束时间选择器选项
  428. endDateOptions: {
  429. disabledDate: (time) => {
  430. if (this.formData.startDate) {
  431. return (
  432. time.getTime() < new Date(this.formData.startDate).getTime()
  433. )
  434. }
  435. return time.getTime() < Date.now() - 8.64e7 // 禁止选择过去的日期
  436. },
  437. disabledTime: (date) => {
  438. if (this.formData.startDate) {
  439. const startDate = new Date(this.formData.startDate)
  440. if (
  441. date.getFullYear() === startDate.getFullYear() &&
  442. date.getMonth() === startDate.getMonth() &&
  443. date.getDate() === startDate.getDate()
  444. ) {
  445. return {
  446. disabledHours: () => {
  447. const hours = []
  448. const startHour = startDate.getHours()
  449. for (let i = 0; i < startHour; i++) {
  450. hours.push(i)
  451. }
  452. return hours
  453. },
  454. disabledMinutes: (selectedHour) => {
  455. if (selectedHour === startHour) {
  456. const minutes = []
  457. const startMinute = startDate.getMinutes()
  458. for (let i = 0; i < startMinute; i++) {
  459. minutes.push(i)
  460. }
  461. return minutes
  462. }
  463. return []
  464. },
  465. }
  466. }
  467. }
  468. return {}
  469. },
  470. },
  471. }
  472. },
  473. computed: {
  474. dialogTitle() {
  475. return this.operationType === 'add'
  476. ? '新增集体审议记录'
  477. : '修改集体审议记录'
  478. },
  479. },
  480. mounted() {
  481. this.loadRecordList()
  482. this.getProjectInfo()
  483. },
  484. methods: {
  485. // 加载记录列表
  486. loadRecordList() {
  487. // 调用API获取集体审议记录列表
  488. const queryParams = {
  489. taskId: this.id, // 使用props传入的id作为项目ID
  490. }
  491. getCollectiveDeliberateList(queryParams)
  492. .then((res) => {
  493. if (res && res.state && res.code === 200) {
  494. // 根据新的接口返回格式,从res.value中获取数据
  495. const data = res.value.records || []
  496. // 处理返回的数据,转换为前端表格需要的格式
  497. this.recordList = Array.isArray(data)
  498. ? data.map((item) => ({
  499. id: item.id,
  500. deliberationForm: item.deliberationForm,
  501. location: item.location,
  502. hostPerson: item.hostPerson,
  503. recordPerson: item.recordPerson,
  504. reviewTime: item.beginTime,
  505. attachments: item.attachmentIds
  506. ? item.attachmentIds.split(',').map((attachmentId) => ({
  507. name: `附件_${attachmentId}`,
  508. url: '#', // 实际应该根据附件ID获取完整URL
  509. }))
  510. : [],
  511. }))
  512. : []
  513. } else {
  514. this.$message.error(res.message || '获取记录列表失败')
  515. // 如果API调用失败,使用模拟数据
  516. this.recordList = []
  517. }
  518. })
  519. .catch((error) => {
  520. this.$message.error('获取记录列表失败:' + error.message)
  521. // 错误时使用模拟数据
  522. })
  523. },
  524. // 获取项目信息
  525. getProjectInfo() {
  526. // 模拟获取项目信息,实际应该调用API
  527. this.formData.reviewProject = 'XX项目成本监审'
  528. this.formData.auditedUnit = 'XX有限公司'
  529. },
  530. // 补充资料
  531. handlePrint() {
  532. this.additionalParams = {
  533. content: '',
  534. sendType: [],
  535. selectedSubUnits: [],
  536. }
  537. this.loadSubUnitList()
  538. this.showSupplementDialog = true
  539. },
  540. // 加载子单位列表
  541. async loadSubUnitList() {
  542. if (!this.id) {
  543. return
  544. }
  545. try {
  546. const res = await getSubUnitList({ taskId: this.id })
  547. if (res && res.code === 200 && res.value) {
  548. this.subUnitList = Array.isArray(res.value)
  549. ? res.value.map((item) => ({
  550. id: item.id || item.unitId,
  551. name: item.name || item.unitName,
  552. taskId: item.taskId || item.childTaskId, // 保存子任务ID
  553. }))
  554. : []
  555. } else {
  556. this.subUnitList = []
  557. }
  558. } catch (error) {
  559. console.error('获取子单位列表失败:', error)
  560. this.subUnitList = []
  561. }
  562. },
  563. // 提交补充资料
  564. async submitSupplement() {
  565. // 验证补充意见
  566. if (
  567. !this.additionalParams.content ||
  568. !this.additionalParams.content.trim()
  569. ) {
  570. this.$message.error('请输入补充意见')
  571. return
  572. }
  573. // 验证任务ID
  574. if (!this.id) {
  575. this.$message.error('缺少任务ID')
  576. return
  577. }
  578. // 验证选择子单位
  579. if (
  580. !this.additionalParams.selectedSubUnits ||
  581. this.additionalParams.selectedSubUnits.length === 0
  582. ) {
  583. this.$message.error('请选择子单位')
  584. return
  585. }
  586. // 验证发送方式
  587. if (
  588. !this.additionalParams.sendType ||
  589. this.additionalParams.sendType.length === 0
  590. ) {
  591. this.$message.error('请选择发送方式')
  592. return
  593. }
  594. try {
  595. // 转换发送方式:site -> 1, sms -> 2
  596. const sendTypeMap = {
  597. site: '1',
  598. sms: '2',
  599. }
  600. const sendTypeStr = this.additionalParams.sendType
  601. .map((type) => sendTypeMap[type])
  602. .filter(Boolean)
  603. .join(',')
  604. // 获取子任务ID(选中的子单位ID)
  605. const childTaskId = this.additionalParams.selectedSubUnits.join(',')
  606. const params = {
  607. taskId: this.id,
  608. processNodeKey: this.currentNode || '',
  609. key: 1,
  610. sendType: sendTypeStr,
  611. content: this.additionalParams.content,
  612. childTaskId: childTaskId,
  613. }
  614. const response = await getReviewTask(params)
  615. if (response && response.code === 200) {
  616. this.$message.success(response.message || '补充资料发送成功')
  617. // 关闭弹窗
  618. this.showSupplementDialog = false
  619. // 重置表单数据
  620. this.additionalParams = {
  621. content: '',
  622. sendType: [],
  623. selectedSubUnits: [],
  624. }
  625. } else {
  626. this.$message.error(response?.message || '补充资料发送失败')
  627. }
  628. } catch (error) {
  629. console.error('补充资料发送失败:', error)
  630. this.$message.error('补充资料发送失败')
  631. }
  632. },
  633. // 新增记录
  634. handleAddRecord() {
  635. this.operationType = 'add'
  636. this.resetForm()
  637. this.showRecordDialog = true
  638. },
  639. // 编辑记录
  640. handleEditRecord(row) {
  641. this.operationType = 'edit'
  642. // 复制数据到表单
  643. this.formData = {
  644. id: row.id,
  645. deliberationForm: row.deliberationForm,
  646. location: row.location,
  647. // 解析时间,实际应该根据API返回格式处理
  648. startDate: row.reviewTime,
  649. endDate: row.reviewTime,
  650. hostPerson: row.hostPerson,
  651. recordPerson: row.recordPerson,
  652. participants: '',
  653. reviewProject: this.formData.reviewProject,
  654. auditedUnit: this.formData.auditedUnit,
  655. reviewSituation: '',
  656. reviewConclusion: '',
  657. attachments: row.attachments || [],
  658. }
  659. // 设置文件列表
  660. this.fileList = row.attachments
  661. ? row.attachments.map((file) => ({
  662. name: file.name,
  663. url: file.url,
  664. uid: file.name,
  665. }))
  666. : []
  667. this.showRecordDialog = true
  668. },
  669. // 删除记录
  670. handleDeleteRecord(row) {
  671. this.$confirm('确定要删除这条记录吗?', '删除确认', {
  672. confirmButtonText: '确定',
  673. cancelButtonText: '取消',
  674. type: 'warning',
  675. })
  676. .then(() => {
  677. // 调用API进行删除操作
  678. deleteCollectiveDeliberate(row.id)
  679. .then((res) => {
  680. if (res && res.state && res.code === 200) {
  681. this.$message.success('删除成功')
  682. this.loadRecordList() // 重新加载记录列表
  683. } else {
  684. this.$message.error(res.message || '删除失败')
  685. }
  686. })
  687. .catch((error) => {
  688. this.$message.error('删除失败:' + error.message)
  689. })
  690. })
  691. .catch(() => {
  692. this.$message.info('已取消删除')
  693. })
  694. },
  695. // 查看附件
  696. handleViewAttachment(row) {
  697. if (row.attachments && row.attachments.length > 0) {
  698. // 打开附件链接
  699. window.open(row.attachments[0].url, '_blank')
  700. }
  701. },
  702. // 文件改变处理
  703. handleFileChange(file, fileList) {
  704. this.fileList = fileList.slice(-1) // 只保留最新选择的文件
  705. },
  706. // 保存记录
  707. handleSave() {
  708. // 表单验证
  709. if (!this.formData.deliberationForm) {
  710. this.$message.error('请输入审议形式')
  711. return
  712. }
  713. if (!this.formData.location) {
  714. this.$message.error('请输入地点')
  715. return
  716. }
  717. if (!this.formData.startDate || !this.formData.endDate) {
  718. this.$message.error('请选择时间')
  719. return
  720. }
  721. if (!this.formData.hostPerson) {
  722. this.$message.error('请选择主持人')
  723. return
  724. }
  725. if (!this.formData.recordPerson) {
  726. this.$message.error('请选择记录人')
  727. return
  728. }
  729. // 构建保存数据,按照接口要求的参数格式
  730. const saveData = {
  731. id: this.formData.id,
  732. taskId: this.id, // 使用props传入的id作为项目ID
  733. deliberationForm: this.formData.deliberationForm,
  734. beginTime: this.formData.startDate,
  735. endTime: this.formData.endDate,
  736. location: this.formData.location,
  737. hostPerson: this.formData.hostPerson,
  738. recordPerson: this.formData.recordPerson,
  739. participants: this.formData.participants,
  740. enterpriseId: '', // 需要从项目信息中获取监审单位id
  741. deliberationContent: this.formData.reviewSituation,
  742. conclusionOpinion: this.formData.reviewConclusion,
  743. attachmentIds: this.fileList
  744. .map((file) => file.uid || file.name)
  745. .join(','), // 附件ID集合,多个用逗号分隔
  746. remark: '', // 备注
  747. }
  748. // 调用API进行保存操作
  749. if (this.operationType === 'add') {
  750. // 添加新记录
  751. addCollectiveDeliberate(saveData)
  752. .then((res) => {
  753. if (res && res.state && res.code === 200) {
  754. this.$message.success('新增成功')
  755. this.loadRecordList() // 重新加载记录列表
  756. this.showRecordDialog = false
  757. this.resetForm()
  758. } else {
  759. this.$message.error(res.message || '新增失败')
  760. }
  761. })
  762. .catch((error) => {
  763. this.$message.error('新增失败:' + error.message)
  764. })
  765. } else {
  766. // 更新现有记录
  767. updateCollectiveDeliberate(saveData)
  768. .then((res) => {
  769. if (res && res.state && res.code === 200) {
  770. this.$message.success('修改成功')
  771. this.loadRecordList() // 重新加载记录列表
  772. this.showRecordDialog = false
  773. this.resetForm()
  774. } else {
  775. this.$message.error(res.message || '修改失败')
  776. }
  777. })
  778. .catch((error) => {
  779. this.$message.error('修改失败:' + error.message)
  780. })
  781. }
  782. },
  783. // 取消操作
  784. handleCancel() {
  785. this.showRecordDialog = false
  786. this.resetForm()
  787. },
  788. // 重置表单
  789. resetForm() {
  790. this.formData = {
  791. id: '',
  792. deliberationForm: '',
  793. startDate: '',
  794. endDate: '',
  795. location: '',
  796. hostPerson: '',
  797. recordPerson: '',
  798. participants: '',
  799. reviewProject: this.formData.reviewProject, // 保持项目信息不变
  800. auditedUnit: this.formData.auditedUnit, // 保持单位信息不变
  801. reviewSituation: '',
  802. reviewConclusion: '',
  803. attachments: [],
  804. }
  805. this.fileList = []
  806. },
  807. },
  808. }
  809. </script>
  810. <style scoped>
  811. /* 主容器样式 */
  812. .collective {
  813. padding: 10px;
  814. font-family: 'Microsoft YaHei', sans-serif;
  815. }
  816. /* 页面头部样式 */
  817. .collective-header {
  818. display: flex;
  819. justify-content: space-between;
  820. align-items: center;
  821. margin-bottom: 20px;
  822. padding: 5px 0;
  823. }
  824. .collective-header-left span {
  825. font-size: 18px;
  826. font-weight: bold;
  827. color: #333;
  828. }
  829. /* 列表容器样式 */
  830. .collective-list {
  831. margin-top: 15px;
  832. border: 1px solid #ebeef5;
  833. border-radius: 4px;
  834. overflow: hidden;
  835. }
  836. /* 表单容器样式 */
  837. .record-form {
  838. padding: 20px 0 0;
  839. background: #fff;
  840. }
  841. /* 表单行样式 */
  842. .form-row {
  843. display: flex;
  844. margin-bottom: 20px;
  845. align-items: flex-start;
  846. min-height: 40px;
  847. }
  848. /* 表单项样式 */
  849. .form-item {
  850. flex: 1;
  851. margin-right: 20px;
  852. position: relative;
  853. display: flex;
  854. align-items: center;
  855. }
  856. /* 紧凑表单项目,减小间距 */
  857. .form-item-compact {
  858. margin-right: 20px; /* 减小右侧间距 */
  859. width: calc(50% - 10px); /* 调整宽度以适应紧凑布局 */
  860. }
  861. .form-item:last-child {
  862. margin-right: 0;
  863. }
  864. /* 表单标签样式 */
  865. .form-label {
  866. display: inline-block;
  867. width: 120px;
  868. text-align: right;
  869. margin-right: 10px;
  870. font-weight: 500;
  871. color: #303133;
  872. font-size: 14px;
  873. line-height: 32px;
  874. vertical-align: middle;
  875. flex-shrink: 0;
  876. }
  877. /* 必填项标记 */
  878. .form-label.required::before {
  879. content: '*';
  880. color: #f56c6c;
  881. margin-right: 4px;
  882. }
  883. /* 表单输入框样式 */
  884. .form-input {
  885. flex: 1;
  886. max-width: 600px;
  887. }
  888. /* 只读输入框样式 */
  889. .readonly-input {
  890. background-color: #f5f7fa;
  891. color: #909399;
  892. cursor: not-allowed;
  893. }
  894. /* 表单选择器样式 */
  895. .form-select {
  896. width: 200px;
  897. }
  898. /* 表单文本域样式 */
  899. .form-textarea {
  900. flex: 1;
  901. max-width: 600px;
  902. }
  903. /* 时间选择器容器样式 */
  904. .time-picker {
  905. display: flex;
  906. align-items: center;
  907. flex-wrap: wrap;
  908. flex: 1;
  909. max-width: 400px;
  910. }
  911. /* 日期选择器样式 */
  912. .date-picker {
  913. width: 180px;
  914. }
  915. /* 日期范围分隔符 */
  916. .date-range-separator {
  917. margin: 0 10px;
  918. color: #606266;
  919. font-size: 14px;
  920. }
  921. /* 文件上传样式 */
  922. .upload-file {
  923. display: flex;
  924. flex-direction: column;
  925. flex: 1;
  926. max-width: 400px;
  927. }
  928. /* 文件名称样式 */
  929. .file-name {
  930. margin-top: 10px;
  931. padding: 5px 0;
  932. word-break: break-all;
  933. }
  934. /* 文件链接样式 */
  935. .file-link {
  936. color: #409eff;
  937. text-decoration: none;
  938. font-size: 14px;
  939. }
  940. .file-link:hover {
  941. text-decoration: underline;
  942. color: #66b1ff;
  943. }
  944. /* 对话框样式优化 */
  945. ::v-deep .el-dialog__header {
  946. padding: 20px 25px 15px;
  947. border-bottom: 1px solid #ebeef5;
  948. background-color: #fafafa;
  949. }
  950. ::v-deep .el-dialog__title {
  951. font-size: 16px;
  952. font-weight: 500;
  953. color: #303133;
  954. }
  955. ::v-deep .el-dialog__body {
  956. padding: 25px;
  957. max-height: 60vh;
  958. overflow-y: auto;
  959. }
  960. ::v-deep .el-dialog__footer {
  961. padding: 15px 25px 20px;
  962. border-top: 1px solid #ebeef5;
  963. margin-top: 10px;
  964. background-color: #fafafa;
  965. }
  966. /* 按钮样式优化 */
  967. .cancel-btn {
  968. margin-right: 15px;
  969. }
  970. .save-btn {
  971. min-width: 80px;
  972. }
  973. /* 表格样式优化 */
  974. ::v-deep .el-table th {
  975. background-color: #f5f7fa;
  976. font-weight: 500;
  977. color: #606266;
  978. border-right: 1px solid #ebeef5;
  979. }
  980. ::v-deep .el-table td {
  981. color: #606266;
  982. border-right: 1px solid #ebeef5;
  983. }
  984. /* 输入框样式优化 */
  985. ::v-deep .el-input__inner,
  986. ::v-deep .el-select .el-input__inner,
  987. ::v-deep .el-date-editor .el-input__inner {
  988. border-radius: 4px;
  989. transition: all 0.3s;
  990. height: 32px;
  991. line-height: 32px;
  992. }
  993. ::v-deep .el-input__inner:hover,
  994. ::v-deep .el-select .el-input__inner:hover,
  995. ::v-deep .el-date-editor .el-input__inner:hover {
  996. border-color: #c0c4cc;
  997. }
  998. ::v-deep .el-input__inner:focus,
  999. ::v-deep .el-select .el-input__inner:focus,
  1000. ::v-deep .el-date-editor .el-input__inner:focus {
  1001. border-color: #409eff;
  1002. outline: none;
  1003. }
  1004. /* 多行文本域样式 */
  1005. ::v-deep .el-textarea__inner {
  1006. resize: vertical;
  1007. border-radius: 4px;
  1008. min-height: 100px;
  1009. padding: 8px 12px;
  1010. }
  1011. /* 响应式设计 */
  1012. @media (max-width: 768px) {
  1013. .collective {
  1014. padding: 5px;
  1015. }
  1016. .collective-header {
  1017. flex-direction: column;
  1018. align-items: flex-start;
  1019. gap: 10px;
  1020. }
  1021. .form-row {
  1022. flex-direction: column;
  1023. margin-bottom: 15px;
  1024. }
  1025. .form-item {
  1026. margin-right: 0;
  1027. margin-bottom: 15px;
  1028. flex-direction: column;
  1029. align-items: flex-start;
  1030. }
  1031. .form-item:last-child {
  1032. margin-bottom: 0;
  1033. }
  1034. .form-label {
  1035. width: 100%;
  1036. text-align: left;
  1037. margin-bottom: 5px;
  1038. line-height: 1.5;
  1039. }
  1040. .form-input,
  1041. .form-select,
  1042. .form-textarea,
  1043. .time-picker,
  1044. .upload-file {
  1045. width: 100%;
  1046. max-width: none;
  1047. }
  1048. .date-picker {
  1049. width: 100%;
  1050. }
  1051. ::v-deep .el-dialog {
  1052. width: 95% !important;
  1053. margin: 5% auto;
  1054. max-width: 600px;
  1055. }
  1056. ::v-deep .el-dialog__header,
  1057. ::v-deep .el-dialog__body,
  1058. ::v-deep .el-dialog__footer {
  1059. padding: 15px;
  1060. }
  1061. ::v-deep .el-dialog__body {
  1062. max-height: 70vh;
  1063. }
  1064. .time-picker {
  1065. flex-direction: column;
  1066. align-items: stretch;
  1067. gap: 10px;
  1068. }
  1069. .date-range-separator {
  1070. display: none;
  1071. }
  1072. .dialog-footer {
  1073. text-align: center;
  1074. }
  1075. .cancel-btn,
  1076. .save-btn {
  1077. margin: 0 5px;
  1078. }
  1079. }
  1080. /* 补充资料弹窗样式优化 */
  1081. ::v-deep .supplement-dialog {
  1082. .el-dialog__header {
  1083. padding: 20px 25px 15px;
  1084. border-bottom: 1px solid #ebeef5;
  1085. background-color: #fafafa;
  1086. }
  1087. .el-dialog__title {
  1088. font-size: 16px;
  1089. font-weight: 500;
  1090. color: #303133;
  1091. }
  1092. .el-dialog__body {
  1093. padding: 25px;
  1094. }
  1095. .el-dialog__footer {
  1096. padding: 15px 25px 20px;
  1097. border-top: 1px solid #ebeef5;
  1098. background-color: #fafafa;
  1099. text-align: right;
  1100. }
  1101. }
  1102. .supplement-dialog-content {
  1103. padding: 0;
  1104. }
  1105. .supplement-form-item {
  1106. display: flex;
  1107. align-items: flex-start;
  1108. margin-bottom: 20px;
  1109. }
  1110. .supplement-form-item:last-child {
  1111. margin-bottom: 0;
  1112. }
  1113. .supplement-form-label {
  1114. display: inline-block;
  1115. width: 100px;
  1116. text-align: left;
  1117. color: #606266;
  1118. font-size: 14px;
  1119. line-height: 32px;
  1120. flex-shrink: 0;
  1121. margin-right: 12px;
  1122. }
  1123. .supplement-form-label.required::before {
  1124. content: '*';
  1125. color: #f56c6c;
  1126. margin-right: 4px;
  1127. }
  1128. .supplement-textarea {
  1129. flex: 1;
  1130. }
  1131. .supplement-select {
  1132. flex: 1;
  1133. min-width: 300px;
  1134. }
  1135. .supplement-checkbox-group {
  1136. display: flex;
  1137. flex-direction: column;
  1138. flex: 1;
  1139. }
  1140. .supplement-checkbox-group .el-checkbox {
  1141. margin-bottom: 8px;
  1142. }
  1143. .supplement-checkbox-group .el-checkbox:last-child {
  1144. margin-bottom: 0;
  1145. }
  1146. .supplement-dialog-footer {
  1147. text-align: right;
  1148. }
  1149. .supplement-dialog-footer .el-button {
  1150. margin-left: 10px;
  1151. }
  1152. /* 打印样式 */
  1153. @media print {
  1154. .collective {
  1155. padding: 0;
  1156. }
  1157. .collective-header-right {
  1158. display: none;
  1159. }
  1160. ::v-deep .el-button {
  1161. display: none;
  1162. }
  1163. ::v-deep .el-dialog {
  1164. box-shadow: none !important;
  1165. margin: 0 !important;
  1166. width: 100% !important;
  1167. }
  1168. ::v-deep .el-dialog__header,
  1169. ::v-deep .el-dialog__footer {
  1170. display: none;
  1171. }
  1172. ::v-deep .el-dialog__body {
  1173. padding: 0;
  1174. overflow: visible;
  1175. }
  1176. }
  1177. </style>