dcc02de8 by lihua

合约策略接口联调

1 parent 228bc72c
......@@ -156,7 +156,7 @@ export const getContractDataProduct = (tenantGuid) => request({
/** 获取下拉数据产品列表的去重字段 */
export const getDamFieldsByProductGuid = (productGuid) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/field-by-dam-guid?productGuid=${productGuid}`,
url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/field-by-dam-guid?damGuid=${productGuid}`,
method: 'post'
})
......@@ -217,9 +217,9 @@ export const continueContractNegotiate = (params) => request({
});
/** 获取可选的企业下拉列表,认证过之后带标识的 */
export const getContractTenantList = () => request({
url: `${import.meta.env.VITE_APP_PERSONAL_URL}/tenant/get-social-credit-code-tenant`,
method: 'post'
export const getContractTenantList = (tenantName = '') => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/connector-invoke/get-enterprise?tenantName=${tenantName}`,
method: 'get'
})
/** 撤回合约 */
......
......@@ -25,6 +25,27 @@ const routes: RouteRecordRaw[] = [
},
],
},
{
path: '/data-asset/data-usage',
component: Layout,
meta: {
title: '数据使用',
icon: 'sidebar-videos',
},
children: [
{
path: '',
name: 'dataUsage',
component: () => import('@/views/data_asset/dataUsage.vue'),
meta: {
title: '',
sidebar: false,
breadcrumb: false,
cache: true
},
},
],
},
]
export default routes
......
<script lang="ts" setup name="dataUsage">
import TableTools from "@/components/Tools/table_tools.vue";
import { commonPageConfig, TableColumnWidth } from '@/utils/enum';
import {
} from "@/api/modules/dataDelivery";
const router = useRouter();
const route = useRoute();
const { proxy } = getCurrentInstance() as any;
const searchItemList = ref([
{
type: "input",
label: "",
field: "dataProductName",
default: "",
placeholder: "数据产品名称",
maxlength: 50,
clearable: true,
},
{
type: "input",
label: "",
field: "contractName",
default: "",
placeholder: "合约名称",
maxlength: 50,
clearable: true,
},
]);
const page = ref({
...commonPageConfig,
dataProductName: '',
contractName: ''
});
const tableFields = ref([
{ label: "序号", type: "index", width: 56, align: "center" },
{
label: "数据产品名称", field: "dataProductName", width: 150, type: "text_btn", columClass: 'text_btn', value: "detail", click: (scope) => {
router.push({
name: 'productListingDetail',
query: {
guid: scope.row.dataProductGuid,
type: 'detail',
name: scope.row.dataProductName,
}
});
}
},
{
label: "合约名称", field: "contractName", width: 160, type: "text_btn", columClass: 'text_btn', value: "detail1", click: (scope) => {
//履约中的合约状态
router.push({
name: 'smartContractDetail',
query: {
guid: scope.row.guid,
name: scope.row.contractName,
type: 'keepAgree',
isDetail: 'Y'
}
});
}
},
{ label: "交付方式", field: "deliveryMethod", width: 120 },
{
label: "交付状态", field: "deliveryStatus", type: "tag", width: 96, align: 'center',
getName: (scope) => {
const deliveryStatus = scope.row.deliveryStatus
switch (deliveryStatus) {
case 1:
return '未交付';
case 2:
return '已交付';
case 3:
return '交付中';
default:
return '--';
}
}, tagType: (scope) => {
const deliveryStatus = scope.row.deliveryStatus
switch (deliveryStatus) {
case 3:
return 'warning';
case 2:
return 'success';
case 1:
return 'info';
default:
return 'info';
}
}
},
{ label: "交付时间", field: "deliveryTime", width: 170 },
]);
const currTableData: any = ref({});
const tableInfo = ref({
id: 'contract-table',
rowKey: 'guid',
loading: false,
fields: tableFields.value,
data: [], //{ verifySatus: 2 }, { verifySatus: 4 }, { verifySatus: 3, deliveryStatus: 2, }
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
width: 160,
btns: (scope) => {
}
}
});
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.dataProductName = '';
page.value.contractName = '';
} else {
page.value.dataProductName = val.dataProductName;
page.value.contractName = val.contractName;
}
getTableData();
};
</script>
<template>
<div class="container_wrap">
<div class="table_tool_wrap">
<TableTools :searchItems="searchItemList" :searchId="'contract-search'" @search="toSearch" :init="false" />
</div>
<div class="table_panel_wrap" style="height: calc(100% - 44px);">
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange" />
</div>
</div>
</template>
<style lang="scss" scoped>
</style>
\ No newline at end of file
......@@ -40,7 +40,7 @@
<template #default="scope">
<el-select v-if="!isLook" v-model="scope.row['constraintName']" placeholder="请选择" :disabled="isLook"
@change="(val) => selectConditionChange(val, scope)" clearable filterable>
<el-option v-for="opt in productFieldList == null ? constraintOptionsList : constraintOptionsList.filter(a => !(a.policyEnName == 'limitField' || a.policyEnName == 'limitedDeliveryConnector' || a.policyEnName == 'limitedUseConnector'))" :key="opt['policyName']" :label="opt['policyName']"
<el-option v-for="opt in constraintOptionsList" :key="opt['policyName']" :label="opt['policyName']"
:value="opt['policyName']" />
</el-select>
<span v-else>{{ scope.row['constraintName'] || '--' }}</span>
......@@ -68,7 +68,7 @@
<span v-else>{{ scope.row['constraintOperatorName'] || '--' }}</span>
</template>
</el-table-column>
<el-table-column prop="constraintValue" label="约束值" :width="isReport ? 'auto' : '240px'"
<el-table-column prop="constraintValue" label="约束值" :width="isReport ? 'auto' : '340px'"
:min-width="isReport ? '160px' : undefined" align="left" :show-overflow-tooltip="!isReport">
<template #header>
<span>约束值</span>
......@@ -76,21 +76,25 @@
</template>
<template #default="scope">
<el-input
v-if="!isLook && !((scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector' || scope.row.constraintEnName == 'limitField'))"
v-if="!isLook && !(productFieldList != null && (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector' || scope.row.constraintEnName == 'dataField'))"
v-model="scope.row['constraintValue']" placeholder="请输入" :maxlength="200"
@change="(val) => handleOperatorSelectChange(val, scope, 'constraintValue')" clearable></el-input>
<!-- 限定连接器 -->
<el-select
v-else-if="!isLook && (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector')"
v-model="scope.row['constraintConnectorValue']" :remote="true" :remote-method="remoteMethod" filterable clearable placeholder="请选择">
<el-option v-for="opt in connectorList" :key="opt['guid']" :label="opt['connectorName']"
:value="opt['guid']" />
v-else-if="!isLook && productFieldList != null && (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector')"
v-model="scope.row['constraintConnectorValue']" :loading="loading" :remote="true"
:remote-method="remoteMethod" :max-collapse-tags="1" :collapse-tags="true" :collapse-tags-tooltip="true"
multiple filterable clearable :placeholder="scope.row.constraintPlaceholderValue || '请输入关键字搜索'" value-key="guid">
<el-option v-for="opt in connectorList" :key="opt['guid']" :label="opt['tenantName']"
:value="opt" />
</el-select>
<!-- 加密字段 -->
<el-select v-else-if="!isLook && scope.row.constraintEnName == 'limitField'"
v-model="scope.row['constraintValue']" filterable clearable placeholder="请选择">
<el-select v-else-if="!isLook && productFieldList != null && scope.row.constraintEnName == 'dataField'"
:max-collapse-tags="1" :collapse-tags="true" :collapse-tags-tooltip="true"
v-model="scope.row['constraintFieldValue']" multiple filterable clearable :placeholder="scope.row.constraintPlaceholderValue || '请选择'"
@change="(val) => handleOperatorSelectChange(val, scope, 'constraintFieldValue')">
<el-option v-for="opt in productFieldList" :key="opt['enName']" :label="opt['chName']"
:value="opt['guid']" />
:value="opt['enName']" />
</el-select>
<span v-else>{{ scope.row['constraintFieldValue'] || '--' }}</span>
</template>
......@@ -114,7 +118,8 @@
import { useValidator } from "@/hooks/useValidator";
import { CirclePlus } from "@element-plus/icons-vue";
import {
getValidContractTemplateList
getValidContractTemplateList,
getContractTenantList
} from "@/api/modules/dataSmartContract"
const { required } = useValidator();
......@@ -147,7 +152,7 @@ const props = defineProps({
},
productFieldList: { //字段列表
type: Array<any>,
default: []
default: null
},
isReport: {
type: Boolean,
......@@ -155,6 +160,7 @@ const props = defineProps({
}
})
const loading = ref(false);
/** 连接器下拉列表,搜索取得 */
const connectorList: any = ref([]);
......@@ -184,11 +190,20 @@ const strategyValueInfo: any = ref([{
}]);
/** 将数据库存储的值转化为该组件接收的树形结构 */
const transferValueToNew = (val) => {
const transferValueToNew = (val, isTemplate = false) => {
let detailPolicyListValue: any[] = []
val?.forEach((p, index) => {
let lastItem = detailPolicyListValue?.[detailPolicyListValue.length - 1];
let childInfo = Object.assign({}, p);
if (childInfo.constraintEnName == 'dataField' && childInfo.additionValue?.length) {
childInfo.constraintFieldValue = childInfo.additionValue.map(a => a.enName);
}
if ((childInfo.constraintEnName == 'limitedDeliveryConnector' || childInfo.constraintEnName == 'limitedUseConnector') && childInfo.additionValue?.length) {
childInfo.constraintConnectorValue = childInfo.additionValue;
}
if (isTemplate && (childInfo.constraintEnName == 'dataField' || childInfo.constraintEnName == 'limitedDeliveryConnector' || childInfo.constraintEnName == 'limitedUseConnector')) {
childInfo.constraintPlaceholderValue = childInfo.constraintValue;
}
delete childInfo.children; //删掉冗余信息,否则后续修改会覆盖正确的值
delete childInfo.action;
delete childInfo.actionEnName;
......@@ -212,6 +227,18 @@ watch(() => props.value, (val) => {
immediate: true
})
watch(() => props.productFieldList, (val, oldValue) => {
strategyValueInfo.value.forEach(s => {
s.children?.forEach(sc => {
if (sc.constraintFieldValue?.length) {
sc.constraintFieldValue = sc.constraintFieldValue.filter(f => val.some(v => v.enName == f))
}
})
})
}, {
deep: true
})
/** 策略信息表格数据 */
const strategyData = computed(() => {
let v: any = [];
......@@ -416,7 +443,7 @@ const templateDialogInfo = ref({
templateDialogInfo.value.visible = false;
//将选择的值带入表格 TODO,跟经理确认是全量覆盖,还是保留操作行为不同的行。暂时先做成全量覆盖吧。
let item: any = templateFormItems.value[0].options?.find((i: any) => i.guid == info.guid);
strategyValueInfo.value = transferValueToNew(item?.policyRSVOS || []);
strategyValueInfo.value = transferValueToNew(item?.policyRSVOS || [], true);
},
cancel: () => {
templateDialogInfo.value.visible = false;
......@@ -443,12 +470,29 @@ const validateValue = () => {
proxy.$ElMessage.error('约束值必填,请填写完整');
return false;
}
if (d.constraintName.includes('字段') && !d.constraintFieldValue?.length) {
proxy.$ElMessage.error('约束值必填,请填写完整');
return false;
}
if ((d.constraintEnName == 'limitedDeliveryConnector' || d.constraintEnName == 'limitedUseConnector') && !d.constraintConnectorValue?.length) {
proxy.$ElMessage.error('约束值必填,请填写完整');
return false;
}
}
return true;
}
const remoteMethod = (query: string) => {
if (query) {
loading.value = true;
getContractTenantList(query).then((res: any) => {
loading.value = false;
if (res.code == proxy.$passCode) {
connectorList.value = res.data || [];
} else {
res?.msg && proxy.$ElMessage.error(res.msg);
}
})
// loading.value = true
// setTimeout(() => {
// loading.value = false
......
......@@ -310,17 +310,17 @@ const hanldeTableSelectChange = (val, scope, item) => {
scope.row.dataProductType = productItem?.productType;
scope.row.dataProductTypeName = productItem?.productTypeName;
/** 选择了产品,需要重新查询去重字段 */
if (val?.productGuid) {
getDamFieldsByProductGuid(val?.productGuid).then((res: any) => {
if (productItem?.productGuid) {
getDamFieldsByProductGuid(productItem?.productGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
productFieldList.value = res.data || [];
productFieldList.value = res.data || initStrategyData.value;
} else {
productFieldList.value = [];
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else {
productFieldList.value = [];
productFieldList.value = initProductFieldValue.value;
}
// 连接器只能选择数据提供方的产品,不需要切换了
// let nodeInfo = nodeInfoFormRef.value.formInline;
......@@ -436,7 +436,11 @@ const constraintOptionsList: any = ref([]);
const actionOptionsList: any = ref([]);
/** 根据选择的数据产品显示限定字段下拉列表 */
const productFieldList :any = ref([]);
const initProductFieldValue: any = ref([]);
const productFieldList: any = ref([]);
/** 初始化的策略值为空数组 */
const initStrategyData = ref([]);
const getSubmitInfo = () => {
let baseInfo = baseInfoFormRef.value.formInline;
......@@ -456,7 +460,17 @@ const getSubmitInfo = () => {
executionerName: tenantList.value.find(t => t.guid == nodeInfo.dataUserGuid)?.tenantName
}];
params.policys = strategyTableRef.value.strategyData?.map((d, index) => {
return Object.assign({}, d, { orderNum: index + 1 })
let v = Object.assign({}, d, { orderNum: index + 1, });
if (d.constraintName.includes('字段') && d.constraintFieldValue?.length) {
v.constraintValue = d.constraintFieldValue.join(',');
v.additionValue = d.constraintFieldValue?.map(dv => {
return {
enName: dv,
chName: productFieldList?.value.find(p => p.enName == dv)?.chName || dv
}
})
}
return v;
}) || [];
return params;
}
......@@ -687,6 +701,19 @@ onBeforeMount(() => {
extendTableInfo.value.data = extendData.value;
productData.value = detailInfo.value.contractSubjects || [];
productTableInfo.value.data = productData.value;
let productGuid = productData.value?.[0]?.dataProductGuid;
if (productGuid) {
getDamFieldsByProductGuid(productGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
productFieldList.value = res.data || initProductFieldValue.value;
} else {
productFieldList.value = initProductFieldValue.value;
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else {
productFieldList.value = initProductFieldValue.value;
}
} else {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
......@@ -835,9 +862,9 @@ onActivated(() => {
<div class="h-title">策略执行节点</div>
<Form ref="nodeInfoFormRef" formId="node-info-form" :itemList="nodeInfoFormItems" :rules="nodeInfoFormRules"
@select-change="handleNodeSelectChange" col="col3" />
<StrategyTable ref="strategyTableRef" :show-title="true" :value="detailInfo.policys || []"
:operatorOptionList="operatorOptionList" :actionOptionsList="actionOptionsList" :productFieldList="productFieldList"
:constraintOptionsList="constraintOptionsList"></StrategyTable>
<StrategyTable ref="strategyTableRef" :show-title="true" :value="detailInfo.policys || initStrategyData"
:operatorOptionList="operatorOptionList" :actionOptionsList="actionOptionsList"
:productFieldList="productFieldList" :constraintOptionsList="constraintOptionsList"></StrategyTable>
</ContentWrap>
</div>
<div class="tool_btns">
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!