substation.data.ts 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { rules } from '/@/utils/helper/validator';
  4. import { render } from '/@/utils/common/renderUtils';
  5. export const columns: BasicColumn[] = [
  6. {
  7. title: '名称',
  8. dataIndex: 'strname',
  9. width: 120,
  10. },
  11. {
  12. title: '安装位置',
  13. dataIndex: 'strinstallpos',
  14. width: 100,
  15. },
  16. {
  17. title: '读取数据方式',
  18. dataIndex: 'strtype',
  19. width: 100,
  20. },
  21. {
  22. title: '分站IP地址',
  23. dataIndex: 'strip',
  24. width: 100,
  25. },
  26. {
  27. title: '链接状态',
  28. dataIndex: 'linkstatus',
  29. width: 100,
  30. },
  31. {
  32. title: '备注',
  33. width: 150,
  34. dataIndex: 'strremark',
  35. },
  36. ];
  37. export const recycleColumns: BasicColumn[] = [
  38. {
  39. title: '名称',
  40. dataIndex: 'strname',
  41. width: 100,
  42. },
  43. {
  44. title: '安装位置',
  45. dataIndex: 'strinstallpos',
  46. width: 100,
  47. },
  48. {
  49. title: '链接状态',
  50. dataIndex: 'linkstatus',
  51. width: 80,
  52. customRender: render.renderAvatar,
  53. },
  54. ];
  55. export const searchFormSchema: FormSchema[] = [
  56. {
  57. label: '监测类型',
  58. field: 'monitorparam',
  59. component: 'MTreeSelect',
  60. componentProps: {
  61. virtual: false,
  62. },
  63. colProps: { span: 6 },
  64. },
  65. {
  66. label: '安装位置',
  67. field: 'strinstallpos',
  68. component: 'Input',
  69. colProps: { span: 6 },
  70. },
  71. {
  72. label: '链接状态',
  73. field: 'linkstatus',
  74. component: 'JDictSelectTag',
  75. componentProps: {
  76. dictCode: 'user_status',
  77. placeholder: '请选择读写类型',
  78. stringToNumber: true,
  79. },
  80. colProps: { span: 6 },
  81. },
  82. ];
  83. export const formSchema: FormSchema[] = [
  84. {
  85. label: '',
  86. field: 'id',
  87. component: 'Input',
  88. show: false,
  89. },
  90. {
  91. label: '名称',
  92. field: 'strname',
  93. component: 'Input',
  94. required: true,
  95. },
  96. {
  97. label: '安装位置',
  98. field: 'strinstallpos',
  99. component: 'Input',
  100. required: true,
  101. },
  102. {
  103. label: '读取数据方式',
  104. field: 'strtype',
  105. component: 'JDictSelectTag',
  106. required: true,
  107. componentProps: {
  108. dictCode: 'getdatatype',
  109. placeholder: '请选择读取数据方式',
  110. },
  111. },
  112. {
  113. label: '监测类型',
  114. field: 'monitorparam',
  115. component: 'MTreeSelect',
  116. componentProps: {
  117. virtual: false,
  118. },
  119. },
  120. {
  121. label: '分站IP或请求地址',
  122. field: 'strip',
  123. component: 'Input',
  124. required: true,
  125. },
  126. {
  127. label: '分站端口',
  128. field: 'nport',
  129. component: 'Input',
  130. },
  131. {
  132. label: 'PLC类型',
  133. field: 'plcType',
  134. component: 'JDictSelectTag',
  135. ifShow: ({ values }) => values.strtype === 'plc',
  136. componentProps: {
  137. dictCode: 'plcType',
  138. placeholder: '请选择PLC类型',
  139. },
  140. },
  141. {
  142. label: '分站站号',
  143. field: 'code',
  144. component: 'InputNumber',
  145. ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype),
  146. },
  147. {
  148. label: '节点码',
  149. field: 'code',
  150. component: 'Input',
  151. ifShow: ({ values }) => values.strtype === 'opc_ua',
  152. },
  153. {
  154. label: '是否从0开始',
  155. field: 'isZeroStart',
  156. component: 'RadioGroup',
  157. defaultValue: 1,
  158. ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype),
  159. componentProps: () => {
  160. return {
  161. options: [
  162. { label: '是', value: 1, key: '1' },
  163. { label: '否', value: 0, key: '2' },
  164. ],
  165. };
  166. },
  167. },
  168. {
  169. label: '分站类型',
  170. field: 'reqparam',
  171. component: 'Input',
  172. ifShow: ({ values }) => ['modbus', 'modbusRtu'].includes(values.strtype),
  173. componentProps: {
  174. placeholder: '请填写158/130/235',
  175. },
  176. },
  177. {
  178. label: '请求方式',
  179. field: 'reqtype',
  180. component: 'JDictSelectTag',
  181. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  182. componentProps: {
  183. dictCode: 'reqtype',
  184. placeholder: '请选择请求方式',
  185. },
  186. },
  187. {
  188. label: 'reqHeader请求头',
  189. field: 'reqHeader',
  190. component: 'Input',
  191. ifShow: ({ values }) =>
  192. values.strtype &&
  193. (values.strtype.startsWith('http') ||
  194. !['plc', 'modbus', 'modbusRtu', 'opc_ua', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))),
  195. },
  196. {
  197. label: '请求参数',
  198. field: 'reqparam',
  199. component: 'Input',
  200. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  201. },
  202. {
  203. label: '读取文件名',
  204. field: 'reqparam',
  205. component: 'Input',
  206. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('txt'),
  207. },
  208. {
  209. label: '请求参数或读取文件名',
  210. field: 'reqparam',
  211. component: 'Input',
  212. ifShow: ({ values }) =>
  213. values.strtype &&
  214. !['plc', 'modbus', 'modbusRtu', 'opc_ua', 'txt', 'http'].some((type) => values.strtype && values.strtype.startsWith(type)) &&
  215. !values.strtype?.startsWith('http') &&
  216. !values.strtype?.startsWith('txt'),
  217. },
  218. {
  219. label: '返回数据解析',
  220. field: 'dataproperty',
  221. component: 'Input',
  222. ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt')),
  223. },
  224. {
  225. label: 'ID字段',
  226. field: 'idcode',
  227. component: 'Input',
  228. ifShow: ({ values }) =>
  229. values.strtype &&
  230. (values.strtype.startsWith('http') ||
  231. values.strtype.startsWith('txt') ||
  232. !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))),
  233. },
  234. {
  235. label: '名称code',
  236. field: 'namecode',
  237. component: 'Input',
  238. ifShow: ({ values }) =>
  239. values.strtype &&
  240. (values.strtype.startsWith('http') ||
  241. values.strtype.startsWith('txt') ||
  242. !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))),
  243. },
  244. {
  245. label: '连接用户名',
  246. field: 'remoteUser',
  247. component: 'Input',
  248. ifShow: ({ values }) =>
  249. values.strtype &&
  250. (values.strtype.startsWith('http') ||
  251. values.strtype === 'opc_ua' ||
  252. !['plc', 'modbus', 'modbusRtu', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))),
  253. },
  254. {
  255. label: '连接密码',
  256. field: 'remotePass',
  257. component: 'Input',
  258. ifShow: ({ values }) =>
  259. values.strtype &&
  260. (values.strtype.startsWith('http') ||
  261. values.strtype === 'opc_ua' ||
  262. !['plc', 'modbus', 'modbusRtu', 'txt'].some((type) => values.strtype && values.strtype.startsWith(type))),
  263. },
  264. {
  265. label: '数据格式化',
  266. field: 'dataformat',
  267. component: 'Input',
  268. ifShow: ({ values }) =>
  269. values.strtype &&
  270. (values.strtype.startsWith('http') ||
  271. values.strtype.startsWith('txt') ||
  272. !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))),
  273. },
  274. {
  275. label: '字符串分隔符',
  276. field: 'splitchar',
  277. component: 'Input',
  278. ifShow: ({ values }) =>
  279. values.strtype &&
  280. (values.strtype.startsWith('http') ||
  281. values.strtype.startsWith('txt') ||
  282. !['plc', 'modbus', 'modbusRtu', 'opc_ua'].some((type) => values.strtype && values.strtype.startsWith(type))),
  283. },
  284. {
  285. label: '控制请求地址',
  286. field: 'controlStrip',
  287. component: 'Input',
  288. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  289. },
  290. {
  291. label: '控制请求类型',
  292. field: 'controlReqtype',
  293. component: 'JDictSelectTag',
  294. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  295. componentProps: {
  296. dictCode: 'reqtype',
  297. placeholder: '请选择控制请求方式',
  298. },
  299. },
  300. {
  301. label: '控制请求Header',
  302. field: 'controlHeader',
  303. component: 'Input',
  304. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  305. },
  306. {
  307. label: '控制请求参数',
  308. field: 'controlReqparam',
  309. component: 'Input',
  310. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  311. },
  312. {
  313. label: '登录地址',
  314. field: 'loginUrl',
  315. component: 'Input',
  316. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  317. },
  318. {
  319. label: '登录结果解析',
  320. field: 'loginResult',
  321. component: 'Input',
  322. ifShow: ({ values }) => values.strtype && values.strtype.startsWith('http'),
  323. },
  324. {
  325. label: '是否自动同步设备',
  326. field: 'isAutoSyn',
  327. component: 'RadioGroup',
  328. defaultValue: 0,
  329. ifShow: ({ values }) => values.strtype && (values.strtype.startsWith('http') || values.strtype.startsWith('txt')),
  330. componentProps: () => {
  331. return {
  332. options: [
  333. { label: '否', value: 0, key: '0' },
  334. { label: '是', value: 1, key: '1' },
  335. ],
  336. };
  337. },
  338. },
  339. {
  340. label: '备注',
  341. field: 'strremark',
  342. component: 'InputTextArea',
  343. },
  344. ];
  345. export const historyColumns: BasicColumn[] = [
  346. {
  347. title: '名称',
  348. dataIndex: 'devicename',
  349. key: 'devicename',
  350. width: 120,
  351. align: 'center',
  352. },
  353. {
  354. title: '安装位置',
  355. dataIndex: 'stationname',
  356. key: 'stationname',
  357. width: 120,
  358. align: 'center',
  359. },
  360. {
  361. title: '开始报警时间',
  362. dataIndex: 'starttime',
  363. key: 'starttime',
  364. width: 120,
  365. align: 'center',
  366. },
  367. {
  368. title: '结束报警时间',
  369. dataIndex: 'endtime',
  370. key: 'endtime',
  371. width: 120,
  372. align: 'center',
  373. },
  374. {
  375. title: '报警状态',
  376. dataIndex: 'nwartype_dictText',
  377. key: 'nwartype_dictText',
  378. width: 120,
  379. align: 'center',
  380. },
  381. ];