fix: bug#10985

This commit is contained in:
xieyonghong 2023-03-28 18:48:30 +08:00
parent d93504a59b
commit ad14983d9c
4 changed files with 46 additions and 50 deletions

View File

@ -42,6 +42,17 @@
:disabled="type === 'edit'"
/>
</j-form-item>
<j-form-item label="运营商" name="operatorName">
<j-select
allowClear
showSearch
:filter-option="filterOption"
:options="OperatorList"
v-model:value="modelRef.operatorName"
placeholder="请选择运营商"
>
</j-select>
</j-form-item>
<j-form-item label="平台对接" name="platformConfigId">
<j-select
showSearch
@ -55,17 +66,7 @@
</j-select>
</j-form-item>
<j-form-item label="运营商" name="operatorName">
<j-select
allowClear
showSearch
:filter-option="filterOption"
:options="OperatorList"
v-model:value="modelRef.operatorName"
placeholder="请选择运营商"
>
</j-select>
</j-form-item>
<j-form-item label="类型" name="cardType">
<j-select
allowClear
@ -113,7 +114,7 @@ const props = defineProps({
});
const btnLoading = ref<boolean>(false);
const platformConfigList = ref<Record<string, any>[]>([]);
const platformConfigCacheList = ref<Record<string, any>[]>([]);
const formRef = ref();
@ -184,6 +185,12 @@ const rules = {
message: '请选择平台对接',
},
],
operatorName: [
{
required: true,
message: '请选择运营商',
},
],
cardType: [
{
required: true,
@ -200,6 +207,10 @@ const filterOption = (input: string, option: any) => {
);
};
const platformConfigList = computed(() => {
return platformConfigCacheList.value.filter(item => item.operatorName === modelRef.operatorName).map(item => ({ label: item.name, value: item.id }))
})
watch(
() => props.data,
(newValue) => {
@ -209,10 +220,7 @@ watch(
terms: [{ column: 'state', value: 'enabled' }],
}).then((resp: any) => {
if (resp.status === 200) {
platformConfigList.value = resp.result.map((item: any) => ({
label: item.name,
value: item.id,
}));
platformConfigCacheList.value = resp.result
}
});
Object.assign(modelRef, newValue);

View File

@ -307,6 +307,9 @@
}}
</div>
</template>
<template #operatorName='slotProps'>
{{ OperatorMap[slotProps.operatorName]}}
</template>
<template #cardType="slotProps">
{{ slotProps.cardType.text }}
</template>
@ -423,6 +426,7 @@ import BatchDropdown from '@/components/BatchDropdown/index.vue';
import { BatchActionsType } from '@/components/BatchDropdown/types';
import {usePermissionStore} from "store/permission";
import {useRouterParams} from "@/utils/hooks/useParams";
import { OperatorList, OperatorMap } from '@/views/iot-card/data'
const router = useRouter();
const menuStory = useMenuStore();
@ -505,11 +509,7 @@ const columns = [
width: 120,
search: {
type: 'select',
options: [
{ label: '移动', value: '移动' },
{ label: '电信', value: '电信' },
{ label: '联通', value: '联通' },
],
options: OperatorList,
},
},
{

View File

@ -130,11 +130,11 @@
</template>
<script lang="ts" setup>
import { getImage } from '@/utils/comm';
import PlatformType from '@/views/iot-card/components/PlatformType.vue';
import { queryById, save, update } from '@/api/iot-card/platform';
import { message } from 'jetlinks-ui-components';
import Doc from '../doc/index.vue';
import { platformTypeList } from '../../data'
const router = useRouter();
const route = useRoute();
@ -158,27 +158,6 @@ const form = reactive({
explain: undefined,
});
const platformTypeList = [
{
label: '移动OneLink',
value: 'onelink',
imgUrl: getImage('/iot-card/onelink.png'),
imgSize: ['78px', '20px'],
},
{
label: '电信Ctwing',
value: 'ctwing',
imgUrl: getImage('/iot-card/ctwingcmp.png'),
imgSize: ['52px', '25px'],
},
{
label: '联通Unicom',
value: 'unicom',
imgUrl: getImage('/iot-card/unicom.png'),
imgSize: ['56px', '41px'],
},
];
const rules = {
name: [
{ required: true, message: '请输入名称' },

View File

@ -1,37 +1,46 @@
import { getImage } from '@/utils/comm';
// 平台类型
export const PlatformTypeList = [
export const platformTypeList = [
{
label: '移动OneLink',
value: 'OneLinkPB',
value: 'onelink',
imgUrl: getImage('/iot-card/onelink.png'),
imgSize: ['78px', '20px'],
},
{
label: '电信Ctwing',
value: 'CtwingCmp',
value: 'ctwing',
imgUrl: getImage('/iot-card/ctwingcmp.png'),
imgSize: ['52px', '25px'],
},
{
label: '联通Unicom',
value: 'UnicomCmp',
value: 'unicom',
imgUrl: getImage('/iot-card/unicom.png'),
imgSize: ['56px', '41px'],
},
];
export const OperatorMap = {
onelink: '移动',
ctwing: '电信',
unicom: '联通',
}
//运营商
export const OperatorList = [
{
label: '移动',
value: '移动',
value: 'onelink',
},
{
label: '电信',
value: '电信',
value: 'ctwing',
},
{
label: '联通',
value: '联通',
value: 'unicom',
},
];