产品地域回显和添加服务包不能添加重复
Showing
2 changed files
with
27 additions
and
13 deletions
| ... | @@ -406,6 +406,7 @@ onMounted(() => { | ... | @@ -406,6 +406,7 @@ onMounted(() => { |
| 406 | v-for="opt in editForm[item.field].getOptions ? editForm[item.field].getOptions(scope) : editForm[item.field].options" | 406 | v-for="opt in editForm[item.field].getOptions ? editForm[item.field].getOptions(scope) : editForm[item.field].options" |
| 407 | :label="editForm[item.field]?.props?.label ? opt[editForm[item.field].props.label] : opt.label" | 407 | :label="editForm[item.field]?.props?.label ? opt[editForm[item.field].props.label] : opt.label" |
| 408 | :value="editForm[item.field]?.props?.value ? opt[editForm[item.field].props.value] : opt.value" | 408 | :value="editForm[item.field]?.props?.value ? opt[editForm[item.field].props.value] : opt.value" |
| 409 | :disabled="editForm[item.field]?.props?.disabled ? opt[editForm[item.field].props.disabled] : opt.disabled" | ||
| 409 | :key="editForm[item.field]?.props?.value ? opt[editForm[item.field].props.value] : opt.value" /> | 410 | :key="editForm[item.field]?.props?.value ? opt[editForm[item.field].props.value] : opt.value" /> |
| 410 | </el-select> | 411 | </el-select> |
| 411 | <el-input v-else-if=" | 412 | <el-input v-else-if=" | ... | ... |
| ... | @@ -695,6 +695,17 @@ const productData: any = ref([]); | ... | @@ -695,6 +695,17 @@ const productData: any = ref([]); |
| 695 | 695 | ||
| 696 | const apiList: any = ref([]); | 696 | const apiList: any = ref([]); |
| 697 | 697 | ||
| 698 | const getAPIOptions = (scope) => { | ||
| 699 | apiList.value.forEach(a => { | ||
| 700 | if (a.guid != scope.row.guid && productData.value.some(p => p.apiGuid == a.guid)) { | ||
| 701 | a.disabled = true; | ||
| 702 | } else { | ||
| 703 | a.disabled = false; | ||
| 704 | } | ||
| 705 | }) | ||
| 706 | return apiList.value; | ||
| 707 | } | ||
| 708 | |||
| 698 | /** 基本信息的入参定义表格配置 */ | 709 | /** 基本信息的入参定义表格配置 */ |
| 699 | const productTableInfo = ref({ | 710 | const productTableInfo = ref({ |
| 700 | id: "input-product-table", | 711 | id: "input-product-table", |
| ... | @@ -702,9 +713,11 @@ const productTableInfo = ref({ | ... | @@ -702,9 +713,11 @@ const productTableInfo = ref({ |
| 702 | fields: [ | 713 | fields: [ |
| 703 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | 714 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, |
| 704 | { label: "服务名称", field: "apiGuid", width: 180, required: true, columClass: 'edit-colum', type: 'edit' }, | 715 | { label: "服务名称", field: "apiGuid", width: 180, required: true, columClass: 'edit-colum', type: 'edit' }, |
| 705 | { label: "API类型", field: "apiType", width: 100, getName: (scope) => { | 716 | { |
| 717 | label: "API类型", field: "apiType", width: 100, getName: (scope) => { | ||
| 706 | return scope.row.apiType && apiTypes.find(a => a.value == scope.row.apiType)?.label || '--'; | 718 | return scope.row.apiType && apiTypes.find(a => a.value == scope.row.apiType)?.label || '--'; |
| 707 | } }, | 719 | } |
| 720 | }, | ||
| 708 | { label: "API地址", field: "requestUrl", minWidth: 240 }, | 721 | { label: "API地址", field: "requestUrl", minWidth: 240 }, |
| 709 | { label: "描述", field: "apiDescription", width: 300 }, | 722 | { label: "描述", field: "apiDescription", width: 300 }, |
| 710 | ], | 723 | ], |
| ... | @@ -714,14 +727,14 @@ const productTableInfo = ref({ | ... | @@ -714,14 +727,14 @@ const productTableInfo = ref({ |
| 714 | type: 'select', | 727 | type: 'select', |
| 715 | field: 'apiGuid', | 728 | field: 'apiGuid', |
| 716 | default: '', | 729 | default: '', |
| 717 | options: apiList.value, | 730 | getOptions: (scope) => getAPIOptions(scope), |
| 718 | props: { | 731 | props: { |
| 719 | label: 'apiName', | 732 | label: 'apiName', |
| 720 | value: 'guid', | 733 | value: 'guid', |
| 721 | disabled: 'disabled' | 734 | disabled: 'disabled' |
| 722 | }, | 735 | }, |
| 723 | placeholder: '请选择', | 736 | placeholder: '请选择', |
| 724 | clearable: false, | 737 | clearable: true, |
| 725 | filterable: true | 738 | filterable: true |
| 726 | }, | 739 | }, |
| 727 | }, | 740 | }, |
| ... | @@ -792,7 +805,7 @@ onActivated(() => { | ... | @@ -792,7 +805,7 @@ onActivated(() => { |
| 792 | getValidApi().then((res: any) => { | 805 | getValidApi().then((res: any) => { |
| 793 | if (res.code == proxy.$passCode) { | 806 | if (res.code == proxy.$passCode) { |
| 794 | apiList.value = res.data || []; | 807 | apiList.value = res.data || []; |
| 795 | productTableInfo.value.editInfo.apiGuid.options = apiList.value; | 808 | // productTableInfo.value.editInfo.apiGuid.getOptions = (scope) => getAPIOptions(scope); |
| 796 | } else { | 809 | } else { |
| 797 | proxy.$ElMessage.error(res.msg); | 810 | proxy.$ElMessage.error(res.msg); |
| 798 | } | 811 | } |
| ... | @@ -838,7 +851,7 @@ onBeforeMount(() => { | ... | @@ -838,7 +851,7 @@ onBeforeMount(() => { |
| 838 | item.default = ''; | 851 | item.default = ''; |
| 839 | if (item.children?.length) { | 852 | if (item.children?.length) { |
| 840 | item.children[0].visible = true; | 853 | item.children[0].visible = true; |
| 841 | item.children[0].default = [detailInfo.value.coverageArea[0]] as any; | 854 | // item.children[0].default = [detailInfo.value.coverageArea[0]] as any; |
| 842 | let p: any = []; | 855 | let p: any = []; |
| 843 | detailInfo.value.coverageArea?.forEach(area => { | 856 | detailInfo.value.coverageArea?.forEach(area => { |
| 844 | if (p.includes(area[0])) { | 857 | if (p.includes(area[0])) { |
| ... | @@ -881,7 +894,7 @@ onBeforeMount(() => { | ... | @@ -881,7 +894,7 @@ onBeforeMount(() => { |
| 881 | baseInfoFormRules.value.damName[1] = checkExistName(checkedInfo.value, existDamName, detailInfo.value, 'damName'); | 894 | baseInfoFormRules.value.damName[1] = checkExistName(checkedInfo.value, existDamName, detailInfo.value, 'damName'); |
| 882 | }) | 895 | }) |
| 883 | setTimeout(() => { | 896 | setTimeout(() => { |
| 884 | baseInfoFormRef.value.ruleFormRef.clearValidate(['sceneDescription', 'subjectDomain', 'coverageAreas', 'isPublicData', 'dataSources', 'propertyDescription', 'sceneLimit']); | 897 | baseInfoFormRef.value.ruleFormRef?.clearValidate(['sceneDescription', 'subjectDomain', 'coverageAreas', 'isPublicData', 'dataSources', 'propertyDescription', 'sceneLimit']); |
| 885 | }, 0); | 898 | }, 0); |
| 886 | assetDataTableInfo.value.data = detailInfo.value.damCatalogTableInfo; | 899 | assetDataTableInfo.value.data = detailInfo.value.damCatalogTableInfo; |
| 887 | productData.value = detailInfo.value.associationApiInfo?.map(d => { | 900 | productData.value = detailInfo.value.associationApiInfo?.map(d => { |
| ... | @@ -1221,16 +1234,17 @@ const handleImportSave = (val) => { | ... | @@ -1221,16 +1234,17 @@ const handleImportSave = (val) => { |
| 1221 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" | 1234 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" |
| 1222 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> | 1235 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> |
| 1223 | </ContentWrap> | 1236 | </ContentWrap> |
| 1224 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth style="margin-top: 15px" :isExpand="expandServiceInfo" | 1237 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth |
| 1225 | @expand="(v) => (expandServiceInfo = v)" description="" class="mb16"> | 1238 | style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" |
| 1239 | class="mb16"> | ||
| 1226 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" | 1240 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" |
| 1227 | @table-select-change="hanldeTableSelectChange" /> | 1241 | @table-select-change="hanldeTableSelectChange" /> |
| 1228 | <div class="row-add-btn"> | 1242 | <div class="row-add-btn"> |
| 1229 | <el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button> | 1243 | <el-button :disabled="productData.length >= apiList.length" link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button> |
| 1230 | </div> | 1244 | </div> |
| 1231 | </ContentWrap> | 1245 | </ContentWrap> |
| 1232 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand" | 1246 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description="" |
| 1233 | @expand="(v) => assetTableInfoExpand = v"> | 1247 | :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> |
| 1234 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> | 1248 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> |
| 1235 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> | 1249 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> |
| 1236 | </div> | 1250 | </div> |
| ... | @@ -1316,5 +1330,4 @@ const handleImportSave = (val) => { | ... | @@ -1316,5 +1330,4 @@ const handleImportSave = (val) => { |
| 1316 | } | 1330 | } |
| 1317 | } | 1331 | } |
| 1318 | } | 1332 | } |
| 1319 | |||
| 1320 | </style> | 1333 | </style> | ... | ... |
-
Please register or sign in to post a comment