point.data.ts 5.3 KB

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