Commit 6755ceae authored by rencs's avatar rencs

Merge branch 'dev_ren' into 'dev'

Dev ren

See merge request !55
parents d5389122 709a4fab
...@@ -39,3 +39,12 @@ export function getDetail(query) { ...@@ -39,3 +39,12 @@ export function getDetail(query) {
method: 'get' method: 'get'
}); });
} }
// /api/website/imageImgStorage/getDetail/{id}
export function imgmoreUpdata(query) {
return fetch({
url: '/api/website/imageImgStorage/updateBatch',
method: 'post',
data: query
});
}
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
align="center" align="center"
> >
</el-table-column> </el-table-column>
<el-table-column prop="imageResolution" label="分辨率" align="center"> <el-table-column prop="imageResolutionStr" label="分辨率" align="center">
</el-table-column> </el-table-column>
<el-table-column prop="imageTakeTimeStr" label="拍摄时间" align="center"> <el-table-column prop="imageTakeTimeStr" label="拍摄时间" align="center">
</el-table-column> </el-table-column>
...@@ -142,7 +142,9 @@ export default { ...@@ -142,7 +142,9 @@ export default {
if (res.status == 200) { if (res.status == 200) {
this.total = res.data.totalCount; this.total = res.data.totalCount;
this.list = res.data.data; this.list = res.data.data;
this.list.map((item) => { this.list.map((item) => {
item.imageResolutionStr = item.imageResolution.join("m,") + "m";
item.imageTakeTimeStr = timestamp2DateAuto( item.imageTakeTimeStr = timestamp2DateAuto(
item.imageTakeTime, item.imageTakeTime,
"yyyy-MM-dd hh:mm:ss" "yyyy-MM-dd hh:mm:ss"
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
<el-button type="primary" plain @click="clearFilterData" <el-button type="primary" plain @click="clearFilterData"
>清除搜索</el-button >清除搜索</el-button
> >
<el-button type="text" @click="moreUp">批量上架</el-button>
<el-button type="text" @click="moreDown">批量下架</el-button>
<el-button type="text" @click="moreDel">批量删除</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -46,9 +49,12 @@ ...@@ -46,9 +49,12 @@
v-loading.body="listLoading" v-loading.body="listLoading"
border border
fit fit
@selection-change="handleSelectionChange"
highlight-current-row highlight-current-row
style="width: 100%" style="width: 100%"
> >
<el-table-column type="selection" width="40" align="center">
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="序号" label="序号"
...@@ -126,7 +132,12 @@ ...@@ -126,7 +132,12 @@
<script> <script>
import { satelliteIntroduction } from "@/utils/formDatas.js"; import { satelliteIntroduction } from "@/utils/formDatas.js";
import { page, update, updateStatus } from "@/api/website/imageLibrary"; import {
page,
update,
updateStatus,
imgmoreUpdata,
} from "@/api/website/imageLibrary";
export default { export default {
name: "satelliteIntroduction", name: "satelliteIntroduction",
...@@ -163,12 +174,17 @@ export default { ...@@ -163,12 +174,17 @@ export default {
}, },
dialogVisible: false, dialogVisible: false,
dialogTitle: "新增卫星", dialogTitle: "新增卫星",
multipleSelection: [],
}; };
}, },
mounted() { mounted() {
this.getList(); this.getList();
}, },
methods: { methods: {
handleSelectionChange(val) {
this.multipleSelection = val;
console.log(this.multipleSelection);
},
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.limit = val; this.listQuery.limit = val;
...@@ -178,6 +194,88 @@ export default { ...@@ -178,6 +194,88 @@ export default {
// this.listQuery = page; // this.listQuery = page;
this.$emit("recordPageInfo", page); this.$emit("recordPageInfo", page);
}, },
//批量上架
moreUp() {
if (this.multipleSelection.length < 1) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("批量上架操作, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
//1
let list = [];
this.multipleSelection.forEach((item) => {
list.push(item.id);
});
imgmoreUpdata({ ids: list.join(","), status: 1 }).then((res) => {
if (res.status == 200) {
this.$message.success("操作成功");
this.getList();
} else {
this.$message.warning(res.message);
}
});
})
.catch(() => {});
},
moreDown() {
if (this.multipleSelection.length < 1) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("批量下架操作, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
//2
let list = [];
this.multipleSelection.forEach((item) => {
list.push(item.id);
});
imgmoreUpdata({ ids: list.join(","), status: 2 }).then((res) => {
if (res.status == 200) {
this.$message.success("操作成功");
this.getList();
} else {
this.$message.warning(res.message);
}
});
})
.catch(() => {});
},
moreDel() {
if (this.multipleSelection.length < 1) {
this.$message.warning("请选择至少一条数据");
return;
}
this.$confirm("批量删除操作, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
//3
let list = [];
this.multipleSelection.forEach((item) => {
list.push(item.id);
});
imgmoreUpdata({ ids: list.join(","), isDel: 1 }).then((res) => {
if (res.status == 200) {
this.$message.success("操作成功");
this.getList();
} else {
this.$message.warning(res.message);
}
});
})
.catch(() => {});
},
//搜索按钮 //搜索按钮
search() { search() {
this.listQuery = { this.listQuery = {
......
...@@ -163,13 +163,14 @@ ...@@ -163,13 +163,14 @@
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="父级" align="center">
<!-- <el-table-column label="父级" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="typelevel">{{ <span class="typelevel">{{
getFatherTypeName(scope.row.pid) getFatherTypeName(scope.row.pid)
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column label="排序" align="center"> <el-table-column label="排序" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.sort }}</span> <span>{{ scope.row.sort }}</span>
...@@ -529,9 +530,12 @@ export default { ...@@ -529,9 +530,12 @@ export default {
} }
}); });
} }
this.tableData.forEach((obj,index)=> { this.tableData.forEach((obj, index) => {
obj.index = ((this.typePagination.currentPage-1)*this.typePagination.pageSize)+(++index) obj.index =
}) (this.typePagination.currentPage - 1) *
this.typePagination.pageSize +
++index;
});
} }
}, },
// 删除类型 // 删除类型
......
...@@ -9,28 +9,68 @@ ...@@ -9,28 +9,68 @@
<el-form :inline="true" :model="searchForm" class="demo-form-inline"> <el-form :inline="true" :model="searchForm" class="demo-form-inline">
<el-form-item label="所有状态"> <el-form-item label="所有状态">
<el-select v-model="searchForm.status" clearable> <el-select v-model="searchForm.status" clearable>
<el-option v-for="(item, index) in bannerStatus" :key="index" :label="item" :value="~~index"></el-option> <el-option label="全部" :value="null"></el-option>
<el-option
v-for="(item, index) in bannerStatus"
:key="index"
:label="item"
:value="~~index"
></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="卫星名称"> <el-form-item label="卫星名称">
<el-input v-model="searchForm.name" placeholder="请输入卫星名称"></el-input> <el-input
v-model="searchForm.name"
placeholder="请输入卫星名称"
></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" plain @click="search">搜索</el-button> <el-button type="primary" plain @click="search">搜索</el-button>
<el-button type="primary" plain @click="clearFilterData">清除搜索</el-button> <el-button type="primary" plain @click="clearFilterData"
>清除搜索</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<el-table :data="list" v-loading.body="listLoading" border fit highlight-current-row style="width: 100%"> <el-table
<el-table-column align="center" label="序号" prop="index" width="65"></el-table-column> :data="list"
<el-table-column align="center" label="卫星名称" prop="name"></el-table-column> v-loading.body="listLoading"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column
align="center"
label="序号"
prop="index"
width="65"
></el-table-column>
<el-table-column
align="center"
label="卫星名称"
prop="name"
></el-table-column>
<el-table-column align="center" label="缩略图"> <el-table-column align="center" label="缩略图">
<template slot-scope="scope"> <template slot-scope="scope">
<img class="cover" :src="scope.row.coverImg" @click.stop="showPreview(scope.row.coverImg)"/> <img
class="cover"
:src="scope.row.coverImg"
@click.stop="showPreview(scope.row.coverImg)"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="分辨率" prop="resolution"></el-table-column> <el-table-column
<el-table-column align="center" label="排序" prop="rank"></el-table-column> align="center"
label="分辨率"
prop="resolution"
></el-table-column>
<el-table-column
align="center"
label="排序"
prop="rank"
></el-table-column>
<el-table-column align="center" label="状态"> <el-table-column align="center" label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{ getStatus(scope.row.status) }} {{ getStatus(scope.row.status) }}
...@@ -38,9 +78,21 @@ ...@@ -38,9 +78,21 @@
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="250"> <el-table-column align="center" label="操作" width="250">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" @click="edit(scope.row)">编辑</el-button> <el-button type="primary" size="mini" @click="edit(scope.row)"
<el-button :type="scope.row.status === 1 ? 'info': 'warning'" size="mini" @click="changeParams(scope.row, 'status')">{{scope.row.status === 1 ? '下架': '上架'}}</el-button> >编辑</el-button
<el-button type="danger" size="mini" @click="changeParams(scope.row, 'isDel')">删除</el-button> >
<el-button
:type="scope.row.status === 1 ? 'info' : 'warning'"
size="mini"
@click="changeParams(scope.row, 'status')"
>{{ scope.row.status === 1 ? "下架" : "上架" }}</el-button
>
<el-button
type="danger"
size="mini"
@click="changeParams(scope.row, 'isDel')"
>删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -58,7 +110,8 @@ ...@@ -58,7 +110,8 @@
:page-sizes="[10, 20, 30, 40]" :page-sizes="[10, 20, 30, 40]"
:page-size="listQuery.limit" :page-size="listQuery.limit"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="~~total"> :total="~~total"
>
</el-pagination> </el-pagination>
<!-- <el-pagination <!-- <el-pagination
background background
...@@ -69,57 +122,56 @@ ...@@ -69,57 +122,56 @@
</el-pagination> --> </el-pagination> -->
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import ElImageViewer from "element-ui/packages/image/src/image-viewer"; import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import { satelliteIntroduction } from "@/utils/formDatas.js" import { satelliteIntroduction } from "@/utils/formDatas.js";
import { page, update } from "@/api/website/satelliteIntroduction" import { page, update } from "@/api/website/satelliteIntroduction";
export default { export default {
name: "satelliteIntroduction", name: "satelliteIntroduction",
components:{ components: {
ElImageViewer ElImageViewer,
}, },
data() { data() {
return { return {
currentIcon:{ currentIcon: {
showPreview: false, showPreview: false,
url: "", url: "",
}, },
data: null,//原数据 data: null, //原数据
list: null,//赋值数据 | 过滤数据 list: null, //赋值数据 | 过滤数据
total: null, total: null,
listLoading: true,//请求加载状态 listLoading: true, //请求加载状态
//请求参数。页码页数等 //请求参数。页码页数等
listQuery: this.$parent.pageInfo, listQuery: this.$parent.pageInfo,
//搜索表单 //搜索表单
searchForm: { searchForm: {
status: this.$parent.pageInfo.status, status: this.$parent.pageInfo.status || null,
name: this.$parent.pageInfo.name name: this.$parent.pageInfo.name,
}, },
//添加banner与修改banner的form对象 //添加banner与修改banner的form对象
editForm: satelliteIntroduction.init(),//提交的表单参数 editForm: satelliteIntroduction.init(), //提交的表单参数
editFormInfo: satelliteIntroduction.formInfo,//表单项。 editFormInfo: satelliteIntroduction.formInfo, //表单项。
editFormRules: satelliteIntroduction.rules,//表单规则 editFormRules: satelliteIntroduction.rules, //表单规则
//是否启用,1、启用,2、禁用 //是否启用,1、启用,2、禁用
bannerStatus: { bannerStatus: {
// 0: '全部', // 0: '全部',
1: '启用', 1: "启用",
2: '禁用', 2: "禁用",
}, },
dialogVisible: false, dialogVisible: false,
dialogTitle: "新增卫星" dialogTitle: "新增卫星",
} };
}, },
mounted() { mounted() {
this.getList() this.getList();
}, },
methods: { methods: {
handleSizeChange(val) { handleSizeChange(val) {
this.listQuery.limit = val this.listQuery.limit = val;
this.getList(); this.getList();
}, },
...@@ -131,45 +183,45 @@ export default { ...@@ -131,45 +183,45 @@ export default {
this.currentIcon.showPreview = false; this.currentIcon.showPreview = false;
}, },
changePageInfo(page) { changePageInfo(page) {
this.$emit('recordPageInfo', page) this.$emit("recordPageInfo", page);
}, },
search() { search() {
this.listQuery = { this.listQuery = {
status: this.searchForm.status || null, status: this.searchForm.status || null,
name: this.searchForm.name || null, name: this.searchForm.name || null,
page: 1, page: 1,
limit: 10 limit: 10,
} };
this.changePageInfo(this.listQuery) this.changePageInfo(this.listQuery);
this.getList(); this.getList();
}, },
//清除搜索 //清除搜索
clearFilterData() { clearFilterData() {
this.searchForm = { this.searchForm = {
status: 0, status: null,
name: "" name: "",
} };
this.listQuery = { this.listQuery = {
status: this.searchForm.status || null, status: this.searchForm.status || null,
name: this.searchForm.name || null, name: this.searchForm.name || null,
page: 1, page: 1,
limit: 10 limit: 10,
} };
this.changePageInfo(this.listQuery) this.changePageInfo(this.listQuery);
this.getList() this.getList();
}, },
//切换页码 //切换页码
currentChange(val) { currentChange(val) {
this.listQuery.page = val; this.listQuery.page = val;
this.changePageInfo(this.listQuery) this.changePageInfo(this.listQuery);
this.getList(); this.getList();
}, },
//编辑 //编辑
edit(row) { edit(row) {
this.$emit('change', 'Edit', row) this.$emit("change", "Edit", row);
}, },
//校验表单 //校验表单
submitForm() { submitForm() {
...@@ -178,21 +230,21 @@ export default { ...@@ -178,21 +230,21 @@ export default {
if (valid) { if (valid) {
_this.updateFunc(); _this.updateFunc();
} else { } else {
console.log('error submit!!'); console.log("error submit!!");
return false; return false;
} }
}); });
}, },
//更新方法 //更新方法
updateFunc() { updateFunc() {
update(this.editForm).then(res => { update(this.editForm).then((res) => {
if (res.status == 200) { if (res.status == 200) {
this.dialogVisible = false; this.dialogVisible = false;
this.getList(); this.getList();
} else { } else {
this.$message.error(res.message); this.$message.error(res.message);
} }
}) });
}, },
//取消表单 //取消表单
resetForm() { resetForm() {
...@@ -201,21 +253,21 @@ export default { ...@@ -201,21 +253,21 @@ export default {
}, },
//新增banner //新增banner
addItem() { addItem() {
this.$emit('change', 'edit') this.$emit("change", "edit");
}, },
//获取状态 //获取状态
getStatus(val) { getStatus(val) {
return this.bannerStatus[val] return this.bannerStatus[val];
}, },
//上下架、删除更新 //上下架、删除更新
changeParams(row, key) { changeParams(row, key) {
this.$confirm('确定继续执行该操作吗?', '提示', { this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: '确定', confirmButtonText: "确定",
cancelButtonText: '取消', cancelButtonText: "取消",
type: 'warning' type: "warning",
}).then(() => { }).then(() => {
this.editForm = row; this.editForm = row;
if (key == 'isDel') { if (key == "isDel") {
this.editForm[key] = row[key] == 0 ? 1 : 0; this.editForm[key] = row[key] == 0 ? 1 : 0;
} else { } else {
this.editForm[key] = row[key] == 1 ? 2 : 1; this.editForm[key] = row[key] == 1 ? 2 : 1;
...@@ -223,25 +275,28 @@ export default { ...@@ -223,25 +275,28 @@ export default {
//更新专题 //更新专题
this.updateFunc(); this.updateFunc();
}) });
}, },
//获取banner列表 //获取banner列表
getList() { getList() {
this.listLoading = true; this.listLoading = true;
page(this.listQuery).then(res => { page(this.listQuery)
this.list = res.data.data .then((res) => {
this.list.forEach((element,index) => { this.list = res.data.data;
element.index = ((this.listQuery.page-1)*this.listQuery.limit)+(index+1) this.list.forEach((element, index) => {
element.index =
(this.listQuery.page - 1) * this.listQuery.limit + (index + 1);
});
this.data = res.data.data;
this.total = res.data.totalCount;
this.listLoading = false;
})
.catch((err) => {
this.listLoading = false;
}); });
this.data = res.data.data },
this.total = res.data.totalCount; },
this.listLoading = false; };
}).catch(err => {
this.listLoading = false;
})
}
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment