minesInfo.data.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { h } from 'vue';
  4. // 生产状态映射表(扩展所有状态)
  5. const productionStatusMap: Record<string | number, { text: string; value: number; color: string }> = {
  6. 0: { text: '正常生产矿井', value: 0, color: 'green' },
  7. 1: { text: '拟建矿井', value: 1, color: 'blue' },
  8. 2: { text: '正常建设煤矿', value: 2, color: 'red' },
  9. 3: { text: '自行停产矿井', value: 3, color: 'red' },
  10. 4: { text: '正在关闭', value: 4, color: 'red' },
  11. 5: { text: '责令停产整顿', value: 5, color: 'red' },
  12. 6: { text: '责令停止建设', value: 6, color: 'red' },
  13. 7: { text: '已关闭矿井', value: 7, color: 'red' },
  14. 8: { text: '长期停产矿井', value: 8, color: 'red' },
  15. 9: { text: '长期停建矿井', value: 9, color: 'red' },
  16. 10: { text: '停产整改矿井', value: 10, color: 'red' },
  17. 11: { text: '长期停建无法联系', value: 11, color: 'red' },
  18. 12: { text: '停建整改', value: 12, color: 'red' },
  19. 13: { text: '自行停建', value: 13, color: 'red' },
  20. 14: { text: '正在实施关闭', value: 14, color: 'red' },
  21. // 15: { text: '已关闭矿井', color: 'red' },
  22. };
  23. // 基于productionStatusMap生成下拉选项
  24. export const productionStatusOptions = Object.entries(productionStatusMap).map(([key, item]) => ({
  25. label: item.text, // 状态名称
  26. value: key, // 状态值
  27. }));
  28. // 颜色映射
  29. const colorHexMap: Record<string, string> = {
  30. blue: '#1890ff',
  31. green: '#208840',
  32. gold: '#faad14',
  33. red: '#f5222d',
  34. gray: '#8c8c8c',
  35. black: '#000000',
  36. };
  37. export const columns: BasicColumn[] = [
  38. {
  39. title: '煤矿编号',
  40. dataIndex: 'mineCode',
  41. width: 100,
  42. },
  43. {
  44. title: '所属执法处',
  45. dataIndex: 'managementName',
  46. width: 100,
  47. },
  48. {
  49. title: '煤矿名称',
  50. dataIndex: 'mineName',
  51. width: 200,
  52. },
  53. {
  54. title: '煤矿简称',
  55. dataIndex: 'mineNameAbbr',
  56. width: 100,
  57. },
  58. {
  59. title: '生产状态',
  60. dataIndex: 'productionStatus',
  61. width: 100,
  62. customRender: ({ record }) => {
  63. // 空值/异常值处理
  64. const status = String(record.productionStatus || '');
  65. const { text, color } = productionStatusMap[status] || { text: '未知状态', color: 'balck' };
  66. // 渲染普通span,仅设置文字颜色
  67. return h('span', { style: { color: colorHexMap[color] || colorHexMap.gray } }, text);
  68. },
  69. },
  70. {
  71. title: '自燃情况',
  72. dataIndex: 'alarmLevel',
  73. width: 100,
  74. },
  75. {
  76. title: '接入状态',
  77. dataIndex: 'accessStatus',
  78. width: 100,
  79. customRender: ({ record }) => {
  80. // 空值/异常值处理
  81. const status = String(record.accessStatus || '');
  82. if (!status || status === 'undefined' || status === 'null') {
  83. return h('span', { style: { color: colorHexMap.black } }, '/');
  84. }
  85. const text = status === '1' ? '接入' : '未接入';
  86. const textColor = status === '1' ? colorHexMap.green : colorHexMap.gold;
  87. return h('span', { style: { color: textColor } }, text);
  88. },
  89. },
  90. {
  91. title: '在线状态',
  92. dataIndex: 'status',
  93. width: 100,
  94. customRender: ({ record }) => {
  95. const status = String(record.status || '');
  96. if (!status || status === 'undefined' || status === 'null') {
  97. return h('span', { style: { color: colorHexMap.black } }, '/');
  98. }
  99. const text = status === '1' ? '在线' : '离线';
  100. const textColor = status === '1' ? colorHexMap.green : colorHexMap.red;
  101. return h('span', { style: { color: textColor } }, text);
  102. },
  103. },
  104. {
  105. title: '应接数量',
  106. dataIndex: 'yingjieNum',
  107. width: 100,
  108. },
  109. {
  110. title: '已接数量',
  111. dataIndex: 'accessGoafNum',
  112. width: 100,
  113. },
  114. {
  115. title: '未接数量',
  116. dataIndex: 'notAccessGoafNum',
  117. width: 100,
  118. },
  119. ];
  120. export const searchFormSchema: FormSchema[] = [
  121. {
  122. field: 'mineCode',
  123. label: '煤矿名称',
  124. component: 'MineCascader',
  125. colProps: { span: 6 },
  126. },
  127. {
  128. field: 'mineNameAbbr',
  129. label: '煤矿简称',
  130. component: 'Input',
  131. colProps: { span: 6 },
  132. },
  133. {
  134. field: 'productionStatus',
  135. label: '生产状态',
  136. component: 'Select',
  137. componentProps: {
  138. options: productionStatusOptions,
  139. },
  140. colProps: { span: 6 },
  141. },
  142. {
  143. field: 'accessStatus',
  144. label: '接入状态',
  145. component: 'Select',
  146. componentProps: {
  147. options: [
  148. { label: '接入', value: 1 },
  149. { label: '未接入', value: 0 },
  150. ],
  151. },
  152. colProps: { span: 6 },
  153. },
  154. {
  155. field: 'status',
  156. label: '在线状态',
  157. component: 'Select',
  158. componentProps: {
  159. options: [
  160. { label: '离线', value: '0' },
  161. { label: '在线', value: '1' },
  162. ],
  163. },
  164. colProps: { span: 6 },
  165. },
  166. {
  167. field: 'riskLevel',
  168. label: '风险等级',
  169. component: 'Select',
  170. componentProps: {
  171. options: [
  172. { label: 'Ⅰ类容易自燃', value: '0' },
  173. { label: 'Ⅱ类自燃', value: '1' },
  174. { label: 'Ⅲ类不易自燃', value: '2' },
  175. ],
  176. },
  177. colProps: { span: 6 },
  178. },
  179. ];