Commit 7fd02e45b66ab3a3130e92e210b5d638a726fc27

Authored by xp.Huang
2 parents 09f9248e 81bbbfdf

Merge branch 'ft_local_dev' into 'main'

fix:修改Teambition上的问题

See merge request huang/yun-teng-iot-front!423
@@ -25,11 +25,28 @@ @@ -25,11 +25,28 @@
25 </div> 25 </div>
26 </Upload> 26 </Upload>
27 </template> 27 </template>
  28 + <template #videoPlatformIdSlot="{ model, field }">
  29 + <a-select
  30 + placeholder="请选择流媒体配置"
  31 + v-model:value="model[field]"
  32 + :options="streamConfigOptions.map((item) => ({ value: item.value, label: item.label }))"
  33 + >
  34 + <template #dropdownRender="{ menuNode: menu }">
  35 + <v-nodes :vnodes="menu" />
  36 + <a-divider style="margin: 4px 0" />
  37 + <div @click="handleOpenStreamConfig" style="padding: 4px 8px; cursor: pointer">
  38 + <plus-outlined />
  39 + 新增流媒体配置
  40 + </div>
  41 + </template>
  42 + </a-select>
  43 + </template>
28 </BasicForm> 44 </BasicForm>
29 </BasicDrawer> 45 </BasicDrawer>
  46 + <SteramingDrawer @register="registerSteramingDrawer" @success="handleSuccess" />
30 </template> 47 </template>
31 <script lang="ts"> 48 <script lang="ts">
32 - import { defineComponent, ref, computed, unref, nextTick } from 'vue'; 49 + import { defineComponent, ref, computed, unref, nextTick, onMounted } from 'vue';
33 import { BasicForm, useForm } from '/@/components/Form'; 50 import { BasicForm, useForm } from '/@/components/Form';
34 import { formSchema } from './config.data'; 51 import { formSchema } from './config.data';
35 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 52 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
@@ -39,14 +56,27 @@ @@ -39,14 +56,27 @@
39 import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue'; 56 import { PlusOutlined, LoadingOutlined } from '@ant-design/icons-vue';
40 import { upload } from '/@/api/oss/ossFileUploader'; 57 import { upload } from '/@/api/oss/ossFileUploader';
41 import { FileItem } from '/@/components/Upload/src/typing'; 58 import { FileItem } from '/@/components/Upload/src/typing';
  59 + import { getStreamingMediaList } from '/@/api/camera/cameraManager';
  60 + import SteramingDrawer from '../streaming/SteramingDrawer.vue';
  61 + import { useDrawer } from '/@/components/Drawer';
42 62
43 export default defineComponent({ 63 export default defineComponent({
44 name: 'ContactDrawer', 64 name: 'ContactDrawer',
45 - components: { BasicDrawer, BasicForm, Upload, PlusOutlined, LoadingOutlined }, 65 + components: {
  66 + BasicDrawer,
  67 + BasicForm,
  68 + Upload,
  69 + PlusOutlined,
  70 + LoadingOutlined,
  71 + SteramingDrawer,
  72 + VNodes: (_, { attrs }) => {
  73 + return attrs.vnodes;
  74 + },
  75 + },
46 emits: ['success', 'register'], 76 emits: ['success', 'register'],
47 setup(_, { emit }) { 77 setup(_, { emit }) {
48 const loading = ref(false); 78 const loading = ref(false);
49 - 79 + const streamConfigOptions: any = ref([]);
50 const isUpdate = ref(true); 80 const isUpdate = ref(true);
51 const editId = ref(''); 81 const editId = ref('');
52 const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({ 82 const [registerForm, { validate, setFieldsValue, resetFields }] = useForm({
@@ -54,7 +84,32 @@ @@ -54,7 +84,32 @@
54 schemas: formSchema, 84 schemas: formSchema,
55 showActionButtonGroup: false, 85 showActionButtonGroup: false,
56 }); 86 });
  87 + onMounted(async () => {
  88 + const res = await getStreamingMediaList({});
  89 + streamConfigOptions.value = res.map((m) => {
  90 + return {
  91 + label: m.host,
  92 + value: m.id,
  93 + };
  94 + });
  95 + });
  96 + const [registerSteramingDrawer, { openDrawer }] = useDrawer();
57 97
  98 + const handleOpenStreamConfig = () => {
  99 + openDrawer(true, {
  100 + createFlag: true,
  101 + });
  102 + };
  103 + async function handleSuccess() {
  104 + const res = await getStreamingMediaList({});
  105 + if (res) {
  106 + streamConfigOptions.value = res.map((m) => {
  107 + return { label: m.host, value: m.id };
  108 + });
  109 + } else {
  110 + streamConfigOptions.value = [];
  111 + }
  112 + }
58 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { 113 const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
59 await resetFields(); 114 await resetFields();
60 setDrawerProps({ confirmLoading: false }); 115 setDrawerProps({ confirmLoading: false });
@@ -136,6 +191,10 @@ @@ -136,6 +191,10 @@
136 beforeUpload, 191 beforeUpload,
137 tenantLogo, 192 tenantLogo,
138 loading, 193 loading,
  194 + streamConfigOptions,
  195 + registerSteramingDrawer,
  196 + handleOpenStreamConfig,
  197 + handleSuccess,
139 }; 198 };
140 }, 199 },
141 }); 200 });
@@ -4,7 +4,6 @@ import { copyTransFun } from '/@/utils/fnUtils'; @@ -4,7 +4,6 @@ import { copyTransFun } from '/@/utils/fnUtils';
4 import type { FormSchema as QFormSchema } from '/@/components/Form/index'; 4 import type { FormSchema as QFormSchema } from '/@/components/Form/index';
5 5
6 import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules'; 6 import { CameraVideoUrl, CameraMaxLength, MediaTypeValidate } from '/@/utils/rules';
7 -import { getStreamingMediaList } from '/@/api/camera/cameraManager';  
8 import { h } from 'vue'; 7 import { h } from 'vue';
9 import SnHelpMessage from './SnHelpMessage.vue'; 8 import SnHelpMessage from './SnHelpMessage.vue';
10 export enum AccessMode { 9 export enum AccessMode {
@@ -154,6 +153,7 @@ export const formSchema: QFormSchema[] = [ @@ -154,6 +153,7 @@ export const formSchema: QFormSchema[] = [
154 return values.accessMode === AccessMode.ManuallyEnter; 153 return values.accessMode === AccessMode.ManuallyEnter;
155 }, 154 },
156 componentProps: { 155 componentProps: {
  156 + maxLength: 36,
157 placeholder: '请输入视频厂家', 157 placeholder: '请输入视频厂家',
158 }, 158 },
159 }, 159 },
@@ -167,6 +167,7 @@ export const formSchema: QFormSchema[] = [ @@ -167,6 +167,7 @@ export const formSchema: QFormSchema[] = [
167 return values.accessMode === AccessMode.ManuallyEnter; 167 return values.accessMode === AccessMode.ManuallyEnter;
168 }, 168 },
169 componentProps: { 169 componentProps: {
  170 + maxLength: 36,
170 placeholder: '请输入摄像头编号', 171 placeholder: '请输入摄像头编号',
171 }, 172 },
172 }, 173 },
@@ -188,15 +189,13 @@ export const formSchema: QFormSchema[] = [ @@ -188,15 +189,13 @@ export const formSchema: QFormSchema[] = [
188 { 189 {
189 field: 'videoPlatformId', 190 field: 'videoPlatformId',
190 label: '流媒体配置', 191 label: '流媒体配置',
191 - component: 'ApiSelect', 192 + component: 'Select',
192 ifShow({ values }) { 193 ifShow({ values }) {
193 return values.accessMode === AccessMode.Streaming; 194 return values.accessMode === AccessMode.Streaming;
194 }, 195 },
  196 + slot: 'videoPlatformIdSlot',
195 componentProps: { 197 componentProps: {
196 placeholder: '请选择流媒体配置', 198 placeholder: '请选择流媒体配置',
197 - api: getStreamingMediaList,  
198 - labelField: 'host',  
199 - valueField: 'id',  
200 }, 199 },
201 }, 200 },
202 { 201 {
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 import { useMessage } from '/@/hooks/web/useMessage'; 9 import { useMessage } from '/@/hooks/web/useMessage';
10 import { PlayProtocol } from '../manage/config.data'; 10 import { PlayProtocol } from '../manage/config.data';
11 11
12 - const emit = defineEmits(['success','register']); 12 + const emit = defineEmits(['success', 'register']);
13 13
14 const createFlag = ref(false); 14 const createFlag = ref(false);
15 15
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 showActionButtonGroup: false, 23 showActionButtonGroup: false,
24 }); 24 });
25 25
26 - const [registerDrawer, { setDrawerProps }] = useDrawerInner((data: DrawerParams) => { 26 + const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner((data: DrawerParams) => {
27 createFlag.value = data.createFlag; 27 createFlag.value = data.createFlag;
28 if (!unref(createFlag)) { 28 if (!unref(createFlag)) {
29 id = data.record!.id; 29 id = data.record!.id;
@@ -48,6 +48,7 @@ @@ -48,6 +48,7 @@
48 const { createMessage } = useMessage(); 48 const { createMessage } = useMessage();
49 createMessage.success(message); 49 createMessage.success(message);
50 emit('success'); 50 emit('success');
  51 + closeDrawer();
51 } catch (e) { 52 } catch (e) {
52 } finally { 53 } finally {
53 setDrawerProps({ 54 setDrawerProps({
@@ -101,6 +101,7 @@ export const formDetailSchema: FormSchema[] = [ @@ -101,6 +101,7 @@ export const formDetailSchema: FormSchema[] = [
101 helpMessage: ['平台IP + 端口'], 101 helpMessage: ['平台IP + 端口'],
102 rules: [{ required: true, message: '平台地址为必填项' }], 102 rules: [{ required: true, message: '平台地址为必填项' }],
103 componentProps: { 103 componentProps: {
  104 + maxLength: 36,
104 placeholder: '请输入平台地址', 105 placeholder: '请输入平台地址',
105 }, 106 },
106 }, 107 },
@@ -110,6 +111,7 @@ export const formDetailSchema: FormSchema[] = [ @@ -110,6 +111,7 @@ export const formDetailSchema: FormSchema[] = [
110 component: 'Input', 111 component: 'Input',
111 rules: [{ required: true, message: '用户Key为必填项' }], 112 rules: [{ required: true, message: '用户Key为必填项' }],
112 componentProps: { 113 componentProps: {
  114 + maxLength: 36,
113 placeholder: '请输入用户Key', 115 placeholder: '请输入用户Key',
114 }, 116 },
115 }, 117 },
@@ -122,6 +124,7 @@ export const formDetailSchema: FormSchema[] = [ @@ -122,6 +124,7 @@ export const formDetailSchema: FormSchema[] = [
122 { required: true, min: 20, message: '用户密钥不能少于20位字符' }, 124 { required: true, min: 20, message: '用户密钥不能少于20位字符' },
123 ], 125 ],
124 componentProps: { 126 componentProps: {
  127 + maxLength: 36,
125 placeholder: '请输入用户密钥', 128 placeholder: '请输入用户密钥',
126 }, 129 },
127 }, 130 },
@@ -25,7 +25,7 @@ export const step1Schemas: FormSchema[] = [ @@ -25,7 +25,7 @@ export const step1Schemas: FormSchema[] = [
25 colProps: { span: 14 }, 25 colProps: { span: 14 },
26 componentProps: { 26 componentProps: {
27 placeholder: '设备名称', 27 placeholder: '设备名称',
28 - maxLength: 255, 28 + maxLength: 36,
29 }, 29 },
30 }, 30 },
31 { 31 {
@@ -87,7 +87,7 @@ export const formSchema: FormSchema[] = [ @@ -87,7 +87,7 @@ export const formSchema: FormSchema[] = [
87 component: 'Input', 87 component: 'Input',
88 componentProps: { 88 componentProps: {
89 placeholder: '请输入标题', 89 placeholder: '请输入标题',
90 - maxLength: 200, 90 + maxLength: 36,
91 }, 91 },
92 }, 92 },
93 { 93 {
@@ -96,6 +96,9 @@ export const formSchema: FormSchema[] = [ @@ -96,6 +96,9 @@ export const formSchema: FormSchema[] = [
96 colProps: { span: 24 }, 96 colProps: { span: 24 },
97 label: '通知内容', 97 label: '通知内容',
98 required: true, 98 required: true,
  99 + componentProps: {
  100 + maxLength: 255,
  101 + },
99 render: ({ model, field }) => { 102 render: ({ model, field }) => {
100 return h(Tinymce, { 103 return h(Tinymce, {
101 value: model[field], 104 value: model[field],
@@ -59,6 +59,7 @@ export const formSchema: FormSchema[] = [ @@ -59,6 +59,7 @@ export const formSchema: FormSchema[] = [
59 const { setFieldsValue } = formActionType; 59 const { setFieldsValue } = formActionType;
60 return { 60 return {
61 placeholder: '请输入标题', 61 placeholder: '请输入标题',
  62 + maxLength: 36,
62 onChange: (value: Event) => { 63 onChange: (value: Event) => {
63 setFieldsValue({ 64 setFieldsValue({
64 [PackageField.VERSION_TAG]: getVersionTag( 65 [PackageField.VERSION_TAG]: getVersionTag(
@@ -79,6 +80,7 @@ export const formSchema: FormSchema[] = [ @@ -79,6 +80,7 @@ export const formSchema: FormSchema[] = [
79 const { setFieldsValue } = formActionType; 80 const { setFieldsValue } = formActionType;
80 return { 81 return {
81 placeholder: '请输入版本', 82 placeholder: '请输入版本',
  83 + maxLength: 36,
82 onChange: (value: Event) => { 84 onChange: (value: Event) => {
83 setFieldsValue({ 85 setFieldsValue({
84 [PackageField.VERSION_TAG]: getVersionTag( 86 [PackageField.VERSION_TAG]: getVersionTag(
@@ -97,6 +99,7 @@ export const formSchema: FormSchema[] = [ @@ -97,6 +99,7 @@ export const formSchema: FormSchema[] = [
97 helpMessage: ['自定义标签应与您设备报告的软件包版本相匹配'], 99 helpMessage: ['自定义标签应与您设备报告的软件包版本相匹配'],
98 componentProps: () => { 100 componentProps: () => {
99 return { 101 return {
  102 + maxLength: 36,
100 placeholder: '请输入版本标签', 103 placeholder: '请输入版本标签',
101 }; 104 };
102 }, 105 },
@@ -191,6 +194,7 @@ export const formSchema: FormSchema[] = [ @@ -191,6 +194,7 @@ export const formSchema: FormSchema[] = [
191 }, 194 },
192 rules: [{ required: true, message: '外部URL为必填项' }], 195 rules: [{ required: true, message: '外部URL为必填项' }],
193 componentProps: { 196 componentProps: {
  197 + maxLength: 36,
194 placeholder: '请输入外部URL', 198 placeholder: '请输入外部URL',
195 }, 199 },
196 }, 200 },
@@ -238,6 +242,7 @@ export const formSchema: FormSchema[] = [ @@ -238,6 +242,7 @@ export const formSchema: FormSchema[] = [
238 }, 242 },
239 helpMessage: ['如果校验和为空,会自动生成'], 243 helpMessage: ['如果校验和为空,会自动生成'],
240 componentProps: { 244 componentProps: {
  245 + maxLength: 36,
241 placeholder: '请输入校验和', 246 placeholder: '请输入校验和',
242 }, 247 },
243 }, 248 },
@@ -246,6 +251,7 @@ export const formSchema: FormSchema[] = [ @@ -246,6 +251,7 @@ export const formSchema: FormSchema[] = [
246 label: '描述', 251 label: '描述',
247 component: 'InputTextArea', 252 component: 'InputTextArea',
248 componentProps: { 253 componentProps: {
  254 + maxLength: 255,
249 placeholder: '请输入描述', 255 placeholder: '请输入描述',
250 }, 256 },
251 }, 257 },
@@ -30,6 +30,7 @@ export enum SchemaFiled { @@ -30,6 +30,7 @@ export enum SchemaFiled {
30 ORDER_BY = 'orderBy', 30 ORDER_BY = 'orderBy',
31 } 31 }
32 export const organizationId = ref(''); 32 export const organizationId = ref('');
  33 +
33 // 表格配置 34 // 表格配置
34 export const columns: BasicColumn[] = [ 35 export const columns: BasicColumn[] = [
35 { 36 {
@@ -147,7 +148,7 @@ export const formSchema: QFormSchema[] = [ @@ -147,7 +148,7 @@ export const formSchema: QFormSchema[] = [
147 required: true, 148 required: true,
148 component: 'Input', 149 component: 'Input',
149 componentProps: { 150 componentProps: {
150 - maxLength: 255, 151 + maxLength: 64,
151 placeholder: '请输入报表名称', 152 placeholder: '请输入报表名称',
152 }, 153 },
153 }, 154 },
@@ -185,6 +186,11 @@ export const formSchema: QFormSchema[] = [ @@ -185,6 +186,11 @@ export const formSchema: QFormSchema[] = [
185 { 186 {
186 field: 'executeWay', 187 field: 'executeWay',
187 component: 'RadioGroup', 188 component: 'RadioGroup',
  189 + helpMessage: [
  190 + `立即执行,在创建完报表配置后,启用配置即执行。
  191 + 定时执行,用户定义执行时间,启用后,
  192 + 在满足执行时间条件后,自动执行。`,
  193 + ],
188 label: '执行方式', 194 label: '执行方式',
189 colProps: { 195 colProps: {
190 span: 24, 196 span: 24,
@@ -225,6 +231,8 @@ export const formSchema: QFormSchema[] = [ @@ -225,6 +231,8 @@ export const formSchema: QFormSchema[] = [
225 }); 231 });
226 } else { 232 } else {
227 setFieldsValue({ queryMode: QueryWay.LATEST }); 233 setFieldsValue({ queryMode: QueryWay.LATEST });
  234 + setFieldsValue({ startTs: 5000 });
  235 + setFieldsValue({ interval: 1000 });
228 dataCompareOpions = [{ label: '固定周期', value: QueryWay.LATEST }]; 236 dataCompareOpions = [{ label: '固定周期', value: QueryWay.LATEST }];
229 updateSchema({ 237 updateSchema({
230 defaultValue: QueryWay.LATEST, 238 defaultValue: QueryWay.LATEST,
@@ -437,7 +445,7 @@ export const formSchema: QFormSchema[] = [ @@ -437,7 +445,7 @@ export const formSchema: QFormSchema[] = [
437 }, 445 },
438 { 446 {
439 field: SchemaFiled.START_TS, 447 field: SchemaFiled.START_TS,
440 - label: '时间周期', 448 + label: '最近时间',
441 component: 'Select', 449 component: 'Select',
442 required: true, 450 required: true,
443 ifShow({ values }) { 451 ifShow({ values }) {
@@ -447,7 +455,7 @@ export const formSchema: QFormSchema[] = [ @@ -447,7 +455,7 @@ export const formSchema: QFormSchema[] = [
447 const { setFieldsValue } = formActionType; 455 const { setFieldsValue } = formActionType;
448 return { 456 return {
449 defaultValue: 1000, 457 defaultValue: 1000,
450 - placeholder: '请选择时间周期', 458 + placeholder: '请选择近期时间',
451 options: intervalOption, 459 options: intervalOption,
452 onChange() { 460 onChange() {
453 setFieldsValue({ [SchemaFiled.INTERVAL]: null }); 461 setFieldsValue({ [SchemaFiled.INTERVAL]: null });
@@ -39,11 +39,11 @@ @@ -39,11 +39,11 @@
39 </Select> 39 </Select>
40 </div> 40 </div>
41 <div> 41 <div>
42 - <Empty v-show="notFoundData" /> 42 + <Empty v-show="item.emptyFlag" />
43 <div 43 <div
44 - v-show="!notFoundData" 44 + v-show="!item.emptyFlag"
45 :id="`chart-${item.device}`" 45 :id="`chart-${item.device}`"
46 - :style="{ height, width }" 46 + style="width: 100%; height: 400px"
47 ></div> 47 ></div>
48 </div> 48 </div>
49 </div> 49 </div>
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 let currentRecord: ExecuteReportRecord = {} as unknown as ExecuteReportRecord; 86 let currentRecord: ExecuteReportRecord = {} as unknown as ExecuteReportRecord;
87 87
88 const chartInstance = ref< 88 const chartInstance = ref<
89 - { device: string; name: string; attributes: string[]; active?: string }[] 89 + { device: string; name: string; attributes: string[]; active?: string; emptyFlag?: boolean }[]
90 >([]); 90 >([]);
91 91
92 const notFoundData = ref(false); 92 const notFoundData = ref(false);
@@ -257,6 +257,15 @@ @@ -257,6 +257,15 @@
257 try { 257 try {
258 loading.value = true; 258 loading.value = true;
259 const result = await exportViewChartApi(device, sendParams); 259 const result = await exportViewChartApi(device, sendParams);
  260 + chartInstance.value.forEach((f) => {
  261 + if (f.device === device) {
  262 + if (Object.keys(result).length === 0) {
  263 + f.emptyFlag = true;
  264 + } else {
  265 + f.emptyFlag = false;
  266 + }
  267 + }
  268 + });
260 validateHasData(result); 269 validateHasData(result);
261 const { xAxisData, series } = getChartsOption(result as unknown as ResponsData); 270 const { xAxisData, series } = getChartsOption(result as unknown as ResponsData);
262 271
@@ -279,19 +279,28 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -279,19 +279,28 @@ export const trigger_condition_schema: FormSchema[] = [
279 component: 'ApiSelect', 279 component: 'ApiSelect',
280 componentProps: ({ formModel }) => { 280 componentProps: ({ formModel }) => {
281 const deviceProfileId = formModel['deviceProfileId']; 281 const deviceProfileId = formModel['deviceProfileId'];
282 - if (unref(organizationId)) {  
283 - return {  
284 - placeholder: '请选择设备',  
285 - mode: 'multiple',  
286 - api: byOrganizationIdGetMasterDevice,  
287 - params: {  
288 - organizationId: unref(organizationId),  
289 - deviceProfileId,  
290 - },  
291 - labelField: 'name',  
292 - valueField: 'tbDeviceId',  
293 - };  
294 - } 282 + return {
  283 + mode: 'multiple',
  284 + api: async () => {
  285 + if (unref(organizationId)) {
  286 + try {
  287 + const data = await byOrganizationIdGetMasterDevice({
  288 + organizationId: unref(organizationId),
  289 + deviceProfileId,
  290 + });
  291 + if (data)
  292 + return data.map((item) => ({
  293 + ...item,
  294 + label: item.alias || item.name,
  295 + value: item.tbDeviceId,
  296 + }));
  297 + } catch (error) {}
  298 + }
  299 + return [];
  300 + },
  301 + placeholder: '请选择设备',
  302 + getPopupContainer: () => document.body,
  303 + };
295 }, 304 },
296 ifShow: ({ values }) => isPart(values.device), 305 ifShow: ({ values }) => isPart(values.device),
297 colProps: { span: 6 }, 306 colProps: { span: 6 },
@@ -473,19 +482,28 @@ export const actionSchema: FormSchema[] = [ @@ -473,19 +482,28 @@ export const actionSchema: FormSchema[] = [
473 component: 'ApiSelect', 482 component: 'ApiSelect',
474 componentProps: ({ formModel }) => { 483 componentProps: ({ formModel }) => {
475 const deviceProfileId = formModel['deviceProfileId']; 484 const deviceProfileId = formModel['deviceProfileId'];
476 - if (unref(organizationId)) {  
477 - return {  
478 - placeholder: '请选择设备',  
479 - mode: 'multiple',  
480 - api: byOrganizationIdGetMasterDevice,  
481 - params: {  
482 - organizationId: unref(organizationId),  
483 - deviceProfileId,  
484 - },  
485 - labelField: 'name',  
486 - valueField: 'tbDeviceId',  
487 - };  
488 - } 485 + return {
  486 + mode: 'multiple',
  487 + api: async () => {
  488 + if (unref(organizationId)) {
  489 + try {
  490 + const data = await byOrganizationIdGetMasterDevice({
  491 + organizationId: unref(organizationId),
  492 + deviceProfileId,
  493 + });
  494 + if (data)
  495 + return data.map((item) => ({
  496 + ...item,
  497 + label: item.alias || item.name,
  498 + value: item.tbDeviceId,
  499 + }));
  500 + } catch (error) {}
  501 + }
  502 + return [];
  503 + },
  504 + placeholder: '请选择设备',
  505 + getPopupContainer: () => document.body,
  506 + };
489 }, 507 },
490 ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget), 508 ifShow: ({ values }) => isPart(values.device) && isDeviceOut(values.outTarget),
491 colProps: { span: 6 }, 509 colProps: { span: 6 },
@@ -59,7 +59,7 @@ export const formSchema: FormSchema[] = [ @@ -59,7 +59,7 @@ export const formSchema: FormSchema[] = [
59 required: true, 59 required: true,
60 component: 'Input', 60 component: 'Input',
61 componentProps: { 61 componentProps: {
62 - maxLength: 36, 62 + maxLength: 32,
63 placeholder: '请输入名称', 63 placeholder: '请输入名称',
64 }, 64 },
65 }, 65 },
@@ -65,12 +65,14 @@ @@ -65,12 +65,14 @@
65 v-if="ifAdd" 65 v-if="ifAdd"
66 v-model:value="scriptForm.description" 66 v-model:value="scriptForm.description"
67 placeholder="请输入备注" 67 placeholder="请输入备注"
  68 + :maxlength="255"
68 /> 69 />
69 <a-textarea 70 <a-textarea
70 :rows="3" 71 :rows="3"
71 v-else 72 v-else
72 v-model:value="scriptForm.output" 73 v-model:value="scriptForm.output"
73 placeholder="输出参数为服务端返回的内容" 74 placeholder="输出参数为服务端返回的内容"
  75 + :maxlength="255"
74 /> 76 />
75 </a-form-item> 77 </a-form-item>
76 </a-form> 78 </a-form>
@@ -109,7 +111,7 @@ @@ -109,7 +111,7 @@
109 typeOptions: [], 111 typeOptions: [],
110 originalOptions: [], 112 originalOptions: [],
111 }); 113 });
112 - const { typeOptions, originalOptions } = toRefs(reportTypeOptions); 114 + const { originalOptions, typeOptions } = toRefs(reportTypeOptions);
113 const { createMessage } = useMessage(); 115 const { createMessage } = useMessage();
114 const { clipboardRef, copiedRef } = useCopyToClipboard(); 116 const { clipboardRef, copiedRef } = useCopyToClipboard();
115 const aceEditor = ref(); 117 const aceEditor = ref();
@@ -149,7 +151,7 @@ @@ -149,7 +151,7 @@
149 }); 151 });
150 aceEditor.value.setValue(); 152 aceEditor.value.setValue();
151 beautify(aceEditor.value.session); 153 beautify(aceEditor.value.session);
152 - scriptForm.convertJs = aceEditor.value.getValue(); 154 + // scriptForm.convertJs = aceEditor.value.getValue();
153 }; 155 };
154 const handleCopy = () => { 156 const handleCopy = () => {
155 const valueRef = aceEditor.value.getValue(); 157 const valueRef = aceEditor.value.getValue();
@@ -184,6 +186,10 @@ @@ -184,6 +186,10 @@
184 const trimParams = scriptForm.params.replace(/\s*/g, ''); 186 const trimParams = scriptForm.params.replace(/\s*/g, '');
185 Reflect.set(value, 'params', trimParams); 187 Reflect.set(value, 'params', trimParams);
186 } 188 }
  189 + if (scriptForm.convertJs.length > 1000) {
  190 + createMessage.error('脚本内容长度不能大于1000');
  191 + throw '脚本内容长度不能大于1000';
  192 + }
187 return { 193 return {
188 ...value, 194 ...value,
189 ...{ convertJs: props.ifAdd ? scriptForm.convertJs : null }, 195 ...{ convertJs: props.ifAdd ? scriptForm.convertJs : null },
@@ -224,6 +224,10 @@ export const accountFormSchema: FormSchema[] = [ @@ -224,6 +224,10 @@ export const accountFormSchema: FormSchema[] = [
224 label: '备注', 224 label: '备注',
225 component: 'InputTextArea', 225 component: 'InputTextArea',
226 colProps: { span: 24 }, 226 colProps: { span: 24 },
  227 + componentProps: {
  228 + maxLength: 255,
  229 + placeholder: '请输入备注',
  230 + },
227 }, 231 },
228 { 232 {
229 field: 'organizationIds', 233 field: 'organizationIds',
@@ -47,7 +47,7 @@ export const formSchema: FormSchema[] = [ @@ -47,7 +47,7 @@ export const formSchema: FormSchema[] = [
47 component: 'Input', 47 component: 'Input',
48 required: true, 48 required: true,
49 componentProps: { 49 componentProps: {
50 - maxLength: 255, 50 + maxLength: 36,
51 }, 51 },
52 }, 52 },
53 { 53 {