mtx-process-list.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  1. <template>
  2. <div :class="[$style.wrapHeight, $style.processlist]">
  3. <div :class="$style.rowHeight">
  4. <mtx-process-catalog-tree
  5. ref="icmatrixCatalogTree"
  6. :key="key"
  7. show-line
  8. top-node-text="内控矩阵"
  9. :is-select-dep="true"
  10. manager-type="view"
  11. :history="this.$route.query.history ? true : false"
  12. :hisv="this.$route.query.history ? this.$route.query.version : null"
  13. :hisorg="this.$route.query.history ? this.$route.query.orgId : null"
  14. :hisorgn="this.$route.query.history ? this.$route.query.orgName : null"
  15. @treeSelect="treeSelect"
  16. @depChanged="depChanged"
  17. @getManagedHorg="getManagedHorg"
  18. ></mtx-process-catalog-tree>
  19. <div :class="$style.rightcard">
  20. <a-card>
  21. <!-- 高级搜索组件 -->
  22. <audit-advanced-query
  23. :expand="expand"
  24. :search-data="formData"
  25. :ref-name="searchform"
  26. :search-style="{ height: '210px', left: '20px', top: '57px' }"
  27. :search-fun="handleSearch"
  28. @searchedClick="searchedClick"
  29. @resetForm="resetForm"
  30. >
  31. <template>
  32. <a-col :span="12">
  33. <a-form-model-item label="控制措施名称" prop="measureName">
  34. <a-input v-model="formData.measureName" allow-clear />
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :span="12">
  38. <a-form-model-item :label="'\u2002\u2002\u2002\u2002控制级别'" prop="controlLevel">
  39. <sd-select v-model="formData.controlLevel" :options="levels" />
  40. </a-form-model-item>
  41. </a-col>
  42. <a-col :span="12">
  43. <a-form-model-item :label="'\u2002\u2002\u2002\u2002控制类型'" prop="controlType">
  44. <sd-select v-model="formData.controlType" :options="types" />
  45. </a-form-model-item>
  46. </a-col>
  47. <a-col :span="12">
  48. <a-form-model-item label="控制发生频率" prop="controlFrequency">
  49. <sd-select v-model="formData.controlFrequency" :options="frequencys" />
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :span="12">
  53. <a-form-model-item :label="'\u2002\u2002\u2002\u2002控制方式'" prop="controlWay">
  54. <sd-select v-model="formData.controlWay" :options="ways" />
  55. </a-form-model-item>
  56. </a-col>
  57. </template>
  58. </audit-advanced-query>
  59. <sd-data-table-ex
  60. :key="key"
  61. ref="icMtxMeasure"
  62. :data-url="`api/xcoa-mobile/v1/icmtxmeasure/findIcMtxMeasures`"
  63. :editnode="true"
  64. form-id="icMtxMeasure"
  65. page-id="ic/measure/icMtxMeasure"
  66. :columns="columns"
  67. :actions="actions"
  68. show-selection
  69. :show-advance-query="true"
  70. :filter-expressions="expressions"
  71. :search-fields="['measureName']"
  72. :custom-delete-fun="deleteRows"
  73. @searchbtnClick="searchbtnClick"
  74. >
  75. <div slot="islink" slot-scope="text, record">
  76. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  77. </div>
  78. </sd-data-table-ex>
  79. <mtx-process-export-modal
  80. :visible="visible"
  81. @import="fnimportresult"
  82. ></mtx-process-export-modal>
  83. </a-card>
  84. <sd-detail-modal
  85. ref="versionform"
  86. :record-id="versionId ? versionId : null"
  87. :read-only="vfreadonly"
  88. page-id="ic/version/icMtxVersion"
  89. :modal-props="{ width: 1200 }"
  90. @save="msave"
  91. @actionBtnClick="actionBtnClick"
  92. >
  93. <template v-slot="{ model, fields }">
  94. <table>
  95. <colgroup>
  96. <col style="width: 20%;" />
  97. <col style="width: 30%;" />
  98. <col style="width: 20%;" />
  99. <col style="width: 30%;" />
  100. </colgroup>
  101. <tr v-show="!vfreadonly"
  102. ><td class="ant-form-item-label ant-form-item-label">
  103. <label title="操作类型" class=""> 操作类型 </label>
  104. </td>
  105. <a-radio-group
  106. v-model="versiontype"
  107. :disabled="versionId ? false : true"
  108. @change="versiontypeChange"
  109. >
  110. <a-radio :value="'修改当前版本'">修改当前版本 </a-radio>
  111. <a-radio :value="'新增新版本'">新增新版本 </a-radio>
  112. </a-radio-group></tr
  113. >
  114. <tr
  115. ><sd-form-item-td
  116. name="belongUnitName"
  117. :input-props="{ defaultValue: orgName, disabled: true }"
  118. ></sd-form-item-td
  119. ><sd-form-item-td v-if="initDateSelect(model)" name="year">
  120. <a-select
  121. v-if="!vfreadonly"
  122. v-model="model.year"
  123. :disabled="versiontype === '修改当前版本' ? true : false"
  124. >
  125. <a-select-option v-for="year in yearArry" :key="year + ''">
  126. {{ year }}
  127. </a-select-option>
  128. </a-select>
  129. </sd-form-item-td>
  130. </tr>
  131. <tr v-show="false"
  132. ><sd-form-item-td name="belongUnitCode"></sd-form-item-td>
  133. <sd-form-item-td
  134. name="belongUnitId"
  135. :input-props="{ defaultValue: orgId }"
  136. ></sd-form-item-td>
  137. </tr>
  138. <tr v-show="false"
  139. ><sd-form-item-td name="auditOrgId"></sd-form-item-td>
  140. <sd-form-item-td name="modifyDeptId"></sd-form-item-td>
  141. </tr>
  142. <tr v-show="false"
  143. ><sd-form-item-td name="modifyDeptCode"></sd-form-item-td>
  144. <sd-form-item-td name="modifyDeptName"></sd-form-item-td>
  145. </tr>
  146. <tr
  147. ><sd-form-item-td name="versionCode">
  148. <template>
  149. <span>{{ model.versionCode }}</span>
  150. </template> </sd-form-item-td
  151. ><sd-form-item-td name="versionType"
  152. ><template>
  153. <span>当前版本</span>
  154. </template>
  155. </sd-form-item-td>
  156. </tr>
  157. <tr
  158. ><sd-form-item-td
  159. :col-span="3"
  160. name="matrixType"
  161. component="a-select"
  162. :input-props="{
  163. disabled: versiontype === '修改当前版本' || !zsgsflag ? true : false,
  164. }"
  165. ></sd-form-item-td>
  166. </tr>
  167. <tr
  168. ><sd-form-item-td :colspan="3" name="matrixDesc">
  169. <a-textarea v-if="!vfreadonly" v-model="model.matrixDesc" :rows="3" />
  170. <span v-else>{{ model.matrixDesc }}</span>
  171. </sd-form-item-td></tr
  172. >
  173. <tr
  174. ><sd-form-item-td name="creatorName"></sd-form-item-td
  175. ><sd-form-item-td name="creationTime"></sd-form-item-td></tr
  176. ></table>
  177. </template>
  178. </sd-detail-modal>
  179. <sd-detail-modal
  180. ref="catalogform"
  181. :read-only="true"
  182. :record-id="catarecordId"
  183. page-id="ic/process/icMtxProcess"
  184. :modal-props="{ width: 1200 }"
  185. >
  186. <template v-slot="{ model, fields }">
  187. <sd-form-item name="prcCode">{{ model.prcCode }}</sd-form-item>
  188. <sd-form-item name="prcName">{{ model.prcName }}</sd-form-item>
  189. <sd-form-item name="prcDesc">
  190. {{ model.prcDesc }}
  191. </sd-form-item>
  192. <sd-form-item name="isEnd">{{
  193. getDisplayVaule(fields.isEnd, model.isEnd)
  194. }}</sd-form-item>
  195. <sd-form-item name="attachment">
  196. <template v-slot:read-and-edit="{ editable }">
  197. <sd-attachment
  198. v-model="model.attachment"
  199. :group-id="JSON.parse(fields.attachment.value).value"
  200. :read-only="true"
  201. />
  202. </template>
  203. </sd-form-item>
  204. <sd-form-item name="sortNum">{{ model.sortNum }}</sd-form-item>
  205. </template>
  206. </sd-detail-modal>
  207. </div>
  208. </div>
  209. </div>
  210. </template>
  211. <script>
  212. import PageService from '@/common/services/page-service'
  213. import { Modal, message } from 'ant-design-vue'
  214. import { getComponentSpec } from '@/common/components/sd-form'
  215. import axios from '@/common/services/axios-instance'
  216. import download from '@/common/services/download'
  217. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  218. import openAsTrustId from '@/common/services/open-as-trust-id'
  219. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  220. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  221. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  222. import auditPermissionTreeService from '../../components/audit-permission-tree-service'
  223. import mtxProcessExportModal from './mtx-process-export-modal'
  224. import mtxProcessCatalogTree from './mtx-process-catalog-tree'
  225. import MtxProcessService from './mtx-process-service'
  226. import components from './_import-components/mtx-process-list-import'
  227. export default {
  228. name: 'MtxProcessList',
  229. metaInfo: {
  230. title: '内控矩阵',
  231. },
  232. components: {
  233. ...components,
  234. mtxProcessCatalogTree,
  235. auditAdvancedQuery,
  236. mtxProcessExportModal,
  237. },
  238. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  239. data() {
  240. return {
  241. formId: 'icMtxMeasure',
  242. orgId: null,
  243. orgName: '',
  244. yearArry: [],
  245. editnode: true, // 列表是否可以新建
  246. key: 0,
  247. treeData: [],
  248. searchform: 'searchform',
  249. formData: {
  250. measureName: '',
  251. controlLevel: '',
  252. controlType: '',
  253. controlFrequency: '',
  254. controlWay: '',
  255. },
  256. columns: [
  257. {
  258. title: '序号',
  259. customRender: (text, record, index) => `${index + 1}`,
  260. width: '80px',
  261. },
  262. {
  263. title: '控制措施名称',
  264. dataIndex: 'measureName',
  265. scopedSlots: { customRender: 'islink' },
  266. },
  267. {
  268. title: '控制措施编号',
  269. dataIndex: 'measureCode',
  270. },
  271. {
  272. title: '控制级别',
  273. dataIndex: 'controlLevel',
  274. width: '90px',
  275. },
  276. {
  277. title: '控制类型',
  278. dataIndex: 'controlType',
  279. width: '90px',
  280. },
  281. {
  282. title: '控制方式',
  283. dataIndex: 'controlWay',
  284. width: '90px',
  285. },
  286. {
  287. title: '责任部门',
  288. dataIndex: 'dutyDeptName',
  289. width: '90px',
  290. },
  291. {
  292. title: '责任岗位',
  293. dataIndex: 'responPosition',
  294. width: '90px',
  295. },
  296. ],
  297. actions: [],
  298. actionsf: [
  299. {
  300. label: '版本设置',
  301. id: 'versionset',
  302. permission: null,
  303. class: 'ant-btn-primary',
  304. callback: () => {
  305. this.vfreadonly = false
  306. this.createversion()
  307. },
  308. index: 8,
  309. },
  310. ],
  311. actionss: [
  312. {
  313. label: '版本查看',
  314. id: 'versionsee',
  315. permission: null,
  316. class: 'ant-btn-primary',
  317. callback: () => {
  318. // const url = '/sd-frame/mtx-version-list' // 新页面要打开的路由地址
  319. // openAsTrustId(url, null)
  320. this.vfreadonly = true
  321. this.createversion()
  322. },
  323. index: 7,
  324. },
  325. {
  326. label: '分类查看',
  327. id: 'catalogview',
  328. // permission: 'iamAuditMatters-catalog',
  329. permission: null,
  330. callback: () => {
  331. this.opencatalog()
  332. },
  333. index: 6,
  334. },
  335. {
  336. label: '分类配置',
  337. id: 'auditMattersCatalog',
  338. // permission: 'iamAuditMatters-catalog',
  339. permission: null,
  340. callback: () => {
  341. const url =
  342. '/sd-frame/mtx-process-catalog?versionId=' +
  343. this.versionId +
  344. '&history=1&orgId=' +
  345. this.orgId +
  346. '&orgName=' +
  347. this.orgName // 新页面要打开的路由地址
  348. openAsTrustId(url, null)
  349. // window.open(url, '_blank')
  350. },
  351. index: 5,
  352. },
  353. {
  354. label: '删除',
  355. id: 'delete',
  356. permission: null,
  357. class: 'batch',
  358. callback: this.deleteRows,
  359. index: 3,
  360. },
  361. {
  362. label: '导入',
  363. id: 'importItem',
  364. // permission: 'iamAuditMatters-import',
  365. permission: null,
  366. callback: this.importItem, // 纯前端操作,不需要权限控制
  367. index: 2,
  368. },
  369. {
  370. label: '导出',
  371. id: 'exportItem',
  372. // permission: 'iamAuditMatters-export',
  373. permission: null,
  374. callback: this.exportItem, // 纯前端操作,不需要权限控制
  375. index: 1,
  376. },
  377. ],
  378. actionsn: [
  379. {
  380. label: '新建',
  381. id: 'new',
  382. // type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  383. class: 'ant-btn-primary',
  384. // permission: 'iamAuditMatters-create', // 纯前端操作,不需要权限控制//只有最后一个结束分类的节点才可以新建事项
  385. permission: null,
  386. callback: this.createMtxmeasure,
  387. index: 4,
  388. },
  389. ],
  390. actionsview: [
  391. {
  392. label: '版本查看',
  393. id: 'versionsee',
  394. permission: null,
  395. class: 'ant-btn-primary',
  396. callback: () => {
  397. // const url = '/sd-frame/mtx-version-list' // 新页面要打开的路由地址
  398. // openAsTrustId(url, null)
  399. this.vfreadonly = true
  400. this.createversion()
  401. },
  402. index: 7,
  403. },
  404. {
  405. label: '分类查看',
  406. id: 'catalogview',
  407. // permission: 'iamAuditMatters-catalog',
  408. permission: null,
  409. callback: () => {
  410. this.opencatalog()
  411. },
  412. index: 6,
  413. },
  414. {
  415. label: '导出',
  416. id: 'exportItem',
  417. // permission: 'iamAuditMatters-export',
  418. permission: null,
  419. callback: this.exportItem, // 纯前端操作,不需要权限控制
  420. index: 1,
  421. },
  422. ],
  423. expressions: [
  424. { dataType: 'str', name: 'isRoot', op: 'eq', stringValue: 'true' },
  425. {
  426. dataType: 'long',
  427. name: 'mtxPrcId',
  428. op: 'eq',
  429. longValue: 0,
  430. },
  431. { dataType: 'long', name: 'mtxVersionId', op: 'eq', longValue: this.versionId },
  432. ],
  433. catalogId: null,
  434. catalogName: '',
  435. auditMattersPath: '',
  436. visible: false,
  437. versionId: null,
  438. history: this.$route.query.history ? this.$route.query.history : null,
  439. vfreadonly: false,
  440. versiontype: '新增新版本',
  441. flag: false,
  442. levels: [],
  443. types: [],
  444. frequencys: [],
  445. ways: [],
  446. orgPermission: [],
  447. catarecordId: null,
  448. formflag: true,
  449. zsgslist: [], // 直属公司列表
  450. zsgsflag: false,
  451. historyYear: null, // 历史年份
  452. }
  453. },
  454. mounted() {
  455. // 初始化数据字典信息
  456. this.initDictionaryInfo()
  457. },
  458. methods: {
  459. // 操作类型修改时候
  460. versiontypeChange(val) {
  461. if (val.target.value === '新增新版本') {
  462. this.historyYear = this.$refs.versionform.getFieldValue('year')
  463. } else {
  464. this.$refs.versionform.setFieldValue('year', this.historyYear)
  465. }
  466. },
  467. getDisplayVaule(field, text) {
  468. if (getComponentSpec(field).getDisplayValue) {
  469. if (typeof text !== 'undefined' && text !== null) {
  470. const value = getComponentSpec(field).parseBackendValue?.(text) || text
  471. return getComponentSpec(field).getDisplayValue(value)
  472. } else {
  473. return ''
  474. }
  475. }
  476. return text
  477. },
  478. getManagedHorg(data) {
  479. this.orgPermission = data
  480. },
  481. initDictionaryInfo() {
  482. axios({
  483. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CONTROL_LEVEL',
  484. method: 'get',
  485. }).then((res) => {
  486. if (res.status === 200) {
  487. this.levels = res.data
  488. }
  489. })
  490. axios({
  491. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CONTROL_TYPE',
  492. method: 'get',
  493. }).then((res) => {
  494. if (res.status === 200) {
  495. this.types = res.data
  496. }
  497. })
  498. axios({
  499. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CONTROL_FREQUENCY',
  500. method: 'get',
  501. }).then((res) => {
  502. if (res.status === 200) {
  503. this.frequencys = res.data
  504. }
  505. })
  506. axios({
  507. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=CONTROL_WAY',
  508. method: 'get',
  509. }).then((res) => {
  510. if (res.status === 200) {
  511. this.ways = res.data
  512. }
  513. })
  514. const params = {
  515. moduleId: 'iamOrg2',
  516. }
  517. auditPermissionTreeService.getCategoryTree(0, params).then((res) => {
  518. if (res.data.length > 0) {
  519. this.zsgslist = res.data
  520. }
  521. })
  522. },
  523. msave() {
  524. this.$refs.versionform.validateFields().then((res) => {
  525. if (res) {
  526. message.success('保存成功')
  527. }
  528. })
  529. },
  530. actionBtnClick(evt, btn) {
  531. evt.waitUntil(
  532. new Promise((resolve, reject) => {
  533. if (btn && btn.buttonId === 'save') {
  534. this.$refs.versionform
  535. .validateFields()
  536. .then((res) => {
  537. if (res) {
  538. if (this.$refs.versionform.getFieldValue('id') !== undefined) {
  539. if (this.versiontype === '新增新版本') {
  540. this.$refs.versionform.setFieldValue('id', null)
  541. }
  542. }
  543. evt.preventDefault()
  544. this.$refs.versionform.save().then((res) => {
  545. message.success('保存成功')
  546. this.getnewversion()
  547. this.Closed()
  548. })
  549. } else {
  550. message.error('保存失败')
  551. }
  552. })
  553. .catch(() => {
  554. evt.preventDefault()
  555. return false
  556. })
  557. // 最终通知内部按钮,所有处理已完成
  558. .finally(resolve)
  559. } else {
  560. this.Closed()
  561. }
  562. })
  563. )
  564. },
  565. initDateSelect(model) {
  566. if (this.formflag) {
  567. this.formflag = false
  568. const nowYear = new Date().getFullYear()
  569. if (!this.flag) {
  570. this.yearArry.push(nowYear)
  571. for (let i = 1; i < 6; i++) {
  572. this.yearArry.push(nowYear - i)
  573. }
  574. for (let i = 1; i < 11; i++) {
  575. this.yearArry.push(nowYear + i)
  576. }
  577. this.yearArry.sort()
  578. this.flag = true
  579. }
  580. if (model.year === undefined) {
  581. model.year = nowYear + ''
  582. }
  583. this.zsgsflag = false
  584. // 判断当前是否有版本
  585. if (!this.versionId) {
  586. model.versionType = 'currentVersion'
  587. this.versiontype = '新增新版本'
  588. // 判断是否是直属
  589. if (
  590. this.zsgslist.length > 0 &&
  591. this.zsgslist.findIndex((i) => i.id === this.orgId) > -1
  592. ) {
  593. this.zsgsflag = true
  594. } else {
  595. model.matrixType = 'own Matrix'
  596. }
  597. } else {
  598. this.versiontype = '修改当前版本'
  599. }
  600. // setTimeout(() => {
  601. // if (this.$refs.versionform?.$refs.detailForm?.$refs.form?.model?.year === undefined) {
  602. // this.$refs.versionform.$refs.detailForm.$refs.form.model.year = nowYear + ''
  603. // }
  604. // // 判断当前是否有版本
  605. // if (!this.versionId) {
  606. // this.$refs.versionform.$refs.detailForm.$refs.form.model.versionType = 'currentVersion'
  607. // this.versiontype = '新增新版本'
  608. // } else {
  609. // this.versiontype = '修改当前版本'
  610. // }
  611. // }, 1000)
  612. }
  613. return true
  614. // this.$refs.versionform.detailForm.setFieldValue('year', nowYear + '')
  615. },
  616. getnewversion() {
  617. const orgId = this.$refs.icmatrixCatalogTree.depvalue
  618. // this.actions = []
  619. const editflag = this.geteditpermission()
  620. if (this.history) {
  621. this.versionId = this.$route.query.version
  622. this.actions.splice(0, this.actions.length)
  623. this.actionsview.forEach((i) => {
  624. this.actions.push(i)
  625. })
  626. } else {
  627. this.actions.splice(0, this.actions.length)
  628. if (editflag) {
  629. this.actionsf.forEach((i) => {
  630. this.actions.push(i)
  631. })
  632. }
  633. MtxProcessService.getversion(this.orgId).then((res) => {
  634. if (res.data.id) {
  635. this.versionId = res.data.id
  636. if (editflag) {
  637. this.actionss.forEach((i) => {
  638. this.actions.push(i)
  639. })
  640. } else {
  641. this.actionsview.forEach((i) => {
  642. this.actions.push(i)
  643. })
  644. }
  645. this.versiontype = '修改当前版本'
  646. } else {
  647. this.versionId = null
  648. this.versiontype = '新增新版本'
  649. }
  650. })
  651. }
  652. this.actions.sort((a, b) => b.index - a.index)
  653. },
  654. geteditpermission() {
  655. let editflag = false
  656. if (this.orgPermission.editNodes) {
  657. // 判断机构部门
  658. const orgId = this.$refs.icmatrixCatalogTree.depvalue
  659. if (orgId) {
  660. const key = this.orgPermission.editNodes.findIndex((i) => i.id === orgId)
  661. if (key > -1) {
  662. editflag = true
  663. }
  664. }
  665. }
  666. return editflag
  667. },
  668. Saved() {
  669. message.success('保存成功')
  670. this.$refs.versionform.hide()
  671. },
  672. Closed() {
  673. this.$refs.versionform.hide()
  674. // this.$refs.versionform.resetFields()
  675. },
  676. createversion() {
  677. this.$refs.versionform.show()
  678. this.formflag = true
  679. // 日期下拉框初始化
  680. // this.initDateSelect()
  681. },
  682. opencatalog() {
  683. if (this.$refs.icmatrixCatalogTree.defaultSelectedKeys > 0) {
  684. this.catarecordId = this.$refs.icmatrixCatalogTree.defaultSelectedKeys[0]
  685. this.$refs.catalogform.show()
  686. } else {
  687. Modal.info({
  688. content: '请选择分类节点',
  689. })
  690. }
  691. },
  692. viewversion() {},
  693. // 选择上级分类后给对应的域赋值
  694. fnTreePicker(value) {
  695. if (value.length > 0) {
  696. this.$refs.dataTable.getDetailModal().setFieldValue('catalogId', value[0].id)
  697. this.$refs.dataTable.getDetailModal().setFieldValue('catalogName', value[0].name)
  698. } else {
  699. this.$refs.dataTable.getDetailModal().setFieldValue('catalogId', '')
  700. this.$refs.dataTable.getDetailModal().setFieldValue('catalogName', '')
  701. this.$refs.dataTable.getDetailModal().setFieldValue('auditMattersPath', '')
  702. }
  703. },
  704. treeSelect(selectedKeys, info) {
  705. this.auditMattersPath = null
  706. // 判断当前节点有编辑权限还是差看权限
  707. const editflag = this.geteditpermission()
  708. // 父级id
  709. if (info != null && info.selectedNodes.length > 0) {
  710. this.parentId = Number(info.selectedNodes[0].data.props.id)
  711. this.parentName = info.selectedNodes[0].data.props.text // 父级名称
  712. this.catalogId = Number(info.selectedNodes[0].data.props.id)
  713. this.catalogName = info.selectedNodes[0].data.props.text // 父级名称
  714. this.editnode = info.selectedNodes[0].data.props.edit
  715. if (info.selectedNodes[0].data.props.props) {
  716. if (info.selectedNodes[0].data.props.props.catalogPath) {
  717. this.auditMattersPath =
  718. info.selectedNodes[0].data.props.props.catalogPath + ',' + this.parentId
  719. } else {
  720. this.auditMattersPath = this.parentId
  721. }
  722. }
  723. // 判断是否显示新建按钮 actionsn 先去掉按钮中的新建然后再判断加上
  724. const flag = this.actions.findIndex((i) => i.id === 'new')
  725. if (
  726. info.selectedNodes[0].data.props.props &&
  727. info.selectedNodes[0].data.props.props.isEnd === '1'
  728. ) {
  729. // 末位节点有新建按钮
  730. if (flag === -1 && editflag) {
  731. this.actionsn.forEach((i) => {
  732. this.actions.push(i)
  733. })
  734. }
  735. if (!editflag && flag > -1) {
  736. this.actions.splice(flag, 1)
  737. }
  738. } else {
  739. // 无新建按钮
  740. if (flag > -1) {
  741. this.actions.splice(flag, 1)
  742. }
  743. }
  744. } else {
  745. if (selectedKeys.id) {
  746. this.parentId = Number(selectedKeys.id)
  747. this.parentName = selectedKeys.text // 父级名称
  748. }
  749. }
  750. const orgId = this.$refs.icmatrixCatalogTree.depvalue
  751. // 判断当前节点是否为根节点
  752. this.expressions.forEach((item) => {
  753. if (item.name === 'mtxPrcId') {
  754. // item.name = 'mtxPrcId'
  755. item.longValue = this.catalogId
  756. } else if (item.name === 'mtxVersionId') {
  757. item.longValue = this.$refs.icmatrixCatalogTree.versionId
  758. } else if (item.name === 'isRoot') {
  759. if (this.catalogId === -1) {
  760. item.stringValue = true
  761. } else {
  762. item.stringValue = false
  763. }
  764. }
  765. })
  766. this.actions.sort((a, b) => b.index - a.index)
  767. this.expressions = [...this.expressions]
  768. },
  769. // 重置
  770. resetForm() {
  771. this.formData.controlLevel = null
  772. this.formData.controlType = null
  773. this.formData.controlFrequency = null
  774. this.formData.controlWay = null
  775. },
  776. handleSearch() {
  777. this.expressions = []
  778. if (this.catalogId === -1) {
  779. this.expressions.push({ dataType: 'str', name: 'isRoot', op: 'eq', stringValue: 'true' })
  780. } else {
  781. this.expressions.push({ dataType: 'str', name: 'isRoot', op: 'eq', stringValue: 'false' })
  782. }
  783. this.expressions.push({
  784. dataType: 'long',
  785. name: 'mtxPrcId',
  786. op: 'eq',
  787. longValue: this.catalogId,
  788. })
  789. this.expressions.push({
  790. dataType: 'long',
  791. name: 'mtxVersionId',
  792. op: 'eq',
  793. longValue: this.versionId,
  794. })
  795. // 审计事项名称
  796. if (this.formData.measureName) {
  797. this.expressions.push({
  798. dataType: 'str',
  799. name: 'measureName',
  800. op: 'like',
  801. stringValue: '%' + this.formData.measureName + '%',
  802. })
  803. }
  804. // 审计事项编号
  805. if (this.formData.controlLevel) {
  806. this.expressions.push({
  807. dataType: 'str',
  808. name: 'controlLevel',
  809. op: 'eq',
  810. stringValue: this.formData.controlLevel[0].id,
  811. })
  812. }
  813. if (this.formData.controlType) {
  814. this.expressions.push({
  815. dataType: 'str',
  816. name: 'controlType',
  817. op: 'eq',
  818. stringValue: this.formData.controlType[0].id,
  819. })
  820. }
  821. if (this.formData.controlFrequency) {
  822. this.expressions.push({
  823. dataType: 'str',
  824. name: 'controlFrequency',
  825. op: 'eq',
  826. stringValue: this.formData.controlFrequency[0].id,
  827. })
  828. }
  829. if (this.formData.controlWay) {
  830. this.expressions.push({
  831. dataType: 'str',
  832. name: 'controlWay',
  833. op: 'eq',
  834. stringValue: this.formData.controlWay[0].id,
  835. })
  836. }
  837. this.expressions = [...this.expressions]
  838. },
  839. // 新建、详情打开新页面
  840. rowClick(record) {
  841. // 判断当前节点有编辑权限还是差看权限
  842. const editflag = this.geteditpermission()
  843. let url =
  844. '/mtx-measure-form?record=' +
  845. record.id +
  846. '&orgName=' +
  847. this.$refs.icmatrixCatalogTree.depName // 新页面要打开的路由地址
  848. if (editflag) {
  849. } else {
  850. url = url + '&mode=' + 'VIEW'
  851. }
  852. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  853. if (refreshFlag) {
  854. this.refresh()
  855. }
  856. })
  857. // const res = crossWindowWatcher.waitForChanged(url)
  858. },
  859. // 部门下拉框选择事件
  860. depChanged(value, info) {
  861. this.orgId = this.$refs.icmatrixCatalogTree.depvalue // 选中的值
  862. this.orgName = this.$refs.icmatrixCatalogTree.depName
  863. this.getnewversion()
  864. },
  865. // 新建保存回调刷新树
  866. onRecordSaved() {
  867. this.key = this.key + 1
  868. },
  869. // 删除回调
  870. onRecordsDeleted() {
  871. message.success('删除成功')
  872. this.key = this.key + 1
  873. this.refresh()
  874. },
  875. deleteRows() {
  876. // const selectedRowKeys = this.$refs.icMtxMeasure.getSelectedRowKeys()
  877. const ids = this.$refs.icMtxMeasure.getSelectedRowKeys()
  878. if (ids.length === 0) {
  879. Modal.info({
  880. content: '请选择需要删除的文件',
  881. })
  882. return
  883. }
  884. // return new Promise((resolve) => {
  885. Modal.confirm({
  886. title: '您确定删除这项内容吗?',
  887. content: '删除数据后,就无法恢复初始的状态。',
  888. okText: '删除',
  889. cancelText: '取消',
  890. okType: 'danger',
  891. onOk: () => {
  892. // this.loading = true
  893. const params = {
  894. ids: ids.join(','),
  895. }
  896. PageService.delete(params, this.formId).then((res) => {
  897. if (res.status === 200) {
  898. message.success({ content: '删除成功!' }, 1).then(() => {
  899. this.$refs.icMtxMeasure.clearSelection()
  900. this.$refs.icMtxMeasure.refresh()
  901. this.refresh()
  902. })
  903. }
  904. })
  905. },
  906. onCancel: () => {},
  907. })
  908. },
  909. createMtxmeasure() {
  910. const rootId = this.$refs.icmatrixCatalogTree.depvalue
  911. if (this.catalogId != null && this.catalogId !== rootId) {
  912. const url =
  913. '/mtx-measure-form?catalogId=' +
  914. this.catalogId +
  915. '&catalogName=' +
  916. this.catalogName +
  917. '&versionId=' +
  918. this.versionId +
  919. '&orgId=' +
  920. this.$refs.icmatrixCatalogTree.depvalue +
  921. '&orgName=' +
  922. this.$refs.icmatrixCatalogTree.depName
  923. // 新页面要打开的路由地址
  924. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  925. if (refreshFlag) {
  926. // 这里写或者调刷新的方法
  927. this.refresh()
  928. }
  929. })
  930. } else {
  931. if (this.catalogId === rootId) {
  932. Modal.confirm({
  933. title: '注意',
  934. content: '不能在根节点下新建审计事项',
  935. okText: '确定',
  936. okType: 'danger',
  937. })
  938. } else {
  939. Modal.confirm({
  940. title: '请先选择审计事项分类',
  941. content: '请先选择审计事项分类。',
  942. okText: '确定',
  943. okType: 'danger',
  944. })
  945. }
  946. }
  947. },
  948. // 导出
  949. exportItem() {
  950. // const rootId = this.$refs.icmatrixCatalogTree.depvalue
  951. const id = this.catalogId
  952. const versionId = this.versionId
  953. MtxProcessService.exportItem(id, versionId).then((res) => {
  954. if (res.status === 200) {
  955. const url = URL.createObjectURL(res.data)
  956. const filename = res.headers['content-disposition']
  957. const fname = filename.substring(filename.indexOf('filename=') + 9, filename.length)
  958. download(url, decodeURI(fname))
  959. } else {
  960. Modal.warning({
  961. title: '提示',
  962. content: '导出报错,请联系管理员!',
  963. })
  964. return false
  965. }
  966. })
  967. },
  968. // 导入
  969. importItem() {
  970. // 选择事项分类
  971. this.visible = true
  972. },
  973. refresh() {
  974. this.$refs.icMtxMeasure.refresh()
  975. },
  976. processReq(req) {
  977. const url = req.url
  978. const expre = req.data.expressions
  979. req.data.expressions = expre
  980. return req
  981. },
  982. fnimportresult(flag) {
  983. if (flag) {
  984. const option = this.$refs.icmatrixCatalogTree.depOptions.findIndex(
  985. (i) => i.value === this.$refs.icmatrixCatalogTree.depvalue
  986. )
  987. const data = {
  988. ...this.$refs.icmatrixCatalogTree.depOptions[option],
  989. data: {
  990. props: {
  991. text: this.$refs.icmatrixCatalogTree.depOptions[option].text,
  992. edit: this.$refs.icmatrixCatalogTree.depOptions[option].edit,
  993. },
  994. },
  995. }
  996. this.$refs.icmatrixCatalogTree.changedep(this.$refs.icmatrixCatalogTree.depvalue, data)
  997. this.$refs.icMtxMeasure.refresh()
  998. }
  999. },
  1000. },
  1001. }
  1002. </script>
  1003. <style module lang="scss">
  1004. @use '@/common/design' as *;
  1005. .wrap-height {
  1006. height: 100%;
  1007. .row-height {
  1008. display: flex;
  1009. flex: auto;
  1010. height: 100%;
  1011. .rightcard {
  1012. flex: 1;
  1013. width: calc(100% - 20%);
  1014. height: 100%;
  1015. }
  1016. }
  1017. }
  1018. :global(.rightcard_mtx-process-list_product) {
  1019. :global(.ant-btn) {
  1020. }
  1021. }
  1022. .processlist {
  1023. :global(.projectlist .ant-table-empty .ant-table-body) {
  1024. overflow-x: hidden !important;
  1025. }
  1026. // :global(.ant-table-placeholder) {
  1027. // width: auto;
  1028. // }
  1029. }
  1030. </style>