59918bc8 by lihua

修改一些编辑有关的问题

1 parent 485f5781
...@@ -655,13 +655,20 @@ export const saveLogicSpace = (params) => request({ ...@@ -655,13 +655,20 @@ export const saveLogicSpace = (params) => request({
655 data: params 655 data: params
656 }) 656 })
657 657
658 /** 编辑逻辑空间 */ 658 /** 编辑逻辑空间,提交草稿或审批流程 */
659 export const updateLogicSpace = (params) => request({ 659 export const updateLogicSpace = (params) => request({
660 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/update`, 660 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/update`,
661 method: 'put', 661 method: 'put',
662 data: params 662 data: params
663 }) 663 })
664 664
665 /** 编辑逻辑空间,审批通过后添加成员信息不需要提交审批 */
666 export const updateLogicSpaceMember = (params) => request({
667 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/update-members`,
668 method: 'put',
669 data: params
670 })
671
665 /** 删除逻辑空间 */ 672 /** 删除逻辑空间 */
666 export const deleteLogicSpace = (guids) => request({ 673 export const deleteLogicSpace = (guids) => request({
667 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/delete`, 674 url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/logic-space/delete`,
......
...@@ -31,7 +31,7 @@ export const handleContentWrapView = (name) => { ...@@ -31,7 +31,7 @@ export const handleContentWrapView = (name) => {
31 } 31 }
32 32
33 /** 添加表格最后一行滚动到可视范围内 */ 33 /** 添加表格最后一行滚动到可视范围内 */
34 export const scrollLastRowToView = (tableRef, dataLen) => { 34 export const scrollLastRowToView = (tableRef, dataLen, cellHeight = 36) => {
35 if (!tableRef) { 35 if (!tableRef) {
36 return; 36 return;
37 } 37 }
...@@ -39,8 +39,8 @@ export const scrollLastRowToView = (tableRef, dataLen) => { ...@@ -39,8 +39,8 @@ export const scrollLastRowToView = (tableRef, dataLen) => {
39 let domScroll = bodyWrapper.parentElement.parentElement; 39 let domScroll = bodyWrapper.parentElement.parentElement;
40 let rect = domScroll.getBoundingClientRect(); 40 let rect = domScroll.getBoundingClientRect();
41 let maxNum = dataLen + 1; 41 let maxNum = dataLen + 1;
42 if (maxNum * 36 > rect.height + domScroll.scrollTop) { 42 if (maxNum * cellHeight > rect.height + domScroll.scrollTop) {
43 tableRef.setScrollTop(maxNum * 36 - rect.height + 2) 43 tableRef.setScrollTop(maxNum * cellHeight - rect.height + 2)
44 } 44 }
45 } 45 }
46 46
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
15 </div> 15 </div>
16 <div class="bottom_tool_wrap"> 16 <div class="bottom_tool_wrap">
17 <el-button @click="cancel">取消</el-button> 17 <el-button @click="cancel">取消</el-button>
18 <el-button @click="save" v-preReClick>保存</el-button> 18 <el-button @click="save" v-show="detailInfo.approveState !== 'Y' && detailInfo.approveState !== 'C' && detailInfo.approveState !== 'R'" v-preReClick>保存</el-button>
19 <el-button type="primary" @click="submit" v-preReClick>提交审批</el-button> 19 <el-button type="primary" @click="submit" v-preReClick>提交审批</el-button>
20 </div> 20 </div>
21 </div> 21 </div>
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
29 </div> 29 </div>
30 <div class="bottom_tool_wrap"> 30 <div class="bottom_tool_wrap">
31 <el-button @click="cancel">取消</el-button> 31 <el-button @click="cancel">取消</el-button>
32 <el-button @click="save" v-preReClick>保存</el-button> 32 <el-button v-show="detailInfo.bizApproveState !== 'Y' && detailInfo.bizApproveState !== 'C' && detailInfo.bizApproveState !== 'R'" @click="save" v-preReClick>保存草稿</el-button>
33 <el-button type="primary" @click="submit" v-preReClick>提交审批</el-button> 33 <el-button type="primary" @click="submit" v-preReClick>提交</el-button>
34 </div> 34 </div>
35 </div> 35 </div>
36 </template> 36 </template>
...@@ -52,7 +52,7 @@ import { useValidator } from '@/hooks/useValidator'; ...@@ -52,7 +52,7 @@ import { useValidator } from '@/hooks/useValidator';
52 import { TableColumnWidth } from "@/utils/enum"; 52 import { TableColumnWidth } from "@/utils/enum";
53 import { scrollLastRowToView } from "@/utils/common"; 53 import { scrollLastRowToView } from "@/utils/common";
54 import StrategyTable from "../data_smart_contract/components/strategyTable.vue"; 54 import StrategyTable from "../data_smart_contract/components/strategyTable.vue";
55 import { getLogicSpaceDetail, saveLogicSpace, updateLogicSpace } from "@/api/modules/dataAsset"; 55 import { getLogicSpaceDetail, saveLogicSpace, updateLogicSpace, updateLogicSpaceMember } from "@/api/modules/dataAsset";
56 56
57 const { required } = useValidator(); 57 const { required } = useValidator();
58 58
...@@ -272,6 +272,61 @@ const addMember = () => { ...@@ -272,6 +272,61 @@ const addMember = () => {
272 }) 272 })
273 } 273 }
274 274
275 // 检查数据是否被修改
276 const checkIfModified = (formInline: any, policyRQVOS: any[]) => {
277 // 检查formInline中的字段
278 for (let key in formInline) {
279 if (formInline[key] !== detailInfo.value[key]) {
280 return true;
281 }
282 }
283
284 // 检查policyRQVOS
285 const originalPolicies = detailInfo.value?.policyRSVOS || [];
286 if (policyRQVOS.length !== originalPolicies.length) {
287 return true;
288 }
289
290 for (let i = 0; i < policyRQVOS.length; i++) {
291 const current = policyRQVOS[i];
292 const original = originalPolicies[i];
293 if (!original) {
294 return true;
295 }
296
297 // 比较策略数据的每个字段
298 for (let key in current) {
299 if (key !== 'childIndex' && key !== 'index' && key !== 'orderNum' && current[key] !== original[key]) {
300 return true;
301 }
302 }
303 }
304
305 // // 检查成员权限数据
306 // const currentMembers = memberTableInfo.value.data || [];
307 // const originalMembers = detailInfo.value?.permissionRSVOS || [];
308 // if (currentMembers.length !== originalMembers.length) {
309 // return true;
310 // }
311
312 // for (let i = 0; i < currentMembers.length; i++) {
313 // const current = currentMembers[i];
314 // const original = originalMembers[i];
315 // if (!original) {
316 // return true;
317 // }
318
319 // // 比较成员数据的每个字段
320 // for (let key in current) {
321 // if (current[key] !== original[key]) {
322 // return true;
323 // }
324 // }
325 // }
326
327 return false;
328 };
329
275 const save = () => { 330 const save = () => {
276 // 保存不检验。 331 // 保存不检验。
277 let formInline = baseInfoFormRef.value.formInline; 332 let formInline = baseInfoFormRef.value.formInline;
...@@ -351,6 +406,9 @@ const submit = () => { ...@@ -351,6 +406,9 @@ const submit = () => {
351 fullscreenLoading.value = true; 406 fullscreenLoading.value = true;
352 if (route.query.guid) { 407 if (route.query.guid) {
353 params.guid = route.query.guid; 408 params.guid = route.query.guid;
409 /** 需要判断是审批通过之后的编辑,若是只改成员信息,则不需要提交审批,只需要调用编辑即可。 */
410 const hasModified = checkIfModified(formInline, params.policyRQVOS);
411 if (hasModified) { //修改过基础信息
354 updateLogicSpace(params).then((res: any) => { 412 updateLogicSpace(params).then((res: any) => {
355 fullscreenLoading.value = false; 413 fullscreenLoading.value = false;
356 if (res?.code == proxy.$passCode) { 414 if (res?.code == proxy.$passCode) {
...@@ -365,6 +423,24 @@ const submit = () => { ...@@ -365,6 +423,24 @@ const submit = () => {
365 } 423 }
366 }) 424 })
367 } else { 425 } else {
426 // 未修改过基础信息,只修改成员,或者任何修改都没有时,直接调用提交成员
427 updateLogicSpaceMember(params).then((res: any) => {
428 fullscreenLoading.value = false;
429 if (res?.code == proxy.$passCode) {
430 proxy.$ElMessage.success('编辑提交成功');
431 userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
432 router.push({
433 name: 'productSpaceManage'
434 });
435 productSpaceStore.setIsRefresh(true);
436 } else {
437 res?.msg && proxy.$ElMessage.error(res.msg);
438 }
439 }).catch(() => {
440 fullscreenLoading.value = false;
441 });
442 }
443 } else {
368 saveLogicSpace(params).then((res: any) => { 444 saveLogicSpace(params).then((res: any) => {
369 fullscreenLoading.value = false; 445 fullscreenLoading.value = false;
370 if (res?.code == proxy.$passCode) { 446 if (res?.code == proxy.$passCode) {
...@@ -413,7 +489,8 @@ onBeforeMount(() => { ...@@ -413,7 +489,8 @@ onBeforeMount(() => {
413 baseInfoFormItems.value.forEach((item: any) => { 489 baseInfoFormItems.value.forEach((item: any) => {
414 item.default = detailInfo.value[item.field] || ''; 490 item.default = detailInfo.value[item.field] || '';
415 }) 491 })
416 memberTableInfo.value.data = detailInfo.value?.permissionRSVOS || []; 492 memberTableData.value = detailInfo.value?.permissionRSVOS || [];
493 memberTableInfo.value.data = memberTableData.value;
417 strategyTableRef.value.strategyData = detailInfo.value?.policyRSVOS || []; 494 strategyTableRef.value.strategyData = detailInfo.value?.policyRSVOS || [];
418 } else { 495 } else {
419 res?.msg && proxy.$ElMessage.error(res?.msg); 496 res?.msg && proxy.$ElMessage.error(res?.msg);
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
5 </div> 5 </div>
6 <el-table :key="key" class="strategyTable no-scroll-vertical" ref="strategyTableRef" v-loading="strategyDataLoading" 6 <el-table :key="key" class="strategyTable no-scroll-vertical" ref="strategyTableRef" v-loading="strategyDataLoading"
7 :data="strategyData" :height="(isReport || isLook) ? 'auto' : '250px'" :highlight-current-row="true" stripe 7 :data="strategyData" :height="(isReport || isLook) ? 'auto' : '250px'" :highlight-current-row="true" stripe
8 tooltip-effect="light" border :span-method="arraySpanMethod"> 8 tooltip-effect="light" border :span-method="arraySpanMethod" row-class-name="edit-row">
9 <el-table-column label="序号" width="56" align="center" fixed="left" :formatter="formatIndex" /> 9 <el-table-column label="序号" width="56" align="center" fixed="left" :formatter="formatIndex" />
10 <el-table-column prop="action" label="行为类型" :width="isLook ? '106px' : (isReport ? 'auto' : '150px')" 10 <el-table-column prop="action" label="行为类型" :width="isLook ? '106px' : (isReport ? 'auto' : '150px')" class-name="edit-colum"
11 :min-width="isReport ? '100px' : undefined" align="left" :show-overflow-tooltip="!isReport"> 11 :min-width="isReport ? '100px' : undefined" align="left" :show-overflow-tooltip="!isReport">
12 <template #header> 12 <template #header>
13 <span>行为类型</span> 13 <span>行为类型</span>
...@@ -147,6 +147,7 @@ import { ...@@ -147,6 +147,7 @@ import {
147 import { 147 import {
148 getAreaData, 148 getAreaData,
149 } from "@/api/modules/queryService"; 149 } from "@/api/modules/queryService";
150 import { scrollLastRowToView } from "@/utils/common";
150 151
151 const { required } = useValidator(); 152 const { required } = useValidator();
152 const { proxy } = getCurrentInstance() as any; 153 const { proxy } = getCurrentInstance() as any;
...@@ -198,6 +199,8 @@ const props = defineProps({ ...@@ -198,6 +199,8 @@ const props = defineProps({
198 } 199 }
199 }) 200 })
200 201
202 const strategyTableRef = ref();
203
201 const loading = ref(false); 204 const loading = ref(false);
202 /** 连接器下拉列表,搜索取得 */ 205 /** 连接器下拉列表,搜索取得 */
203 const connectorList: any = ref([]); 206 const connectorList: any = ref([]);
...@@ -547,6 +550,9 @@ const addStrategy = () => { ...@@ -547,6 +550,9 @@ const addStrategy = () => {
547 action: '', 550 action: '',
548 children: [{ childIndex: 1 }] 551 children: [{ childIndex: 1 }]
549 }) 552 })
553 nextTick(() => {
554 scrollLastRowToView(strategyTableRef.value, strategyData.value.length, 40);
555 })
550 } 556 }
551 557
552 /** 添加约束条件 */ 558 /** 添加约束条件 */
...@@ -559,6 +565,14 @@ const handleConditionClickAdd = (scope) => { ...@@ -559,6 +565,14 @@ const handleConditionClickAdd = (scope) => {
559 let childIndex = scope.row.childIndex; 565 let childIndex = scope.row.childIndex;
560 let lastIndex = sv.children.at(-1)?.childIndex || 0; 566 let lastIndex = sv.children.at(-1)?.childIndex || 0;
561 sv.children.splice(childIndex, 0, { childIndex: lastIndex + 1 }) 567 sv.children.splice(childIndex, 0, { childIndex: lastIndex + 1 })
568 let svIndex = sv.index;
569 let cnt = 0;
570 for (let i = 0; i<svIndex - 1; i++) {
571 cnt = cnt + (strategyValueInfo.value[i]?.children?.length || 1);
572 }
573 nextTick(() => {
574 scrollLastRowToView(strategyTableRef.value, cnt + lastIndex + 1, 40);
575 })
562 } 576 }
563 } 577 }
564 578
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!