更新666
This commit is contained in:
@@ -29,14 +29,14 @@
|
||||
<el-table-column label="是否每日更新" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.is_update==1?true:false"
|
||||
@change="clickStatus(scope.row)">
|
||||
@change="clickStatus(scope.row,1)">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否前台展示" width="150" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.status==1?false:true"
|
||||
@change="clickStatus(scope.row)">
|
||||
@change="clickStatus(scope.row,0)">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -228,10 +228,15 @@ console.log(error);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
clickStatus(row) {
|
||||
clickStatus(row,type) {
|
||||
var that = this;
|
||||
axios.post(row.status ? '/admin/source_category/enable' : '/admin/source_category/disable', Object.assign({}, PostBase, {
|
||||
source_category_id: row.source_category_id
|
||||
let url = row.status ? '/admin/source_category/enable' : '/admin/source_category/disable'
|
||||
if(type==1){
|
||||
url = !row.is_update ? '/admin/source_category/enable' : '/admin/source_category/disable'
|
||||
}
|
||||
axios.post(url, Object.assign({}, PostBase, {
|
||||
source_category_id: row.source_category_id,
|
||||
type: type
|
||||
}))
|
||||
.then(function (response) {
|
||||
that.getList();
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user