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"
placeholder="请选择所属产品"
:disabled="!!route.query.id"
showSearch
@change="handleProductChange"
>
<j-select-option
v-for="(item, index) in productList"
:key="index"
:value="item.id"
:label="item.name"
>
{{ item.name }}
</j-select-option>
@ -344,6 +347,12 @@ const getProductList = async () => {
};
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);
if (res?.success) {
message.success('保存成功');
router.back();
history.back();
}
})
.catch((err: any) => {

View File

@ -104,6 +104,9 @@
<template #provider="slotProps">
{{ providerType[slotProps.provider] }}
</template>
<template #productId="slotProps">
{{ getProductName(slotProps.productId) }}
</template>
<template #state="slotProps">
<j-badge
:text="slotProps.state?.text"
@ -214,7 +217,7 @@ const columns = [
title: '产品名称',
dataIndex: 'productId',
key: 'productId',
// scopedSlots: true,
scopedSlots: true,
search: {
type: 'select',
options: () =>
@ -405,4 +408,25 @@ const getActions = (
}
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>

View File

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