audit-rectplanproject-list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <a-card :class="$style.rectPlanProjectlist">
  3. <div :class="[$style.btns]">
  4. <audit-advanced-export
  5. ref="rectplanprojectExport"
  6. :class-style="[$style.buttonSpacing]"
  7. :v-if="false"
  8. :config-id="191"
  9. :exclebxh="false"
  10. ></audit-advanced-export>
  11. </div>
  12. <!-- 高级搜索区域 -->
  13. <audit-advanced-query
  14. :expand="expand"
  15. :class="$style.advancedQuery"
  16. :search-data="advSearchForm"
  17. :ref-name="searchform"
  18. :search-style="{ height: '220px', left: '20px', top: '50px' }"
  19. :search-fun="advSearch"
  20. @searchedClick="searchedClick"
  21. @resetForm="resetForm"
  22. >
  23. <template>
  24. <a-row>
  25. <a-col :span="12">
  26. <a-form-model-item label="审计机构">
  27. <a-form-model-item>
  28. <AuditGroupPicker
  29. v-model="auditUnit"
  30. :single="true"
  31. :read-only="false"
  32. :root-node="rootNode"
  33. />
  34. </a-form-model-item>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :span="12">
  38. <a-form-model-item label="项目名称" prop="projectName">
  39. <a-input v-model="advSearchForm.projectName" />
  40. </a-form-model-item>
  41. </a-col>
  42. </a-row>
  43. <a-row>
  44. <a-col :span="12">
  45. <a-form-model-item label="项目编号" prop="projectCode">
  46. <a-input v-model="advSearchForm.projectCode" />
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :span="12">
  50. <a-form-model-item label="整改责任主体" prop="auditedUnit">
  51. <!-- <a-input v-model="advSearchForm.auditedUnit" /> -->
  52. <sd-group-picker
  53. ref="unitSelect"
  54. v-model="advSearchForm.auditedUnit"
  55. :single="true"
  56. :read-only="false"
  57. @change="changeunit"
  58. />
  59. </a-form-model-item>
  60. </a-col>
  61. </a-row>
  62. <a-row>
  63. <a-col :span="12">
  64. <a-form-model-item label="年度计划" prop="planYear">
  65. <a-date-picker
  66. v-model="advSearchForm.planYear"
  67. mode="year"
  68. picker="YYYY"
  69. format="YYYY"
  70. :allow-clear="false"
  71. placeholder="选择年度"
  72. :input-read-only="true"
  73. :value="year"
  74. :open="endOpen"
  75. @panelChange="yearChange"
  76. @openChange="handleEndOpenChange"
  77. ></a-date-picker>
  78. </a-form-model-item>
  79. </a-col>
  80. </a-row>
  81. </template>
  82. </audit-advanced-query>
  83. <div :class="$style.rectPlanProjectlist">
  84. <sd-data-table-ex
  85. ref="dataTable"
  86. :projectlist="true"
  87. :columns="columns"
  88. :actions="actions"
  89. show-selection
  90. form-id="iamWorkRectProject"
  91. data-url="api/xcoa-mobile/v1/rectPlan-project/all-list"
  92. :filter-expressions="tableExpressions"
  93. :show-advance-query="true"
  94. :search-fields="['projectName']"
  95. :custom-delete-fun="deleteRows"
  96. @searchbtnClick="searchbtnClick"
  97. >
  98. <div slot="isLink" slot-scope="text, record">
  99. <a :title="text" @click="linkProject(record)">{{ text }}</a>
  100. </div>
  101. <div slot="opt" slot-scope="text, record" :class="$style.operatecol">
  102. <!-- 管理员 项目组长 项目副组长 则可以变更 -->
  103. <span v-for="(bt, index) in buttonsfortable" :key="index">
  104. <a-button
  105. v-if="record.changeButtons === 'true'"
  106. type="link"
  107. size="small"
  108. @click="optbuttonClick(bt.id, record)"
  109. >{{ bt.label }}
  110. <!-- <sd-icon :type="bt.icontype" :theme="bt.theme"/> -->
  111. </a-button>
  112. </span>
  113. </div>
  114. </sd-data-table-ex>
  115. </div>
  116. <div v-show="false">
  117. <sd-user-picker
  118. ref="assignTeamLeader"
  119. v-model="mainSendUnit"
  120. :single="true"
  121. :read-only="false"
  122. @change="change"
  123. />
  124. <sd-user-picker
  125. ref="assignTeamAuditedContacts"
  126. v-model="mainSendUnit"
  127. :single="true"
  128. :read-only="false"
  129. @change="changeAuditedContacts"
  130. />
  131. </div>
  132. </a-card>
  133. </template>
  134. <script>
  135. import { message, Modal } from 'ant-design-vue'
  136. import { getUserInfo } from '@/common/store-mixin'
  137. import axios from '@/common/services/axios-instance'
  138. import errorUtil from '@/common/services/error-util'
  139. import TableActionTypes from '@/common/services/table-action-types'
  140. import TableColumnTypes from '@/common/services/table-column-types'
  141. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  142. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  143. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  144. import auditAdvancedExport from '../../components/audit-advanced-export'
  145. import AuditRectplanprojectService from './audit-rectplanproject-service'
  146. import AuditGroupPicker from '../../components/picker/audit-group-picker.vue'
  147. import components from './_import-components/audit-rectplanproject-list-import'
  148. export default {
  149. name: 'AuditRectplanprojectList',
  150. metaInfo: {
  151. title: '整改计划列表',
  152. },
  153. components: { ...components, auditAdvancedQuery, auditAdvancedExport, AuditGroupPicker },
  154. mixins: [auditAdvancedQueryMixins],
  155. data() {
  156. return {
  157. endOpen: false,
  158. year: null,
  159. searchYear: '',
  160. auditUnit: [],
  161. rootNode: {},
  162. auditUnitName: '',
  163. yearArry: [],
  164. searchValue: '',
  165. mainSendUnit: [],
  166. checkboxValue: false,
  167. pageId: 'audit/project/iamAuditProject',
  168. columns: [
  169. {
  170. title: '序号',
  171. customRender: (text, record, index) => `${index + 1}`,
  172. width: '80px',
  173. },
  174. {
  175. title: '项目名称',
  176. dataIndex: 'projectName',
  177. width: '450px',
  178. scopedSlots: { customRender: 'isLink' },
  179. },
  180. {
  181. title: '项目编号',
  182. defaultSortOrder: 'descend',
  183. dataIndex: 'projectCode',
  184. width: '180px',
  185. },
  186. {
  187. title: '项目Id',
  188. dataIndex: 'projectId',
  189. sdHidden: true,
  190. },
  191. {
  192. title: '跟踪人账号',
  193. dataIndex: 'resppersonsAccount',
  194. sdHidden: true,
  195. },
  196. {
  197. title: '项目来源',
  198. dataIndex: 'projectSource',
  199. sdHidden: true,
  200. },
  201. {
  202. title: '整改责任主体',
  203. dataIndex: 'auditedUnitName',
  204. width: '200px',
  205. },
  206. {
  207. title: '整改责任主体联系人',
  208. // sorter: true,
  209. dataIndex: 'auditedContactsName',
  210. width: '180px',
  211. },
  212. {
  213. title: '整改责任主体联系人账号',
  214. dataIndex: 'auditedContactsAccount',
  215. sdHidden: true,
  216. },
  217. {
  218. title: '整改跟踪人',
  219. sorter: true,
  220. dataIndex: 'resppersonsName',
  221. width: '140px',
  222. },
  223. {
  224. title: '整改计划反馈截止日期',
  225. sorter: true,
  226. dataIndex: 'expectFinishDate',
  227. sdRender: TableColumnTypes.date,
  228. width: '200px',
  229. sdHidden: true,
  230. },
  231. {
  232. title: '当前状态',
  233. dataIndex: 'flowState',
  234. width: '150px',
  235. sdHidden: true,
  236. },
  237. { title: '文档状态', dataIndex: 'endType', width: '120px', sdHidden: true },
  238. {
  239. title: '当前处理人',
  240. dataIndex: 'currentUser',
  241. width: '150px',
  242. sdHidden: true,
  243. },
  244. {
  245. title: '操作',
  246. dataIndex: 'id',
  247. scopedSlots: { customRender: 'opt' },
  248. width: '260px',
  249. },
  250. ],
  251. actions: [
  252. {
  253. label: '新建',
  254. id: 'new',
  255. type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
  256. permission: null, // 纯前端操作,不需要权限控制
  257. callback: this.createrectplanproject,
  258. },
  259. // {
  260. // label: '复制整改计划',
  261. // id: 'copyrectproject',
  262. // permission: null, // 纯前端操作,不需要权限控制
  263. // callback: this.copyrectproject,
  264. // },
  265. {
  266. label: '删除',
  267. id: 'delete',
  268. type: 'delete', // 删除按钮,不需要回调,会自动处理(对sd-data-table无效)
  269. permission: null,
  270. },
  271. // {
  272. // label: '导出',
  273. // id: 'export',
  274. // permission: null,
  275. // callback: this.export,
  276. // },
  277. ],
  278. tableExpressions: [],
  279. buttonsfortable: [
  280. {
  281. label: '指定跟踪人',
  282. id: 'changeleader',
  283. showCondition: '',
  284. },
  285. {
  286. label: '指定联系人',
  287. id: 'auditedContacts',
  288. showCondition: '',
  289. },
  290. ],
  291. searchform: 'searchform',
  292. expand: false,
  293. advSearchForm: {
  294. auditUnit: '',
  295. projectName: '',
  296. projectCode: '',
  297. auditedUnit: '',
  298. planYear: '',
  299. },
  300. itemStatusOptions: [],
  301. auditTypeOptions: [],
  302. auditModeOptions: [],
  303. projectId: '',
  304. setType: '',
  305. unitName: '',
  306. }
  307. },
  308. created() {
  309. let userInfo = getUserInfo()
  310. const params = {
  311. orgId: userInfo.deptId,
  312. }
  313. axios({
  314. url: 'api/xcoa-mobile/v1/iamorg/getCurrentUserGroup',
  315. method: 'get',
  316. }).then((res) => {
  317. userInfo = res.data
  318. params.orgId = res.data.id
  319. axios({
  320. url: 'api/xcoa-mobile/v1/iamorg/findIamOrg',
  321. method: 'post',
  322. params,
  323. }).then((res) => {
  324. const deptCode = userInfo.id.toString()
  325. const deptName = res.data.orgName
  326. this.rootNode = { code: deptCode, name: deptName, id: res.data.id }
  327. this.auditUnit = [this.rootNode]
  328. this.initedSteps++
  329. // 审计机构
  330. if (this.auditUnit[0] !== undefined) {
  331. this.tableExpressions.push({
  332. dataType: 'str',
  333. name: 'unitName',
  334. op: 'like',
  335. stringValue: this.auditUnit[0].name,
  336. })
  337. }
  338. })
  339. })
  340. },
  341. mounted() {},
  342. methods: {
  343. export() {
  344. this.$refs.rectplanprojectExport.exportdata()
  345. },
  346. changeunit(values) {
  347. this.unitName = ''
  348. values.forEach((element) => {
  349. this.unitName = element.name
  350. })
  351. },
  352. createrectplanproject() {
  353. const url = `/sd-flow-guide?code=PRODUCT_IAM_ZGJH` // 新页面要打开的路由地址
  354. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  355. if (refreshFlag) {
  356. // 这里写或者调刷新的方法
  357. // this.refreshDataTable()
  358. this.$refs.dataTable.refresh()
  359. }
  360. })
  361. },
  362. onSearch(value) {
  363. this.tableExpressions = []
  364. if (value) {
  365. const expressions = []
  366. // 项目名称
  367. expressions.push({
  368. dataType: 'str',
  369. name: 'projectName',
  370. op: 'like',
  371. stringValue: `%${value}%`,
  372. })
  373. // 项目编号
  374. expressions.push({
  375. dataType: 'str',
  376. name: 'projectCode',
  377. op: 'like',
  378. stringValue: `%${value}%`,
  379. })
  380. this.tableExpressions.push({
  381. dataType: 'exps',
  382. op: 'or',
  383. expressionsValue: expressions,
  384. })
  385. }
  386. },
  387. advSearch() {
  388. this.tableExpressions = []
  389. // 审计机构
  390. if (this.auditUnit[0] !== undefined) {
  391. this.tableExpressions.push({
  392. dataType: 'str',
  393. name: 'unitName',
  394. op: 'like',
  395. stringValue: this.auditUnit[0].name,
  396. })
  397. }
  398. // 项目名称
  399. if (this.advSearchForm.projectName) {
  400. this.tableExpressions.push({
  401. dataType: 'str',
  402. name: 'projectName',
  403. op: 'like',
  404. stringValue: `%${this.advSearchForm.projectName}%`,
  405. })
  406. }
  407. // console.log(this.tableExpressions)
  408. // 项目编号
  409. if (this.advSearchForm.projectCode) {
  410. this.tableExpressions.push({
  411. dataType: 'str',
  412. name: 'projectCode',
  413. op: 'like',
  414. stringValue: `%${this.advSearchForm.projectCode}%`,
  415. })
  416. }
  417. // 整改责任主体
  418. if (this.advSearchForm.auditedUnit) {
  419. this.tableExpressions.push({
  420. dataType: 'str',
  421. name: 'auditedUnitName',
  422. op: 'like',
  423. stringValue: `%${this.unitName}%`,
  424. })
  425. }
  426. // 年度计划
  427. if (this.advSearchForm.planYear) {
  428. this.tableExpressions.push({
  429. dataType: 'str',
  430. name: 'planYear',
  431. op: 'eq',
  432. stringValue: `${this.advSearchForm.planYear}`,
  433. })
  434. }
  435. // this.expand = false
  436. },
  437. searchedClick() {
  438. this.expand = !this.expand
  439. },
  440. linkProject(record) {
  441. const userInfo = getUserInfo()
  442. debugger
  443. if (
  444. (record.flowState === '起草') | (record.flowState === '开始') &&
  445. record.currentUser === userInfo.name
  446. ) {
  447. const url = '/sd-webflow/pages/draft/' + record.instId // 编辑面要打开的路由地址
  448. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  449. if (refreshFlag) {
  450. // 这里写或者调刷新的方法
  451. this.$refs.dataTable.refresh()
  452. }
  453. })
  454. } else {
  455. window.open('#/sd-webflow/done-pages/' + record.instId)
  456. }
  457. },
  458. // 项目组长配置保存
  459. change(val) {
  460. const obj = []
  461. if (val.length > 0) {
  462. return new Promise((resolve) => {
  463. AuditRectplanprojectService.changeTeamEditor(
  464. this.projectId,
  465. 'iamWorkRectProject',
  466. val
  467. ).then((res) => {
  468. if (res.data) {
  469. this.$refs.dataTable.clearSelection()
  470. this.$refs.dataTable.refresh()
  471. }
  472. })
  473. })
  474. } else {
  475. Modal.warning({
  476. title: '提示',
  477. content: '请选择人员!',
  478. })
  479. }
  480. },
  481. // 项目组长配置保存(整改责任主体联系人)
  482. changeAuditedContacts(val) {
  483. const obj = []
  484. if (val.length > 0) {
  485. return new Promise((resolve) => {
  486. AuditRectplanprojectService.changeTeamAuditContactsEditor(
  487. this.projectId,
  488. 'iamWorkRectProject',
  489. val
  490. ).then((res) => {
  491. if (res.data) {
  492. this.$refs.dataTable.clearSelection()
  493. this.$refs.dataTable.refresh()
  494. }
  495. })
  496. })
  497. } else {
  498. Modal.warning({
  499. title: '提示',
  500. content: '请选择人员!',
  501. })
  502. }
  503. },
  504. AdvSearchClick() {
  505. this.expand = !this.expand
  506. },
  507. copyrectproject() {
  508. const selectedRowKeys = this.$refs.dataTable.getSelectedRowKeys()
  509. if (selectedRowKeys.length === 0) {
  510. Modal.info({
  511. content: '请选择需要复制的数据!',
  512. })
  513. return false
  514. } else if (selectedRowKeys.length > 1) {
  515. Modal.info({
  516. content: '只能选择一个数据进行复制!',
  517. })
  518. return false
  519. }
  520. const selectRows = this.$refs.dataTable.getSelectedRows()
  521. const record = selectRows[0]
  522. const params = {
  523. inputs: [
  524. { name: 'formId', value: record.formId },
  525. { name: 'beanId', value: record.beanId },
  526. { name: 'flowId', value: record.flowId },
  527. { name: 'advancedFields', value: '' },
  528. { name: 'attFields', value: 'rectattach' },
  529. ],
  530. pagePath: '/audit/rectPlanProject/iamWorkRectProject',
  531. ignoreFieldValue: '',
  532. }
  533. AuditRectplanprojectService.copy(params).then((res) => {
  534. this.linkProject({
  535. flowState: '起草',
  536. currentUser: getUserInfo().name,
  537. instId: res.data.instId,
  538. })
  539. })
  540. },
  541. optbuttonClick(val, record) {
  542. // 变更编辑人
  543. if (val === 'changeleader') {
  544. const jsonArry = []
  545. if (record.resppersonsAccount !== '' && record.resppersonsAccount !== null) {
  546. if (record.resppersonsAccount.indexOf(',') > -1) {
  547. const codes = record.resppersonsAccount.split(',')
  548. const names = record.resppersonsName.split(',')
  549. for (let i = 0; i < codes.length; i++) {
  550. jsonArry.push({ type: 'User', code: codes[i], name: names[i], attrs: [] })
  551. }
  552. } else {
  553. jsonArry.push({
  554. type: 'User',
  555. code: record.resppersonsAccount,
  556. name: record.resppersonsName,
  557. attrs: [],
  558. })
  559. }
  560. }
  561. this.mainSendUnit = jsonArry
  562. this.projectId = record.id
  563. setTimeout(() => {
  564. this.$refs.assignTeamLeader.openPicker()
  565. }, 0)
  566. }
  567. // 变更整改责任主体联系人
  568. if (val === 'auditedContacts') {
  569. const jsonArry = []
  570. if (record.auditedContactsAccount !== '' && record.auditedContactsAccount !== null) {
  571. if (record.auditedContactsAccount.indexOf(',') > -1) {
  572. const codes = record.auditedContactsAccount.split(',')
  573. const names = record.auditedContactsName.split(',')
  574. for (let i = 0; i < codes.length; i++) {
  575. jsonArry.push({ type: 'User', code: codes[i], name: names[i], attrs: [] })
  576. }
  577. } else {
  578. jsonArry.push({
  579. type: 'User',
  580. code: record.auditedContactsAccount,
  581. name: record.auditedContactsName,
  582. attrs: [],
  583. })
  584. }
  585. }
  586. this.mainSendUnit = jsonArry
  587. this.projectId = record.id
  588. setTimeout(() => {
  589. this.$refs.assignTeamAuditedContacts.openPicker()
  590. }, 0)
  591. }
  592. },
  593. // 重置年份
  594. resetForm() {
  595. this.advSearchForm.auditedUnit = ''
  596. this.unitName = ''
  597. },
  598. yearChange(value) {
  599. this.year = value
  600. this.advSearchForm.planYear = value.format('YYYY')
  601. if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
  602. document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
  603. }
  604. },
  605. handleEndOpenChange(open) {
  606. this.endOpen = open
  607. },
  608. deleteRows() {
  609. // debugger
  610. const selectedRowKeys = this.$refs.dataTable.getSelectedRowKeys()
  611. if (selectedRowKeys.length === 0) {
  612. Modal.info({
  613. content: '请选择需要删除的文件',
  614. })
  615. return
  616. }
  617. const selectedRows = this.$refs.dataTable.getSelectedRows()
  618. let flag = false
  619. selectedRows.forEach((item) => {
  620. if (item.endType !== 0) {
  621. flag = true
  622. }
  623. })
  624. if (flag) {
  625. Modal.error({
  626. title: '删除失败:存在不是草稿状态的数据',
  627. })
  628. return
  629. }
  630. return new Promise((resolve) => {
  631. Modal.confirm({
  632. title: '您确定删除这项内容吗?',
  633. content: '删除这条数据后,就无法恢复初始的状态。',
  634. okText: '删除',
  635. cancelText: '取消',
  636. okType: 'danger',
  637. onOk: () => {
  638. axios({
  639. url: 'api/framework/v1/page/' + this.$refs.dataTable.formId,
  640. method: 'delete',
  641. params: { ids: selectedRowKeys.join(',') },
  642. })
  643. .then(() => {
  644. this.$refs.dataTable.clearSelection()
  645. this.$refs.dataTable.refresh()
  646. message.success('删除成功')
  647. this.$emit('recordsDeleted', selectedRowKeys)
  648. let query = {}
  649. query = {
  650. rectId: selectedRowKeys.join(','),
  651. }
  652. axios({
  653. url: `api/xcoa-mobile/v1/spicrectfeedback/deleteByrectId?rectId=${query.rectId}`,
  654. method: 'get',
  655. }).then((res) => {
  656. console.log('删除子表数据成功')
  657. })
  658. })
  659. .catch((err) => {
  660. const msg = errorUtil.getMessage(err) || '删除失败'
  661. message.error(msg)
  662. })
  663. .finally(resolve)
  664. },
  665. onCancel: () => {
  666. resolve()
  667. },
  668. })
  669. })
  670. },
  671. },
  672. }
  673. </script>
  674. <style module lang="scss">
  675. @use '@/common/design' as *;
  676. .btns {
  677. position: absolute;
  678. top: 24px;
  679. right: 20.5px;
  680. z-index: 100;
  681. }
  682. .advancedQuery {
  683. :global(.ant-col .ant-form-item-label) {
  684. width: 20% !important;
  685. }
  686. :global(.reporttablecardxm) {
  687. :global(.ant-table-body) {
  688. height: auto !important;
  689. min-height: auto !important;
  690. overflow: auto;
  691. }
  692. }
  693. :global(.ant-col .ant-form-item-control-wrapper) {
  694. width: 80% !important;
  695. }
  696. }
  697. .buttonSpacing {
  698. margin-left: 5px;
  699. }
  700. </style>