form.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. /**
  2. * 应急物资表单配置
  3. */
  4. import type { FormConfig } from '@/types/basic-form';
  5. import { validateFormTime } from '@/utils/validateFormTime';
  6. import { NOTIFY_RANGE } from '../constant';
  7. // 盘点任务表单信息
  8. export const INVENTORY_TASK_FROM_CONFIG: FormConfig[] = [
  9. {
  10. label: '盘点任务名称:',
  11. prop: 'taskName',
  12. component: 'ElInput',
  13. componentProps: {
  14. placeholder: '请输入盘点任务名称',
  15. },
  16. },
  17. {
  18. label: '任务截止时间:',
  19. prop: 'endTime',
  20. component: 'ElDatePicker',
  21. componentProps: {
  22. placeholder: '请选择任务截止时间',
  23. type: 'datetime',
  24. format: 'YYYY-MM-DD HH:mm',
  25. dateFormat: 'MMM DD, YYYY',
  26. timeFormat: 'HH:mm',
  27. valueFormat: 'YYYY-MM-DD HH:mm',
  28. },
  29. },
  30. ];
  31. // 盘点任务表单数据
  32. export const INVENTORY_TASK_FROM_DATA = {
  33. taskName: '',
  34. endTime: '',
  35. };
  36. // 盘点任务表单规则
  37. export const INVENTORY_TASK_FROM_RULES = {
  38. taskName: [{ required: true, message: '请输入盘点任务名称', trigger: 'blur' }],
  39. endTime: [
  40. { required: true, message: '请选择任务截止时间', trigger: 'change' },
  41. { validator: validateFormTime, trigger: 'change' },
  42. ],
  43. };
  44. const BASIC_EMERGENCY_ITEM_FROM_CONFIG = {
  45. REQUIRED_QUANTITY: {
  46. label: '应备数量:',
  47. prop: 'requiredQuantity',
  48. slot: 'requiredQuantity',
  49. },
  50. CURRENT_QUANTITY: {
  51. label: '当前数量:',
  52. prop: 'currentQuantity',
  53. slot: 'currentQuantity',
  54. },
  55. UNIT: {
  56. label: '数量单位:',
  57. prop: 'unit',
  58. component: 'ElInput',
  59. componentProps: {
  60. placeholder: '请输入数量单位',
  61. },
  62. },
  63. PARK: {
  64. label: '园区:',
  65. prop: 'park',
  66. slot: 'park',
  67. },
  68. LOCATION: {
  69. label: '地点:',
  70. prop: 'location',
  71. slot: 'location',
  72. },
  73. KEEPER_NAME: {
  74. label: '保管人:',
  75. prop: 'keeperName',
  76. slot: 'keeperName',
  77. },
  78. EXPIRATION_DATE: {
  79. label: '使用期限:',
  80. prop: 'expirationDate',
  81. component: 'ElDatePicker',
  82. componentProps: {
  83. placeholder: '请选择使用期限',
  84. type: 'date',
  85. format: 'YYYY-MM-DD',
  86. valueFormat: 'YYYY-MM-DD',
  87. },
  88. },
  89. REMARK: {
  90. label: '备注:',
  91. prop: 'remark',
  92. component: 'ElInput',
  93. componentProps: {
  94. placeholder: '请输入备注',
  95. type: 'textarea',
  96. rows: 5,
  97. },
  98. },
  99. };
  100. export const ADD_EMERGENCY_ITEM_FROM_CONFIG: FormConfig[] = [
  101. {
  102. label: '应急类型:',
  103. prop: 'emergencyType',
  104. slot: 'emergencyType',
  105. },
  106. {
  107. label: '物资类型:',
  108. prop: 'supplyType',
  109. slot: 'supplyType',
  110. },
  111. {
  112. label: '应急物资名称:',
  113. prop: 'supplyName',
  114. component: 'ElInput',
  115. componentProps: {
  116. placeholder: '请输入应急物资名称',
  117. },
  118. },
  119. BASIC_EMERGENCY_ITEM_FROM_CONFIG.REQUIRED_QUANTITY,
  120. BASIC_EMERGENCY_ITEM_FROM_CONFIG.CURRENT_QUANTITY,
  121. BASIC_EMERGENCY_ITEM_FROM_CONFIG.UNIT,
  122. BASIC_EMERGENCY_ITEM_FROM_CONFIG.PARK,
  123. BASIC_EMERGENCY_ITEM_FROM_CONFIG.LOCATION,
  124. BASIC_EMERGENCY_ITEM_FROM_CONFIG.KEEPER_NAME,
  125. BASIC_EMERGENCY_ITEM_FROM_CONFIG.EXPIRATION_DATE,
  126. BASIC_EMERGENCY_ITEM_FROM_CONFIG.REMARK,
  127. ];
  128. export const EDIT_EMERGENCY_ITEM_FROM_CONFIG: FormConfig[] = [
  129. {
  130. label: '应急类型:',
  131. prop: 'emergencyTypeName',
  132. component: 'ElInput',
  133. componentProps: {
  134. disabled: true,
  135. placeholder: '请输入应急类型',
  136. },
  137. },
  138. {
  139. label: '物资类型:',
  140. prop: 'supplyTypeName',
  141. component: 'ElInput',
  142. componentProps: {
  143. disabled: true,
  144. placeholder: '请输入物资类型',
  145. },
  146. },
  147. {
  148. label: '应急物资名称:',
  149. prop: 'supplyName',
  150. component: 'ElInput',
  151. componentProps: {
  152. placeholder: '请输入应急物资名称',
  153. disabled: true,
  154. },
  155. },
  156. BASIC_EMERGENCY_ITEM_FROM_CONFIG.REQUIRED_QUANTITY,
  157. BASIC_EMERGENCY_ITEM_FROM_CONFIG.CURRENT_QUANTITY,
  158. BASIC_EMERGENCY_ITEM_FROM_CONFIG.UNIT,
  159. BASIC_EMERGENCY_ITEM_FROM_CONFIG.PARK,
  160. BASIC_EMERGENCY_ITEM_FROM_CONFIG.LOCATION,
  161. BASIC_EMERGENCY_ITEM_FROM_CONFIG.KEEPER_NAME,
  162. BASIC_EMERGENCY_ITEM_FROM_CONFIG.EXPIRATION_DATE,
  163. BASIC_EMERGENCY_ITEM_FROM_CONFIG.REMARK,
  164. ];
  165. export const VIEW_EMERGENCY_ITEM_FROM_CONFIG: FormConfig[] = [
  166. {
  167. label: '应急类型:',
  168. prop: 'emergencyTypeName',
  169. component: 'ElInput',
  170. componentProps: {
  171. placeholder: '请输入应急类型',
  172. },
  173. },
  174. {
  175. label: '物资类型:',
  176. prop: 'supplyTypeName',
  177. component: 'ElInput',
  178. componentProps: {
  179. placeholder: '请输入物资类型',
  180. },
  181. },
  182. {
  183. label: '应急物资名称:',
  184. prop: 'supplyName',
  185. component: 'ElInput',
  186. componentProps: {
  187. placeholder: '请输入应急物资名称',
  188. },
  189. },
  190. {
  191. label: '应备数量:',
  192. prop: 'requiredQuantity',
  193. component: 'ElInput',
  194. componentProps: {
  195. placeholder: '请输入应备数量',
  196. },
  197. },
  198. {
  199. label: '当前数量:',
  200. prop: 'currentQuantity',
  201. component: 'ElInput',
  202. componentProps: {
  203. placeholder: '请输入当前数量',
  204. },
  205. },
  206. BASIC_EMERGENCY_ITEM_FROM_CONFIG.UNIT,
  207. {
  208. label: '园区:',
  209. prop: 'parkName',
  210. component: 'ElInput',
  211. componentProps: {
  212. placeholder: '请输入园区',
  213. },
  214. },
  215. {
  216. label: '地点:',
  217. prop: 'locationName',
  218. component: 'ElInput',
  219. componentProps: {
  220. placeholder: '请输入地点',
  221. },
  222. },
  223. {
  224. label: '保管人:',
  225. prop: 'keeperName',
  226. component: 'ElInput',
  227. componentProps: {
  228. placeholder: '请输入保管人',
  229. },
  230. },
  231. BASIC_EMERGENCY_ITEM_FROM_CONFIG.EXPIRATION_DATE,
  232. BASIC_EMERGENCY_ITEM_FROM_CONFIG.REMARK,
  233. ];
  234. const EMERGENCY_ITEM_DATA = {
  235. emergencyType: '',
  236. emergencyTypeName: '',
  237. supplyType: '',
  238. supplyTypeName: '',
  239. supplyName: '',
  240. requiredQuantity: null,
  241. currentQuantity: null,
  242. unit: '',
  243. park: '',
  244. location: '',
  245. expirationDate: '',
  246. remark: '',
  247. keeperId: null,
  248. keeperName: '',
  249. };
  250. // 盘点任务表单数据
  251. export const ADD_EMERGENCY_ITEM_DATA = {
  252. ...EMERGENCY_ITEM_DATA,
  253. };
  254. export const EDIT_EMERGENCY_ITEM_DATA = {
  255. ...EMERGENCY_ITEM_DATA,
  256. id: null,
  257. };
  258. export const VIEW_EMERGENCY_ITEM_DATA = {
  259. ...EDIT_EMERGENCY_ITEM_DATA,
  260. parkName: '',
  261. locationName: '',
  262. };
  263. const BASIC_EMERGENCY_ITEM_RULES = {
  264. requiredQuantity: [{ required: true, message: '请输入应备数量', trigger: 'change' }],
  265. location: [{ required: true, message: '请选择地点', trigger: 'change' }],
  266. expirationDate: [{ validator: validateFormTime, trigger: 'change' }],
  267. keeperName: [{ required: true, message: '请选择保管人', trigger: 'change' }],
  268. };
  269. export const ADD_EMERGENCY_ITEM_RULES = {
  270. emergencyType: [{ required: true, message: '请选择应急类型', trigger: 'change' }],
  271. supplyType: [{ required: true, message: '请选择物资类型', trigger: 'change' }],
  272. supplyName: [{ required: true, message: '请输入应急物资名称', trigger: 'change' }],
  273. park: [{ required: true, message: '请选择园区', trigger: 'change' }],
  274. ...BASIC_EMERGENCY_ITEM_RULES,
  275. };
  276. export const EDIT_EMERGENCY_ITEM_RULES = {
  277. ...BASIC_EMERGENCY_ITEM_RULES,
  278. };
  279. // 导出报废记录表单配置
  280. export const EXPORT_DISCARD_FROM_CONFIG: FormConfig[] = [
  281. {
  282. label: '报废时间段:',
  283. prop: 'discardTime',
  284. slot: 'discardTime',
  285. },
  286. ];
  287. // 导出报废记录数据
  288. export const EXPORT_DISCARD_FROM_DATA = {
  289. discardTime: [],
  290. };
  291. // 导出报废记录规则
  292. export const EXPORT_DISCARD_FROM_RULES = {
  293. discardTime: [{ required: true, message: '请输入报废时间段', trigger: 'change' }],
  294. };
  295. // 物资报废单数据
  296. export const SUPPLIES_DISCARD_FROM_CONFIG: FormConfig[] = [
  297. {
  298. label: '报废数量:',
  299. prop: 'quantity',
  300. slot: 'quantity',
  301. },
  302. {
  303. label: '报废理由:',
  304. prop: 'scrapReason',
  305. slot: 'scrapReason',
  306. },
  307. {
  308. label: '报废照片:',
  309. prop: 'scrapImage',
  310. slot: 'scrapImage',
  311. },
  312. ];
  313. // 物资报废单数据
  314. export const SUPPLIES_DISCARD_FROM_DATA = {
  315. quantity: null,
  316. scrapReason: '',
  317. scrapImage: '',
  318. };
  319. // 物资报废单规则
  320. export const SUPPLIES_DISCARD_FROM_RULES = {
  321. quantity: [{ required: true, message: '请输入报废数量', trigger: 'blur' }],
  322. scrapReason: [{ required: true, message: '请输入报废理由', trigger: 'blur' }],
  323. };
  324. // 物资申领计划表单配置
  325. export const SUPPLY_REQUEST_FORM_CONFIG: FormConfig[] = [
  326. {
  327. label: '物资申领计划:',
  328. prop: 'planName',
  329. component: 'ElInput',
  330. componentProps: {
  331. placeholder: '请输入物资申领计划',
  332. },
  333. },
  334. {
  335. label: '采购日期:',
  336. prop: 'purchaseDate',
  337. component: 'ElDatePicker',
  338. componentProps: {
  339. placeholder: '请选择采购日期',
  340. type: 'date',
  341. format: 'YYYY-MM-DD',
  342. valueFormat: 'YYYY-MM-DD',
  343. },
  344. },
  345. ];
  346. // 物资申领计划表单数据
  347. export const SUPPLY_REQUEST_FORM_DATA = {
  348. planName: '',
  349. purchaseDate: '',
  350. };
  351. // 物资申领计划表单规则
  352. export const SUPPLY_REQUEST_FORM_RULES = {
  353. planName: [{ required: true, message: '请输入物资申领计划', trigger: 'blur' }],
  354. };
  355. // 发起采购表单配置
  356. export const START_PURCHASE_FORM_CONFIG: FormConfig[] = [
  357. {
  358. label: '采购日期:',
  359. prop: 'purchaseDate',
  360. component: 'ElDatePicker',
  361. componentProps: {
  362. placeholder: '请选择采购日期',
  363. type: 'date',
  364. format: 'YYYY-MM-DD',
  365. valueFormat: 'YYYY-MM-DD',
  366. },
  367. },
  368. ];
  369. // 发起采购表单数据
  370. export const START_PURCHASE_FORM_DATA = {
  371. purchaseDate: '',
  372. };
  373. // 发起采购表单规则
  374. export const START_PURCHASE_FORM_RULES = {
  375. purchaseDate: [{ required: true, message: '请选择采购日期', trigger: 'change' }],
  376. };
  377. // 物资领用通知表单配置
  378. export const NOTIFY_DEPARTMENT_FORM_CONFIG: FormConfig[] = [
  379. {
  380. label: '通知范围:',
  381. prop: 'noticeScope',
  382. slot: 'noticeScope',
  383. },
  384. {
  385. label: '领用时间:',
  386. prop: 'requestTime',
  387. component: 'ElDatePicker',
  388. componentProps: {
  389. placeholder: '请选择领用时间',
  390. type: 'date',
  391. format: 'YYYY-MM-DD',
  392. valueFormat: 'YYYY-MM-DD',
  393. },
  394. },
  395. {
  396. label: '领用地点:',
  397. prop: 'requestLocation',
  398. component: 'ElInput',
  399. componentProps: {
  400. placeholder: '请输入领用地点',
  401. },
  402. },
  403. ];
  404. // 物资领用通知表单数据
  405. export const NOTIFY_DEPARTMENT_FORM_DATA = {
  406. noticeScope: NOTIFY_RANGE.ALL,
  407. requestTime: '',
  408. requestLocation: '',
  409. };
  410. // 物资领用通知表单规则
  411. export const NOTIFY_DEPARTMENT_FORM_RULES = {
  412. noticeScope: [{ required: true, message: '请选择通知范围', trigger: 'change' }],
  413. requestTime: [{ required: true, message: '请选择领用时间', trigger: 'change' }],
  414. requestLocation: [{ required: true, message: '请输入领用地点', trigger: 'blur' }],
  415. };