update: 组件替换自测优化
This commit is contained in:
parent
56122ac90c
commit
257765cb50
|
@ -16,10 +16,11 @@
|
||||||
disabled && myValue === item.value
|
disabled && myValue === item.value
|
||||||
? 'active-checked-disabled'
|
? 'active-checked-disabled'
|
||||||
: '',
|
: '',
|
||||||
|
item.disabled ? 'disabled' : '',
|
||||||
]"
|
]"
|
||||||
v-for="(item, index) in options"
|
v-for="(item, index) in options"
|
||||||
:key="index"
|
:key="index"
|
||||||
@click="myValue = item.value"
|
@click="handleRadio(item)"
|
||||||
>
|
>
|
||||||
<img v-if="item.logo" class="img" :src="item.logo" alt="" />
|
<img v-if="item.logo" class="img" :src="item.logo" alt="" />
|
||||||
<span>{{ item.label }}</span>
|
<span>{{ item.label }}</span>
|
||||||
|
@ -86,6 +87,11 @@ const myValue = computed({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleRadio = (item: any) => {
|
||||||
|
if (item.disabled) return;
|
||||||
|
myValue.value = item.value;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@ -93,6 +99,11 @@ const myValue = computed({
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
.disabled {
|
||||||
|
color: rgba(0, 0, 0, 0.25);
|
||||||
|
border-color: #f5f5f5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
&-item {
|
&-item {
|
||||||
width: 49%;
|
width: 49%;
|
||||||
height: 70px;
|
height: 70px;
|
||||||
|
|
|
@ -133,22 +133,22 @@ watch(
|
||||||
() => dimension.value,
|
() => dimension.value,
|
||||||
(val) => {
|
(val) => {
|
||||||
if (val === 'today') {
|
if (val === 'today') {
|
||||||
dateRange[0] = moment().startOf('day').format('x');
|
dateRange.value[0] = moment().startOf('day').format('x');
|
||||||
}
|
}
|
||||||
if (val === 'week') {
|
if (val === 'week') {
|
||||||
dateRange[0] = moment().subtract(1, 'week').format('x');
|
dateRange.value[0] = moment().subtract(1, 'week').format('x');
|
||||||
}
|
}
|
||||||
if (val === 'month') {
|
if (val === 'month') {
|
||||||
dateRange[0] = moment().subtract(1, 'month').format('x');
|
dateRange.value[0] = moment().subtract(1, 'month').format('x');
|
||||||
}
|
}
|
||||||
if (val === 'year') {
|
if (val === 'year') {
|
||||||
dateRange[0] = moment().subtract(1, 'year').format('x');
|
dateRange.value[0] = moment().subtract(1, 'year').format('x');
|
||||||
}
|
}
|
||||||
dateRange[1] = moment().format('x');
|
dateRange.value[1] = moment().format('x');
|
||||||
emits('change', {
|
emits('change', {
|
||||||
time: {
|
time: {
|
||||||
start: dateRange[0],
|
start: dateRange.value[0],
|
||||||
end: dateRange[1],
|
end: dateRange.value[1],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -55,7 +55,22 @@
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</j-col>
|
</j-col>
|
||||||
<j-col :span="24">
|
<j-col :span="24" v-if="route.query.type === 'gb28181-2016'">
|
||||||
|
<j-form-item
|
||||||
|
label="厂商"
|
||||||
|
name="manufacturer"
|
||||||
|
:rules="[
|
||||||
|
{ required: false, message: '' },
|
||||||
|
{ max: 64, message: '最多可输入64个字符' },
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<j-input
|
||||||
|
v-model:value="formData.manufacturer"
|
||||||
|
placeholder="请输入厂商名称"
|
||||||
|
/>
|
||||||
|
</j-form-item>
|
||||||
|
</j-col>
|
||||||
|
<j-col :span="24" v-if="route.query.type === 'fixed-media'">
|
||||||
<j-form-item
|
<j-form-item
|
||||||
name="media_url"
|
name="media_url"
|
||||||
:rules="[
|
:rules="[
|
||||||
|
@ -112,6 +127,21 @@
|
||||||
/>
|
/>
|
||||||
</j-form-item>
|
</j-form-item>
|
||||||
</j-col>
|
</j-col>
|
||||||
|
<j-col :span="24" v-if="route.query.type === 'gb28181-2016'">
|
||||||
|
<j-form-item label="云台类型" name="ptzType">
|
||||||
|
<j-select
|
||||||
|
v-model:value="formData.ptzType"
|
||||||
|
:options="[
|
||||||
|
{ label: '未知', value: 0 },
|
||||||
|
{ label: '球体', value: 1 },
|
||||||
|
{ label: '半球体', value: 2 },
|
||||||
|
{ label: '固定枪机', value: 3 },
|
||||||
|
{ label: '遥控枪机', value: 4 },
|
||||||
|
]"
|
||||||
|
placeholder="请选择云台类型"
|
||||||
|
/>
|
||||||
|
</j-form-item>
|
||||||
|
</j-col>
|
||||||
<j-col :span="24">
|
<j-col :span="24">
|
||||||
<j-form-item name="description" label="说明">
|
<j-form-item name="description" label="说明">
|
||||||
<j-textarea
|
<j-textarea
|
||||||
|
@ -163,7 +193,9 @@ const formData = ref({
|
||||||
description: '',
|
description: '',
|
||||||
deviceId: route.query.id,
|
deviceId: route.query.id,
|
||||||
name: '',
|
name: '',
|
||||||
// 以下三个字段, 提交时需提取到others字段当中
|
manufacturer: '',
|
||||||
|
ptzType: '',
|
||||||
|
// 以下字段, 提交时需提取到others字段当中
|
||||||
media_password: '',
|
media_password: '',
|
||||||
media_url: '',
|
media_url: '',
|
||||||
media_username: '',
|
media_username: '',
|
||||||
|
@ -172,6 +204,7 @@ const formData = ref({
|
||||||
watch(
|
watch(
|
||||||
() => props.channelData,
|
() => props.channelData,
|
||||||
(val: any) => {
|
(val: any) => {
|
||||||
|
console.log('val: ', val);
|
||||||
const {
|
const {
|
||||||
id,
|
id,
|
||||||
address,
|
address,
|
||||||
|
@ -179,6 +212,8 @@ watch(
|
||||||
description,
|
description,
|
||||||
deviceId,
|
deviceId,
|
||||||
name,
|
name,
|
||||||
|
manufacturer,
|
||||||
|
ptzType,
|
||||||
others,
|
others,
|
||||||
...extra
|
...extra
|
||||||
} = val;
|
} = val;
|
||||||
|
@ -189,6 +224,8 @@ watch(
|
||||||
description,
|
description,
|
||||||
deviceId,
|
deviceId,
|
||||||
name,
|
name,
|
||||||
|
manufacturer,
|
||||||
|
ptzType: ptzType?.value || 0,
|
||||||
...others,
|
...others,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -225,6 +262,8 @@ const handleSubmit = () => {
|
||||||
media_url,
|
media_url,
|
||||||
media_password,
|
media_password,
|
||||||
media_username,
|
media_username,
|
||||||
|
manufacturer,
|
||||||
|
ptzType,
|
||||||
...extraFormData
|
...extraFormData
|
||||||
} = formData.value;
|
} = formData.value;
|
||||||
if (media_url || media_password || media_username) {
|
if (media_url || media_password || media_username) {
|
||||||
|
|
|
@ -294,9 +294,12 @@ const getActions = (
|
||||||
data.state.value === 'notActive' ||
|
data.state.value === 'notActive' ||
|
||||||
data.provider === 'fixed-media',
|
data.provider === 'fixed-media',
|
||||||
icon: 'SyncOutlined',
|
icon: 'SyncOutlined',
|
||||||
onClick: () => {
|
onClick: async () => {
|
||||||
// updateChannel()
|
const res = await DeviceApi.updateChannels(data.id);
|
||||||
console.log('updateChannel: ', data);
|
if (res.success) {
|
||||||
|
message.success('通道更新成功');
|
||||||
|
listRef.value?.reload();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue