20b074ca by lihua

创建合约按钮根据角色修改

1 parent facb616e
......@@ -47,3 +47,13 @@ export const commonPageConfig = {
/** 通用的系统guid */
export const SystemGuid = '455a0c2180aa4217b60e859032de0943';
/** 三种用户角色 */
export enum USERROLE {
/** 数据使用方 */
USE = 'use',
/** 数据提供方 */
PROVIDER = 'provider',
/** 平台运营方 */
OPERATION = 'operation'
}
\ No newline at end of file
......
......@@ -8,6 +8,7 @@ meta:
<script lang="ts" setup>
import useUserStore from '@/store/modules/user';
import { USERROLE } from '@/utils/enum';
import { ElMessage } from 'element-plus';
const userStore = useUserStore()
......@@ -22,7 +23,7 @@ const dialogVisible = computed(() => {
const loading = ref(false);
/** 记录用户选择的角色 */
const selectRole = ref('use'); //TODO,在专区需要默认值是平台运营方。
const selectRole = ref(USERROLE.USE); //TODO,在专区需要默认值是平台运营方。
onBeforeRouteLeave(() => {
})
......@@ -83,16 +84,16 @@ const beforeLogin = () => {
<div class="login_form login-size">
<div class="login-title">选择角色</div>
<div class="row-main">
<div class="per" :class="selectRole == 'use' ? 'selected' : ''" @click="selectRole = 'use'">
<div class="per" :class="selectRole == USERROLE.USE ? 'selected' : ''" @click="selectRole = USERROLE.USE">
<div class="img-use"></div>
<div class="title">数据使用方</div>
</div>
<div class="per" :class="selectRole == 'provider' ? 'selected' : ''" @click="selectRole = 'provider'">
<div class="per" :class="selectRole == USERROLE.PROVIDER ? 'selected' : ''" @click="selectRole = USERROLE.PROVIDER">
<div class="img-provider"></div>
<div class="title">数据提供方</div>
</div>
<!-- 只有专区才有 -->
<!-- <div class="per" :class="selectRole == 'operation' ? 'selected' : ''" @click="selectRole = 'operation'">
<!-- <div class="per" :class="selectRole == USERROLE.OPERATION ? 'selected' : ''" @click="selectRole = USERROLE.OPERATION">
<div class="img-operation"></div>
<div class="title">平台运营方</div>
</div> -->
......
......@@ -17,7 +17,7 @@ import {
import StrategyTable from "./components/strategyTable.vue";
import { CirclePlus } from "@element-plus/icons-vue";
import { scrollLastRowToView } from "@/utils/common";
import { TableColumnWidth } from "@/utils/enum";
import { TableColumnWidth, USERROLE } from "@/utils/enum";
import {
getParamsList,
} from "@/api/modules/queryService";
......@@ -38,6 +38,11 @@ const fullPath = route.fullPath;
const dataSmartContract = useDataSmartContract();
const { proxy } = getCurrentInstance() as any;
/** 是否是数据提供方 */
const isDataUse = computed(() => {
return localStorage.getItem('userRole') == USERROLE.USE;
})
const signModeList = ref([]);
const baseInfoFormRef = ref();
......@@ -437,6 +442,10 @@ const getSubmitInfo = () => {
}
const saveDraft = () => {
if (isDataUse.value) {
proxy.$ElMessage.error('数据使用方不能新建合约');
return;
}
let params: any = getSubmitInfo();
params.isResubmit = false;
fullscreenLoading.value = true;
......@@ -474,6 +483,10 @@ const saveDraft = () => {
}
const submit = () => {
if (isDataUse.value) {
proxy.$ElMessage.error('数据使用方不能新建合约');
return;
}
baseInfoFormRef.value.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
for (const data of extendData.value) {
......@@ -606,13 +619,14 @@ const cancel = () => {
const detailInfo: any = ref({});
/** 当前会员是否认证信息 */
const currTenantDetailInfo: any = ref({ });
const currTenantDetailInfo: any = ref({});
const psLogon = ref();
onBeforeMount(() => {
let exec = () => {
if (userData.superTubeFlag != 'Y') {
let userRole = localStorage.getItem('userRole');
if (userRole == USERROLE.PROVIDER) {
baseInfoFormItems.value[1].disabled = true;
baseInfoFormItems.value[1].default = '01';
productTableInfo.value.editInfo.dataProductId.props.label = 'productName';
......
......@@ -12,7 +12,7 @@ import {
cancelContract,
} from "@/api/modules/dataSmartContract"
import useDataSmartContract from "@/store/modules/dataSmartContract";
import { commonPageConfig } from '@/utils/enum';
import { commonPageConfig, USERROLE } from '@/utils/enum';
import { getEnterpriseData } from "@/api/modules/dataIdentify";
const userData = JSON.parse(localStorage.userData);
......@@ -22,6 +22,11 @@ const route = useRoute();
const { proxy } = getCurrentInstance() as any;
const dataSmartContractStore = useDataSmartContract();
/** 是否是数据提供方 */
const isDataUse = computed(() => {
return localStorage.getItem('userRole') == USERROLE.USE;
})
const searchItemList = ref([
{
type: "input",
......@@ -290,6 +295,10 @@ const tablePageChange = (info) => {
};
const newCreate = () => {
if (isDataUse.value) {
proxy.$ElMessage.error('数据使用方不能新建合约');
return;
}
let exec = () => {
if (tenantData.isCertification != 'Y' && !currTenantDetailInfo.value.trustedIdentityCredential) { //认证过的
if (userData.superTubeFlag != 'Y') {//平台用户
......@@ -347,11 +356,12 @@ onBeforeMount(() => {
<div class="container_wrap">
<div class="table_tool_wrap">
<TableTools :searchItems="searchItemList" :searchId="'contract-search'" @search="toSearch" :init="false" />
<div class="tools_btns">
<!-- 数据使用方没有新增按钮 -->
<div class="tools_btns" v-if="!isDataUse">
<el-button type="primary" @click="newCreate">新增</el-button>
</div>
</div>
<div class="table_panel_wrap">
<div class="table_panel_wrap" :style="{ height: !isDataUse ? 'calc(100% - 88px)' : 'calc(100% - 44px)' }">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
</div>
</div>
......
<script lang="ts" setup name="homeIndex">
import { USERROLE } from '@/utils/enum';
const router = useRouter();
......@@ -43,7 +45,7 @@ const click = (command) => {
<template>
<div class="main-content">
<div class="role-main dataUse" v-if="dataRole == 'use'">
<div class="role-main dataUse" v-if="dataRole == USERROLE.USE">
<div class="header-title">数据使用方</div>
<div class="chunk-row" @click="click('identify')">
<div class="img identify"></div>
......@@ -94,7 +96,7 @@ const click = (command) => {
</div>
</div>
</div>
<div class="role-main dataProvider" v-if="dataRole == 'provider'">
<div class="role-main dataProvider" v-if="dataRole == USERROLE.PROVIDER">
<div class="header-title">数据提供方</div>
<div class="chunk-main">
<div class="chunk-per" @click="click('identify')">
......@@ -129,7 +131,7 @@ const click = (command) => {
</div>
</div>
</div>
<div class="role-main dataOperation" v-if="dataRole == 'operation'">
<div class="role-main dataOperation" v-if="dataRole == USERROLE.OPERATION">
<div class="header-title">平台运营方</div>
<div class="chunk-main">
<div class="chunk-per" @click="click('identify')">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!