Sfoglia il codice sorgente

Merge branch 'develop/0.0.2(样式修改)' into test

DESKTOP-SVI9JE1\muzen 1 anno fa
parent
commit
ae64cbb0e0

+ 15 - 2
src/views/content/setting/detail.vue

@@ -122,7 +122,8 @@
         </el-form-item>
       </el-form>
       <el-table v-show="audioData.form.type !== 2" ref="table" :data="audioData.tableData" :row-key="rowKey"
-        @selection-change="handleSelectionChange" @select="handleSelectChange" v-loading="audioData.loading">
+        @selection-change="handleSelectionChange" @select="handleSelectChange" @select-all="handleSelectAllChange"
+        v-loading="audioData.loading">
         <el-table-column type="selection" width="55" key="selection" />
         <el-table-column label="ID" prop="id" align="center" key="id" show-overflow-tooltip />
         <el-table-column label="音频名称" prop="name" align="center" key="name" show-overflow-tooltip />
@@ -329,12 +330,24 @@ const handleSelectionChange = (e) => {
 
 // 取消勾选
 const handleSelectChange = (arr, row) => {
-  if(arr.findIndex(i => i.id === row.id) === -1) {
+  if (arr.findIndex(i => i.id === row.id) === -1) {
     let index = data.selectionList.findIndex(i => i.audioId === row.id)
     data.selectionList.splice(index, 1)
   }
 }
 
+const handleSelectAllChange = (e) => {
+  if (e.length === 0) {
+    for (let i = 0; i < audioData.tableData.length; i++) {
+      for (let j = 0; j < data.selectionList.length; j++) {
+        if (audioData.tableData[i].id === data.selectionList[j].audioId) {
+          data.selectionList.splice(j, 1)
+        }
+      }
+    }
+  }
+}
+
 // 单选
 const handleChooseAudio = (e) => {
   data.form.audioList = []

+ 14 - 1
src/views/insert/insertContent/detail.vue

@@ -76,7 +76,7 @@
         </el-form-item>
       </el-form>
       <el-table ref="table" :data="audioData.tableData" :row-key="rowKey" @selection-change="handleSelectionChange"
-        @select="handleSelectChange" v-loading="audioData.loading">
+        @select="handleSelectChange" @select-all="handleSelectAllChange" v-loading="audioData.loading">
         <el-table-column type="selection" width="55" key="selection" />
         <el-table-column label="ID" prop="id" align="center" key="id" show-overflow-tooltip />
         <el-table-column label="音频名称" prop="name" align="center" key="name" show-overflow-tooltip />
@@ -309,6 +309,19 @@ const handleSelectChange = (arr, row) => {
   }
 }
 
+// 取消全选
+const handleSelectAllChange = (e) => {
+  if (e.length === 0) {
+    for (let i = 0; i < audioData.tableData.length; i++) {
+      for (let j = 0; j < data.selectionList.length; j++) {
+        if (audioData.tableData[i].id === data.selectionList[j].audioId) {
+          data.selectionList.splice(j, 1)
+        }
+      }
+    }
+  }
+}
+
 // 选择时段
 const handleCheckTime = (e) => {
   data.form.timeId = e.timeId