audit-project-detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <audit-form-top-banner>
  3. <div :class="$style.wrapContent">
  4. <sd-detail-form
  5. ref="form"
  6. page-id="audit/project/iamAuditProject"
  7. form-id="iamAuditProject"
  8. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  9. :class="[$style.form, 'readonlyform']"
  10. >
  11. <template v-slot="{ model, fields }">
  12. <table>
  13. <tr>
  14. <sd-form-item-td name="projectTitle">
  15. <span>{{ model.projectTitle }}</span>
  16. </sd-form-item-td>
  17. <sd-form-item-td name="auditType">
  18. <span>{{ fields.auditType.attr.displayValue }}</span>
  19. </sd-form-item-td>
  20. </tr>
  21. <tr class="auditprojectdetailname">
  22. <sd-form-item-td name="projectPrincipalName" label="项目负责人">
  23. <span>{{ model.projectPrincipalName }}</span>
  24. </sd-form-item-td>
  25. <sd-form-item-td name="projectCode">
  26. <span>{{ model.projectCode }}</span>
  27. </sd-form-item-td>
  28. </tr>
  29. <tr>
  30. <sd-form-item-td name="auditedUnitNames" :colspan="3">
  31. <span>{{ model.auditedUnitNames }}</span>
  32. </sd-form-item-td>
  33. <!-- <sd-form-item-td name="auditBasis">
  34. <span>{{ fields.auditBasis.attr.displayValue }}</span>
  35. </sd-form-item-td> -->
  36. </tr>
  37. <tr>
  38. <sd-form-item-td name="auditMode">
  39. <span>{{ fields.auditMode.attr.displayValue }}</span>
  40. </sd-form-item-td>
  41. <sd-form-item-td
  42. v-if="model.auditType === '03' || model.auditType === '04'"
  43. name="auditedUser"
  44. >
  45. <span>{{ model.auditedUser }}</span>
  46. </sd-form-item-td>
  47. </tr>
  48. <tr>
  49. <sd-form-item-td v-if="model.auditMode === '02'" name="externalUnitIds" :colspan="3">
  50. <span>{{ model.externalUnitNames }}</span>
  51. </sd-form-item-td>
  52. </tr>
  53. <!-- <tr>
  54. <sd-form-item-td name="auditObjective" :colspan="3">
  55. <span>{{ model.auditObjective }}</span>
  56. </sd-form-item-td>
  57. </tr> -->
  58. <tr>
  59. <sd-form-item-td name="projectContent" :colspan="3">
  60. <span>{{ model.projectContent }}</span>
  61. </sd-form-item-td>
  62. </tr>
  63. <tr>
  64. <sd-form-item-td name="whetherFinance" :hidden="true">
  65. <span>{{ fields.whetherFinance.attr.displayValue }}</span>
  66. </sd-form-item-td>
  67. <sd-form-item-td name="whetherOverseas" :hidden="true">
  68. <span>{{ fields.whetherOverseas.attr.displayValue }}</span>
  69. </sd-form-item-td>
  70. </tr>
  71. <tr class="auditprojectdetailname">
  72. <sd-form-item-td name="whetherAuditCoverage">
  73. <span>{{ fields.whetherAuditCoverage.attr.displayValue }}</span>
  74. </sd-form-item-td>
  75. </tr>
  76. <tr>
  77. <sd-form-item-td name="planStartTime">
  78. <span>{{ fields.planStartTime.attr.displayValue }}</span>
  79. </sd-form-item-td>
  80. <sd-form-item-td name="planEndTime">
  81. <span>{{ fields.planEndTime.attr.displayValue }}</span>
  82. </sd-form-item-td>
  83. </tr>
  84. <tr>
  85. <sd-form-item-td name="planDays" :colspan="3">
  86. <span>{{ model.planDays }}</span>
  87. </sd-form-item-td>
  88. </tr>
  89. <tr>
  90. <sd-form-item-td name="groupLeaderName" label="审计组长">
  91. <span>{{ model.groupLeaderName }}</span>
  92. </sd-form-item-td>
  93. <sd-form-item-td name="projectUser" lable="项目组员">
  94. <span>{{ userMember }}</span>
  95. </sd-form-item-td>
  96. </tr>
  97. <!-- <tr>
  98. <sd-form-item-td name="exPersonnelNum">
  99. <span>{{ model.exPersonnelNum }}</span>
  100. </sd-form-item-td>
  101. <sd-form-item-td name="predictedCost">
  102. <span>{{
  103. model.predictedCost === undefined
  104. ? model.predictedCost
  105. : parseFloat(model.predictedCost).toFixed(2)
  106. }}</span>
  107. </sd-form-item-td>
  108. </tr> -->
  109. <tr>
  110. <sd-form-item-td name="attachment" :colspan="3">
  111. <template>
  112. <sd-attachment
  113. v-model="model.attachment"
  114. :group-id="JSON.parse(fields.attachment.value).value"
  115. :read-only="true"
  116. />
  117. </template>
  118. </sd-form-item-td>
  119. </tr>
  120. <tr>
  121. <sd-form-item-td name="projectRemarks" :colspan="3">
  122. <span>{{ model.projectRemarks }}</span>
  123. </sd-form-item-td>
  124. </tr>
  125. <tr>
  126. <!-- 审计通知书 -->
  127. <sd-form-item-td name="noticeId" :colspan="3" :label="'审计通知书'">
  128. <template v-slot:read-and-edit="{ editable }">
  129. <!-- <sd-attachment-ex -->
  130. <XmSdAttachmentex
  131. :key="noticeAttachmentKey"
  132. ref="noticeAttachment"
  133. v-model="model.noticeId"
  134. :group-id="groupId"
  135. :read-only="!editable"
  136. :uploadable="false"
  137. :temtype="temtype"
  138. :temdataurl="temdataurl"
  139. :is-open-file="false"
  140. :custom-select-template-fun="selectTemplate"
  141. />
  142. </template>
  143. </sd-form-item-td>
  144. </tr>
  145. </table>
  146. </template>
  147. </sd-detail-form>
  148. <a-modal
  149. :visible="visible"
  150. destroy-on-close
  151. width="800px"
  152. title="选择模板"
  153. @cancel="hiddenModal"
  154. @ok="autoTaoDaFile"
  155. >
  156. <iam-audit-notice-template-select
  157. ref="templateSelect"
  158. :project-id="projectId + ''"
  159. :template-list="templateList"
  160. ></iam-audit-notice-template-select>
  161. </a-modal>
  162. </div>
  163. </audit-form-top-banner>
  164. </template>
  165. <script>
  166. import axios from '@/common/services/axios-instance'
  167. import { Message } from 'ant-design-vue'
  168. import moment from 'moment'
  169. import loginService from '@/login/login-service'
  170. import iamAuditNoticeTemplateSelect from '../notice/iam-audit-notice-template-select.vue'
  171. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
  172. import XmAttachmentCus from '@product/iam/core/attachment/xm-attachment-cus'
  173. import XmSdAttachmentex from './xm-sd-attachment-ex.vue'
  174. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  175. import components from './_import-components/audit-project-detail-import'
  176. export default {
  177. name: 'AuditProjectDetail',
  178. metaInfo: {
  179. title: '审计项目详情',
  180. },
  181. components: {
  182. ...components,
  183. XmSdAttachmentex,
  184. iamAuditNoticeTemplateSelect,
  185. auditFormTopBanner,
  186. },
  187. data() {
  188. return {
  189. userMember: '',
  190. visible: false,
  191. temdataurl: '',
  192. templateList: [],
  193. temtype: '03',
  194. groupId: '',
  195. noticeAttachmentKey: 0,
  196. projectInfo: null, // 项目信息
  197. projectId: '',
  198. }
  199. },
  200. mounted() {
  201. // debugger
  202. axios({
  203. url:
  204. `api/xcoa-mobile/v1/iamauditproject/getProjectUserList?projectId=` +
  205. this.$route.query.record,
  206. method: 'get',
  207. }).then((res) => {
  208. this.userMember = res.data.join(',')
  209. })
  210. // 获取一个随机的附件GroupId
  211. axios({
  212. url: `api/xcoa-mobile/v1/iamauditproject/getGroupId`,
  213. method: 'get',
  214. }).then((res) => {
  215. console.log('group-Id --------------', res.data)
  216. this.groupId = res.data
  217. })
  218. },
  219. created() {
  220. // 获取模板列表
  221. if (this.$route.query.projectId) {
  222. this.projectId = this.$route.query.projectId
  223. const ini = setInterval(() => {
  224. if (this.$refs.flow) {
  225. clearInterval(ini)
  226. }
  227. })
  228. } else if (this.$route.query.record) {
  229. this.projectId = this.$route.query.record
  230. } else {
  231. return
  232. }
  233. this.temdataurl =
  234. `api/xcoa-mobile/v1/iamtemplate/findTemplate?projectId=` +
  235. this.projectId +
  236. `&templateType=` +
  237. this.temtype
  238. // 获取模板列表
  239. axios.get(this.temdataurl).then((res) => {
  240. this.templateList = res.data
  241. })
  242. // 获取项目信息
  243. axios({
  244. url: 'api/xcoa-mobile/v1/page/wp/audit/project/iamAuditProject?id=' + this.projectId,
  245. method: 'get',
  246. }).then((res) => {
  247. this.projectInfo = res.data.pageFormData.pageFieldInfos
  248. })
  249. },
  250. methods: {
  251. // 展示选择模板窗口
  252. selectTemplate() {
  253. // debugger
  254. // 获取模板列表
  255. if (this.$route.query.projectId) {
  256. this.projectId = this.$route.query.projectId
  257. } else if (this.$route.query.record) {
  258. this.projectId = this.$route.query.record
  259. }
  260. // 获取项目信息
  261. axios({
  262. url: 'api/xcoa-mobile/v1/page/wp/audit/project/iamAuditProject?id=' + this.projectId,
  263. method: 'get',
  264. }).then((res) => {
  265. this.projectInfo = res.data.pageFormData.pageFieldInfos
  266. })
  267. // 获取模板列表
  268. this.temdataurl =
  269. `api/xcoa-mobile/v1/iamtemplate/findTemplate?projectId=` +
  270. this.projectId +
  271. `&templateType=` +
  272. this.temtype
  273. axios.get(this.temdataurl).then((res) => {
  274. this.templateList = res.data
  275. this.visible = true
  276. })
  277. },
  278. // 隐藏选择模板窗口
  279. hiddenModal() {
  280. this.$refs.noticeAttachment.copyLoading = false
  281. this.visible = false
  282. },
  283. // 自动套打文档内容
  284. autoTaoDaFile() {
  285. // debugger
  286. let tmpName = null
  287. const selectTmp = this.$refs.templateSelect.checkedTemp
  288. if (!selectTmp.id) {
  289. Message.info('请选择模板', 1)
  290. } else {
  291. // 设置加载中状态
  292. this.$refs.templateSelect.spinning = true
  293. axios
  294. .get(`api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${selectTmp.attachment}`)
  295. .then((res) => {
  296. tmpName = res.data[0].name
  297. axios
  298. .post(
  299. `api/xcoa-mobile/v1/attachment-extend/attachment-copy/${res.data[0].code}/${this.$refs.noticeAttachment.groupId}?catNum=-1&fromTemplate=1`
  300. )
  301. .then((res) => {
  302. // 执行套打
  303. this.taodafile(tmpName)
  304. })
  305. })
  306. }
  307. },
  308. taodafile(fileName) {
  309. debugger
  310. const indiDocX = this.$refs.noticeAttachment
  311. // 计算套打内容
  312. const auditedUnit = this.$refs.form.getFieldValue('auditedUnitNames')
  313. let auditedText = ''
  314. auditedText = auditedUnit
  315. // auditedUnit.forEach((item) => {
  316. // auditedText += item.name
  317. // })
  318. // 项目名称
  319. // const projectTitle = this.projectInfo.find((item) => {
  320. // return item.name === 'projectTitle'
  321. // })
  322. // 找到组长及组员
  323. const userListJson = this.projectInfo.find((item) => {
  324. return item.name === 'iamProjectUserList'
  325. })
  326. const zzuser = []
  327. const fzzuser = []
  328. const zyuser = []
  329. const userList = JSON.parse(userListJson.value)
  330. userList.forEach((item) => {
  331. // 组长
  332. if (item.userType === '05') {
  333. zzuser.push(item.userName)
  334. }
  335. // 副组长
  336. if (item.userType === '01') {
  337. fzzuser.push(item.userName)
  338. }
  339. // 主审
  340. if (item.userType === '02') {
  341. zyuser.splice(0, 1, item.userName)
  342. }
  343. // 成员
  344. if (item.userType === '03') {
  345. zyuser.push(item.userName)
  346. }
  347. })
  348. // 审计机关
  349. const auditUnit = this.projectInfo.find((item) => {
  350. return item.name === 'unitName'
  351. })
  352. // 被审计人员
  353. const auditedUser = this.projectInfo.find((item) => {
  354. return item.name === 'auditedUser'
  355. })
  356. // 计划年度
  357. const planYear = this.projectInfo.find((item) => {
  358. return item.name === 'planYear'
  359. })
  360. // 审计期间开始
  361. const auditperiodStart = this.projectInfo.find((item) => {
  362. return item.name === 'auditperiodStart'
  363. })
  364. // 审计期间结束
  365. const auditperiodEnd = this.projectInfo.find((item) => {
  366. return item.name === 'auditperiodEnd'
  367. })
  368. console.log('---更新完')
  369. // 更新完附件列表之后,才自动套打
  370. indiDocX.getFileList().then((res) => {
  371. var userFile = indiDocX.slCtl.Content.Control.getFileByName(fileName)
  372. // userFile.code = userFile.Unid
  373. loginService.updateRefreshToken().then(() => {
  374. indiDocX.markBusy(fileName)
  375. indiDocX.updateActivedAtt?.(userFile.code, true)
  376. indiDocX.slCtl.Content.Control.UpdateRegion(
  377. fileName,
  378. {
  379. 审计期间开始: moment(auditperiodStart.value).format('YYYY年MM月DD日'),
  380. 审计期间开始1: moment(auditperiodStart.value).format('YYYY年MM月DD日'),
  381. 审计期间结束: moment(auditperiodEnd.value).format('YYYY年MM月DD日'),
  382. 被审计单位: auditedText,
  383. 被审计单位1: auditedText,
  384. 计划年度: planYear.value,
  385. 被审计人员: auditedUser.value,
  386. 被审计人员1: auditedUser.value,
  387. 被审计人员2: auditedUser.value,
  388. 审计组长: zzuser.join('、'),
  389. 审计副组长: fzzuser.join('、'),
  390. 审计组员: zyuser.join('、'),
  391. 编制日期: moment().format('YYYY年MM月DD日'),
  392. },
  393. '',
  394. {
  395. IsMaximization: 'false',
  396. Status: '-1',
  397. WaterMark: indiDocX.waterMark(userFile, 'UpdateRegion'),
  398. },
  399. indiDocX.pluginInfo()
  400. )
  401. ?.finally(() => {
  402. indiDocX.updateActivedAtt?.(userFile.code, false)
  403. this.hiddenModal()
  404. setTimeout(() => {
  405. indiDocX.getFileList()
  406. }, 0)
  407. indiDocX.markBusy(fileName, false)
  408. })
  409. .catch(() => {
  410. indiDocX.markBusy(userFile, false)
  411. })
  412. })
  413. })
  414. },
  415. close(flag) {
  416. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  417. window.close()
  418. },
  419. getFormFieldValue(name) {
  420. const objArry = this.$refs.form.getFieldValue(name)
  421. if (objArry !== undefined) {
  422. if (objArry.length > 0) {
  423. let result = ''
  424. objArry.forEach((e) => {
  425. result += e.name + ','
  426. })
  427. return result.substr(0, result.length - 1)
  428. }
  429. }
  430. return ''
  431. },
  432. },
  433. }
  434. </script>
  435. <style module lang="scss">
  436. @import '@/webflow/sd-flow-form.scss';
  437. .formDiv {
  438. padding: 22px;
  439. :global(.buttons_sd-detail-form_common) {
  440. :global(.ant-form-item-control-wrapper) {
  441. padding-top: 4%;
  442. padding-left: 24%;
  443. }
  444. }
  445. .tr_border {
  446. box-sizing: border-box;
  447. border-right: 1px solid #e8e8e8;
  448. border-left: 1px solid #e8e8e8;
  449. }
  450. :global(.title_sd-detail-form_common) {
  451. font-size: 1.5em;
  452. text-align: center;
  453. }
  454. :global(.buttons_sd-detail-form_common) {
  455. display: none;
  456. }
  457. }
  458. .close-btn,
  459. .save-btn {
  460. position: absolute;
  461. top: 18px;
  462. font-size: 16px;
  463. font-weight: 400;
  464. color: #fff;
  465. cursor: pointer;
  466. border: none;
  467. }
  468. .close-btn {
  469. right: 15px;
  470. }
  471. .page {
  472. height: 100%;
  473. :global(.sd-frame-main) {
  474. height: 100%;
  475. padding: 10px;
  476. overflow: auto;
  477. }
  478. }
  479. .header {
  480. background: linear-gradient(to right, #3f9bff, #0e7df6);
  481. .header-title {
  482. display: inline;
  483. font-size: 25px;
  484. font-weight: 400;
  485. color: #fff;
  486. }
  487. }
  488. .wrapContent {
  489. padding-top: 20px;
  490. }
  491. :global .auditprojectdetailname > td.ant-form-item-label > label {
  492. white-space: break-spaces !important;
  493. }
  494. </style>