更新666

This commit is contained in:
Alone
2024-11-04 11:35:32 +08:00
parent 16fd7106d6
commit 3777395105
17 changed files with 976 additions and 117 deletions
+47 -2
View File
@@ -8,6 +8,7 @@
<el-form :inline="true" @submit.native.prevent>
<el-form-item>
<el-button icon="el-icon-plus" size="small" @click="clickAdd" plain>添加资源</el-button>
<el-button icon="el-icon-delete" size="small" @click="postMultDelete" plain>批量删除</el-button>
<el-button icon="el-icon-document-copy" size="small" @click="getExport" plain>导出资源</el-button>
<el-button icon="el-icon-plus" size="small" @click="ImportShow" plain>夸克导入专用</el-button>
<el-button icon="el-icon-plus" size="small" @click="ImportBatch" plain>批量导入</el-button>
@@ -29,7 +30,9 @@
</el-form-item>
</div>
</el-form>
<el-table :data="dataList.data" v-loading="loading">
<el-table :data="dataList.data" @selection-change="changeSelection" v-loading="loading">
<el-table-column type="selection" width="50">
</el-table-column>
<el-table-column prop="source_id" label="ID" width="80">
</el-table-column>
<el-table-column prop="title" label="资源名称">
@@ -146,7 +149,7 @@
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
<span style="color: #999;">导入夸克官方导出的csv文件</span>
<span style="color: #999;">使用xlsx格式,第一列资源名称 第二列资源地址</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -214,6 +217,7 @@ https://drive.uc.cn/s/xxxxxxxxxxx"
dialogFormAdd: false,
dialogFormEdit: false,
loading: true,
selectList: [],
dataList: [],
form: {
page: 1,
@@ -468,6 +472,47 @@ https://drive.uc.cn/s/xxxxxxxxxxx"
window.open(url);
that.$message.success('数据导出成功');
},
postMultDelete() {
var that = this;
if (that.selectList.length == 0) {
that.$message.error('未选择任何资源!');
return;
}
this.$confirm('即将删除选中的资源, 是否确认?', '批量删除', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.post('/admin/source/delete', Object.assign({}, PostBase, {
source_id: that.selectList.join(",")
}))
.then(function (response) {
that.getList();
if (response.data.code == CODE_SUCCESS) {
that.$message({
message: response.data.message,
type: 'success'
});
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
console.log(error);
});
}).catch(() => {
});
},
changeSelection(list) {
var that = this;
that.selectList = [];
for (var index in list) {
that.selectList.push(list[index].source_id);
}
},
}
})
</script>