index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div>
  3. <list ref="list">
  4. <!--单位计量-->
  5. <unitAdd
  6. type="add"
  7. slot="unitAdd"
  8. @unitAddSuccess="unitAddSuccess"
  9. v-if="tool.checkAuth($route.name,'insert')"
  10. />
  11. <template v-slot:unitEdit="scope">
  12. <unitAdd
  13. type="edit"
  14. @unitAddSuccess="unitAddSuccess"
  15. :unitData="scope.data"
  16. v-if="tool.checkAuth($route.name,'update')"
  17. />
  18. </template>
  19. <template v-slot:unitDel="scope">
  20. <Del type="unit"
  21. @deleteSuccess="UnitDeleteSuccess"
  22. :id="scope.data.data.unitid"
  23. v-if="tool.checkAuth($route.name,'delete')"
  24. />
  25. </template>
  26. <!--单位计量组-->
  27. <unit-group-add
  28. type="add"
  29. slot="unitGroupAdd"
  30. @unitAddSuccess="unitGroupAddSuccess"
  31. :allUnit="unitList"
  32. v-if="tool.checkAuth($route.name,'insert')"
  33. />
  34. <template v-slot:unitGroupEdit="scope">
  35. <unit-group-add
  36. type="edit"
  37. :unitData="scope.data.row"
  38. @unitAddSuccess="unitGroupAddSuccess"
  39. :allUnit="scope.data.unitList"
  40. v-if="tool.checkAuth($route.name,'update')"
  41. />
  42. </template>
  43. <template v-slot:unitGroupDel="scope">
  44. <Del type="unitGroup"
  45. @deleteSuccess="unitGroupDelSuccess"
  46. :id="scope.data.unitgroupid"
  47. v-if="tool.checkAuth($route.name,'delete')"
  48. />
  49. </template>
  50. </list>
  51. </div>
  52. </template>
  53. <script>
  54. import list from './components/list'
  55. import Del from './components/delete'
  56. import unitAdd from './components/unitAdd'
  57. import unitGroupAdd from './components/unitGroupAdd'
  58. export default {
  59. name: '',
  60. data() {
  61. return {
  62. unitList:''
  63. };
  64. },
  65. components:{list,Del,unitAdd,unitGroupAdd},
  66. computed:{
  67. },
  68. watch:{
  69. },
  70. created() {
  71. this.getUnit()
  72. },
  73. methods: {
  74. /* 计量单位增加成功 */
  75. unitAddSuccess() {
  76. this.$refs.list.getUnit()
  77. },
  78. /* 计量单位删除成功 */
  79. UnitDeleteSuccess() {
  80. this.$refs.list.getUnit()
  81. },
  82. /* 计量组添加成功 */
  83. unitGroupAddSuccess() {
  84. this.$refs.list.getUnitGroup()
  85. },
  86. /* 计量组删除成功 */
  87. unitGroupDelSuccess() {
  88. this.$refs.list.getUnitGroup()
  89. },
  90. /* 获取单位列表 */
  91. async getUnit() {
  92. let res = await this.$api.requested({
  93. "id": "20220922084803",
  94. "version":1,
  95. "content": {
  96. "nocache":true,
  97. "where":{
  98. "condition":""
  99. }
  100. }
  101. })
  102. this.unitList = res.data
  103. console.log(res)
  104. },
  105. },
  106. };
  107. </script>
  108. <style scoped>
  109. </style>