3
0

minesInfo.data.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { h } from 'vue';
  4. import { StatusColorEnum } from '/@/enums/jeecgEnum';
  5. import { isEmpty } from 'lodash-es';
  6. // 1. 颜色映射(修正原拼写错误,统一规则)
  7. // export const StatusColorEnum: Record<string, string> = {
  8. // blue: '#1890ff',
  9. // green: '#208840',
  10. // gold: '#faad14',
  11. // red: '#f5222d',
  12. // gray: '#8c8c8c',
  13. // black: '#000000',
  14. // };
  15. // 2. 定义生产状态映射类型(和dataQuality保持一致)
  16. export type ProductionStatusMap = Record<
  17. string | number,
  18. {
  19. label: string;
  20. value: number | string;
  21. color: string;
  22. }
  23. >;
  24. // 3. 生成动态表格列(接收动态状态映射)
  25. export const columns: BasicColumn[] = [
  26. {
  27. title: '煤矿编号',
  28. dataIndex: 'mineCode',
  29. width: 100,
  30. },
  31. {
  32. title: '所属上级',
  33. dataIndex: 'parentArea',
  34. width: 100,
  35. },
  36. {
  37. title: '煤矿名称',
  38. dataIndex: 'mineName',
  39. width: 200,
  40. },
  41. {
  42. title: '煤矿简称',
  43. dataIndex: 'mineNameAbbr',
  44. width: 100,
  45. ifShow: false,
  46. },
  47. {
  48. title: '生产状态',
  49. dataIndex: 'gjMineStatus',
  50. width: 100,
  51. // customRender: ({ record }) => {
  52. // // 空值/异常值处理
  53. // const status = String(record.productionStatus || '');
  54. // // 从动态映射取值,兜底未知状态
  55. // const { label, color } = dynamicStatusMap.value[status] || {
  56. // label: '-',
  57. // };
  58. // // 渲染带颜色的文字
  59. // return h(
  60. // 'span',
  61. // {
  62. // style: { color: StatusColorEnum[color] },
  63. // },
  64. // label
  65. // );
  66. // },
  67. },
  68. {
  69. title: '自燃倾向性',
  70. dataIndex: 'coalSeamLevel',
  71. width: 100,
  72. },
  73. {
  74. title: '瓦斯等级',
  75. dataIndex: 'gasLevelName',
  76. width: 100,
  77. },
  78. {
  79. title: '接入状态',
  80. dataIndex: 'accessStatus',
  81. width: 100,
  82. customRender: ({ record }) => {
  83. // 空值/异常值处理
  84. const status = String(record.accessStatus);
  85. if (isEmpty(status)) {
  86. return h('span', '-');
  87. }
  88. const text = status === '1' ? '接入' : '未接入';
  89. const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.gold;
  90. return h('span', { style: { color: textColor } }, text);
  91. },
  92. },
  93. {
  94. title: '在线状态',
  95. dataIndex: 'status',
  96. width: 100,
  97. customRender: ({ record }) => {
  98. const status = String(record.status);
  99. if (isEmpty(status)) {
  100. return h('span', '-');
  101. }
  102. const text = status === '1' ? '在线' : '离线';
  103. const textColor = status === '1' ? StatusColorEnum.green : StatusColorEnum.red;
  104. return h('span', { style: { color: textColor } }, text);
  105. },
  106. },
  107. {
  108. title: '应接数量',
  109. dataIndex: 'yingjieNum',
  110. width: 100,
  111. },
  112. {
  113. title: '已接数量',
  114. dataIndex: 'accessGoafNum',
  115. width: 100,
  116. },
  117. {
  118. title: '未接数量',
  119. dataIndex: 'notAccessGoafNum',
  120. width: 100,
  121. },
  122. ];
  123. // 4. 生成动态搜索表单配置(接收动态下拉选项)
  124. export const searchFormSchema: FormSchema[] = [
  125. {
  126. field: 'deptId',
  127. label: '煤矿名称',
  128. component: 'MineCascader',
  129. colProps: { span: 6 },
  130. },
  131. {
  132. field: 'mineNameAbbr',
  133. label: '煤矿简称',
  134. component: 'Input',
  135. colProps: { span: 6 },
  136. show: false,
  137. },
  138. {
  139. field: 'gjMineStatus',
  140. label: '生产状态',
  141. component: 'JDictSelectTag',
  142. componentProps: {
  143. dictCode: 'mineProStatus',
  144. placeholder: '请选择生产状态',
  145. },
  146. colProps: { span: 6 },
  147. },
  148. {
  149. field: 'accessStatus',
  150. label: '接入状态',
  151. component: 'Select',
  152. componentProps: {
  153. options: [
  154. { label: '接入', value: 1 },
  155. { label: '未接入', value: 0 },
  156. ],
  157. },
  158. colProps: { span: 6 },
  159. },
  160. {
  161. field: 'status',
  162. label: '在线状态',
  163. component: 'Select',
  164. componentProps: {
  165. options: [
  166. { label: '离线', value: '0' },
  167. { label: '在线', value: '1' },
  168. ],
  169. },
  170. colProps: { span: 6 },
  171. },
  172. {
  173. field: 'gasLevelName',
  174. label: '瓦斯等级',
  175. component: 'Select',
  176. componentProps: {
  177. options: [
  178. { label: '低瓦斯', value: '低瓦斯' },
  179. { label: '高瓦斯', value: '高瓦斯' },
  180. { label: '突出', value: '突出' },
  181. ],
  182. },
  183. colProps: { span: 6 },
  184. },
  185. {
  186. field: 'riskLevel',
  187. label: '风险等级',
  188. component: 'Select',
  189. componentProps: {
  190. options: [
  191. { label: 'Ⅰ类容易自燃', value: '0' },
  192. { label: 'Ⅱ类自燃', value: '1' },
  193. { label: 'Ⅲ类不易自燃', value: '2' },
  194. ],
  195. },
  196. colProps: { span: 6 },
  197. show: false,
  198. },
  199. ];