7b4a8015 by lihua

合约添加逻辑空间接口联调

1 parent 2c31b6ac
......@@ -222,6 +222,18 @@ export const getContractTenantList = (tenantName = '') => request({
method: 'get'
})
/** 根据逻辑空间guid获取可选的企业下拉列表,认证过后带标识的 */
export const getContractTenantListBySpaceGuid = (spaceGuid) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/connector-invoke/logic/user-member-by-space-guid?spaceGuid=${spaceGuid}`,
method: 'get'
})
/** 根据逻辑空间guid获取策略模板 */
export const getContractPolicyTemplateListBySpaceGuid = (spaceGuid) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/connector-invoke/logic/policy-by-space-guid?spaceGuid=${spaceGuid}`,
method: 'get'
})
/** 撤回合约 */
export const cancelContract = (guid) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract/canal?guid=${guid}`,
......
......@@ -40,6 +40,7 @@ const userStore = useUserStore()
const emits = defineEmits([
"radioGroupChange",
"selectChange",
"selectFocus",
"inputChange",
"treeSelectLoad",
"treeSelectNodeChange",
......@@ -134,6 +135,10 @@ const richTextChange = (val, item) => {
formInline.value[item.field] = val;
ruleFormRef.value?.validateField([item.field]);
}
/** 下拉选择框聚焦事件 */
const selectFocus = (item) => {
emits("selectFocus", item);
}
const selectChange = (val, row) => {
const info = formInline.value;
......@@ -938,7 +943,7 @@ const panelChange = (scope, row) => {
:collapse-tags="item.collapse ?? false" :collapse-tags-tooltip="item.tagsTooltip ?? false"
:max-collapse-tags="item.maxTags ?? 1" :teleported="item.teleported ?? true"
:allow-create="item.allowCreate ?? false" :default-first-option="item.allowCreate ?? false"
:maxlength="item.maxlength ?? 50" @change="(val) => selectChange(val, item)">
:maxlength="item.maxlength ?? 50" @change="(val) => selectChange(val, item)" @focus="selectFocus(item)">
<el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label"
:value="item.props?.value ? opt[item.props.value] : opt.value" :disabled="opt.disabled" />
</el-select>
......
......@@ -646,8 +646,16 @@ const arraySpanMethod = ({ row, column, rowIndex, columnIndex }) => {
/** 弹出模板选择对话框 */
const invokeTemplate = () => {
// TODO,判断是否有策略模板信息。
if (props.templateJson?.length) {
proxy.$openMessageBox("使用模板会覆盖现有策略信息,确定要使用产品所在逻辑空间的模板配置吗?", () => {
if (props.templateJson) {
if (!props.templateJson?.length) {
proxy.$ElMessage.warning('当前逻辑空间中未设置策略配置信息');
return;
}
if (!strategyValueInfo.value?.length) {
strategyValueInfo.value = transferValueToNew(props.templateJson, true);
return;
}
proxy.$openMessageBox("该操作会覆盖现有策略信息,确定要使用产品所在逻辑空间的策略配置吗?", () => {
strategyValueInfo.value = transferValueToNew(props.templateJson, true);
}, () => {
proxy.$ElMessage.info("已取消");
......
......@@ -11,6 +11,8 @@ import {
getConstraintPolicyList,
getContractDataProduct,
getContractTenantList,
getContractTenantListBySpaceGuid,
getContractPolicyTemplateListBySpaceGuid,
saveContract,
updateContract,
getDamFieldsByProductGuid
......@@ -241,7 +243,7 @@ const productTableInfo = ref({
{ label: "数据产品编码", field: "dataProductId", width: 261 },
{ label: "产品类型", field: "dataProductTypeName", width: 100 },
{ label: "所属主体名称", field: "dataProductEntityName", width: 200 },
{ label: "逻辑空间", field: "logicSpaceName", width: 200 }, //TODO,字段名称
{ label: "逻辑空间", field: "logicSpaceName", width: 200 },
{ label: "产品简介", field: "dataProductAbstract", width: 240 },
],
editInfo: {
......@@ -309,8 +311,8 @@ const hanldeTableSelectChange = (val, scope, item) => {
scope.row.dataProductGuid = productItem?.productGuid;
scope.row.dataProductType = productItem?.productType;
scope.row.dataProductTypeName = productItem?.productTypeName;
//TODO,逻辑空间名称
scope.row.logicSpaceName = productItem?.logicSpaceName;
scope.row.logicSpaceGuid = productItem?.logicSpaceGuid;
/** 选择了产品,需要重新查询去重字段 */
if (productItem?.productGuid) {
getDamFieldsByProductGuid(productItem?.productGuid).then((res: any) => {
......@@ -329,17 +331,28 @@ const hanldeTableSelectChange = (val, scope, item) => {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
// TODO,需要重新更新数据使用方的下拉列表,如果逻辑空间是空值,则可以选择所有企业,否则只能选择逻辑空间下的成员企业。
if (productItem?.logicSpaceName) {
// 需要重新更新数据使用方的下拉列表,如果逻辑空间是空值,则可以选择所有企业,否则只能选择逻辑空间下的成员企业。
if (productItem?.logicSpaceGuid) {
// 建议使用方下拉列表企业包含所在的逻辑空间。一个企业可能有多个逻辑空间。或者根据逻辑空间获取成员列表。
// tenantList.value.filter();
// 调用逻辑空间接口,因为策略模板也需要使用。
//templateJson.value = res.data;
getContractMemberTenantList(productItem?.logicSpaceGuid);
getContractPolicyTemplateListBySpaceGuid(productItem?.logicSpaceGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
templateJson.value = res.data || [];
} else {
templateJson.value = [];
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else {
getContractMemberTenantList(null);
templateJson.value = null;
}
} else {
productFieldList.value = initProductFieldValue.value;
annonFieldsList.value = initProductFieldValue.value;
// TODO,需要更新数据使用方下拉列表
getContractMemberTenantList(null);
templateJson.value = null;
}
if (baseInfoFormRef.value?.formInline?.signModeCode == '02') {
let nodeInfo = nodeInfoFormRef.value.formInline;
......@@ -361,6 +374,9 @@ const hanldeTableSelectChange = (val, scope, item) => {
/** 策略执行者下拉列表 */
const tenantList: any = ref([]);
/** 数据产品提供方下拉列表 */
const providerTenantList: any = ref([]);
const nodeInfoFormRef = ref();
// 策略执行者类型列表
......@@ -380,7 +396,7 @@ const nodeInfoFormItems = ref([{
placeholder: '请选择',
field: 'dataProviderGuid',
default: '',
options: tenantList.value, //先禁用,选择产品后自动带出
options: providerTenantList.value, //先禁用,选择产品后自动带出
props: {
value: 'guid',
label: 'tenantName'
......@@ -436,6 +452,16 @@ const nodeInfoFormRules = ref({
dataUserGuid: [required('请选择数据使用方策略执行者名称')],
});
/** 下拉选择框聚焦事件 */
const handleNodeSelectFocus = (item) => {
if (item.field == 'dataUserGuid') {
if (!productData.value?.[0]?.dataProductId) {
proxy.$ElMessage.error('请先选择数据产品');
return;
}
}
}
const handleNodeSelectChange = (val, row, info) => {
if (row.field == 'dataUserGuid') {
let tenantItem = tenantList.value.find(t => t.guid == val);
......@@ -448,6 +474,9 @@ const handleNodeSelectChange = (val, row, info) => {
const strategyTableRef = ref();
/** 逻辑空间的策略模板信息,若是逻辑空间不存在,则值为null,若是逻辑空间中未设置模板,则值为[] */
const templateJson: any = ref(null);
/** 约束运算符字典下拉 */
const operatorOptionList: any = ref([]);
......@@ -480,7 +509,7 @@ const getSubmitInfo = () => {
executionerTypeCode: executorTypeList.value[0]?.value,
executionerGuid: nodeInfo.dataProviderGuid,
executionerId: nodeInfo.dataProviderId,
executionerName: tenantList.value.find(t => t.guid == nodeInfo.dataProviderGuid)?.tenantName
executionerName: providerTenantList.value.find(t => t.guid == nodeInfo.dataProviderGuid)?.tenantName
}, {
executionerTypeCode: executorTypeList.value[1]?.value,
executionerGuid: nodeInfo.dataUserGuid,
......@@ -505,7 +534,7 @@ const getSubmitInfo = () => {
label: limitedStateOptionsList.value.find(p => p.value == d.constraintStateValue)?.label || d.constraintStateValue
}];
}
else if ((d.constraintEnName == 'limitedDeliveryConnector' || d.constraintEnName == 'limitedUseConnector') && d.constraintConnectorValue?.length) {
else if ((d.constraintEnName == 'limitedDeliveryConnector' || d.constraintEnName == 'limitedUseConnector') && d.constraintConnectorValue?.length) {
v.constraintValue = d.constraintConnectorValue?.join(',');
v.additionValue = d.additionValue;
} else if (d.constraintEnName == 'areaAddress' && d.constraintAddressValue?.length) {
......@@ -696,7 +725,29 @@ const cancel = () => {
const detailInfo: any = ref({});
const psLogon = ref();
const getContractMemberTenantList = (spaceGuid) => {
if (!spaceGuid) {
tenantList.value = providerTenantList.value;
nodeInfoFormItems.value[4].options = tenantList.value;
return;
}
getContractTenantListBySpaceGuid(spaceGuid).then((res: any) => {
if (res.code == proxy.$passCode) {
tenantList.value = res.data || [];
nodeInfoFormItems.value[4].options = tenantList.value;
let dataUserGuid = nodeInfoFormRef.value.formInline.dataUserGuid;
if (dataUserGuid && !tenantList.value.some(item => item.guid == dataUserGuid)) {
nodeInfoFormItems.value[4].default = '';
nodeInfoFormItems.value[5].default = '';
}
} else {
tenantList.value = [];
nodeInfoFormItems.value[4].default = '';
nodeInfoFormItems.value[5].default = '';
res?.msg && proxy.$ElMessage.error(res.msg);
}
})
}
onBeforeMount(() => {
let exec = () => {
......@@ -718,7 +769,7 @@ onBeforeMount(() => {
detailInfo.value = res.data || {};
baseInfoFormItems.value.forEach(item => {
item.default = detailInfo.value[item.field];
if (item.default && route.query.type == 'copy' && item.field == 'contractName') {
if (item.default && route.query.type == 'copy' && item.field == 'contractName') {
item.default = item.default + '_copy';
}
});
......@@ -765,6 +816,23 @@ onBeforeMount(() => {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
let logicSpaceGuid = productData.value?.[0]?.logicSpaceGuid;
if (logicSpaceGuid) {
// 建议使用方下拉列表企业包含所在的逻辑空间。一个企业可能有多个逻辑空间。或者根据逻辑空间获取成员列表。
// 调用逻辑空间接口,因为策略模板也需要使用。
getContractMemberTenantList(logicSpaceGuid);
getContractPolicyTemplateListBySpaceGuid(logicSpaceGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
templateJson.value = res.data || [];
} else {
templateJson.value = [];
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else {
getContractMemberTenantList(null);
templateJson.value = null;
}
} else {
productFieldList.value = initProductFieldValue.value;
annonFieldsList.value = initProductFieldValue.value;
......@@ -778,8 +846,8 @@ onBeforeMount(() => {
// 默认点对点,数据使用方可以选择
// nodeInfoFormItems.value[1].disabled = true;
nodeInfoFormItems.value[1].default = userData.tenantGuid;
if (tenantList.value.length) {
let item = tenantList.value.find(t => t.guid == userData.tenantGuid);
if (providerTenantList.value.length) {
let item = providerTenantList.value.find(t => t.guid == userData.tenantGuid);
nodeInfoFormItems.value[2].default = item?.socialCreditCode;
}
} else {
......@@ -881,11 +949,10 @@ onBeforeMount(() => {
})
getContractTenantList().then((res: any) => {
if (res.code == proxy.$passCode) {
tenantList.value = res.data || [];
nodeInfoFormItems.value[1].options = tenantList.value;
nodeInfoFormItems.value[4].options = tenantList.value;
providerTenantList.value = res.data || [];
nodeInfoFormItems.value[1].options = providerTenantList.value;
if (nodeInfoFormItems.value[1].default) {
let item = tenantList.value.find(t => t.guid == nodeInfoFormItems.value[1].default);
let item = providerTenantList.value.find(t => t.guid == nodeInfoFormItems.value[1].default);
nodeInfoFormItems.value[2].default = item?.socialCreditCode;
}
} else {
......@@ -898,8 +965,8 @@ onActivated(() => {
if (route.query.guid) {
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
if (tab) {
document.title = route.query.type == 'copy' ? `复制合约-${route.query.name}` : `编辑合约-${route.query.name}`;
tab.meta.title = route.query.type == 'copy' ? `复制合约-${route.query.name}` : `编辑合约-${route.query.name}`;
document.title = route.query.type == 'copy' ? `复制合约-${route.query.name}` : `编辑合约-${route.query.name}`;
tab.meta.title = route.query.type == 'copy' ? `复制合约-${route.query.name}` : `编辑合约-${route.query.name}`;
}
}
})
......@@ -929,16 +996,18 @@ onActivated(() => {
@expand="(v) => (expandPolicy = v)" description="">
<div class="h-title">策略执行节点</div>
<Form ref="nodeInfoFormRef" formId="node-info-form" :itemList="nodeInfoFormItems" :rules="nodeInfoFormRules"
@select-change="handleNodeSelectChange" col="col3" />
@select-change="handleNodeSelectChange" @select-focus="handleNodeSelectFocus" col="col3" />
<StrategyTable ref="strategyTableRef" :show-title="true" :value="detailInfo.policys || initStrategyData"
:operatorOptionList="operatorOptionList" :actionOptionsList="actionOptionsList" :limit-state-option-list="limitedStateOptionsList"
:productFieldList="productFieldList" :annon-fields-list="annonFieldsList" :constraintOptionsList="constraintOptionsList"></StrategyTable>
:operatorOptionList="operatorOptionList" :actionOptionsList="actionOptionsList" :templateJson="templateJson"
:limit-state-option-list="limitedStateOptionsList" :productFieldList="productFieldList"
:annon-fields-list="annonFieldsList" :constraintOptionsList="constraintOptionsList"></StrategyTable>
</ContentWrap>
</div>
<div class="tool_btns">
<div class="btns">
<el-button @click="cancel">取消</el-button>
<el-button @click="saveDraft" v-show="route.query.type == 'copy' || (detailInfo?.contractStatus != '00')">保存</el-button>
<el-button @click="saveDraft"
v-show="route.query.type == 'copy' || (detailInfo?.contractStatus != '00')">保存</el-button>
<el-button type="primary" @click="submit">合约协商</el-button>
</div>
</div>
......
......@@ -18,7 +18,8 @@ import {
terminateContract,
getTerminateDetailInfo,
getSignatureFile,
getDamFieldsByProductGuid
getDamFieldsByProductGuid,
getContractPolicyTemplateListBySpaceGuid
} from "@/api/modules/dataSmartContract";
import {
tagMethod,
......@@ -969,6 +970,9 @@ const constraintOptionsList: any = ref([]);
/** 策略操作行为下拉列表 */
const actionOptionsList: any = ref([]);
/** 逻辑空间的策略模板信息,若是逻辑空间不存在,则值为null,若是逻辑空间中未设置模板,则值为[] */
const templateJson: any = ref(null);
/** 限定状态字典下拉列表 */
const limitedStateOptionsList: any = ref([]);
......@@ -1112,6 +1116,19 @@ onBeforeMount(() => {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
let logicSpaceGuid = productTableInfo.value.data?.[0]?.logicSpaceGuid;
if (logicSpaceGuid) {
getContractPolicyTemplateListBySpaceGuid(logicSpaceGuid).then((res: any) => {
if (res?.code == proxy.$passCode) {
templateJson.value = res.data || [];
} else {
templateJson.value = [];
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
} else {
templateJson.value = null;
}
} else {
productFieldList.value = initProductFieldValue.value;
annonFieldsList.value = initProductFieldValue.value;
......@@ -1359,7 +1376,7 @@ onActivated(() => {
<ContentWrap v-show="detailType == 'consult' && currentStep != 1" id="policy-info-consult" title="合约策略"
expandSwicth style="margin-top: 15px" :isExpand="expandPolicyConsult" @expand="(v) => (expandPolicyConsult = v)"
description="">
<StrategyTable ref="strategyTableEditRef" :show-title="true" :value="consultDetailInfo?.policys"
<StrategyTable ref="strategyTableEditRef" :show-title="true" :value="consultDetailInfo?.policys" :template-json="templateJson"
:operatorOptionList="operatorOptionList" :actionOptionsList="actionOptionsList" :productFieldList="productFieldList" :annonFieldsList="annonFieldsList"
:limit-state-option-list="limitedStateOptionsList" :constraintOptionsList="constraintOptionsList"></StrategyTable>
</ContentWrap>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!