index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <div>
  3. <div class="container normal-panel normal-margin" style="display:flex">
  4. <add type="add" @addSuccess="$refs.list.listData()" :productData="productList" :brandData="brandList" v-if="tool.checkAuth($route.name,'update')"></add>
  5. <Up type="all" style="margin-left:16px" @upSuccess="onSuccess()" :id="checkboxData.map(item => item.sa_itemgroupid)" v-if="Object.keys(checkboxData).length > 0 && checkboxData[0].isonsale == 0 && tool.checkAuth($route.name,'up_sales')"></Up>
  6. <Down type="all" style="margin-left:16px" @downSuccess="onSuccess()" :id="checkboxData.map(item => item.sa_itemgroupid)" v-if="Object.keys(checkboxData).length > 0 && checkboxData[0].isonsale == 1 && tool.checkAuth($route.name,'down_sales')"></Down>
  7. </div>
  8. <div class="container normal-panel normal-margin">
  9. <list ref="list" @checkboxCallBack="checkboxCallBack">
  10. <template v-slot:detail="scope">
  11. <product_detail :data="scope.data" :type="'text'"></product_detail>
  12. </template>
  13. <template v-slot:edit="scope">
  14. <add v-if="tool.checkAuth($route.name,'update')" type="edit" @addSuccess="onSuccess()" :productData="productList" :brandData="brandList" :groupData="scope.data"></add>
  15. </template>
  16. <template v-slot:del="scope">
  17. <Del v-if="tool.checkAuth($route.name,'delete') && scope.data.isonsale == 0" type="group" @deleteSuccess="onSuccess()" :id="scope.data.sa_itemgroupid"></Del>
  18. </template>
  19. <template v-slot:up="scope">
  20. <Up type="one" @upSuccess="onSuccess()" :id="[scope.data.sa_itemgroupid]" v-if="scope.data.isonsale == 0 && tool.checkAuth($route.name,'up_sales')"></Up>
  21. </template>
  22. <template v-slot:down="scope">
  23. <Down type="one" @downSuccess="onSuccess()" :id="[scope.data.sa_itemgroupid]" v-if="scope.data.isonsale == 1 && tool.checkAuth($route.name,'down_sales')"></Down>
  24. </template>
  25. </list>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import product_detail from './modules/details.vue';
  31. import list from './modules/list'
  32. import add from './modules/add'
  33. import Del from './modules/delete'
  34. import Up from './modules/up'
  35. import Down from './modules/down'
  36. export default {
  37. name:"index",
  38. components:{
  39. list,
  40. add,
  41. product_detail,
  42. Del,
  43. Up,
  44. Down,
  45. },
  46. data() {
  47. return {
  48. /* 商品列表数据 */
  49. productList:'',
  50. /* 品牌列表数据 */
  51. brandList:'',
  52. checkboxData:{}
  53. }
  54. },
  55. created() {
  56. this.getProductList()
  57. this.getBrandList()
  58. },
  59. methods: {
  60. /* 可选择的商品列表 */
  61. async getProductList() {
  62. let res = await this.$api.requested({
  63. "id": "20220923112503",
  64. "version":1,
  65. "content": {
  66. "nocache":true,
  67. "sa_itemgroupid":0,
  68. "where":{
  69. "condition":""
  70. }
  71. }
  72. })
  73. this.productList = res.data
  74. console.log(this.productList,'商品');
  75. },
  76. /* 可选择的品牌列表 */
  77. async getBrandList() {
  78. let res = await this.$api.requested({
  79. "id": "20220922085103",
  80. "version":1,
  81. "content": {
  82. "nocache":true,
  83. "where":{
  84. "condition":""
  85. }
  86. }
  87. })
  88. this.brandList = res.data
  89. console.log(this.brandList,'品牌');
  90. },
  91. checkboxCallBack(data) {
  92. this.checkboxData = data
  93. },
  94. onSuccess () {
  95. console.log("执行更新")
  96. this.$refs.list.listData()
  97. },
  98. }
  99. }
  100. </script>
  101. <style>
  102. </style>