Commit 9b0f183df3a37271528b65703748cc706b11078c

Authored by ww
1 parent 8f3cc529

perf: 优化物模型设置服务与事件时取消读写类型设置

... ... @@ -8,7 +8,7 @@ VITE_GLOB_PUBLIC_PATH = /
8 8 # Please note that no line breaks
9 9
10 10 # 本地
11   -VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-scada","http://localhost:3000/"],["/large-designer", "http://localhost:5555/large-designer/"]]
  11 +VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-scada","http://localhost:5173/thingskit-scada"],["/large-designer", "http://localhost:5555/large-designer/"]]
12 12
13 13 # 实时数据的ws地址
14 14 VITE_GLOB_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token=
... ...
... ... @@ -22,9 +22,11 @@
22 22 value: ModelOfMatterParams[];
23 23 disabled: boolean;
24 24 hasStructForm?: boolean;
  25 + hiddenAccessMode?: boolean;
25 26 }>(),
26 27 {
27 28 value: () => [],
  29 + hiddenAccessMode: false,
28 30 hasStructForm: false,
29 31 }
30 32 );
... ... @@ -106,11 +108,12 @@
106 108 <span class="mr-2">
107 109 <PlusOutlined />
108 110 </span>
109   - <span @click="!$props.disabled && handleCreateParams()">增加参数</span>
  111 + <span @click="!disabled && handleCreateParams()">增加参数</span>
110 112 </div>
111 113 </div>
112 114 <StructFormModel
113   - :has-struct-form="$props.hasStructForm!"
  115 + :has-struct-form="hasStructForm!"
  116 + :hidden-access-mode="hiddenAccessMode"
114 117 :disabled="$props.disabled"
115 118 :value-list="getValue"
116 119 @register="registerModal"
... ...
... ... @@ -23,6 +23,7 @@
23 23 disabled: boolean;
24 24 hasStructForm: boolean;
25 25 valueList: StructRecord[];
  26 + hiddenAccessMode: boolean;
26 27 }>();
27 28
28 29 const emit = defineEmits(['register', 'submit']);
... ... @@ -31,7 +32,7 @@
31 32
32 33 const [register, { validate, setFieldsValue, setProps }] = useForm({
33 34 labelWidth: 100,
34   - schemas: formSchemas(props.hasStructForm),
  35 + schemas: formSchemas(props.hasStructForm, props.hiddenAccessMode),
35 36 actionColOptions: {
36 37 span: 14,
37 38 },
... ...
... ... @@ -28,7 +28,11 @@ export const validateJSON = (_rule, value = [] as ModelOfMatterParams[], _callba
28 28 return Promise.reject('JSON对象不能为空');
29 29 };
30 30
31   -export const formSchemas = (hasStructForm: boolean, isTcp = false): FormSchema[] => {
  31 +export const formSchemas = (
  32 + hasStructForm: boolean,
  33 + hiddenAccessMode: boolean,
  34 + isTcp = false
  35 +): FormSchema[] => {
32 36 return [
33 37 {
34 38 field: FormField.FUNCTION_NAME,
... ... @@ -299,7 +303,7 @@ export const formSchemas = (hasStructForm: boolean, isTcp = false): FormSchema[]
299 303 colProps: {
300 304 span: 24,
301 305 },
302   - ifShow: () => !hasStructForm,
  306 + ifShow: () => !hiddenAccessMode && !hasStructForm,
303 307 defaultValue: 'r',
304 308 componentProps: {
305 309 placeholder: '请选择读写类型',
... ...
... ... @@ -19,7 +19,7 @@
19 19
20 20 const [register, { validate, resetFields, setFieldsValue, setProps }] = useForm({
21 21 labelWidth: 100,
22   - schemas: formSchemas(false, props.transportType === TransportTypeEnum.TCP),
  22 + schemas: formSchemas(false, false, props.transportType === TransportTypeEnum.TCP),
23 23 actionColOptions: {
24 24 span: 14,
25 25 },
... ...
... ... @@ -143,6 +143,9 @@ export const serviceSchemas = (tcpDeviceFlag: boolean): FormSchema[] => {
143 143 rules: [{ message: '输入参数为必填项', required: true, type: 'array' }],
144 144 ifShow: !tcpDeviceFlag,
145 145 colProps: { span: 24 },
  146 + componentProps: {
  147 + hiddenAccessMode: true,
  148 + },
146 149 },
147 150 {
148 151 field: FormField.OUTPUT_PARAM,
... ... @@ -151,6 +154,9 @@ export const serviceSchemas = (tcpDeviceFlag: boolean): FormSchema[] => {
151 154 valueField: 'value',
152 155 changeEvent: 'update:value',
153 156 colProps: { span: 24 },
  157 + componentProps: {
  158 + hiddenAccessMode: true,
  159 + },
154 160 },
155 161 {
156 162 field: FormField.REFARK,
... ... @@ -218,6 +224,9 @@ export const eventSchemas: FormSchema[] = [
218 224 valueField: 'value',
219 225 changeEvent: 'update:value',
220 226 colProps: { span: 24 },
  227 + componentProps: {
  228 + hiddenAccessMode: true,
  229 + },
221 230 },
222 231 {
223 232 field: FormField.REFARK,
... ...