西藏巴青项目

gen-locale-pages.js 3.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. const fs = require("fs")
  2. const path = require("path")
  3. const feeding = fs.readFileSync(
  4. path.join(__dirname, "../src/views/breedingStandards/feeding/index.vue"),
  5. "utf8"
  6. )
  7. function patch(s, pairs) {
  8. let o = s
  9. for (const [a, b] of pairs) {
  10. o = o.split(a).join(b)
  11. }
  12. return o
  13. }
  14. const base = path.join(__dirname, "../src/views/breedingStandards")
  15. fs.writeFileSync(
  16. path.join(base, "equipmentOperation/index.vue"),
  17. patch(feeding, [
  18. ["FeedingManageStandard", "EquipmentOperationStandard"],
  19. ['stdNs: "feed"', 'stdNs: "eqp"'],
  20. ["feeding:standard", "equipment:workStandard"],
  21. ["listFeedingStandard", "listEquipmentWorkStandard"],
  22. ["getFeedingStandard", "getEquipmentWorkStandard"],
  23. ["addFeedingStandard", "addEquipmentWorkStandard"],
  24. ["updateFeedingStandard", "updateEquipmentWorkStandard"],
  25. ["delFeedingStandard", "delEquipmentWorkStandard"],
  26. ["syncKbFeedingStandard", "syncKbEquipmentWorkStandard"],
  27. ["removeKbFeedingStandard", "removeKbEquipmentWorkStandard"],
  28. ["publishFeedingStandard", "publishEquipmentWorkStandard"],
  29. ["offlineFeedingStandard", "offlineEquipmentWorkStandard"],
  30. ["@/api/breedingStandards/feedingManage", "@/api/breedingStandards/equipmentWorkStandard"],
  31. ["breedingStd.feed.confirmDelete", "breedingStd.eqp.confirmDelete"],
  32. [
  33. 'return [1, 2].map((value) => ({ label: this.stdT("type" + value), value }))',
  34. 'return [1, 2, 3, 4].map((value) => ({ label: this.stdT("type" + value), value }))'
  35. ]
  36. ])
  37. )
  38. let growth = patch(feeding, [
  39. ["FeedingManageStandard", "GrowthOutboundStandard"],
  40. ['stdNs: "feed"', 'stdNs: "growth"'],
  41. ["feeding:standard", "growthSlaughter:standard"],
  42. ["listFeedingStandard", "listGrowthSlaughterStandard"],
  43. ["getFeedingStandard", "getGrowthSlaughterStandard"],
  44. ["addFeedingStandard", "addGrowthSlaughterStandard"],
  45. ["updateFeedingStandard", "updateGrowthSlaughterStandard"],
  46. ["delFeedingStandard", "delGrowthSlaughterStandard"],
  47. ["syncKbFeedingStandard", "syncKbGrowthSlaughterStandard"],
  48. ["removeKbFeedingStandard", "removeKbGrowthSlaughterStandard"],
  49. ["publishFeedingStandard", "publishGrowthSlaughterStandard"],
  50. ["offlineFeedingStandard", "offlineGrowthSlaughterStandard"],
  51. ["@/api/breedingStandards/feedingManage", "@/api/breedingStandards/growthSlaughter"],
  52. ["breedingStd.feed.confirmDelete", "breedingStd.growth.confirmDelete"],
  53. ['min: 3, max: 20, message: this.$t("breedingStd.common.ruleLen3120"', 'min: 1, max: 20, message: this.$t("breedingStd.common.ruleLen120"']
  54. ])
  55. fs.writeFileSync(path.join(base, "growthOutbound/index.vue"), growth)
  56. let ep = patch(feeding, [
  57. ["FeedingManageStandard", "EpidemicTreatmentStandard"],
  58. ['stdNs: "feed"', 'stdNs: "ep"'],
  59. ["feeding:standard", "epidemicTreatment:standard"],
  60. ["listFeedingStandard", "listEpidemicTreatmentStandard"],
  61. ["getFeedingStandard", "getEpidemicTreatmentStandard"],
  62. ["addFeedingStandard", "addEpidemicTreatmentStandard"],
  63. ["updateFeedingStandard", "updateEpidemicTreatmentStandard"],
  64. ["delFeedingStandard", "delEpidemicTreatmentStandard"],
  65. ["syncKbFeedingStandard", "syncKbEpidemicTreatmentStandard"],
  66. ["removeKbFeedingStandard", "removeKbEpidemicTreatmentStandard"],
  67. ["publishFeedingStandard", "publishEpidemicTreatmentStandard"],
  68. ["offlineFeedingStandard", "offlineEpidemicTreatmentStandard"],
  69. ["@/api/breedingStandards/feedingManage", "@/api/breedingStandards/epidemicTreatment"],
  70. ["breedingStd.feed.confirmDelete", "breedingStd.ep.confirmDelete"],
  71. [
  72. 'return [1, 2].map((value) => ({ label: this.stdT("type" + value), value }))',
  73. 'return [1].map((value) => ({ label: this.stdT("type" + value), value }))'
  74. ],
  75. ['min: 3, max: 20, message: this.$t("breedingStd.common.ruleLen3120"', 'min: 1, max: 20, message: this.$t("breedingStd.common.ruleLen120"']
  76. ])
  77. fs.writeFileSync(path.join(base, "diseaseTreatment/epidemicTreatment/index.vue"), ep)
  78. console.log("generated equipment, growth, epidemic from feeding template")