根据角色显示创建合约按钮
Showing
5 changed files
with
50 additions
and
13 deletions
| ... | @@ -47,3 +47,13 @@ export const commonPageConfig = { | ... | @@ -47,3 +47,13 @@ export const commonPageConfig = { |
| 47 | 47 | ||
| 48 | /** 通用的系统guid */ | 48 | /** 通用的系统guid */ |
| 49 | export const SystemGuid = '4149c763d70948b195eb3d4b997c1722'; | 49 | export const SystemGuid = '4149c763d70948b195eb3d4b997c1722'; |
| 50 | |||
| 51 | /** 三种用户角色 */ | ||
| 52 | export enum USERROLE { | ||
| 53 | /** 数据使用方 */ | ||
| 54 | USE = 'use', | ||
| 55 | /** 数据提供方 */ | ||
| 56 | PROVIDER = 'provider', | ||
| 57 | /** 平台运营方 */ | ||
| 58 | OPERATION = 'operation' | ||
| 59 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -8,6 +8,7 @@ meta: | ... | @@ -8,6 +8,7 @@ meta: |
| 8 | 8 | ||
| 9 | <script lang="ts" setup> | 9 | <script lang="ts" setup> |
| 10 | import useUserStore from '@/store/modules/user'; | 10 | import useUserStore from '@/store/modules/user'; |
| 11 | import { USERROLE } from '@/utils/enum'; | ||
| 11 | import { ElMessage } from 'element-plus'; | 12 | import { ElMessage } from 'element-plus'; |
| 12 | 13 | ||
| 13 | const userStore = useUserStore() | 14 | const userStore = useUserStore() |
| ... | @@ -22,7 +23,7 @@ const dialogVisible = computed(() => { | ... | @@ -22,7 +23,7 @@ const dialogVisible = computed(() => { |
| 22 | const loading = ref(false); | 23 | const loading = ref(false); |
| 23 | 24 | ||
| 24 | /** 记录用户选择的角色 */ | 25 | /** 记录用户选择的角色 */ |
| 25 | const selectRole = ref('use'); //TODO,在专区需要默认值是平台运营方。 | 26 | const selectRole = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。 |
| 26 | 27 | ||
| 27 | onBeforeRouteLeave(() => { | 28 | onBeforeRouteLeave(() => { |
| 28 | }) | 29 | }) |
| ... | @@ -83,16 +84,16 @@ const beforeLogin = () => { | ... | @@ -83,16 +84,16 @@ const beforeLogin = () => { |
| 83 | <div class="login_form login-size"> | 84 | <div class="login_form login-size"> |
| 84 | <div class="login-title">选择角色</div> | 85 | <div class="login-title">选择角色</div> |
| 85 | <div class="row-main"> | 86 | <div class="row-main"> |
| 86 | <div class="per" :class="selectRole == 'use' ? 'selected' : ''" @click="selectRole = 'use'"> | 87 | <div class="per" :class="selectRole == USERROLE.USE ? 'selected' : ''" @click="selectRole = USERROLE.USE"> |
| 87 | <div class="img-use"></div> | 88 | <div class="img-use"></div> |
| 88 | <div class="title">数据使用方</div> | 89 | <div class="title">数据使用方</div> |
| 89 | </div> | 90 | </div> |
| 90 | <div class="per" :class="selectRole == 'provider' ? 'selected' : ''" @click="selectRole = 'provider'"> | 91 | <div class="per" :class="selectRole == USERROLE.PROVIDER ? 'selected' : ''" @click="selectRole = USERROLE.PROVIDER"> |
| 91 | <div class="img-provider"></div> | 92 | <div class="img-provider"></div> |
| 92 | <div class="title">数据提供方</div> | 93 | <div class="title">数据提供方</div> |
| 93 | </div> | 94 | </div> |
| 94 | <!-- 只有专区才有 --> | 95 | <!-- 只有专区才有 --> |
| 95 | <!-- <div class="per" :class="selectRole == 'operation' ? 'selected' : ''" @click="selectRole = 'operation'"> | 96 | <!-- <div class="per" :class="selectRole == USERROLE.OPERATION ? 'selected' : ''" @click="selectRole = USERROLE.OPERATION"> |
| 96 | <div class="img-operation"></div> | 97 | <div class="img-operation"></div> |
| 97 | <div class="title">平台运营方</div> | 98 | <div class="title">平台运营方</div> |
| 98 | </div> --> | 99 | </div> --> | ... | ... |
| ... | @@ -17,7 +17,7 @@ import { | ... | @@ -17,7 +17,7 @@ import { |
| 17 | import StrategyTable from "./components/strategyTable.vue"; | 17 | import StrategyTable from "./components/strategyTable.vue"; |
| 18 | import { CirclePlus } from "@element-plus/icons-vue"; | 18 | import { CirclePlus } from "@element-plus/icons-vue"; |
| 19 | import { scrollLastRowToView } from "@/utils/common"; | 19 | import { scrollLastRowToView } from "@/utils/common"; |
| 20 | import { TableColumnWidth } from "@/utils/enum"; | 20 | import { TableColumnWidth, USERROLE } from "@/utils/enum"; |
| 21 | import { | 21 | import { |
| 22 | getParamsList, | 22 | getParamsList, |
| 23 | } from "@/api/modules/queryService"; | 23 | } from "@/api/modules/queryService"; |
| ... | @@ -38,6 +38,11 @@ const fullPath = route.fullPath; | ... | @@ -38,6 +38,11 @@ const fullPath = route.fullPath; |
| 38 | const dataSmartContract = useDataSmartContract(); | 38 | const dataSmartContract = useDataSmartContract(); |
| 39 | const { proxy } = getCurrentInstance() as any; | 39 | const { proxy } = getCurrentInstance() as any; |
| 40 | 40 | ||
| 41 | /** 是否是数据提供方 */ | ||
| 42 | const isDataUse = computed(() => { | ||
| 43 | return localStorage.getItem('userRole') == USERROLE.USE; | ||
| 44 | }) | ||
| 45 | |||
| 41 | const signModeList = ref([]); | 46 | const signModeList = ref([]); |
| 42 | 47 | ||
| 43 | const baseInfoFormRef = ref(); | 48 | const baseInfoFormRef = ref(); |
| ... | @@ -437,6 +442,10 @@ const getSubmitInfo = () => { | ... | @@ -437,6 +442,10 @@ const getSubmitInfo = () => { |
| 437 | } | 442 | } |
| 438 | 443 | ||
| 439 | const saveDraft = () => { | 444 | const saveDraft = () => { |
| 445 | if (isDataUse.value) { | ||
| 446 | proxy.$ElMessage.error('数据使用方不能新建合约'); | ||
| 447 | return; | ||
| 448 | } | ||
| 440 | let params: any = getSubmitInfo(); | 449 | let params: any = getSubmitInfo(); |
| 441 | params.isResubmit = false; | 450 | params.isResubmit = false; |
| 442 | fullscreenLoading.value = true; | 451 | fullscreenLoading.value = true; |
| ... | @@ -474,6 +483,10 @@ const saveDraft = () => { | ... | @@ -474,6 +483,10 @@ const saveDraft = () => { |
| 474 | } | 483 | } |
| 475 | 484 | ||
| 476 | const submit = () => { | 485 | const submit = () => { |
| 486 | if (isDataUse.value) { | ||
| 487 | proxy.$ElMessage.error('数据使用方不能新建合约'); | ||
| 488 | return; | ||
| 489 | } | ||
| 477 | baseInfoFormRef.value.ruleFormRef?.validate((valid, errorItem) => { | 490 | baseInfoFormRef.value.ruleFormRef?.validate((valid, errorItem) => { |
| 478 | if (valid) { | 491 | if (valid) { |
| 479 | for (const data of extendData.value) { | 492 | for (const data of extendData.value) { |
| ... | @@ -606,13 +619,14 @@ const cancel = () => { | ... | @@ -606,13 +619,14 @@ const cancel = () => { |
| 606 | const detailInfo: any = ref({}); | 619 | const detailInfo: any = ref({}); |
| 607 | 620 | ||
| 608 | /** 当前会员是否认证信息 */ | 621 | /** 当前会员是否认证信息 */ |
| 609 | const currTenantDetailInfo: any = ref({ }); | 622 | const currTenantDetailInfo: any = ref({}); |
| 610 | 623 | ||
| 611 | const psLogon = ref(); | 624 | const psLogon = ref(); |
| 612 | 625 | ||
| 613 | onBeforeMount(() => { | 626 | onBeforeMount(() => { |
| 614 | let exec = () => { | 627 | let exec = () => { |
| 615 | if (userData.superTubeFlag != 'Y') { | 628 | let userRole = localStorage.getItem('userRole'); |
| 629 | if (userRole == USERROLE.PROVIDER) { | ||
| 616 | baseInfoFormItems.value[1].disabled = true; | 630 | baseInfoFormItems.value[1].disabled = true; |
| 617 | baseInfoFormItems.value[1].default = '01'; | 631 | baseInfoFormItems.value[1].default = '01'; |
| 618 | productTableInfo.value.editInfo.dataProductId.props.label = 'productName'; | 632 | productTableInfo.value.editInfo.dataProductId.props.label = 'productName'; | ... | ... |
| ... | @@ -12,7 +12,7 @@ import { | ... | @@ -12,7 +12,7 @@ import { |
| 12 | cancelContract, | 12 | cancelContract, |
| 13 | } from "@/api/modules/dataSmartContract" | 13 | } from "@/api/modules/dataSmartContract" |
| 14 | import useDataSmartContract from "@/store/modules/dataSmartContract"; | 14 | import useDataSmartContract from "@/store/modules/dataSmartContract"; |
| 15 | import { commonPageConfig } from '@/utils/enum'; | 15 | import { commonPageConfig, USERROLE } from '@/utils/enum'; |
| 16 | import { getEnterpriseData } from "@/api/modules/dataIdentify"; | 16 | import { getEnterpriseData } from "@/api/modules/dataIdentify"; |
| 17 | 17 | ||
| 18 | const userData = JSON.parse(localStorage.userData); | 18 | const userData = JSON.parse(localStorage.userData); |
| ... | @@ -22,6 +22,11 @@ const route = useRoute(); | ... | @@ -22,6 +22,11 @@ const route = useRoute(); |
| 22 | const { proxy } = getCurrentInstance() as any; | 22 | const { proxy } = getCurrentInstance() as any; |
| 23 | const dataSmartContractStore = useDataSmartContract(); | 23 | const dataSmartContractStore = useDataSmartContract(); |
| 24 | 24 | ||
| 25 | /** 是否是数据提供方 */ | ||
| 26 | const isDataUse = computed(() => { | ||
| 27 | return localStorage.getItem('userRole') == USERROLE.USE; | ||
| 28 | }) | ||
| 29 | |||
| 25 | const searchItemList = ref([ | 30 | const searchItemList = ref([ |
| 26 | { | 31 | { |
| 27 | type: "input", | 32 | type: "input", |
| ... | @@ -290,6 +295,10 @@ const tablePageChange = (info) => { | ... | @@ -290,6 +295,10 @@ const tablePageChange = (info) => { |
| 290 | }; | 295 | }; |
| 291 | 296 | ||
| 292 | const newCreate = () => { | 297 | const newCreate = () => { |
| 298 | if (isDataUse.value) { | ||
| 299 | proxy.$ElMessage.error('数据使用方不能新建合约'); | ||
| 300 | return; | ||
| 301 | } | ||
| 293 | let exec = () => { | 302 | let exec = () => { |
| 294 | if (tenantData.isCertification != 'Y' && !currTenantDetailInfo.value.trustedIdentityCredential) { //认证过的 | 303 | if (tenantData.isCertification != 'Y' && !currTenantDetailInfo.value.trustedIdentityCredential) { //认证过的 |
| 295 | if (userData.superTubeFlag != 'Y') {//平台用户 | 304 | if (userData.superTubeFlag != 'Y') {//平台用户 |
| ... | @@ -347,11 +356,12 @@ onBeforeMount(() => { | ... | @@ -347,11 +356,12 @@ onBeforeMount(() => { |
| 347 | <div class="container_wrap"> | 356 | <div class="container_wrap"> |
| 348 | <div class="table_tool_wrap"> | 357 | <div class="table_tool_wrap"> |
| 349 | <TableTools :searchItems="searchItemList" :searchId="'contract-search'" @search="toSearch" :init="false" /> | 358 | <TableTools :searchItems="searchItemList" :searchId="'contract-search'" @search="toSearch" :init="false" /> |
| 350 | <div class="tools_btns"> | 359 | <!-- 数据使用方没有新增按钮 --> |
| 360 | <div class="tools_btns" v-if="!isDataUse"> | ||
| 351 | <el-button type="primary" @click="newCreate">新增</el-button> | 361 | <el-button type="primary" @click="newCreate">新增</el-button> |
| 352 | </div> | 362 | </div> |
| 353 | </div> | 363 | </div> |
| 354 | <div class="table_panel_wrap"> | 364 | <div class="table_panel_wrap" :style="{ height: !isDataUse ? 'calc(100% - 88px)' : 'calc(100% - 44px)' }"> |
| 355 | <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" /> | 365 | <Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" /> |
| 356 | </div> | 366 | </div> |
| 357 | </div> | 367 | </div> | ... | ... |
| 1 | <script lang="ts" setup name="homeIndex"> | 1 | <script lang="ts" setup name="homeIndex"> |
| 2 | import { USERROLE } from '@/utils/enum'; | ||
| 3 | |||
| 2 | 4 | ||
| 3 | const router = useRouter(); | 5 | const router = useRouter(); |
| 4 | 6 | ||
| ... | @@ -43,7 +45,7 @@ const click = (command) => { | ... | @@ -43,7 +45,7 @@ const click = (command) => { |
| 43 | 45 | ||
| 44 | <template> | 46 | <template> |
| 45 | <div class="main-content"> | 47 | <div class="main-content"> |
| 46 | <div class="role-main dataUse" v-if="dataRole == 'use'"> | 48 | <div class="role-main dataUse" v-if="dataRole == USERROLE.USE"> |
| 47 | <div class="header-title">数据使用方</div> | 49 | <div class="header-title">数据使用方</div> |
| 48 | <div class="chunk-row" @click="click('identify')"> | 50 | <div class="chunk-row" @click="click('identify')"> |
| 49 | <div class="img identify"></div> | 51 | <div class="img identify"></div> |
| ... | @@ -94,7 +96,7 @@ const click = (command) => { | ... | @@ -94,7 +96,7 @@ const click = (command) => { |
| 94 | </div> | 96 | </div> |
| 95 | </div> | 97 | </div> |
| 96 | </div> | 98 | </div> |
| 97 | <div class="role-main dataProvider" v-if="dataRole == 'provider'"> | 99 | <div class="role-main dataProvider" v-if="dataRole == USERROLE.PROVIDER"> |
| 98 | <div class="header-title">数据提供方</div> | 100 | <div class="header-title">数据提供方</div> |
| 99 | <div class="chunk-main"> | 101 | <div class="chunk-main"> |
| 100 | <div class="chunk-per" @click="click('identify')"> | 102 | <div class="chunk-per" @click="click('identify')"> |
| ... | @@ -129,7 +131,7 @@ const click = (command) => { | ... | @@ -129,7 +131,7 @@ const click = (command) => { |
| 129 | </div> | 131 | </div> |
| 130 | </div> | 132 | </div> |
| 131 | </div> | 133 | </div> |
| 132 | <div class="role-main dataOperation" v-if="dataRole == 'operation'"> | 134 | <div class="role-main dataOperation" v-if="dataRole == USERROLE.OPERATION"> |
| 133 | <div class="header-title">平台运营方</div> | 135 | <div class="header-title">平台运营方</div> |
| 134 | <div class="chunk-main"> | 136 | <div class="chunk-main"> |
| 135 | <div class="chunk-per" @click="click('identify')"> | 137 | <div class="chunk-per" @click="click('identify')"> | ... | ... |
-
Please register or sign in to post a comment