cad.data.ts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. import { BasicColumn } from '/@/components/Table';
  2. import { FormSchema } from '/@/components/Table';
  3. import { useMineDepartmentStore } from '/@/store/modules/mine';
  4. // 3. 生成动态表格列(接收动态状态映射)
  5. export function getColumns(): BasicColumn[] {
  6. return [
  7. {
  8. title: '煤矿名称',
  9. dataIndex: 'mineName',
  10. width: 100,
  11. },
  12. {
  13. title: '图纸名称',
  14. dataIndex: 'fileName',
  15. width: 100,
  16. },
  17. {
  18. title: '图纸类型',
  19. dataIndex: 'fileType',
  20. width: 100,
  21. },
  22. {
  23. title: '更新时间',
  24. dataIndex: 'createTime',
  25. width: 100,
  26. },
  27. {
  28. title: '备注',
  29. dataIndex: 'remark',
  30. width: 100,
  31. },
  32. ];
  33. }
  34. // 4. 生成动态搜索表单配置
  35. export function getSearchFormSchema(): FormSchema[] {
  36. return [
  37. {
  38. field: 'deptId',
  39. label: '煤矿名称',
  40. component: 'MineCascader',
  41. colProps: { span: 6 },
  42. },
  43. {
  44. field: 'fileName',
  45. label: '图纸名称',
  46. component: 'Input',
  47. colProps: { span: 6 },
  48. },
  49. {
  50. field: 'fileType',
  51. label: '图纸分类',
  52. component: 'Select',
  53. componentProps: {
  54. options: [
  55. { label: '安全监控部署图', value: '安全监控部署图' },
  56. { label: '通风系统图', value: '通风系统图' },
  57. { label: '防灭火图', value: '防灭火图' },
  58. { label: '人员位置监测系统图', value: '人员位置监测系统图' },
  59. { label: '采掘工程平面图', value: '采掘工程平面图' },
  60. ],
  61. },
  62. colProps: { span: 6 },
  63. },
  64. ];
  65. }
  66. export const formSchema: FormSchema[] = [
  67. {
  68. label: '',
  69. field: 'id',
  70. component: 'Input',
  71. show: false,
  72. },
  73. {
  74. label: '',
  75. field: 'wjId',
  76. component: 'Input',
  77. show: false,
  78. },
  79. {
  80. label: '煤矿名称',
  81. field: 'mineCode',
  82. component: 'MineCascader',
  83. componentProps: {
  84. changeOnSelect: false,
  85. },
  86. required: true,
  87. dynamicRules: () => {
  88. //需要return
  89. return [
  90. {
  91. //默认开启表单检验
  92. required: true,
  93. // value 当前手机号输入的值
  94. validator: (_, value) => {
  95. //需要return 一个Promise对象
  96. const dept = useMineDepartmentStore().findDepartById(value);
  97. return new Promise((resolve, reject) => {
  98. if (!dept) {
  99. reject('请选择部门');
  100. }
  101. if (!dept?.isLeaf) {
  102. reject('请选择具体矿井');
  103. }
  104. resolve();
  105. });
  106. },
  107. },
  108. ];
  109. },
  110. },
  111. {
  112. label: '文件名称',
  113. field: 'fileName',
  114. component: 'Input',
  115. required: true,
  116. },
  117. {
  118. label: '文件类型',
  119. field: 'fileType',
  120. component: 'Select',
  121. componentProps: {
  122. options: [
  123. { label: '安全监控部署图', value: '安全监控部署图' },
  124. { label: '通风系统图', value: '通风系统图' },
  125. { label: '防灭火图', value: '防灭火图' },
  126. { label: '人员位置监测系统图', value: '人员位置监测系统图' },
  127. { label: '采掘工程平面图', value: '采掘工程平面图' },
  128. ],
  129. },
  130. required: true,
  131. },
  132. {
  133. label: '文件',
  134. field: 'fileAttach',
  135. component: 'Input',
  136. slot: 'fileupload',
  137. required: true,
  138. ifShow({ values }) {
  139. return !values.id;
  140. },
  141. },
  142. {
  143. label: '备注',
  144. field: 'remark',
  145. component: 'Input',
  146. },
  147. ];
  148. // 地图编辑弹框表单
  149. export const mapEditForm: FormSchema[] = [
  150. {
  151. field: 'mineCode',
  152. label: '煤矿编码',
  153. component: 'MineCascader',
  154. colProps: { span: 6 },
  155. groupName: '常规查询',
  156. // show: false,
  157. },
  158. {
  159. field: 'mineName',
  160. label: '煤矿名称',
  161. component: 'Input',
  162. colProps: { span: 6 },
  163. groupName: '常规查询',
  164. },
  165. {
  166. field: 'fileName',
  167. label: '图纸名称',
  168. component: 'Input',
  169. colProps: { span: 6 },
  170. groupName: '常规查询',
  171. },
  172. {
  173. field: 'fileType',
  174. label: '图纸类型',
  175. component: 'Select',
  176. componentProps: {
  177. options: [
  178. { label: '安全监控部署图', value: '安全监控部署图' },
  179. { label: '通风系统图', value: '通风系统图' },
  180. { label: '防灭火图', value: '防灭火图' },
  181. { label: '人员位置监测系统图', value: '人员位置监测系统图' },
  182. { label: '采掘工程平面图', value: '采掘工程平面图' },
  183. ],
  184. },
  185. colProps: { span: 6 },
  186. groupName: '常规查询',
  187. },
  188. {
  189. field: 'fileAttach',
  190. label: '附件',
  191. component: 'Upload',
  192. colProps: { span: 6 },
  193. groupName: '常规查询',
  194. },
  195. {
  196. field: 'remark',
  197. label: '备注',
  198. component: 'InputTextArea',
  199. colProps: { span: 6 },
  200. groupName: '常规查询',
  201. },
  202. ];