fix: bug#10475、10549、10545、10543、10541

This commit is contained in:
JiangQiming 2023-03-17 22:04:41 +08:00
parent 27f392dda8
commit 084c43cf76
3 changed files with 41 additions and 2 deletions

View File

@ -91,11 +91,14 @@
v-model:value="formData.productId" v-model:value="formData.productId"
placeholder="请选择所属产品" placeholder="请选择所属产品"
:disabled="!!route.query.id" :disabled="!!route.query.id"
showSearch
@change="handleProductChange"
> >
<j-select-option <j-select-option
v-for="(item, index) in productList" v-for="(item, index) in productList"
:key="index" :key="index"
:value="item.id" :value="item.id"
:label="item.name"
> >
{{ item.name }} {{ item.name }}
</j-select-option> </j-select-option>
@ -344,6 +347,12 @@ const getProductList = async () => {
}; };
getProductList(); getProductList();
const handleProductChange = () => {
formData.value.others.access_pwd =
productList.value.find((f: any) => f.id === formData.value.productId)
?.configuration.access_pwd || '';
};
/** /**
* 新增产品 * 新增产品
*/ */
@ -407,7 +416,7 @@ const handleSubmit = () => {
: await DeviceApi.update(params); : await DeviceApi.update(params);
if (res?.success) { if (res?.success) {
message.success('保存成功'); message.success('保存成功');
router.back(); history.back();
} }
}) })
.catch((err: any) => { .catch((err: any) => {

View File

@ -104,6 +104,9 @@
<template #provider="slotProps"> <template #provider="slotProps">
{{ providerType[slotProps.provider] }} {{ providerType[slotProps.provider] }}
</template> </template>
<template #productId="slotProps">
{{ getProductName(slotProps.productId) }}
</template>
<template #state="slotProps"> <template #state="slotProps">
<j-badge <j-badge
:text="slotProps.state?.text" :text="slotProps.state?.text"
@ -214,7 +217,7 @@ const columns = [
title: '产品名称', title: '产品名称',
dataIndex: 'productId', dataIndex: 'productId',
key: 'productId', key: 'productId',
// scopedSlots: true, scopedSlots: true,
search: { search: {
type: 'select', type: 'select',
options: () => options: () =>
@ -405,4 +408,25 @@ const getActions = (
} }
return acts; return acts;
}; };
const productList = ref<any[]>([]);
const getProductList = () => {
DeviceApi.getProductList(
encodeQuery({
terms: {
messageProtocol$in: ['gb28181-2016', 'fixed-media'],
},
}),
).then((resp: any) => {
productList.value = resp.result.map((pItem: any) => ({
label: pItem.name,
value: pItem.id,
}));
});
};
getProductList();
const getProductName = (pid: string) => {
return productList.value.find((f: any) => f.value === pid)?.label;
};
</script> </script>

View File

@ -23,6 +23,11 @@ export type DeviceItem = {
transport: string; transport: string;
} & BaseItem; } & BaseItem;
type configuration = {
access_pwd: string;
stream_mode: string;
}
export type ProductType = { export type ProductType = {
accessId: string; accessId: string;
accessName: string; accessName: string;
@ -42,6 +47,7 @@ export type ProductType = {
protocolName: string; protocolName: string;
state: number; state: number;
transportProtocol: string; transportProtocol: string;
configuration: configuration;
} }