huangmp 2 лет назад
Родитель
Сommit
ebea0c6b06
1 измененных файлов с 25 добавлено и 4 удалено
  1. 25 4
      src/views/modules/promotion/promotionVideo.vue

+ 25 - 4
src/views/modules/promotion/promotionVideo.vue

@@ -107,10 +107,7 @@
     <!-- 列表相关区域 -->
     <div class="main-container">
       <div class="operation-bar">
-<!--        <div class="default-btn primary-btn" @click="addOrUpdateHandle()"-->
-<!--             v-if="isAuth('print:promotionVideo:save')">{{$t("crud.addTitle")}}</div>-->
-<!--        <div class="default-btn primary-btn" @click="addOrUpdateHandle()">{{$t("crud.addTitle")}}</div>-->
-<!--        <div class="default-btn primary-btn" @click="openUploadDialog()">导入数据</div>-->
+        <el-button type="primary" size="small" :loading="syncVisible" @click="handleSyncBatch()">批量同步数据</el-button>
       </div>
       <div class="table-con spec-table">
         <el-table
@@ -313,6 +310,7 @@ export default {
       fansNumRange: [],
       likeNumRange: [],
       commNumRange: [],
+      dataListSelections:[]
     }
   },
   components: {
@@ -327,6 +325,29 @@ export default {
     this.getShopList()
   },
   methods: {
+    handleSyncBatch(){
+      if(this.dataListSelections.length === 0){
+        this.$message.warning("至少选择一条数据")
+      }
+      this.syncVisible = true
+      this.$http({
+        url: this.$http.adornUrl('/promotion/promotionVideo/syncVideoDataBatch'),
+        method: 'POST',
+        data: this.$http.adornData({videoList: this.dataListSelections})
+      }).then(({ data }) => {
+        this.syncVisible = false
+        this.$message({
+          message: this.$i18n.t('publics.operation'),
+          type: 'success',
+        })
+        for(let item in data){
+          let index = this.dataList.findIndex(d => d.id === data[item].id)
+          this.$set(this.dataList, index, data[item])
+        }
+      }).catch((error) =>{
+        this.syncVisible = false
+      })
+    },
     syncHandle(row, index){
       this.syncVisible = true
       this.$http({