fileIndex.data.ts 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { queryDeviceList } from './performance.api';
  4. import { defHttp } from '/@/utils/http/axios';
  5. import { TreeItem } from '/@/components/Tree/index';
  6. //tree
  7. export const treeData: TreeItem[] = [
  8. {
  9. title: 'parent 1',
  10. key: '0-0',
  11. icon: 'home|svg',
  12. children: [
  13. { title: 'leaf', key: '0-0-0' },
  14. {
  15. title: 'leaf',
  16. key: '0-0-1',
  17. children: [
  18. { title: 'leaf', key: '0-0-0-0' },
  19. { title: 'leaf', key: '0-0-0-1' },
  20. ],
  21. },
  22. ],
  23. },
  24. {
  25. title: 'parent 2',
  26. key: '1-1',
  27. icon: 'home|svg',
  28. children: [
  29. { title: 'leaf', key: '1-1-0' },
  30. { title: 'leaf', key: '1-1-1' },
  31. ],
  32. },
  33. {
  34. title: 'parent 3',
  35. key: '2-2',
  36. icon: 'home|svg',
  37. children: [
  38. { title: 'leaf', key: '2-2-0' },
  39. { title: 'leaf', key: '2-2-1' },
  40. ],
  41. },
  42. ];
  43. export const columns: BasicColumn[] = [
  44. {
  45. title: '设备类型',
  46. dataIndex: 'devicekind_dictText',
  47. width: 120,
  48. },
  49. // {
  50. // title: '设备类型code',
  51. // dataIndex: 'devicekind',
  52. // width: 120,
  53. // },
  54. // {
  55. // title: 'plc地址',
  56. // dataIndex: 'plcaddr',
  57. // width: 100,
  58. // },
  59. // {
  60. // title: 'plc读写位数',
  61. // dataIndex: 'floatnum',
  62. // width: 100,
  63. // // customRender: render.renderAvatar,
  64. // },
  65. // {
  66. // title: '读写类型',
  67. // dataIndex: 'datakind_dictText',
  68. // width: 80,
  69. // // sorter: true,
  70. // // customRender: ({ text }) => {
  71. // // return render.renderDict(text, 'sex');
  72. // // },
  73. // },
  74. {
  75. title: '值名称',
  76. dataIndex: 'valuename',
  77. width: 100,
  78. },
  79. {
  80. title: '值code',
  81. dataIndex: 'valuecode',
  82. width: 100,
  83. },
  84. // {
  85. // title: '值类型',
  86. // width: 150,
  87. // dataIndex: 'valuetype_dictText',
  88. // },
  89. // {
  90. // title: '最小值',
  91. // width: 100,
  92. // dataIndex: 'fmin',
  93. // },
  94. // {
  95. // title: '最大值',
  96. // dataIndex: 'fmax',
  97. // width: 100,
  98. // },
  99. // {
  100. // title: '模拟最小值',
  101. // dataIndex: 'testlow',
  102. // width: 100,
  103. // },
  104. // {
  105. // title: '模拟最大值',
  106. // width: 100,
  107. // dataIndex: 'testup',
  108. // },
  109. // {
  110. // title: '小数位数',
  111. // width: 100,
  112. // dataIndex: 'floatnum',
  113. // },
  114. // {
  115. // title: '是否保存',
  116. // dataIndex: 'saveflag_dictText',
  117. // width: 80,
  118. // },
  119. ];
  120. export const searchFormSchema: FormSchema[] = [
  121. {
  122. label: '设备类型',
  123. field: 'devicekind',
  124. component: 'MTreeSelect',
  125. colProps: { span: 6 },
  126. },
  127. {
  128. label: '值名称',
  129. field: 'valuename',
  130. component: 'Input',
  131. colProps: { span: 6 },
  132. },
  133. {
  134. label: '值code',
  135. field: 'valuecode',
  136. component: 'Input',
  137. colProps: { span: 6 },
  138. },
  139. ];
  140. export const formSchema: FormSchema[] = [
  141. {
  142. label: '',
  143. field: 'id',
  144. component: 'Input',
  145. show: false,
  146. },
  147. {
  148. label: '设备分类',
  149. field: 'devicekind',
  150. component: 'ApiSelect',
  151. // componentProps: {
  152. // dictCode: 'devicekind',
  153. // placeholder: '请选择设备分类',
  154. // },
  155. componentProps: ({ formModel, formActionType }) => {
  156. return {
  157. // options: provincesOptions,
  158. placeholder: '请选择设备分类',
  159. api: queryDeviceList,
  160. resultField: 'result',
  161. // use name as label
  162. labelField: 'itemText',
  163. // use id as value
  164. valueField: 'itemValue',
  165. onChange: (e: any) => {
  166. formModel.devicetype = '';
  167. const { updateSchema } = formActionType;
  168. updateSchema({
  169. field: 'devicetype',
  170. componentProps: {
  171. api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${e + 'kind'}` }, params),
  172. resultField: 'result',
  173. labelField: 'title',
  174. valueField: 'value',
  175. },
  176. });
  177. },
  178. };
  179. },
  180. },
  181. {
  182. label: '点表类型',
  183. field: 'devicetype',
  184. component: 'ApiSelect',
  185. componentProps: ({ formModel, formActionType }) => {
  186. // debugger;
  187. return {
  188. // options: provincesOptions,
  189. componentProps: {},
  190. api: (params) => defHttp.get({ url: `/sys/dict/getDictItems/${formModel.devicekind + 'kind'}` }, params),
  191. resultField: 'result',
  192. labelField: 'title',
  193. valueField: 'value',
  194. };
  195. },
  196. },
  197. {
  198. label: '值名称',
  199. field: 'valuename',
  200. component: 'Input',
  201. },
  202. {
  203. label: '值code',
  204. field: 'valuecode',
  205. component: 'Input',
  206. },
  207. {
  208. label: '值类型',
  209. field: 'valuetype',
  210. component: 'JDictSelectTag',
  211. componentProps: {
  212. dictCode: 'valuetype',
  213. placeholder: '请选择设备类型',
  214. stringToNumber: true,
  215. },
  216. },
  217. {
  218. label: '指令默认写入值',
  219. field: 'value',
  220. component: 'Input',
  221. },
  222. {
  223. label: 'plc地址',
  224. field: 'plcaddr',
  225. component: 'Input',
  226. },
  227. {
  228. label: '数据类型',
  229. field: 'datakind',
  230. component: 'JDictSelectTag',
  231. componentProps: {
  232. dictCode: 'datakind',
  233. placeholder: '请选择数据类型',
  234. stringToNumber: true,
  235. },
  236. },
  237. {
  238. label: '字节数',
  239. field: 'len',
  240. component: 'Input',
  241. },
  242. {
  243. label: '最小值',
  244. field: 'fmin',
  245. component: 'InputNumber',
  246. },
  247. {
  248. label: '最大值',
  249. field: 'fmax',
  250. component: 'InputNumber',
  251. },
  252. {
  253. label: '模拟最小值',
  254. field: 'testlow',
  255. component: 'InputNumber',
  256. },
  257. {
  258. label: '模拟最大值',
  259. field: 'testup',
  260. component: 'InputNumber',
  261. },
  262. {
  263. label: '开始指令',
  264. field: 'startcommand ',
  265. component: 'InputTextArea',
  266. },
  267. {
  268. label: '结束指令',
  269. field: 'endcommand',
  270. component: 'InputTextArea',
  271. },
  272. {
  273. label: '控制指令设置模拟数据',
  274. field: 'setTestdata',
  275. component: 'InputTextArea',
  276. },
  277. {
  278. label: '是否保存',
  279. field: 'saveflag',
  280. component: 'JDictSelectTag',
  281. componentProps: {
  282. dictCode: 'booltype',
  283. placeholder: '是否保存',
  284. },
  285. },
  286. {
  287. label: '是否报警',
  288. field: 'bwarning',
  289. component: 'JDictSelectTag',
  290. componentProps: {
  291. dictCode: 'booltype',
  292. placeholder: '是否报警',
  293. },
  294. },
  295. {
  296. label: '是否计算平均值',
  297. field: 'avgflag',
  298. component: 'JDictSelectTag',
  299. componentProps: {
  300. dictCode: 'booltype',
  301. placeholder: '是否计算平均值',
  302. },
  303. },
  304. {
  305. label: '小数位数',
  306. field: 'floatnum',
  307. component: 'InputNumber',
  308. },
  309. {
  310. label: '备注',
  311. field: 'strremark',
  312. component: 'InputTextArea',
  313. },
  314. ];