windPointManage.data.ts 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. import type { BasicColumn } from '/@/components/Table';
  2. import type { FormSchema } from '/@/components/Table';
  3. import { h } from 'vue';
  4. import { StatusColorEnum } from '/@/enums/jeecgEnum';
  5. import { useMineDepartmentStore } from '/@/store/modules/mine';
  6. import { getWindrectList, getWindrectRegulation } from './windPointManage.api';
  7. /** 按矿编码(fax)在组织树中匹配部门名称,未匹配时回退显示原编码 */
  8. function renderMineNameByFax(mineCode: string): string {
  9. if (!mineCode) return '-';
  10. const mine = useMineDepartmentStore().findDepart((n) => n.fax === mineCode, useMineDepartmentStore().getDepartTree);
  11. return mine?.departName || mineCode;
  12. }
  13. /** 注册测风点位管理表格列 */
  14. export const pointColumns: BasicColumn[] = [
  15. {
  16. title: '煤矿编号',
  17. dataIndex: 'mineCode',
  18. width: 140,
  19. fixed: 'left',
  20. customRender: ({ text }) => h('span', renderMineNameByFax(String(text ?? ''))),
  21. },
  22. {
  23. title: '区域名称',
  24. dataIndex: 'name',
  25. width: 150,
  26. fixed: 'left',
  27. },
  28. {
  29. title: '层级',
  30. dataIndex: 'level',
  31. width: 100,
  32. customRender: ({ text }) => {
  33. const map: Record<number, string> = {
  34. 1: '矿井进风',
  35. 2: '采区进风',
  36. 3: '采区用风',
  37. 4: '采区回风',
  38. 5: '矿井回风',
  39. };
  40. return map[text] || text;
  41. },
  42. },
  43. {
  44. title: '需风量(m³/min)',
  45. dataIndex: 'airVolume',
  46. width: 100,
  47. },
  48. // {
  49. // title: '规程值',
  50. // dataIndex: 'regulationId',
  51. // width: 90,
  52. // },
  53. {
  54. title: '测风设备',
  55. dataIndex: 'windrectId',
  56. width: 100,
  57. customRender({ record }) {
  58. return h('span', record.windrectId ? '已绑定' : '未绑定');
  59. },
  60. },
  61. {
  62. title: '创建时间',
  63. dataIndex: 'createTime',
  64. width: 150,
  65. },
  66. // {
  67. // title: '状态',
  68. // dataIndex: 'status',
  69. // width: 80,
  70. // customRender: ({ text }) => {
  71. // const val = text ?? 'active';
  72. // const color = val === 'active' ? StatusColorEnum.green : StatusColorEnum.gray;
  73. // const label = val === 'active' ? '在用' : '停用';
  74. // return h('span', { style: { color } }, label);
  75. // },
  76. // },
  77. ];
  78. /** 上传数据布点表格列(Windrect) */
  79. export const windrectColumns: BasicColumn[] = [
  80. // {
  81. // title: '设备编码',
  82. // dataIndex: 'deviceCode',
  83. // width: 130,
  84. // fixed: 'left',
  85. // },
  86. {
  87. title: '设备位置',
  88. dataIndex: 'devicePos',
  89. width: 200,
  90. },
  91. {
  92. title: '矿井名称',
  93. dataIndex: 'mineName',
  94. width: 160,
  95. },
  96. {
  97. title: '状态',
  98. dataIndex: 'status',
  99. width: 100,
  100. customRender: ({ text }) => {
  101. const normal = String(text) === '1';
  102. const color = normal ? StatusColorEnum.green : StatusColorEnum.red;
  103. const label = normal ? '正常' : '停用';
  104. return h('span', { style: { color, fontWeight: 'bold' } }, label);
  105. },
  106. },
  107. // {
  108. // title: '创建时间',
  109. // dataIndex: 'createTime',
  110. // width: 160,
  111. // },
  112. ];
  113. /** 新增/编辑 MineArea 表单 */
  114. export const formSchema: FormSchema[] = [
  115. {
  116. label: 'id',
  117. field: 'id',
  118. component: 'Input',
  119. show: false,
  120. },
  121. {
  122. label: '煤矿编号',
  123. field: 'mineCode',
  124. component: 'MineCascader',
  125. required: true,
  126. // 编辑态(已有 id)禁用矿编码,避免误改归属矿井;新增态保持可选
  127. dynamicDisabled: ({ values }) => !!values.id,
  128. // 切换煤矿时清空已选测风设备,避免绑定到其他矿的设备
  129. componentProps: ({ formActionType }) => ({
  130. placeholder: '请输入煤矿编号',
  131. changeOnSelect: true,
  132. initFromStore: false,
  133. syncFromStore: false,
  134. onChange: () => {
  135. formActionType.setFieldsValue({ windrectId: undefined });
  136. },
  137. }),
  138. },
  139. {
  140. label: '测风地点名称',
  141. field: 'name',
  142. required: true,
  143. component: 'Input',
  144. componentProps: {
  145. placeholder: '请输入矿井名称',
  146. },
  147. },
  148. {
  149. label: '层级',
  150. field: 'level',
  151. component: 'Select',
  152. required: true,
  153. componentProps: {
  154. placeholder: '请选择层级',
  155. options: [
  156. { label: '矿井进风', value: 1 },
  157. { label: '采区进风', value: 2 },
  158. { label: '采区用风', value: 3 },
  159. { label: '采区回风', value: 4 },
  160. { label: '矿井回风', value: 5 },
  161. ],
  162. },
  163. },
  164. {
  165. label: '需风量(m³/min)',
  166. field: 'airVolume',
  167. component: 'InputNumber',
  168. componentProps: {
  169. placeholder: '请输入需风量',
  170. min: 0,
  171. style: 'width: 100%',
  172. },
  173. },
  174. {
  175. label: '巷道分类',
  176. field: 'regulationId',
  177. component: 'ApiSelect',
  178. required: true,
  179. componentProps: {
  180. api: getWindrectRegulation,
  181. labelField: 'name',
  182. valueField: 'id',
  183. placeholder: '请选择巷道分类',
  184. },
  185. },
  186. {
  187. label: '测风设备',
  188. field: 'windrectId',
  189. component: 'ApiSelect',
  190. // 与「煤矿编号」联动:按选中矿(MineCascader 值为部门 id)过滤本矿测风设备;
  191. // ApiSelect 深度监听 params 变化,切矿后自动重新请求
  192. componentProps: ({ formModel }) => ({
  193. api: getWindrectList,
  194. labelField: 'devicePos',
  195. valueField: 'id',
  196. placeholder: '请输入测风设备',
  197. searchable: true,
  198. params: formModel?.mineCode ? { deptId: formModel.mineCode } : {},
  199. }),
  200. },
  201. ];
  202. /* ====== 判识模型管理(暂注释,待接口就绪后恢复)======
  203. /* 判识模型参数配置表格列
  204. export const modelConfigColumns: BasicColumn[] = [
  205. {
  206. title: '判识指标',
  207. dataIndex: 'paramName',
  208. width: 200,
  209. fixed: 'left',
  210. },
  211. {
  212. title: '判别条件',
  213. dataIndex: 'paramFormula',
  214. width: 150,
  215. },
  216. {
  217. title: '阈值参数',
  218. dataIndex: 'paramKey',
  219. width: 150,
  220. },
  221. {
  222. title: '阈值参数',
  223. dataIndex: 'currentValue',
  224. width: 120,
  225. edit: true,
  226. editComponent: 'Input',
  227. },
  228. {
  229. title: '默认值',
  230. dataIndex: 'defaultValue',
  231. width: 120,
  232. },
  233. {
  234. title: '当前值',
  235. dataIndex: 'value',
  236. width: 120,
  237. },
  238. {
  239. title: '权重',
  240. dataIndex: 'weight',
  241. width: 120,
  242. },
  243. ];
  244. /* 判识模型参数编辑表单(与 modelConfigColumns 字段对齐)
  245. export const modelConfigFormSchema: FormSchema[] = [
  246. {
  247. label: '判识指标',
  248. field: 'paramName',
  249. component: 'Input',
  250. componentProps: { disabled: true },
  251. },
  252. {
  253. label: '判别条件',
  254. field: 'paramFormula',
  255. component: 'Input',
  256. componentProps: { placeholder: '请输入判别条件' },
  257. },
  258. {
  259. label: '阈值参数',
  260. field: 'paramKey',
  261. required: true,
  262. component: 'Input',
  263. componentProps: { placeholder: '请输入阈值参数字段名' },
  264. },
  265. {
  266. label: '阈值参数值',
  267. field: 'currentValue',
  268. required: true,
  269. component: 'Input',
  270. componentProps: { placeholder: '请输入阈值参数值' },
  271. },
  272. {
  273. label: '默认值',
  274. field: 'defaultValue',
  275. component: 'Input',
  276. componentProps: { placeholder: '请输入默认值' },
  277. },
  278. {
  279. label: '当前值',
  280. field: 'value',
  281. component: 'Input',
  282. componentProps: { placeholder: '请输入当前值' },
  283. },
  284. {
  285. label: '权重',
  286. field: 'weight',
  287. component: 'InputNumber',
  288. componentProps: { placeholder: '请输入权重', min: 0, max: 1, step: 0.01, style: 'width:100%' },
  289. },
  290. {
  291. label: '单位',
  292. field: 'unit',
  293. component: 'Input',
  294. componentProps: { placeholder: '请输入单位' },
  295. },
  296. {
  297. label: '说明',
  298. field: 'description',
  299. component: 'InputTextArea',
  300. componentProps: { placeholder: '请输入说明', rows: 3 },
  301. },
  302. ];
  303. /* 判识模型默认配置数据
  304. export const defaultModelConfigs = [
  305. {
  306. paramName: '风速上限',
  307. paramKey: 'windSpeedUpperLimit',
  308. currentValue: '6.0',
  309. defaultValue: '6.0',
  310. unit: 'm/s',
  311. description: '实测风速超过此值即触发风速超限报警',
  312. },
  313. {
  314. paramName: '风量不足裕度',
  315. paramKey: 'volumeLowMargin',
  316. currentValue: '20',
  317. defaultValue: '20',
  318. unit: '%',
  319. description: '实测风量低于标准风量×(1-裕度)即触发风量不足报警',
  320. },
  321. {
  322. paramName: '缺失点位报警数',
  323. paramKey: 'missingPointAlarm',
  324. currentValue: '1',
  325. defaultValue: '1',
  326. unit: '个',
  327. description: '上传测风点数少于注册测风点数超过此值即触发报警',
  328. },
  329. {
  330. paramName: '关联异常点数',
  331. paramKey: 'relatedAbnormalPoints',
  332. currentValue: '2',
  333. defaultValue: '2',
  334. unit: '个',
  335. description: '同一区域多个测风点同时异常超过此值即触发关联异常报警',
  336. },
  337. {
  338. paramName: '综合判识阈值',
  339. paramKey: 'compositeThreshold',
  340. currentValue: '0.60',
  341. defaultValue: '0.60',
  342. unit: '',
  343. description: '加权风险得分达到此值判定为"疑似"隐蔽工作面',
  344. },
  345. {
  346. paramName: '采区风量差值异常周期',
  347. paramKey: 'diffAbnormalCycles',
  348. currentValue: '3',
  349. defaultValue: '3',
  350. unit: '个测风周期',
  351. description: '差值持续为正且超过此测风周期数即触发异常',
  352. },
  353. {
  354. paramName: '采区有效风量率警戒线',
  355. paramKey: 'effectiveRateWarning',
  356. currentValue: '70',
  357. defaultValue: '70',
  358. unit: '%',
  359. description: '采区有效风量率低于此值即触发预警',
  360. },
  361. ];
  362. */