Commit e0168be878e782ac188bd191f2166d90270efff9

Authored by xp.Huang
2 parents 988e262d 5639dc37

Merge branch 'local_dev_ft' into 'main'

pref:优化状态为tag

See merge request huang/yun-teng-iot-front!458
... ... @@ -75,7 +75,52 @@ export const searchFormSchema: FormSchema[] = [
75 75 },
76 76 ];
77 77 },
78   -
  78 + colProps: { span: 6 },
  79 + },
  80 + {
  81 + field: 'deviceProfileName',
  82 + label: '设备配置',
  83 + component: 'Input',
  84 + componentProps: {
  85 + maxLength: 255,
  86 + placeholder: '请输入设备配置',
  87 + },
  88 + dynamicRules: () => {
  89 + return [
  90 + {
  91 + required: false,
  92 + validator: (_, value) => {
  93 + if (String(value).length > 255) {
  94 + return Promise.reject('字数不超过255个字');
  95 + }
  96 + return Promise.resolve();
  97 + },
  98 + },
  99 + ];
  100 + },
  101 + colProps: { span: 6 },
  102 + },
  103 + {
  104 + field: 'organizationName',
  105 + label: '所属组织',
  106 + component: 'Input',
  107 + componentProps: {
  108 + maxLength: 255,
  109 + placeholder: '请输入所属组织',
  110 + },
  111 + dynamicRules: () => {
  112 + return [
  113 + {
  114 + required: false,
  115 + validator: (_, value) => {
  116 + if (String(value).length > 255) {
  117 + return Promise.reject('字数不超过255个字');
  118 + }
  119 + return Promise.resolve();
  120 + },
  121 + },
  122 + ];
  123 + },
79 124 colProps: { span: 6 },
80 125 },
81 126 {
... ... @@ -138,7 +183,11 @@ export const formSchema: DescItem[] = [
138 183 field: 'status',
139 184 label: '状态',
140 185 render: (_, data) => {
141   - return data.status == 1 ? '在线' : '离线';
  186 + const status = data.status;
  187 + const enable = status === 1 ? '在线' : '离线';
  188 + const color = enable === '在线' ? 'green' : 'red';
  189 + const text = enable === '在线' ? '在线' : '离线';
  190 + return h(Tag, { color }, () => text);
142 191 },
143 192 },
144 193 {
... ... @@ -156,7 +205,11 @@ export const formDetailSchema: DescItem[] = [
156 205 field: 'status',
157 206 label: '状态',
158 207 render: (_, data) => {
159   - return data.status == 1 ? '在线' : '离线';
  208 + const status = data.status;
  209 + const enable = status === 1 ? '在线' : '离线';
  210 + const color = enable === '在线' ? 'green' : 'red';
  211 + const text = enable === '在线' ? '在线' : '离线';
  212 + return h(Tag, { color }, () => text);
160 213 },
161 214 },
162 215 {
... ... @@ -167,36 +220,14 @@ export const formDetailSchema: DescItem[] = [
167 220
168 221 //处理表单
169 222 export const formHandleSchema: FormSchema[] = [
170   - // {
171   - // field: 'deviceName',
172   - // label: '设备名称',
173   - // component: 'Input',
174   - // componentProps: {
175   - // disabled: true,
176   - // },
177   - // },
178   - // {
179   - // field: 'status',
180   - // label: '状态',
181   - // component: 'Input',
182   - // componentProps: {
183   - // disabled: true,
184   - // },
185   - // },
186   - // {
187   - // field: 'createTime',
188   - // label: '时间',
189   - // colProps: { span: 24 },
190   - // component: 'Input',
191   - // componentProps: {
192   - // disabled: true,
193   - // },
194   - // },
195 223 {
196 224 field: 'description',
197 225 label: '备注',
198 226 colProps: { span: 24 },
199 227 component: 'InputTextArea',
200   - componentProps: {},
  228 + componentProps: {
  229 + maxLength: 255,
  230 + placeholder: '请输入备注',
  231 + },
201 232 },
202 233 ];
... ...