dataQuality.data.ts 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. import { BasicColumn, FormSchema } from '/@/components/Table';
  2. import { h } from 'vue';
  3. // 生产状态映射表(扩展所有状态)
  4. export const productionStatusMap: Record<string | number, { label: string; value: number; color: string }> = {
  5. 0: { label: '正常生产矿井', value: 0, color: 'green' },
  6. 1: { label: '拟建矿井', value: 1, color: 'blue' },
  7. 2: { label: '正常建设煤矿', value: 2, color: 'green' },
  8. 3: { label: '自行停产矿井', value: 3, color: 'green' },
  9. 4: { label: '正在关闭', value: 4, color: 'green' },
  10. 5: { label: '责令停产整顿', value: 5, color: 'green' },
  11. 6: { label: '责令停止建设', value: 6, color: 'green' },
  12. 7: { label: '已关闭矿井', value: 7, color: 'green' },
  13. 8: { label: '长期停产矿井', value: 8, color: 'green' },
  14. 9: { label: '长期停建矿井', value: 9, color: 'green' },
  15. 10: { label: '停产整改矿井', value: 10, color: 'green' },
  16. 11: { label: '长期停建无法联系', value: 11, color: 'green' },
  17. 12: { label: '停建整改', value: 12, color: 'green' },
  18. 13: { label: '自行停建', value: 13, color: 'green' },
  19. 14: { label: '正在实施关闭', value: 14, color: 'green' },
  20. // 15: { label: '已关闭矿井', value: 15, color: 'green' },
  21. };
  22. // 颜色映射
  23. const colorHexMap: Record<string, string> = {
  24. blue: '#1890ff',
  25. green: '#208840',
  26. gold: '#faad14',
  27. red: '#f5222d',
  28. gray: '#8c8c8c',
  29. black: '#000000',
  30. };
  31. /** 表格列配置 */
  32. export const columns: BasicColumn[] = [
  33. {
  34. title: '煤矿名称',
  35. dataIndex: 'mineName',
  36. width: 250,
  37. },
  38. {
  39. title: '煤矿简称',
  40. dataIndex: 'mineNameAbbr',
  41. width: 150,
  42. },
  43. {
  44. title: '生产状态',
  45. dataIndex: 'mineProStatus',
  46. width: 120,
  47. customRender: ({ record }) => {
  48. // 空值/异常值处理
  49. const status = record.mineProStatus;
  50. const { label, color } = productionStatusMap[status] || { label: '未知状态', color: 'balck' };
  51. return h('span', { style: { color: colorHexMap[color] || colorHexMap.gray } }, label);
  52. },
  53. },
  54. {
  55. title: '在线状态',
  56. dataIndex: 'mineLinkStatus',
  57. width: 100,
  58. customRender: ({ record }) => {
  59. console.log(record.mineLinkStatus);
  60. const status = record.mineLinkStatus;
  61. if (status === undefined || status === null) {
  62. return h('span', { style: { color: colorHexMap.black } }, '/');
  63. }
  64. const text = status === 1 ? '在线' : '离线';
  65. const textColor = status === 1 ? colorHexMap.green : colorHexMap.red;
  66. return h('span', { style: { color: textColor } }, text);
  67. },
  68. },
  69. {
  70. title: '质量问题详情',
  71. dataIndex: 'queJson',
  72. width: 400,
  73. ellipsis: true,
  74. slots: {
  75. customRender : 'queJson'
  76. }
  77. },
  78. {
  79. title: '当前状态',
  80. dataIndex: 'isOk',
  81. width: 100,
  82. customRender: ({ record }) => {
  83. const status = record.isOk;
  84. const text = status ? '已解决' : '未解决';
  85. const textColor = status ? colorHexMap.green : colorHexMap.red;
  86. return h('span', { style: { color: textColor } }, text);
  87. },
  88. },
  89. {
  90. title: '处理时间',
  91. dataIndex: 'updateTime',
  92. width: 180,
  93. },
  94. ];
  95. /** 查询表单配置 */
  96. export const searchFormSchema: FormSchema[] = [
  97. {
  98. field: 'mineCode',
  99. label: '煤矿名称',
  100. component: 'MineCascader',
  101. colProps: { span: 6 },
  102. groupName: '常规查询',
  103. },
  104. {
  105. field: 'mineNameAbbr',
  106. label: '煤矿简称',
  107. component: 'Input',
  108. colProps: { span: 6 },
  109. groupName: '常规查询',
  110. },
  111. {
  112. field: 'productionStatus',
  113. label: '生产状态',
  114. component: 'Select',
  115. componentProps: {
  116. options: [
  117. { label: '拟建矿井', value: '0' },
  118. { label: '正常生产矿井', value: '1' },
  119. { label: '长期停产矿井', value: '1' },
  120. ],
  121. },
  122. colProps: { span: 6 },
  123. groupName: '常规查询',
  124. },
  125. {
  126. field: 'mineLinkStatus',
  127. label: '在线状态',
  128. component: 'Select',
  129. componentProps: {
  130. options: [
  131. { label: '离线', value: '0' },
  132. { label: '在线', value: '1' },
  133. { label: '未连接', value: '2' },
  134. ],
  135. },
  136. colProps: { span: 6 },
  137. groupName: '常规查询',
  138. },
  139. ];
  140. // 模拟煤矿在线状态选项数据
  141. export const mineLinkStatusOptions = [
  142. { label: '在线', value: 1 },
  143. { label: '离线', value: 0 },
  144. ];
  145. export const topFormSchema: FormSchema[]= [
  146. {
  147. field: 'mineCode',
  148. label: '煤矿名称',
  149. component: 'MineCascader',
  150. required: true,
  151. },
  152. ];
  153. /** 弹框表单配置 */
  154. export const formSchema = [
  155. {
  156. field: 'goafName',
  157. label: '工作面名称',
  158. component: 'Input',
  159. },
  160. {
  161. field: 'queCon',
  162. label: '问题描述',
  163. component: 'Input',
  164. },
  165. {
  166. field: 'startTime',
  167. label: '开始时间',
  168. component: 'DatePicker',
  169. componentProps: {
  170. showTime: true,
  171. format: 'YYYY-MM-DD HH:mm:ss',
  172. },
  173. required: true,
  174. },
  175. {
  176. field: 'endTime',
  177. label: '结束时间',
  178. component: 'DatePicker',
  179. componentProps: {
  180. showTime: true,
  181. format: 'YYYY-MM-DD HH:mm:ss',
  182. },
  183. required: true,
  184. },
  185. {
  186. field: 'param',
  187. label: '参数',
  188. component: 'Input',
  189. required: true,
  190. },
  191. ];