audit-data-apply.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div :class="[$style.wrapHeight, $style.dataclass]">
  3. <div :class="$style.rowHeight">
  4. <div :class="$style.rowLeft">
  5. <audit-class-tree
  6. ref="auditMaintainCatalogTree"
  7. show-line
  8. top-node-text="数据分类维护"
  9. :is-select-dep="true"
  10. :draggable="true"
  11. :cate="true"
  12. :is-select="true"
  13. @treeSelect="treeSelect"
  14. ></audit-class-tree>
  15. </div>
  16. <div :class="$style.rightcard">
  17. <a-card>
  18. <!-- 高级搜索组件 -->
  19. <audit-advanced-query
  20. :expand="expand"
  21. :search-data="formData"
  22. :ref-name="searchform"
  23. :search-style="{ height: '150px', left: '20px', top: '57px' }"
  24. :search-fun="handleSearch"
  25. @searchedClick="searchedClick"
  26. >
  27. <template>
  28. <a-col :span="12">
  29. <a-form-model-item :label="'申请人'" prop="creatorName">
  30. <a-input v-model="formData.creatorName" allow-clear />
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col :span="12">
  34. <a-form-model-item :label="'申请单位'" prop="unitName">
  35. <a-input v-model="formData.unitName" allow-clear />
  36. </a-form-model-item>
  37. </a-col>
  38. </template>
  39. </audit-advanced-query>
  40. <SdDataTableEx
  41. ref="sqapplyDataTable"
  42. :filter-expressions="expressions"
  43. :columns="columns"
  44. :actions="actions"
  45. form-id="iamAuditSqapply"
  46. data-url="api/xcoa-mobile/v1/iamauditsqapply/iamDataSqapplyList"
  47. :search-fields="['creatorName']"
  48. show-selection
  49. :show-advance-query="true"
  50. @searchbtnClick="searchbtnClick"
  51. >
  52. <div slot="isLink" slot-scope="text, record">
  53. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  54. </div>
  55. </SdDataTableEx>
  56. </a-card>
  57. </div>
  58. </div>
  59. <audit-advanced-export
  60. ref="export"
  61. :v-if="false"
  62. :exclebxh="false"
  63. table-id="iamAuditSqapply"
  64. :expressions="exportExpressions"
  65. :config-id="161"
  66. />
  67. </div>
  68. </template>
  69. <script>
  70. import { Modal, message } from 'ant-design-vue'
  71. import axios from '@/common/services/axios-instance'
  72. import auditClassTree from './audit-class-tree.vue'
  73. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  74. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  75. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  76. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  77. import SdDataTableEx from '@/common/components/sd-data-table-ex.vue'
  78. import SdFormItem from '@/common/components/sd-form-item.vue'
  79. import dataService from './data-config'
  80. import TableActionTypes from '@/common/services/table-action-types'
  81. import TableColumnTypes from '@/common/services/table-column-types'
  82. import auditAdvancedExport from '../../components/audit-advanced-export.vue'
  83. import { getUserInfo } from '@/common/store-mixin'
  84. export default {
  85. name: 'AuditDataApply',
  86. metaInfo: {
  87. title: '授权申请',
  88. },
  89. components: {
  90. SdDataTableEx,
  91. auditClassTree,
  92. auditAdvancedQuery,
  93. auditAdvancedExport,
  94. },
  95. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  96. data() {
  97. return {
  98. editnode: true,
  99. key: 0,
  100. searchform: 'searchform',
  101. formData: {
  102. creatorName: '',
  103. unitName: '',
  104. },
  105. exportExpressions: [],
  106. auditOrgId: null,
  107. parentId: 0,
  108. parentCategoryId: '000000',
  109. level: 1,
  110. isEnd: null,
  111. columns: [
  112. {
  113. title: '序号',
  114. dataIndex: 'sortNumber',
  115. width: '80px',
  116. customRender: (text, record, index) => `${index + 1}`,
  117. },
  118. {
  119. title: '分类名称',
  120. dataIndex: 'modelName',
  121. scopedSlots: { customRender: 'isLink' },
  122. },
  123. // 分类编号
  124. {
  125. title: '分类编号',
  126. dataIndex: 'modelCode',
  127. },
  128. {
  129. title: '指定公司',
  130. dataIndex: 'unitName',
  131. },
  132. {
  133. title: '授权者',
  134. dataIndex: 'creatorName',
  135. },
  136. {
  137. title: '授权类型',
  138. dataIndex: 'empowerType',
  139. },
  140. {
  141. title: '授权开始日期',
  142. dataIndex: 'startDate',
  143. sdRender: TableColumnTypes.date,
  144. },
  145. {
  146. title: '授权截止日期',
  147. dataIndex: 'endDate',
  148. sdRender: TableColumnTypes.date,
  149. },
  150. {
  151. title: '申请日期',
  152. dataIndex: 'creationTime',
  153. sdRender: TableColumnTypes.date,
  154. defaultSortOrder: 'desc',
  155. sorter: true,
  156. },
  157. {
  158. title: '当前状态',
  159. dataIndex: 'flowState',
  160. },
  161. {
  162. title: '操作人',
  163. dataIndex: 'currentUser',
  164. },
  165. ],
  166. actions: [
  167. {
  168. label: '授权申请',
  169. id: 'sqapply',
  170. permission: null,
  171. type: TableActionTypes.primary,
  172. callback: () => {
  173. // PRODUCT_IAM_SQSQ 原来
  174. const url = '/sd-flow-guide?code=PRODUCT_IAM_SQSQ' // 新页面要打开的路由地址
  175. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  176. if (refreshFlag) {
  177. // 这里写或者调刷新的方法
  178. this.refreshDataTable()
  179. }
  180. })
  181. },
  182. },
  183. {
  184. label: '导出',
  185. id: 'export',
  186. permission: null,
  187. callback: () => {
  188. this.fnexport()
  189. },
  190. },
  191. {
  192. label: '删除',
  193. id: 'delete',
  194. type: TableActionTypes.ex.delete, // 删除按钮,不需要回调,会自动处理(对sd-data-table无效)
  195. },
  196. ],
  197. expressions: [],
  198. isroot: true,
  199. className: '',
  200. }
  201. },
  202. methods: {
  203. refreshDataTable() {
  204. this.$refs.sqapplyDataTable.clearSelection()
  205. this.$refs.sqapplyDataTable.refresh()
  206. },
  207. fnexport: function() {
  208. this.exportExpressions = []
  209. this.exportExpressions = [
  210. { dataType: 'str', name: 'docType', op: 'eq', stringValue: 'date_apply' },
  211. ]
  212. setTimeout(() => {
  213. this.$refs.export.exportdata()
  214. }, 200)
  215. },
  216. handleSearch() {
  217. this.expressions = []
  218. if (this.formData.creatorName) {
  219. this.expressions.push({
  220. dataType: 'str',
  221. name: 'creatorName',
  222. op: 'like',
  223. stringValue: `%${this.formData.creatorName}%`,
  224. })
  225. }
  226. // 申请单位
  227. if (this.formData.unitName) {
  228. this.expressions.push({
  229. dataType: 'str',
  230. name: 'unitName',
  231. op: 'like',
  232. stringValue: `%${this.formData.unitName}%`,
  233. })
  234. }
  235. this.expressions.push({
  236. dataType: 'long',
  237. name: 'parentId',
  238. op: 'eq',
  239. longValue: this.parentId,
  240. })
  241. },
  242. // 删除回调
  243. onRecordsDeleted() {
  244. message.success('删除成功')
  245. this.$refs.auditMaintainCatalogTree.initTreeData()
  246. },
  247. // 新建保存回调刷新树
  248. onRecordSaved() {
  249. this.$refs.auditMaintainCatalogTree.initTreeData()
  250. },
  251. treeSelect(selectedKeys, info) {
  252. // 父级id
  253. this.formData.creatorName = ''
  254. this.formData.unitName = ''
  255. this.expressions = []
  256. if (info.selectedNodes[0].key !== '0') {
  257. const categoryId = info.selectedNodes[0].data.props.props.categoryId
  258. this.expressions = [
  259. {
  260. dataType: 'str',
  261. name: 'modelCode',
  262. op: 'like',
  263. stringValue: `${categoryId}`,
  264. },
  265. ]
  266. }
  267. },
  268. // 删除
  269. deleteRows() {
  270. const ids = this.$refs.dataTable.getSelectedRowKeys()
  271. dataService.deleteCategory(ids).then(() => {
  272. this.onRecordsDeleted()
  273. this.refresh()
  274. })
  275. },
  276. refresh() {
  277. this.$refs.dataTable.refresh()
  278. },
  279. // 判断按钮显示
  280. showeditbutton(deptId) {
  281. axios({
  282. url: 'api/xcoa-mobile/v1/iamdatacategory/getRole?selectOrgId=0',
  283. method: 'get',
  284. }).then((res) => {
  285. if (res.data === true) {
  286. if (this.actions.length === 0) {
  287. this.actionscsh.forEach((a) => {
  288. this.actions.push(a)
  289. })
  290. }
  291. } else {
  292. this.actions = []
  293. }
  294. })
  295. },
  296. rowClick(record) {
  297. // 判断权限
  298. if (
  299. (record.flowState === '起草') | (record.flowState === '开始') &&
  300. record.creatorAccount === getUserInfo().account
  301. ) {
  302. const url = '/sd-webflow/pages/draft/' + record.instId // 编辑面要打开的路由地址
  303. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  304. if (refreshFlag) {
  305. // 这里写或者调刷新的方法
  306. this.refreshDataTable()
  307. }
  308. })
  309. } else {
  310. window.open('#/sd-webflow/done-pages/' + record.instId)
  311. }
  312. },
  313. },
  314. }
  315. </script>
  316. <style module lang="scss">
  317. @use '@/common/design' as *;
  318. .wrap-height {
  319. height: 100%;
  320. .row-left {
  321. width: 20%;
  322. }
  323. .row-height {
  324. display: flex;
  325. flex: auto;
  326. height: 100%;
  327. .rightcard {
  328. flex: 1;
  329. width: calc(100% - 20%);
  330. height: 100%;
  331. overflow-y: auto;
  332. }
  333. }
  334. }
  335. .dataclass {
  336. :global(.projectlist .ant-table-empty .ant-table-body) {
  337. overflow-x: hidden !important;
  338. }
  339. :global(span > .ant-btn:nth-child(2)) {
  340. color: #fff;
  341. background-color: #1890ff;
  342. border-color: #1890ff;
  343. }
  344. // :global(.ant-table-placeholder) {
  345. // width: auto;
  346. // }
  347. }
  348. </style>