index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div>
  3. <basicLayout
  4. ref="basicLayout"
  5. :oldFormPath="{
  6. add:'HDrpManagement/ProductMag/modules'
  7. }"
  8. tableName="productManageTable"
  9. idName="itemid"
  10. ownertable="plm_item"
  11. :apiId="{query:20220923140602,del:20220923152202}"
  12. :options="options"
  13. >
  14. <div slot="custom">
  15. <label class="search__label" style="margin: auto;width: 70px;">是否上架:</label>
  16. <el-select class="inline-24" v-model="selectParam.isonsale" placeholder="请选择是否上架" @change="selectChange" size="small" clearable>
  17. <el-option
  18. v-for="item in isOnSaleData"
  19. :key="item.value"
  20. :label="item.label"
  21. :value="item.value">
  22. </el-option>
  23. </el-select>
  24. <label class="search__label" style="margin: auto;width: 40px;">状态:</label>
  25. <el-select class="inline-24" v-model="selectParam.status" placeholder="请选择状态" @change="selectChange" size="small" clearable>
  26. <el-option
  27. v-for="item in statusData"
  28. :key="item.value"
  29. :label="item.value"
  30. :value="item.value">
  31. </el-option>
  32. </el-select>
  33. </div>
  34. <template v-slot:tbList="scope">
  35. <div>
  36. <p :style="scope.data.column.data.isonsale === 1?'color:#52c41a':'color:red'" v-if="scope.data.column.columnname === 'isonsale'">
  37. <!-- {{scope.data.column.data.isonsale === 1?'上架中':'已下架'}}-->
  38. <el-switch
  39. v-model="scope.data.column.data.isonsale"
  40. :active-value='1'
  41. :inactive-value='0'
  42. @change="isOnSaleChange(scope.data.column.data)">
  43. </el-switch>
  44. </p>
  45. <p v-else-if="scope.data.column.columnname === 'cover'">
  46. <previewImage v-if="scope.data.column.data.attinfos[0]" style="width:80px;height:80px;margin-top:0px" class="image" :image="scope.data.column.data.attinfos[0]" :list="scope.data.column.data.attinfos" :deletebtn="false"></previewImage>
  47. </p>
  48. <p v-else>{{scope.data.column.data[[scope.data.column.columnname]]}}</p>
  49. </div>
  50. </template>
  51. <template v-slot:tbOpreation="scope">
  52. <editTemp :data="scope.data.data"></editTemp>
  53. </template>
  54. </basicLayout>
  55. </div>
  56. </template>
  57. <script>
  58. /**
  59. * @basicLayout 提供this.$ref['basicLayout'].listData()方法查询列表信息
  60. * @param {string} formPath 新建,编辑组件所在文件夹名称,以后所有列表新增修改文件统一放入Form文件夹下面,并创建与开发应用相同的名称的子文件夹
  61. * @param {string} tableName 开发端配置的表格名称
  62. * @param {String} idName 数据主id名称
  63. * @param {object} apiId:{query:查询的接口id,del:删除的接口id}
  64. * @param {Array} options:{label:描述,value:值}
  65. */
  66. import previewImage from '@/components/previewImage/index'
  67. import editTemp from './modules/edit.vue'
  68. export default {
  69. data () {
  70. return {
  71. options:[],
  72. isOnSaleData:[
  73. {
  74. value:0,
  75. label:'否'
  76. },
  77. {
  78. value:1,
  79. label:'是'
  80. }
  81. ],
  82. statusData:[
  83. {
  84. value:'新建',
  85. label:'新建'
  86. },
  87. {
  88. value:'审核',
  89. label:'审核'
  90. }
  91. ],
  92. selectParam:{
  93. isonsale:'',
  94. status:''
  95. }
  96. }
  97. },
  98. components:{
  99. previewImage,
  100. editTemp
  101. },
  102. methods:{
  103. async isOnSaleChange(val){
  104. console.log("更改状态",val.isonsale)
  105. console.log(val)
  106. const res = await this.$api.requested({
  107. "id": 20220923154802,
  108. "content": {
  109. "itemids": [val.itemid],
  110. "isonsale": val.isonsale//0:下架,1:上架
  111. },
  112. })
  113. this.tool.showMessage(res,()=>{
  114. this.$refs.basicLayout.listData()
  115. })
  116. },
  117. selectChange(){
  118. this.$refs.basicLayout.param.content.where = this.selectParam
  119. this.$refs.basicLayout.listData()
  120. }
  121. }
  122. }
  123. </script>
  124. <style>
  125. </style>