audit-view-list.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <div :class="$style.wrapHeight">
  3. <div :class="$style.rowHeight">
  4. <AduitAreaTree ref="auditAreaTree" @treeSelect="treeSelect"></AduitAreaTree>
  5. <div :class="$style.rightcard">
  6. <a-card>
  7. <!-- 高级搜索组件 -->
  8. <audit-advanced-query
  9. :expand="expand"
  10. :search-data="formData"
  11. :ref-name="searchform"
  12. :search-style="{ height: '150px', left: '20px', top: '57px' }"
  13. :search-fun="handleSearch"
  14. @searchedClick="searchedClick"
  15. >
  16. <template>
  17. <!-- <a-col :span="12">
  18. <a-form-model-item :label="'模型编号'" prop="modelCode">
  19. <a-input v-model="formData.modelCode" allow-clear />
  20. </a-form-model-item>
  21. </a-col> -->
  22. <a-col :span="12">
  23. <a-form-model-item :label="'模型名称'" prop="modelName">
  24. <a-input v-model="formData.modelName" allow-clear />
  25. </a-form-model-item>
  26. </a-col>
  27. </template>
  28. </audit-advanced-query>
  29. <sd-data-table
  30. ref="SJMXDataTable"
  31. :filter-expressions="expressions"
  32. :columns="columns"
  33. :actions="actions"
  34. form-id="iamModelMaintain"
  35. data-url="api/xcoa-mobile/v1/iammodelmaintain/iamModelMaintainQueryList"
  36. :search-fields="['modelName']"
  37. show-selection
  38. :show-advance-query="true"
  39. @searchbtnClick="searchbtnClick"
  40. >
  41. <div slot="islink" slot-scope="text, record">
  42. <a v-if="rowNameStatus(record)" :title="text" @click="rowClick(record)">{{ text }}</a>
  43. <span v-else>{{ text }}</span>
  44. </div>
  45. <div slot="action" slot-scope="text, record">
  46. <!-- 如果 -->
  47. <a-button
  48. v-if="sharedSettingStatus(record)"
  49. type="link"
  50. @click="onActionShare(record)"
  51. >申请共享</a-button
  52. >
  53. <span v-else :class="$style.noAction">申请共享</span>
  54. </div>
  55. </sd-data-table>
  56. </a-card>
  57. </div>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import axios from '@/common/services/axios-instance'
  63. import { Modal, message } from 'ant-design-vue'
  64. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  65. import TableActionTypes from '@/common/services/table-action-types'
  66. import { getUserInfo } from '@/common/store-mixin'
  67. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  68. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  69. import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
  70. // import auditMaintainClassifyTree from './audit-maintain-classify-tree'
  71. import auditMaintainService from './audit-maintain-service'
  72. import AduitAreaTree from './aduit-area-tree.vue'
  73. import components from './_import-components/audit-view-list-import'
  74. export default {
  75. name: 'AuditViewList',
  76. metaInfo: {
  77. title: '模型查询',
  78. },
  79. components: {
  80. ...components,
  81. auditAdvancedQuery,
  82. // auditMaintainClassifyTree,
  83. AduitAreaTree,
  84. },
  85. mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
  86. data() {
  87. return {
  88. key: 0,
  89. treeData: [],
  90. searchform: 'searchform',
  91. formData: {
  92. modelCode: '',
  93. modelName: '',
  94. },
  95. formId: 'iamModelMaintain',
  96. columns: [
  97. {
  98. title: '序号',
  99. dataIndex: 'sortNumber',
  100. width: '70px',
  101. customRender: (text, record, index) => `${index + 1}`,
  102. },
  103. {
  104. title: '模型名称',
  105. dataIndex: 'modelName',
  106. scopedSlots: { customRender: 'islink' },
  107. },
  108. {
  109. title: '模型编号',
  110. dataIndex: 'id',
  111. },
  112. {
  113. title: '模型描述',
  114. dataIndex: 'modelDesc',
  115. },
  116. {
  117. title: '操作',
  118. dataIndex: 'sharedSetting',
  119. // 按钮
  120. scopedSlots: { customRender: 'action' },
  121. },
  122. ],
  123. actions: [
  124. {
  125. label: '授权申请',
  126. id: 'sqapply',
  127. permission: null,
  128. type: TableActionTypes.primary,
  129. callback: () => {
  130. window.open('#/sd-flow-guide?code=PRODUCT_IAM_MLSQSQ')
  131. },
  132. },
  133. ],
  134. expressions: [
  135. {
  136. dataType: 'str',
  137. name: 'catalogId',
  138. op: 'eq',
  139. stringValue: 0,
  140. },
  141. ],
  142. catalogId: null,
  143. catalogName: '',
  144. isroot: true,
  145. modelDomain: '',
  146. }
  147. },
  148. computed: {
  149. userInfoData() {
  150. return getUserInfo()
  151. },
  152. },
  153. methods: {
  154. treeSelect(selectedKeys, info) {
  155. this.modelDomain = selectedKeys[0] || ''
  156. this.handleSearch()
  157. },
  158. refresh() {
  159. return this.$refs.SJMBKDataTable.refresh(true)
  160. },
  161. rowClick(record) {
  162. const url = '/audit-maintain-from?record=' + record.id + '&type=readonly' // 新页面要打开的路由地址
  163. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  164. if (refreshFlag) {
  165. this.refresh()
  166. }
  167. })
  168. },
  169. // 共享按钮状态
  170. sharedSettingStatus(record) {
  171. // 0 没共享过, 1 有共享记录
  172. // 如果是创建人,已经申请过,
  173. // 开启共享状态
  174. const flag =
  175. record.reservelong1 !== 1 &&
  176. record.creatorId !== this.userInfoData.id &&
  177. record.sharedSetting === 0 &&
  178. record.reservestring1 !== 'true'
  179. // if (record.creatorId !== this.userInfoData.id) {
  180. // return true
  181. // }
  182. return flag
  183. },
  184. rowNameStatus(record) {
  185. return (
  186. record.reservelong1 === 1 ||
  187. record.creatorId === this.userInfoData.id ||
  188. record.reservestring1 === 'true'
  189. )
  190. },
  191. // 模板名称是否能点击
  192. islink(record) {
  193. // 如果是创建人,已经申请过,且审核状态是通过
  194. // 可以点击
  195. if (record.creatorId === this.userInfoData.id) {
  196. return true
  197. }
  198. return false
  199. },
  200. // 查询
  201. handleSearch() {
  202. this.expressions = []
  203. // 模型编号
  204. if (this.formData.modelCode) {
  205. this.expressions.push({
  206. dataType: 'str',
  207. name: 'id',
  208. op: 'like',
  209. stringValue: `%${this.formData.modelCode}%`,
  210. })
  211. }
  212. // 模型名称
  213. if (this.formData.modelName) {
  214. this.expressions.push({
  215. dataType: 'str',
  216. name: 'modelName',
  217. op: 'like',
  218. stringValue: `%${this.formData.modelName}%`,
  219. })
  220. }
  221. // 模型领域
  222. if (this.modelDomain) {
  223. this.expressions.push({
  224. dataType: 'str',
  225. name: 'modelDomain',
  226. op: 'eq',
  227. stringValue: this.modelDomain,
  228. })
  229. }
  230. },
  231. // 点击申请共享
  232. onActionShare(val) {
  233. const userInfo = getUserInfo()
  234. const dataList = []
  235. const paramsList = ['modelId', 'applyForId', 'applyStatus']
  236. paramsList.forEach((item) => {
  237. const obj = {}
  238. obj.key = item
  239. obj.oldVal = null
  240. if (item === 'modelId') {
  241. obj.newVal = val.id
  242. }
  243. if (item === 'applyForId') {
  244. obj.newVal = userInfo.id
  245. }
  246. if (item === 'applyStatus') {
  247. obj.newVal = '0'
  248. }
  249. dataList.push(obj)
  250. })
  251. const jsonStr = JSON.stringify(dataList)
  252. const paramsLog = {
  253. beanId: null,
  254. formId: 'iamModelShare',
  255. pageId: 'audit/maintain/iamModelShare',
  256. jsonStr,
  257. }
  258. const params = {
  259. eventId: 'save',
  260. inputs: [
  261. {
  262. name: 'id',
  263. },
  264. {
  265. name: 'modelId',
  266. value: val.id,
  267. },
  268. {
  269. name: 'applyForId',
  270. value: userInfo.id,
  271. },
  272. {
  273. name: 'applyStatus',
  274. value: '0',
  275. },
  276. {
  277. name: 'belongedOrgId',
  278. value: -1,
  279. },
  280. {
  281. name: 'modelCreatorId',
  282. value: val.creatorId,
  283. },
  284. ],
  285. pageFlowId: null,
  286. pagePath: null,
  287. }
  288. auditMaintainService.getApplyShareModel().then((res) => {
  289. params.pageFlowId = res.data.attrs.pageflowId
  290. params.pagePath = res.data.attrs.pagePath
  291. auditMaintainService.applyShareLog(paramsLog).then((resLog) => {
  292. if (res.data) {
  293. auditMaintainService.applyShare(params).then((resPar) => {
  294. // 提示
  295. if (resPar.data) message.warning('您的申请已发送创建人请稍等,申请通过后即可查看')
  296. })
  297. }
  298. })
  299. })
  300. // id val.id
  301. // 根据id向创建人发送通知
  302. },
  303. },
  304. }
  305. </script>
  306. <style module lang="scss">
  307. @use '@/common/design' as *;
  308. .wrap-height {
  309. height: 100%;
  310. .row-height {
  311. display: flex;
  312. flex: auto;
  313. height: 100%;
  314. .rightcard {
  315. flex: 1;
  316. width: calc(100% - 20%);
  317. height: 100%;
  318. }
  319. }
  320. }
  321. .no-action {
  322. padding: 0 15px;
  323. color: $text-color-secondary;
  324. }
  325. </style>