解决限定地域以及表格约束值显示中文问题
Showing
8 changed files
with
109 additions
and
36 deletions
| ... | @@ -376,7 +376,19 @@ const execTableInfo = ref({ | ... | @@ -376,7 +376,19 @@ const execTableInfo = ref({ |
| 376 | { label: "约束条件", field: "constraintName", width: 120 }, | 376 | { label: "约束条件", field: "constraintName", width: 120 }, |
| 377 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | 377 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, |
| 378 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, | 378 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, |
| 379 | { label: "约束条件值", field: "constraintValue", width: 150 }, | 379 | { label: "约束条件值", field: "constraintValue", width: 150, getName: (scope) => { |
| 380 | let row = scope.row; | ||
| 381 | if (row.constraintEnName == 'dataField') { | ||
| 382 | return row.additionValue?.map(a => a.chName)?.join(','); | ||
| 383 | } | ||
| 384 | if (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') { | ||
| 385 | return scope.row.additionValue?.map(a => a.tenantName)?.join(',') | ||
| 386 | } | ||
| 387 | if (scope.row.constraintEnName == 'limitedState' || scope.row.constraintEnName == 'areaAddress') { | ||
| 388 | return scope.row.additionValue?.map(a => a.label)?.join(','); | ||
| 389 | } | ||
| 390 | return scope.row['constraintValue'] || '--'; | ||
| 391 | } }, | ||
| 380 | { label: "检验结果", field: "result", width: 130 }, | 392 | { label: "检验结果", field: "result", width: 130 }, |
| 381 | // { label: "上报时间", field: "reportingTime", width: 170 }, | 393 | // { label: "上报时间", field: "reportingTime", width: 170 }, |
| 382 | ], | 394 | ], | ... | ... |
| ... | @@ -212,7 +212,19 @@ const execContractTableInfo = ref({ | ... | @@ -212,7 +212,19 @@ const execContractTableInfo = ref({ |
| 212 | { label: "约束条件", field: "constraintName", width: 120 }, | 212 | { label: "约束条件", field: "constraintName", width: 120 }, |
| 213 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | 213 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, |
| 214 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, | 214 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, |
| 215 | { label: "约束条件值", field: "constraintValue", width: 150 }, | 215 | { label: "约束条件值", field: "constraintValue", width: 150, getName: (scope) => { |
| 216 | let row = scope.row; | ||
| 217 | if (row.constraintEnName == 'dataField') { | ||
| 218 | return row.additionValue?.map(a => a.chName)?.join(','); | ||
| 219 | } | ||
| 220 | if (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') { | ||
| 221 | return scope.row.additionValue?.map(a => a.tenantName)?.join(',') | ||
| 222 | } | ||
| 223 | if (scope.row.constraintEnName == 'limitedState' || scope.row.constraintEnName == 'areaAddress') { | ||
| 224 | return scope.row.additionValue?.map(a => a.label)?.join(','); | ||
| 225 | } | ||
| 226 | return scope.row['constraintValue'] || '--'; | ||
| 227 | } }, | ||
| 216 | { label: "执行结果", field: "result", width: 130 }, | 228 | { label: "执行结果", field: "result", width: 130 }, |
| 217 | // { label: "上报时间", field: "reportingTime", width: 170 }, | 229 | // { label: "上报时间", field: "reportingTime", width: 170 }, |
| 218 | ], | 230 | ], | ... | ... |
| ... | @@ -1311,7 +1311,7 @@ const respParamsTableInfo = ref({ | ... | @@ -1311,7 +1311,7 @@ const respParamsTableInfo = ref({ |
| 1311 | </div> | 1311 | </div> |
| 1312 | <div class="row-extra-desc"> | 1312 | <div class="row-extra-desc"> |
| 1313 | <div class="per-extra-desc">{{ '是否缓存:' + (detailInfo.isCache == 'Y' ? '是' : '否') }}</div> | 1313 | <div class="per-extra-desc">{{ '是否缓存:' + (detailInfo.isCache == 'Y' ? '是' : '否') }}</div> |
| 1314 | <div>{{ '是否加密存储:' + (detailInfo.scenario == 'Y' ? '是' : '否') }}</div> | 1314 | <div>{{ '是否加密存储:' + (detailInfo.isEncrypField == 'Y' ? '是' : '否') }}</div> |
| 1315 | </div> | 1315 | </div> |
| 1316 | <!-- </template> --> | 1316 | <!-- </template> --> |
| 1317 | <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }} | 1317 | <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }} | ... | ... |
| ... | @@ -197,29 +197,6 @@ const handleProcessDialogBtnClick = (btn) => { | ... | @@ -197,29 +197,6 @@ const handleProcessDialogBtnClick = (btn) => { |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | const execContractTableInfo = ref({ | ||
| 201 | id: "exec-contract-table", | ||
| 202 | height: '214px', | ||
| 203 | fields: <any[]>[ | ||
| 204 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | ||
| 205 | { label: "策略id", field: "strategyId", width: 260 }, | ||
| 206 | { label: "操作行为", field: "action", width: 120 }, | ||
| 207 | { label: "操作行为英文名称", field: "actionEnName", width: 140 }, | ||
| 208 | { label: "约束条件", field: "constraintName", width: 120 }, | ||
| 209 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | ||
| 210 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, | ||
| 211 | { label: "约束条件值", field: "constraintValue", width: 150 }, | ||
| 212 | { label: "执行结果", field: "result", width: 130 }, | ||
| 213 | // { label: "上报时间", field: "reportingTime", width: 170 }, | ||
| 214 | ], | ||
| 215 | data: [], | ||
| 216 | showPage: false, | ||
| 217 | actionInfo: { | ||
| 218 | show: false | ||
| 219 | }, | ||
| 220 | loading: false | ||
| 221 | }); | ||
| 222 | |||
| 223 | </script> | 200 | </script> |
| 224 | 201 | ||
| 225 | <template> | 202 | <template> | ... | ... |
| ... | @@ -110,7 +110,8 @@ | ... | @@ -110,7 +110,8 @@ |
| 110 | v-model="scope.row['constraintAddressValue']" :props="addressProps" :show-all-levels="true" :clearable="true" | 110 | v-model="scope.row['constraintAddressValue']" :props="addressProps" :show-all-levels="true" :clearable="true" |
| 111 | show-checked-strategy="parent" :filterable="true" :collapse-tags="true" :collapse-tags-tooltip="true" | 111 | show-checked-strategy="parent" :filterable="true" :collapse-tags="true" :collapse-tags-tooltip="true" |
| 112 | :max-collapse-tags="1" :options="parentAreaData" :disabled="false" | 112 | :max-collapse-tags="1" :options="parentAreaData" :disabled="false" |
| 113 | @change="(val) => handleOperatorSelectChange(val, scope, 'constraintAddressValue')" /> | 113 | @change="(val) => handleOperatorSelectChange(val, scope, 'constraintAddressValue')"> |
| 114 | </el-cascader> | ||
| 114 | <span v-else>{{((scope.row.constraintEnName == 'dataField') ? | 115 | <span v-else>{{((scope.row.constraintEnName == 'dataField') ? |
| 115 | scope.row.additionValue?.map(a => a.chName)?.join(',') : ((scope.row.constraintEnName == | 116 | scope.row.additionValue?.map(a => a.chName)?.join(',') : ((scope.row.constraintEnName == |
| 116 | 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') ? | 117 | 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') ? |
| ... | @@ -359,8 +360,13 @@ const transferValueToNew = (val, isTemplate = false) => { | ... | @@ -359,8 +360,13 @@ const transferValueToNew = (val, isTemplate = false) => { |
| 359 | const init = ref(false); | 360 | const init = ref(false); |
| 360 | 361 | ||
| 361 | watch(() => props.value, (val) => { | 362 | watch(() => props.value, (val) => { |
| 362 | init.value = true; | 363 | //init.value = true; |
| 363 | strategyValueInfo.value = transferValueToNew(val); | 364 | strategyValueInfo.value = transferValueToNew(val); |
| 365 | if (strategyValueInfo.value.some(s => s.constraintEnName == 'areaAddress' && s.additionValue?.some(a => a.value.split('-')?.length > 2))) { | ||
| 366 | init.value= true; | ||
| 367 | } else { | ||
| 368 | init.value= false; | ||
| 369 | } | ||
| 364 | }, { | 370 | }, { |
| 365 | deep: true, | 371 | deep: true, |
| 366 | immediate: true | 372 | immediate: true |
| ... | @@ -440,6 +446,46 @@ const selectConditionChange = (val, scope) => { | ... | @@ -440,6 +446,46 @@ const selectConditionChange = (val, scope) => { |
| 440 | } | 446 | } |
| 441 | } | 447 | } |
| 442 | 448 | ||
| 449 | const removeChildrenWithParentsOptimized = (selectedValues) => { | ||
| 450 | if (!Array.isArray(selectedValues) || selectedValues.length === 0) { | ||
| 451 | return [] | ||
| 452 | } | ||
| 453 | |||
| 454 | // 1. 按路径长度排序(从短到长) | ||
| 455 | const sortedValues = [...selectedValues].sort((a, b) => a.length - b.length) | ||
| 456 | |||
| 457 | // 2. 使用Map存储所有路径的前缀 | ||
| 458 | const parentMap = new Map() | ||
| 459 | const result = [] | ||
| 460 | |||
| 461 | // 3. 处理每个路径 | ||
| 462 | for (const path of sortedValues) { | ||
| 463 | let isChild = false | ||
| 464 | |||
| 465 | // 4. 检查当前路径的每个前缀(不包括自身)是否已经在parentMap中 | ||
| 466 | for (let i = 1; i < path.length; i++) { // 注意:i < path.length,不是 i <= path.length | ||
| 467 | const prefix = path.slice(0, i) | ||
| 468 | const prefixKey = prefix.join(',') | ||
| 469 | |||
| 470 | if (parentMap.has(prefixKey)) { | ||
| 471 | // 当前路径是某个已有路径的子节点 | ||
| 472 | isChild = true | ||
| 473 | break | ||
| 474 | } | ||
| 475 | } | ||
| 476 | |||
| 477 | // 5. 如果不是任何已有路径的子节点 | ||
| 478 | if (!isChild) { | ||
| 479 | result.push(path) | ||
| 480 | // 将当前路径添加到Map中(作为可能的父节点) | ||
| 481 | const pathKey = path.join(',') | ||
| 482 | parentMap.set(pathKey, true) | ||
| 483 | } | ||
| 484 | } | ||
| 485 | |||
| 486 | return result | ||
| 487 | } | ||
| 488 | |||
| 443 | const handleOperatorSelectChange = (val, scope, field) => { | 489 | const handleOperatorSelectChange = (val, scope, field) => { |
| 444 | init.value = false; | 490 | init.value = false; |
| 445 | let index = scope.row.index; | 491 | let index = scope.row.index; |
| ... | @@ -451,7 +497,8 @@ const handleOperatorSelectChange = (val, scope, field) => { | ... | @@ -451,7 +497,8 @@ const handleOperatorSelectChange = (val, scope, field) => { |
| 451 | return connectorList.value.find(c => c.guid == vv); | 497 | return connectorList.value.find(c => c.guid == vv); |
| 452 | }) | 498 | }) |
| 453 | } else if (field == 'constraintAddressValue') { | 499 | } else if (field == 'constraintAddressValue') { |
| 454 | svChild.additionValue = val?.map(vv => { | 500 | let result: any[] = removeChildrenWithParentsOptimized(val); |
| 501 | svChild.additionValue = result?.map(vv => { | ||
| 455 | let label = '' | 502 | let label = '' |
| 456 | let node: any = {}; | 503 | let node: any = {}; |
| 457 | vv.forEach((vc, index) => { | 504 | vv.forEach((vc, index) => { |
| ... | @@ -465,7 +512,8 @@ const handleOperatorSelectChange = (val, scope, field) => { | ... | @@ -465,7 +512,8 @@ const handleOperatorSelectChange = (val, scope, field) => { |
| 465 | }) | 512 | }) |
| 466 | return { | 513 | return { |
| 467 | value: vv.join('-'), | 514 | value: vv.join('-'), |
| 468 | label: label | 515 | label: label, |
| 516 | targetValue: vv.at(-1) | ||
| 469 | }; | 517 | }; |
| 470 | }) | 518 | }) |
| 471 | } | 519 | } | ... | ... |
| ... | @@ -407,7 +407,19 @@ const execContractTableInfo = ref({ | ... | @@ -407,7 +407,19 @@ const execContractTableInfo = ref({ |
| 407 | { label: "约束条件", field: "constraintName", width: 120 }, | 407 | { label: "约束条件", field: "constraintName", width: 120 }, |
| 408 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | 408 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, |
| 409 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, | 409 | { label: "约束条件运算符", field: "constraintOperatorName", width: 140 }, |
| 410 | { label: "约束条件值", field: "constraintValue", width: 150 }, | 410 | { label: "约束条件值", field: "constraintValue", width: 150, getName: (scope) => { |
| 411 | let row = scope.row; | ||
| 412 | if (row.constraintEnName == 'dataField') { | ||
| 413 | return row.additionValue?.map(a => a.chName)?.join(','); | ||
| 414 | } | ||
| 415 | if (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') { | ||
| 416 | return scope.row.additionValue?.map(a => a.tenantName)?.join(',') | ||
| 417 | } | ||
| 418 | if (scope.row.constraintEnName == 'limitedState' || scope.row.constraintEnName == 'areaAddress') { | ||
| 419 | return scope.row.additionValue?.map(a => a.label)?.join(','); | ||
| 420 | } | ||
| 421 | return scope.row['constraintValue'] || '--'; | ||
| 422 | } }, | ||
| 411 | { label: "执行结果", field: "result", width: 130 }, | 423 | { label: "执行结果", field: "result", width: 130 }, |
| 412 | // { label: "上报时间", field: "reportingTime", width: 170 }, | 424 | // { label: "上报时间", field: "reportingTime", width: 170 }, |
| 413 | ], | 425 | ], | ... | ... |
| ... | @@ -495,8 +495,8 @@ const getSubmitInfo = () => { | ... | @@ -495,8 +495,8 @@ const getSubmitInfo = () => { |
| 495 | v.constraintValue = d.constraintConnectorValue?.join(','); | 495 | v.constraintValue = d.constraintConnectorValue?.join(','); |
| 496 | v.additionValue = d.additionValue; | 496 | v.additionValue = d.additionValue; |
| 497 | } else if (d.constraintEnName == 'areaAddress' && d.constraintAddressValue?.length) { | 497 | } else if (d.constraintEnName == 'areaAddress' && d.constraintAddressValue?.length) { |
| 498 | v.constraintValue = d.constraintAddressValue?.map(dd => { | 498 | v.constraintValue = d.additionValue?.map(dd => { |
| 499 | return dd.at(-1); | 499 | return dd.targetValue; |
| 500 | })?.join(','); | 500 | })?.join(','); |
| 501 | v.additionValue = d.additionValue; | 501 | v.additionValue = d.additionValue; |
| 502 | } | 502 | } | ... | ... |
| ... | @@ -153,8 +153,8 @@ const btnHandles = ref({ | ... | @@ -153,8 +153,8 @@ const btnHandles = ref({ |
| 153 | v.constraintValue = d.constraintConnectorValue?.join(','); | 153 | v.constraintValue = d.constraintConnectorValue?.join(','); |
| 154 | v.additionValue = d.additionValue; | 154 | v.additionValue = d.additionValue; |
| 155 | } else if (d.constraintEnName == 'areaAddress' && d.constraintAddressValue?.length) { | 155 | } else if (d.constraintEnName == 'areaAddress' && d.constraintAddressValue?.length) { |
| 156 | v.constraintValue = d.constraintAddressValue?.map(dd => { | 156 | v.constraintValue = d.additionValue?.map(dd => { |
| 157 | return dd.at(-1); | 157 | return dd.targetValue; |
| 158 | })?.join(','); | 158 | })?.join(','); |
| 159 | v.additionValue = d.additionValue; | 159 | v.additionValue = d.additionValue; |
| 160 | } | 160 | } |
| ... | @@ -797,7 +797,19 @@ const execContractTableInfo = ref({ | ... | @@ -797,7 +797,19 @@ const execContractTableInfo = ref({ |
| 797 | { label: "约束条件", field: "constraintName", width: 120 }, | 797 | { label: "约束条件", field: "constraintName", width: 120 }, |
| 798 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, | 798 | { label: "约束条件英文名称", field: "constraintEnName", width: 140 }, |
| 799 | { label: "约束条件运算符", field: "constraintOperatorCodeName", width: 140 }, | 799 | { label: "约束条件运算符", field: "constraintOperatorCodeName", width: 140 }, |
| 800 | { label: "约束条件值", field: "constraintValue", width: 150 }, | 800 | { label: "约束条件值", field: "constraintValue", width: 150, getName: (scope) => { |
| 801 | let row = scope.row; | ||
| 802 | if (row.constraintEnName == 'dataField') { | ||
| 803 | return row.additionValue?.map(a => a.chName)?.join(','); | ||
| 804 | } | ||
| 805 | if (scope.row.constraintEnName == 'limitedDeliveryConnector' || scope.row.constraintEnName == 'limitedUseConnector') { | ||
| 806 | return scope.row.additionValue?.map(a => a.tenantName)?.join(',') | ||
| 807 | } | ||
| 808 | if (scope.row.constraintEnName == 'limitedState' || scope.row.constraintEnName == 'areaAddress') { | ||
| 809 | return scope.row.additionValue?.map(a => a.label)?.join(','); | ||
| 810 | } | ||
| 811 | return scope.row['constraintValue'] || '--'; | ||
| 812 | } }, | ||
| 801 | { label: "执行结果", field: "result", width: 130 }, | 813 | { label: "执行结果", field: "result", width: 130 }, |
| 802 | { label: "上报时间", field: "reportingTime", width: 170 }, | 814 | { label: "上报时间", field: "reportingTime", width: 170 }, |
| 803 | ], | 815 | ], | ... | ... |
-
Please register or sign in to post a comment