fad6cc67 by lihua

修改一些编辑有关的问题

1 parent e9be6fda
......@@ -613,13 +613,20 @@ export const saveLogicSpace = (params) => request({
data: params
})
/** 编辑逻辑空间 */
/** 编辑逻辑空间,提交草稿或审批流程 */
export const updateLogicSpace = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/update`,
method: 'put',
data: params
})
/** 编辑逻辑空间,审批通过后添加成员信息不需要提交审批 */
export const updateLogicSpaceMember = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/update-members`,
method: 'put',
data: params
})
/** 删除逻辑空间 */
export const deleteLogicSpace = (guids) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/delete`,
......
......@@ -31,7 +31,7 @@ export const handleContentWrapView = (name) => {
}
/** 添加表格最后一行滚动到可视范围内 */
export const scrollLastRowToView = (tableRef, dataLen) => {
export const scrollLastRowToView = (tableRef, dataLen, cellHeight = 36) => {
if (!tableRef) {
return;
}
......@@ -39,8 +39,8 @@ export const scrollLastRowToView = (tableRef, dataLen) => {
let domScroll = bodyWrapper.parentElement.parentElement;
let rect = domScroll.getBoundingClientRect();
let maxNum = dataLen + 1;
if (maxNum * 36 > rect.height + domScroll.scrollTop) {
tableRef.setScrollTop(maxNum * 36 - rect.height + 2)
if (maxNum * cellHeight > rect.height + domScroll.scrollTop) {
tableRef.setScrollTop(maxNum * cellHeight - rect.height + 2)
}
}
......
......@@ -15,7 +15,7 @@
</div>
<div class="bottom_tool_wrap">
<el-button @click="cancel">取消</el-button>
<el-button @click="save" v-preReClick>保存</el-button>
<el-button @click="save" v-show="detailInfo.approveState !== 'Y' && detailInfo.approveState !== 'C' && detailInfo.approveState !== 'R'" v-preReClick>保存</el-button>
<el-button type="primary" @click="submit" v-preReClick>提交审批</el-button>
</div>
</div>
......
......@@ -29,8 +29,8 @@
</div>
<div class="bottom_tool_wrap">
<el-button @click="cancel">取消</el-button>
<el-button @click="save" v-preReClick>保存</el-button>
<el-button type="primary" @click="submit" v-preReClick>提交审批</el-button>
<el-button v-show="detailInfo.bizApproveState !== 'Y' && detailInfo.bizApproveState !== 'C' && detailInfo.bizApproveState !== 'R'" @click="save" v-preReClick>保存草稿</el-button>
<el-button type="primary" @click="submit" v-preReClick>提交</el-button>
</div>
</div>
</template>
......@@ -52,7 +52,7 @@ import { useValidator } from '@/hooks/useValidator';
import { TableColumnWidth } from "@/utils/enum";
import { scrollLastRowToView } from "@/utils/common";
import StrategyTable from "../data_smart_contract/components/strategyTable.vue";
import { getLogicSpaceDetail, saveLogicSpace, updateLogicSpace } from "@/api/modules/dataAsset";
import { getLogicSpaceDetail, saveLogicSpace, updateLogicSpace, updateLogicSpaceMember } from "@/api/modules/dataAsset";
const { required } = useValidator();
......@@ -272,6 +272,61 @@ const addMember = () => {
})
}
// 检查数据是否被修改
const checkIfModified = (formInline: any, policyRQVOS: any[]) => {
// 检查formInline中的字段
for (let key in formInline) {
if (formInline[key] !== detailInfo.value[key]) {
return true;
}
}
// 检查policyRQVOS
const originalPolicies = detailInfo.value?.policyRSVOS || [];
if (policyRQVOS.length !== originalPolicies.length) {
return true;
}
for (let i = 0; i < policyRQVOS.length; i++) {
const current = policyRQVOS[i];
const original = originalPolicies[i];
if (!original) {
return true;
}
// 比较策略数据的每个字段
for (let key in current) {
if (key !== 'childIndex' && key !== 'index' && key !== 'orderNum' && current[key] !== original[key]) {
return true;
}
}
}
// // 检查成员权限数据
// const currentMembers = memberTableInfo.value.data || [];
// const originalMembers = detailInfo.value?.permissionRSVOS || [];
// if (currentMembers.length !== originalMembers.length) {
// return true;
// }
// for (let i = 0; i < currentMembers.length; i++) {
// const current = currentMembers[i];
// const original = originalMembers[i];
// if (!original) {
// return true;
// }
// // 比较成员数据的每个字段
// for (let key in current) {
// if (current[key] !== original[key]) {
// return true;
// }
// }
// }
return false;
};
const save = () => {
// 保存不检验。
let formInline = baseInfoFormRef.value.formInline;
......@@ -351,6 +406,9 @@ const submit = () => {
fullscreenLoading.value = true;
if (route.query.guid) {
params.guid = route.query.guid;
/** 需要判断是审批通过之后的编辑,若是只改成员信息,则不需要提交审批,只需要调用编辑即可。 */
const hasModified = checkIfModified(formInline, params.policyRQVOS);
if (hasModified) { //修改过基础信息
updateLogicSpace(params).then((res: any) => {
fullscreenLoading.value = false;
if (res?.code == proxy.$passCode) {
......@@ -365,6 +423,24 @@ const submit = () => {
}
})
} else {
// 未修改过基础信息,只修改成员,或者任何修改都没有时,直接调用提交成员
updateLogicSpaceMember(params).then((res: any) => {
fullscreenLoading.value = false;
if (res?.code == proxy.$passCode) {
proxy.$ElMessage.success('编辑提交成功');
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'productSpaceManage'
});
productSpaceStore.setIsRefresh(true);
} else {
res?.msg && proxy.$ElMessage.error(res.msg);
}
}).catch(() => {
fullscreenLoading.value = false;
});
}
} else {
saveLogicSpace(params).then((res: any) => {
fullscreenLoading.value = false;
if (res?.code == proxy.$passCode) {
......@@ -413,7 +489,8 @@ onBeforeMount(() => {
baseInfoFormItems.value.forEach((item: any) => {
item.default = detailInfo.value[item.field] || '';
})
memberTableInfo.value.data = detailInfo.value?.permissionRSVOS || [];
memberTableData.value = detailInfo.value?.permissionRSVOS || [];
memberTableInfo.value.data = memberTableData.value;
strategyTableRef.value.strategyData = detailInfo.value?.policyRSVOS || [];
} else {
res?.msg && proxy.$ElMessage.error(res?.msg);
......
......@@ -5,9 +5,9 @@
</div>
<el-table :key="key" class="strategyTable no-scroll-vertical" ref="strategyTableRef" v-loading="strategyDataLoading"
:data="strategyData" :height="(isReport || isLook) ? 'auto' : '250px'" :highlight-current-row="true" stripe
tooltip-effect="light" border :span-method="arraySpanMethod">
tooltip-effect="light" border :span-method="arraySpanMethod" row-class-name="edit-row">
<el-table-column label="序号" width="56" align="center" fixed="left" :formatter="formatIndex" />
<el-table-column prop="action" label="行为类型" :width="isLook ? '106px' : (isReport ? 'auto' : '150px')"
<el-table-column prop="action" label="行为类型" :width="isLook ? '106px' : (isReport ? 'auto' : '150px')" class-name="edit-colum"
:min-width="isReport ? '100px' : undefined" align="left" :show-overflow-tooltip="!isReport">
<template #header>
<span>行为类型</span>
......@@ -147,6 +147,7 @@ import {
import {
getAreaData,
} from "@/api/modules/queryService";
import { scrollLastRowToView } from "@/utils/common";
const { required } = useValidator();
const { proxy } = getCurrentInstance() as any;
......@@ -198,6 +199,8 @@ const props = defineProps({
}
})
const strategyTableRef = ref();
const loading = ref(false);
/** 连接器下拉列表,搜索取得 */
const connectorList: any = ref([]);
......@@ -547,6 +550,9 @@ const addStrategy = () => {
action: '',
children: [{ childIndex: 1 }]
})
nextTick(() => {
scrollLastRowToView(strategyTableRef.value, strategyData.value.length, 40);
})
}
/** 添加约束条件 */
......@@ -559,6 +565,14 @@ const handleConditionClickAdd = (scope) => {
let childIndex = scope.row.childIndex;
let lastIndex = sv.children.at(-1)?.childIndex || 0;
sv.children.splice(childIndex, 0, { childIndex: lastIndex + 1 })
let svIndex = sv.index;
let cnt = 0;
for (let i = 0; i<svIndex - 1; i++) {
cnt = cnt + (strategyValueInfo.value[i]?.children?.length || 1);
}
nextTick(() => {
scrollLastRowToView(strategyTableRef.value, cnt + lastIndex + 1, 40);
})
}
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!