123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <template>
- <div :class="$style.wrapHeight">
- <div :class="$style.rowHeight">
- <AduitAreaTree ref="auditAreaTree" @treeSelect="treeSelect"></AduitAreaTree>
- <div :class="$style.rightcard">
- <a-card>
- <!-- 高级搜索组件 -->
- <audit-advanced-query
- :expand="expand"
- :search-data="formData"
- :ref-name="searchform"
- :search-style="{ height: '150px', left: '20px', top: '57px' }"
- :search-fun="handleSearch"
- @searchedClick="searchedClick"
- >
- <template>
- <!-- <a-col :span="12">
- <a-form-model-item :label="'模型编号'" prop="modelCode">
- <a-input v-model="formData.modelCode" allow-clear />
- </a-form-model-item>
- </a-col> -->
- <a-col :span="12">
- <a-form-model-item :label="'模型名称'" prop="modelName">
- <a-input v-model="formData.modelName" allow-clear />
- </a-form-model-item>
- </a-col>
- </template>
- </audit-advanced-query>
- <sd-data-table
- ref="SJMXDataTable"
- :filter-expressions="expressions"
- :columns="columns"
- :actions="actions"
- form-id="iamModelMaintain"
- data-url="api/xcoa-mobile/v1/iammodelmaintain/iamModelMaintainQueryList"
- :search-fields="['modelName']"
- show-selection
- :show-advance-query="true"
- @searchbtnClick="searchbtnClick"
- >
- <div slot="islink" slot-scope="text, record">
- <a v-if="rowNameStatus(record)" :title="text" @click="rowClick(record)">{{ text }}</a>
- <span v-else>{{ text }}</span>
- </div>
- <div slot="action" slot-scope="text, record">
- <!-- 如果 -->
- <a-button
- v-if="sharedSettingStatus(record)"
- type="link"
- @click="onActionShare(record)"
- >申请共享</a-button
- >
- <span v-else :class="$style.noAction">申请共享</span>
- </div>
- </sd-data-table>
- </a-card>
- </div>
- </div>
- </div>
- </template>
- <script>
- import axios from '@/common/services/axios-instance'
- import { Modal, message } from 'ant-design-vue'
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import TableActionTypes from '@/common/services/table-action-types'
- import { getUserInfo } from '@/common/store-mixin'
- import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
- import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
- import auditAdvancedGroupMixins from '../../components/audit-advanced-group-mixins'
- // import auditMaintainClassifyTree from './audit-maintain-classify-tree'
- import auditMaintainService from './audit-maintain-service'
- import AduitAreaTree from './aduit-area-tree.vue'
- import components from './_import-components/audit-view-list-import'
- export default {
- name: 'AuditViewList',
- metaInfo: {
- title: '模型查询',
- },
- components: {
- ...components,
- auditAdvancedQuery,
- // auditMaintainClassifyTree,
- AduitAreaTree,
- },
- mixins: [auditAdvancedQueryMixins, auditAdvancedGroupMixins],
- data() {
- return {
- key: 0,
- treeData: [],
- searchform: 'searchform',
- formData: {
- modelCode: '',
- modelName: '',
- },
- formId: 'iamModelMaintain',
- columns: [
- {
- title: '序号',
- dataIndex: 'sortNumber',
- width: '70px',
- customRender: (text, record, index) => `${index + 1}`,
- },
- {
- title: '模型名称',
- dataIndex: 'modelName',
- scopedSlots: { customRender: 'islink' },
- },
- {
- title: '模型编号',
- dataIndex: 'id',
- },
- {
- title: '模型描述',
- dataIndex: 'modelDesc',
- },
- {
- title: '操作',
- dataIndex: 'sharedSetting',
- // 按钮
- scopedSlots: { customRender: 'action' },
- },
- ],
- actions: [
- {
- label: '授权申请',
- id: 'sqapply',
- permission: null,
- type: TableActionTypes.primary,
- callback: () => {
- window.open('#/sd-flow-guide?code=PRODUCT_IAM_MLSQSQ')
- },
- },
- ],
- expressions: [
- {
- dataType: 'str',
- name: 'catalogId',
- op: 'eq',
- stringValue: 0,
- },
- ],
- catalogId: null,
- catalogName: '',
- isroot: true,
- modelDomain: '',
- }
- },
- computed: {
- userInfoData() {
- return getUserInfo()
- },
- },
- methods: {
- treeSelect(selectedKeys, info) {
- this.modelDomain = selectedKeys[0] || ''
- this.handleSearch()
- },
- refresh() {
- return this.$refs.SJMBKDataTable.refresh(true)
- },
- rowClick(record) {
- const url = '/audit-maintain-from?record=' + record.id + '&type=readonly' // 新页面要打开的路由地址
- crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
- if (refreshFlag) {
- this.refresh()
- }
- })
- },
- // 共享按钮状态
- sharedSettingStatus(record) {
- // 0 没共享过, 1 有共享记录
- // 如果是创建人,已经申请过,
- // 开启共享状态
- const flag =
- record.reservelong1 !== 1 &&
- record.creatorId !== this.userInfoData.id &&
- record.sharedSetting === 0 &&
- record.reservestring1 !== 'true'
- // if (record.creatorId !== this.userInfoData.id) {
- // return true
- // }
- return flag
- },
- rowNameStatus(record) {
- return (
- record.reservelong1 === 1 ||
- record.creatorId === this.userInfoData.id ||
- record.reservestring1 === 'true'
- )
- },
- // 模板名称是否能点击
- islink(record) {
- // 如果是创建人,已经申请过,且审核状态是通过
- // 可以点击
- if (record.creatorId === this.userInfoData.id) {
- return true
- }
- return false
- },
- // 查询
- handleSearch() {
- this.expressions = []
- // 模型编号
- if (this.formData.modelCode) {
- this.expressions.push({
- dataType: 'str',
- name: 'id',
- op: 'like',
- stringValue: `%${this.formData.modelCode}%`,
- })
- }
- // 模型名称
- if (this.formData.modelName) {
- this.expressions.push({
- dataType: 'str',
- name: 'modelName',
- op: 'like',
- stringValue: `%${this.formData.modelName}%`,
- })
- }
- // 模型领域
- if (this.modelDomain) {
- this.expressions.push({
- dataType: 'str',
- name: 'modelDomain',
- op: 'eq',
- stringValue: this.modelDomain,
- })
- }
- },
- // 点击申请共享
- onActionShare(val) {
- const userInfo = getUserInfo()
- const dataList = []
- const paramsList = ['modelId', 'applyForId', 'applyStatus']
- paramsList.forEach((item) => {
- const obj = {}
- obj.key = item
- obj.oldVal = null
- if (item === 'modelId') {
- obj.newVal = val.id
- }
- if (item === 'applyForId') {
- obj.newVal = userInfo.id
- }
- if (item === 'applyStatus') {
- obj.newVal = '0'
- }
- dataList.push(obj)
- })
- const jsonStr = JSON.stringify(dataList)
- const paramsLog = {
- beanId: null,
- formId: 'iamModelShare',
- pageId: 'audit/maintain/iamModelShare',
- jsonStr,
- }
- const params = {
- eventId: 'save',
- inputs: [
- {
- name: 'id',
- },
- {
- name: 'modelId',
- value: val.id,
- },
- {
- name: 'applyForId',
- value: userInfo.id,
- },
- {
- name: 'applyStatus',
- value: '0',
- },
- {
- name: 'belongedOrgId',
- value: -1,
- },
- {
- name: 'modelCreatorId',
- value: val.creatorId,
- },
- ],
- pageFlowId: null,
- pagePath: null,
- }
- auditMaintainService.getApplyShareModel().then((res) => {
- params.pageFlowId = res.data.attrs.pageflowId
- params.pagePath = res.data.attrs.pagePath
- auditMaintainService.applyShareLog(paramsLog).then((resLog) => {
- if (res.data) {
- auditMaintainService.applyShare(params).then((resPar) => {
- // 提示
- if (resPar.data) message.warning('您的申请已发送创建人请稍等,申请通过后即可查看')
- })
- }
- })
- })
- // id val.id
- // 根据id向创建人发送通知
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .wrap-height {
- height: 100%;
- .row-height {
- display: flex;
- flex: auto;
- height: 100%;
- .rightcard {
- flex: 1;
- width: calc(100% - 20%);
- height: 100%;
- }
- }
- }
- .no-action {
- padding: 0 15px;
- color: $text-color-secondary;
- }
- </style>
|