cpm-project-list.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <template>
  2. <div :class="[$style.wrapHeight, $style.warpper]">
  3. <xm-search-form
  4. v-if="onlListColumnDefs.length"
  5. v-show="showAdvSearch"
  6. ref="searchForm"
  7. :onl-list-column-defs="onlListColumnDefs"
  8. @search="(value) => (customFilterExpressions = value)"
  9. @close="() => (advSearchBtnActived = false)"
  10. />
  11. <a-card>
  12. <div :class="[$style.btns]">
  13. <audit-advanced-export
  14. v-if="true"
  15. ref="exportBtn"
  16. :class-style="[$style.buttonSpacing]"
  17. :exclebxh="false"
  18. :expressions="expressions"
  19. :config-id="51"
  20. :v-show="false"
  21. />
  22. </div>
  23. <sd-data-table
  24. :key="key"
  25. :row-key="'id'"
  26. ref="cpmProjectList"
  27. :editnode="editnode"
  28. form-id="onlhead:cd78040cdda84c6b90b2c688d9bfbaa1"
  29. :data-url="'api/xcoa-mobile/v1/cpm-project/list'"
  30. :columns="columns"
  31. show-selection
  32. :search-fields="searchFields"
  33. :class="{ [$style.fuzzyAdvSearch]: fuzzyAndAdvSearch }"
  34. :filter-expressions="expressions"
  35. :process-res="processRes"
  36. :process-req="processReq"
  37. >
  38. <template slot="islink" slot-scope="text, record">
  39. <a :title="text" @click="open(record)">{{ text }}</a>
  40. </template>
  41. <template slot="action" slot-scope="text, record">
  42. <a type="link" @click="rowClick(record)" v-if="record.open">打开作业</a>
  43. <span v-else>打开作业</span>
  44. </template>
  45. <!-- 既有高级查询,又有模糊查询,显示高级查询图标 -->
  46. <template v-if="fuzzyAndAdvSearch" slot="headerPrefix">
  47. <sd-advance-search-btn
  48. :actived="advSearchBtnActived"
  49. :class="$style.advsearchbtn"
  50. @click="switchSearch"
  51. />
  52. </template>
  53. </sd-data-table>
  54. </a-card>
  55. </div>
  56. </template>
  57. <script>
  58. import axios from '@/common/services/axios-instance'
  59. import systemManage from '@/system-manage/system-manage'
  60. import TableColumnTypes from '@/common/services/table-column-types'
  61. import sdAdvanceSearchBtn from '@/application-manage/sd-advance-search-btn.vue'
  62. import auditAdvancedExport from '@product/iam/components/audit-advanced-export'
  63. import xmSearchForm from '@product/iam/components/xm-search-form.vue'
  64. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  65. import CpmService from '../cpm-service'
  66. import components from './_import-components/cpm-project-list-import'
  67. export default {
  68. name: 'CpmProjectList',
  69. metaInfo: {
  70. title: '合规项目列表',
  71. },
  72. components: {
  73. ...components,
  74. sdAdvanceSearchBtn,
  75. xmSearchForm,
  76. auditAdvancedExport,
  77. },
  78. mixins: [],
  79. data() {
  80. return {
  81. yearArry: [],
  82. waterMark: systemManage.getFormWaterMark(),
  83. flag: true,
  84. recordId: '',
  85. editnode: false, // 列表是否可以新建
  86. key: 0,
  87. treeData: [],
  88. searchform: 'searchform',
  89. formData: {
  90. title: '',
  91. checkType: null,
  92. startDept: null,
  93. },
  94. checkTypeOptions: [],
  95. columns: [
  96. {
  97. title: '序号',
  98. customRender: (text, record, index) => (record.isChildren ? '' : `${index + 1}`),
  99. width: '70px',
  100. },
  101. { dataIndex: 'id', sdHidden: true },
  102. {
  103. title: '项目名称',
  104. dataIndex: 'title',
  105. scopedSlots: { customRender: 'islink' },
  106. },
  107. {
  108. title: '项目编号',
  109. dataIndex: 'currentNumber',
  110. width: '200px',
  111. },
  112. {
  113. title: '检查类型',
  114. dataIndex: 'checkType',
  115. width: '100px',
  116. },
  117. {
  118. title: '发起机构',
  119. dataIndex: 'startDeptName',
  120. width: '150px',
  121. },
  122. {
  123. title: '被检查单位',
  124. dataIndex: 'checkedDeptNames',
  125. },
  126. {
  127. title: '项目组长',
  128. dataIndex: 'submitterNames',
  129. width: '150px',
  130. },
  131. {
  132. title: '操作',
  133. dataIndex: '',
  134. scopedSlots: { customRender: 'action' },
  135. align: 'center',
  136. width: '100px',
  137. },
  138. {
  139. dataIndex: 'creationTime',
  140. sdHidden: true,
  141. sorter: true,
  142. defaultSortOrder: 'ascend', // 没有点击任何排序列时,默认的排序列
  143. },
  144. ],
  145. expressions: [],
  146. catalogId: null,
  147. catalogName: '',
  148. auditMattersPath: '',
  149. visible: false,
  150. showfuzzySearch: true, // builder-高级搜索开始
  151. advSearchBtnActived: false,
  152. onlListColumnDefs: [
  153. {
  154. attrFD: {
  155. clickable: true,
  156. },
  157. fieldId: 'title',
  158. fieldName: '项目名称',
  159. fieldType: 'string',
  160. isShowForm: 1,
  161. search: 1,
  162. searchConfigurable: true,
  163. searchMode: null,
  164. },
  165. {
  166. attrFD: {
  167. clickable: true,
  168. },
  169. fieldAttr: {
  170. appDict: [
  171. {
  172. id: '259493279754747904',
  173. text: '合规检查立项',
  174. },
  175. ],
  176. appDictId: '259493279754747904',
  177. dict: [],
  178. multiple: 'false',
  179. selectListItem: [
  180. {
  181. label: '违规调查',
  182. value: 'wg',
  183. },
  184. {
  185. label: '合规检查',
  186. value: 'hg',
  187. },
  188. ],
  189. },
  190. fieldAttrFD: {
  191. category: 'basic',
  192. cid: 'sd-radio',
  193. columns: 2,
  194. formItemProps: {
  195. inputProps: {
  196. dep: { _pending: false, id: 37770, subs: [] },
  197. mock: false,
  198. shallow: false,
  199. value: {},
  200. vmCount: 0,
  201. },
  202. },
  203. id: '1676516153680-4',
  204. listItemType: 'appDict',
  205. },
  206. fieldId: 'checkType',
  207. fieldName: '检查类型',
  208. fieldType: 'selectlist',
  209. isShowForm: 1,
  210. search: 1,
  211. searchConfigurable: true,
  212. searchMode: null,
  213. },
  214. {
  215. attrFD: {
  216. clickable: false,
  217. includeSub: true,
  218. },
  219. fieldAttr: {
  220. isUpdate: 'true',
  221. lev: 'COMPANY',
  222. maxLength: '100',
  223. setValueOnLoad: 'true',
  224. signFieldType: 'name',
  225. type: 'group',
  226. selectionType: 'Group',
  227. },
  228. fieldAttrFD: {
  229. cid: 'sd-sign-box',
  230. columns: 1,
  231. formItemProps: {
  232. inputProps: {
  233. dep: { _pending: false, id: 25709, subs: [] },
  234. mock: false,
  235. shallow: false,
  236. value: {},
  237. vmCount: 0,
  238. },
  239. },
  240. id: '1679906700480-1',
  241. },
  242. fieldId: 'startDept',
  243. fieldName: '发起机构',
  244. fieldType: 'selectgroup',
  245. isShowForm: 1,
  246. search: 1,
  247. searchConfigurable: true,
  248. searchMode: null,
  249. },
  250. ],
  251. customFilterExpressions: [],
  252. }
  253. },
  254. computed: {
  255. fuzzyAndAdvSearch() {
  256. // 既有高级查询,又有模糊查询
  257. return this.onlListColumnDefs.some((item) => item.search) && this.searchFields?.length > 0
  258. },
  259. showAdvSearch() {
  260. if (this.fuzzyAndAdvSearch) {
  261. return this.advSearchBtnActived
  262. }
  263. return this.onlListColumnDefs.length
  264. },
  265. searchFields() {
  266. if (this.showfuzzySearch && this.columns[0]) {
  267. return [this.columns[0].dataIndex]
  268. }
  269. return []
  270. },
  271. },
  272. mounted() {
  273. this.initDictionaryInfo()
  274. },
  275. watch: {
  276. customFilterExpressions: function() {
  277. this.handleSearch()
  278. },
  279. },
  280. // builder-高级搜索结束
  281. methods: {
  282. // 切换查询(高级查询、模糊查询)
  283. switchSearch() {
  284. if (this.advSearchBtnActived) {
  285. // 显示了高级查询,则重置
  286. this.$refs.searchForm.reset()
  287. } else {
  288. // 未显示高级查询,则置空模糊查询
  289. this.showfuzzySearch = false
  290. this.$refs.cpmProjectList.onSearchChange('')
  291. this.$nextTick(() => {
  292. this.showfuzzySearch = true
  293. })
  294. }
  295. this.advSearchBtnActived = !this.advSearchBtnActived
  296. },
  297. // 设置请求内容
  298. processReq(req) {
  299. const orderBy = 'creationTime asc'
  300. req.data.orderBy = orderBy
  301. return req
  302. },
  303. // 数据返回后,整理response对象
  304. processRes(res) {
  305. if (res.data) {
  306. res.data.forEach((item) => {
  307. // 判断监测单位是否有下级节点
  308. item.projectId = item.id
  309. if (item.subProjectBeans.length > 0) {
  310. item.children = []
  311. // 循环监测单位
  312. item.subProjectBeans.forEach((mitem, mindex) => {
  313. item.children.push({
  314. id: mitem.id,
  315. projectId: item.id,
  316. checkedDeptNames: mitem.checkedDeptNames,
  317. submitterNames: mitem.leaderName,
  318. open: mitem.open,
  319. isChildren: true,
  320. })
  321. })
  322. }
  323. })
  324. }
  325. return res
  326. },
  327. export() {},
  328. initDictionaryInfo() {
  329. CpmService.getDictData().then((res) => {
  330. if (res) {
  331. const dict = []
  332. res.data.forEach((r) => {
  333. dict.push({
  334. id: r.code,
  335. name: r.name,
  336. })
  337. })
  338. this.checkTypeOptions = dict
  339. }
  340. })
  341. },
  342. handleSearch() {
  343. this.expressions = []
  344. this.expressions = [...this.customFilterExpressions]
  345. },
  346. // 重置
  347. resetForm() {
  348. this.formData.title = ''
  349. this.formData.checkType = null
  350. this.formData.startDept = null
  351. },
  352. rowClick(record) {
  353. let url =
  354. `/cpm-project/cpm-check-plan?moduleId=267018022657347584&formListId=267018023269715968&projectId=` +
  355. record.projectId +
  356. '&groupId=1'
  357. if (record.isChildren) {
  358. url =
  359. `/cpm-project/cpm-check-plan?moduleId=267018022657347584&formListId=267018023269715968&projectId=` +
  360. record.projectId +
  361. '&groupId=' +
  362. record.id // 新页面要打开作业页面的路由地址
  363. }
  364. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  365. if (refreshFlag) {
  366. this.refresh()
  367. }
  368. })
  369. },
  370. open(record) {
  371. // const url = `/sd-webform?id=` + record.id + `&pageId=onl%3Acd78040cdda84c6b90b2c688d9bfbaa1` // 新页面要打开作业页面的路由地址
  372. const url = `/sd-webflow/done-pages/` + record.instId
  373. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  374. if (refreshFlag) {
  375. this.refresh()
  376. }
  377. })
  378. // window.open('#/sd-webform?id=' + record.id + '&pageId=onl%3Acd78040cdda84c6b90b2c688d9bfbaa1')
  379. },
  380. refresh() {
  381. return this.$refs.cpmProjectList.refresh(true)
  382. },
  383. },
  384. }
  385. </script>
  386. <style module lang="scss">
  387. @use '@/common/design' as *;
  388. @import '@/application-manage/advance-search.scss';
  389. .wrap-height {
  390. height: 100%;
  391. .row-height {
  392. display: flex;
  393. flex: auto;
  394. height: 100%;
  395. .rightcard {
  396. flex: 1;
  397. width: calc(100% - 20%);
  398. height: 100%;
  399. }
  400. }
  401. }
  402. .warpper {
  403. display: flex;
  404. flex-direction: column;
  405. height: 100%;
  406. > div:first-child {
  407. margin-bottom: 10px;
  408. }
  409. > div:last-child {
  410. flex: 1;
  411. min-height: auto;
  412. }
  413. :global(.ant-table-title) {
  414. display: none;
  415. }
  416. form + div {
  417. float: right;
  418. }
  419. }
  420. </style>