Commit 53bdfc72 authored by lixy's avatar lixy
parents 492bc711 71eb5542
......@@ -93,8 +93,8 @@
<el-form-item label="价格" prop="price">
<el-input-number
:min="0"
:step="1"
:precision="0"
:step="0.01"
:precision="2"
v-model="form.price"
></el-input-number>
</el-form-item>
......@@ -178,11 +178,17 @@ export default {
price: 0,
status: 0,
};
this.$nextTick(() => {
this.$refs["form"].clearValidate();
});
},
edit(row) {
this.showAddOrUpd = true;
this.titleText = "修改卫星传感器";
this.form = row;
this.$nextTick(() => {
this.$refs["form"].clearValidate();
});
},
changeSate(row, state) {
let data = {
......
......@@ -162,7 +162,7 @@
v-model="price"
:min="0"
:step="0.1"
:precision="1"
:precision="2"
style="width: 50%"
></el-input-number>
</p>
......
<template>
<div class="block">
<div class="head">
<div class="go-back" @click="goBack"><i class="el-icon-back"></i>返回上一页</div>
<div class="go-back" @click="goBack">
<i class="el-icon-back"></i>返回上一页
</div>
</div>
<div class="body">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-alert title="基础信息" type="info" :closable="false" style="margin-bottom: 10px"></el-alert>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-alert
title="基础信息"
type="info"
:closable="false"
style="margin-bottom: 10px"
></el-alert>
<el-form-item label="产品名称" prop="name">
<el-input class="half-width" v-model="ruleForm.name" placeholder="请输入产品名称"></el-input>
<el-input
class="half-width"
v-model="ruleForm.name"
placeholder="请输入产品名称"
></el-input>
</el-form-item>
<el-form-item label="产品缩略图" prop="coverImg">
<!-- 上传 -->
<my-upload :value="ruleForm.coverImg" @input="(val, info) => getSrc('coverImg', val)"></my-upload>
<!-- 上传 -->
<my-upload
:value="ruleForm.coverImg"
@input="(val, info) => getSrc('coverImg', val)"
></my-upload>
</el-form-item>
<el-form-item label="上传源文件" :prop="'imageInfoRelationList.url' && 'imageInfoRelationList.price'">
<el-form-item
label="上传源文件"
:prop="'imageInfoRelationList.url' && 'imageInfoRelationList.price'"
>
<!-- 上传 -->
<my-upload refName="upload2" :value="ruleForm.imageInfoRelationList.url" @input="(val, info) => getSrc('imageInfoRelationList', val, info)"></my-upload>
<my-upload
refName="upload2"
:value="ruleForm.imageInfoRelationList.url"
@input="(val, info) => getSrc('imageInfoRelationList', val, info)"
></my-upload>
<div v-if="ruleForm.imageInfoRelationList.fileWidth">尺寸大小:{{ruleForm.imageInfoRelationList.fileWidth}}</div>
<el-input class="half-width" size="small" v-model="ruleForm.imageInfoRelationList.price" placeholder="请输入价格"></el-input>
<div v-if="ruleForm.imageInfoRelationList.fileWidth">
尺寸大小:{{ ruleForm.imageInfoRelationList.fileWidth }}
</div>
<el-input
class="half-width"
size="small"
v-model="ruleForm.imageInfoRelationList.price"
placeholder="请输入价格"
></el-input>
</el-form-item>
<el-alert title="产品参数" type="info" :closable="false" style="margin-bottom: 10px"></el-alert>
<el-alert
title="产品参数"
type="info"
:closable="false"
style="margin-bottom: 10px"
></el-alert>
<el-form-item label="影像分类" prop="type">
<el-select v-model="ruleForm.type" placeholder="请选择">
......@@ -32,24 +70,45 @@
v-for="(item, index) in imageTypes"
:key="~~index"
:label="item"
:value="~~index">
:value="~~index"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="产品类型" prop="paramJson.productType">
<el-input class="half-width" v-model="ruleForm.paramJson.productType" placeholder="请输入产品类型"></el-input>
<el-input
class="half-width"
v-model="ruleForm.paramJson.productType"
placeholder="请输入产品类型"
></el-input>
</el-form-item>
<el-form-item label="文件格式" prop="paramJson.productType">
<el-input class="half-width" v-model="ruleForm.paramJson.fileType" placeholder="请输入文件格式"></el-input>
<el-input
class="half-width"
v-model="ruleForm.paramJson.fileType"
placeholder="请输入文件格式"
></el-input>
</el-form-item>
<el-form-item label="卫星" prop="paramJson.satellite">
<el-input class="half-width" v-model="ruleForm.paramJson.satellite" placeholder="请输入卫星型号"></el-input>
<el-input
class="half-width"
v-model="ruleForm.paramJson.satellite"
placeholder="请输入卫星型号"
></el-input>
</el-form-item>
<el-form-item label="分辨率" prop="paramJson.resolution">
<el-input class="half-width" v-model="ruleForm.paramJson.resolution" placeholder="请输入产品分辨率"></el-input>
<el-input
class="half-width"
v-model="ruleForm.paramJson.resolution"
placeholder="请输入产品分辨率"
></el-input>
</el-form-item>
<el-form-item label="拍摄地点" prop="paramJson.address">
<el-input class="half-width" v-model="ruleForm.paramJson.address" placeholder="请输入拍摄地点"></el-input>
<el-input
class="half-width"
v-model="ruleForm.paramJson.address"
placeholder="请输入拍摄地点"
></el-input>
</el-form-item>
<el-form-item label="拍摄时间" prop="paramJson.shotTime">
<el-date-picker
......@@ -57,7 +116,8 @@
v-model="ruleForm.paramJson.shotTime"
type="datetime"
placeholder="选择日期时间"
:picker-options="datePickerOptions">
:picker-options="datePickerOptions"
>
</el-date-picker>
</el-form-item>
<el-form-item label="可否商用" prop="paramJson.commercial">
......@@ -73,8 +133,22 @@
</el-radio-group>
</el-form-item>
<el-form-item label="相似图片" prop="relatedIds">
<el-button type="primary" icon="el-icon-plus" @click="showImagesDialog">相似图片</el-button>
<el-tag type="success">已选 {{images.selects.length}}</el-tag>
<el-button
type="primary"
icon="el-icon-plus"
@click="showImagesDialog"
>相似图片</el-button
>
<el-tag type="success">已选 {{ images.selects.length }}</el-tag>
</el-form-item>
<el-form-item label="产品介绍">
<kind-editor
id="editor_id"
:content.sync="ruleForm.intro"
:afterChange="afterChange()"
:loadStyleMode="false"
@on-content-change="onContentChange"
></kind-editor>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">确定</el-button>
......@@ -83,23 +157,40 @@
</el-form>
</div>
<!-- 相似图片弹窗 -->
<el-dialog title="相似图片" :visible.sync="images.visible" width="80%" :close-on-click-modal="false">
<el-dialog
title="相似图片"
:visible.sync="images.visible"
width="80%"
:close-on-click-modal="false"
>
<el-row :gutter="20">
<el-col :span="6" v-for="item in images.datas" :key="item.id">
<div :class="`grid-content${selectsArr.includes('' + item.id) ? ' active' : ''}`" @click="select(item)">
<div
:class="`grid-content${
selectsArr.includes('' + item.id) ? ' active' : ''
}`"
@click="select(item)"
>
<el-image :src="item.url" lazy></el-image>
</div>
</el-col>
</el-row>
<div style="margin-top: 10px; display: flex; align-item: center; justify-content: center;">
<div
style="
margin-top: 10px;
display: flex;
align-item: center;
justify-content: center;
"
>
<el-pagination
small
layout="prev, pager, next"
:page-size="images.pageInfo.limit"
:total="images.total"
@current-change="currentChange">
@current-change="currentChange"
>
</el-pagination>
</div>
<div slot="footer" class="dialog-footer">
......@@ -111,96 +202,94 @@
</template>
<script>
import MyUpload from "@/components/Upload/singleImageX"//上传组件
import { update, getAll, getDetail } from "@/api/website/imageLibrary"
import MyUpload from "@/components/Upload/singleImageX"; //上传组件
import { update, getAll, getDetail } from "@/api/website/imageLibrary";
import KindEditor from "@/components/Kindeditor";
export default {
components: {
MyUpload
MyUpload,
KindEditor,
},
data() {
let checkNumber = function (rule, value, callback) {
if (value === '') {
callback(new Error('请输入价格'));
if (value === "") {
callback(new Error("请输入价格"));
} else {
if (isNaN(value)) {
callback(new Error('请输入数字'));
callback(new Error("请输入数字"));
} else {
callback();
}
}
}
};
return {
//1--影像美图 2--专题图 3--遥感成果图
imageTypes: {
1: '影像美图',
2: '专题图',
3: '遥感成果图',
1: "影像美图",
2: "专题图",
3: "遥感成果图",
},
ruleForm: {
name: '',
coverImg: '',
name: "",
coverImg: "",
imageInfoRelationList: {
url: '',
url: "",
price: null,
fileWidth: '',
fileSize: '',
fileWidth: "",
fileSize: "",
},
type: '',
intro: "",
type: "",
relatedIds: "",
paramJson: {
productType: '',
fileType: '',
satellite: '',
resolution: '',
address: '',
shotTime: '',
commercial: '',
watermark: '',
}
productType: "",
fileType: "",
satellite: "",
resolution: "",
address: "",
shotTime: "",
commercial: "",
watermark: "",
},
},
rules: {
name: [
{required: true, message: '请输入产品名称', trigger: 'blur'}
],
name: [{ required: true, message: "请输入产品名称", trigger: "blur" }],
coverImg: [
{required: true, message: '请上传缩略图', trigger: 'change'}
{ required: true, message: "请上传缩略图", trigger: "change" },
],
'imageInfoRelationList.url': [
{required: true, message: '请上传源文件', trigger: 'change'}
"imageInfoRelationList.url": [
{ required: true, message: "请上传源文件", trigger: "change" },
],
'imageInfoRelationList.price': [
{required: true, message: '请输入价格', trigger: 'blur'},
{validator: checkNumber, trigger: 'blur'}//校验是否是数字
"imageInfoRelationList.price": [
{ required: true, message: "请输入价格", trigger: "blur" },
{ validator: checkNumber, trigger: "blur" }, //校验是否是数字
],
type: [
{required: true, message: '请选择影像类型', trigger: 'change'}
{ required: true, message: "请选择影像类型", trigger: "change" },
],
'paramJson.productType': [
{required: true, message: '请输入产品类型', trigger: 'blur'}
"paramJson.productType": [
{ required: true, message: "请输入产品类型", trigger: "blur" },
],
'paramJson.fileType': [
{required: true, message: '请输入文件格式'}
"paramJson.fileType": [{ required: true, message: "请输入文件格式" }],
"paramJson.satellite": [
{ required: true, message: "请输入卫星型号", trigger: "blur" },
],
'paramJson.satellite': [
{required: true, message: '请输入卫星型号', trigger: 'blur'}
"paramJson.resolution": [
{ required: true, message: "请输入分辨率", trigger: "blur" },
],
'paramJson.resolution': [
{required: true, message: '请输入分辨率', trigger: 'blur'}
"paramJson.address": [
{ required: true, message: "请输入拍摄地点", trigger: "blur" },
],
'paramJson.address': [
{required: true, message: '请输入拍摄地点', trigger: 'blur'}
"paramJson.shotTime": [
{ required: true, message: "请选择拍摄时间", trigger: "change" },
],
'paramJson.shotTime': [
{required: true, message: '请选择拍摄时间', trigger: 'change'}
"paramJson.commercial": [
{ required: true, message: "请选择", trigger: "change" },
],
'paramJson.commercial': [
{required: true, message: '请选择', trigger: 'change'}
"paramJson.watermark": [
{ required: true, message: "请选择", trigger: "change" },
],
'paramJson.watermark': [
{required: true, message: '请选择', trigger: 'change'}
]
},
images: {
pageInfo: {
......@@ -210,29 +299,40 @@ export default {
total: 100,
datas: [],
visible: false,
selects: []
selects: [],
},
selectsArr: [],
datePickerOptions: {
disabledDate: (time) => {
return time.getTime() > new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 -1)
}
}
}
return (
time.getTime() >
new Date(
new Date(new Date().toLocaleDateString()).getTime() +
24 * 60 * 60 * 1000 -
1
)
);
},
},
};
},
mounted() {
//获取所有相似图像
this.getAllImages()
this.$bus.$on('imageLibrary-edit-renderData', this.renderData)
this.getAllImages();
this.$bus.$on("imageLibrary-edit-renderData", this.renderData);
},
beforeDestroy() {
this.$bus.$off('imageLibrary-edit-renderData')
this.$bus.$off("imageLibrary-edit-renderData");
},
methods: {
afterChange() {},
onContentChange(val) {
this.ruleForm.intro = val;
},
//打开相似图片dialog弹窗
showImagesDialog() {
// console.log(this.images.selects)
this.selectsArr = JSON.parse(JSON.stringify(this.images.selects))
this.selectsArr = JSON.parse(JSON.stringify(this.images.selects));
this.images.visible = true;
},
//相似图片弹窗图片列表切换页面方法
......@@ -249,70 +349,77 @@ export default {
//选择相似图片
select(item) {
let selects = this.selectsArr;
let index = selects.indexOf(item.id + '')
let index = selects.indexOf(item.id + "");
if (index > -1) {
selects.splice(index, 1)
selects.splice(index, 1);
} else {
selects.push(item.id + '')
selects.push(item.id + "");
}
this.selectsArr = selects
this.selectsArr = selects;
},
//获取所有相似图像
getAllImages() {
getAll(this.images.pageInfo).then(res => {
this.images.datas = res.data.data
this.images.total = res.data.totalCount
})
getAll(this.images.pageInfo).then((res) => {
this.images.datas = res.data.data;
this.images.total = res.data.totalCount;
});
},
//上传图片,获取图片地址
getSrc(key, val, info) {
let rule = ['imageInfoRelationList'];
let rule = ["imageInfoRelationList"];
if (rule.includes(key) && info) {
this.ruleForm[key] = {
url: val,
price: this.ruleForm[key].price,
fileWidth: info.width + '*' + info.height,
fileSize: info.size
}
fileWidth: info.width + "*" + info.height,
fileSize: info.size,
};
this.$set(this.ruleForm.paramJson, 'fileType', info.type)
this.$set(this.ruleForm.paramJson, "fileType", info.type);
} else {
this.ruleForm[key] = val;
}
},
//点击编辑的时候,获取表格行数据,渲染edit页面
renderData(params) {
//获取详情
let val = params;
let afterFormat = this.filterParams(val);
let afterFormat = this.filterParams(val);
let data = JSON.parse(JSON.stringify(afterFormat));
// data.paramJson = JSON.parse(data.paramJson);
//注意:imageInfoRelationListParse为imageInfoRelationList参数的最后一项,赋值显示
data.imageInfoRelationList = data.imageInfoRelationListParse[0];
data.coverImg = data.coverImg || '';
data.coverImg = data.coverImg || "";
this.ruleForm = data;
this.images.selects = this.ruleForm.relatedIds.split(',')//相似图片转为数组格式
this.images.selects = this.ruleForm.relatedIds.split(","); //相似图片转为数组格式
},
//返回上一页
goBack() {
this.$emit('change', 'List')
this.$emit("change", "List");
},
//过滤多余属性
filterParams(obj) {
let p = {}
let b = ['isDel', 'status', 'updTime', 'crtTime', 'allowCustom', 'rank', 'relationId', 'similarImageList']
let p = {};
let b = [
"isDel",
"status",
"updTime",
"crtTime",
"allowCustom",
"rank",
"relationId",
"similarImageList",
];
for (let key in obj) {
if (!b.includes(key)) {
if (key === 'imageInfoRelationList') {
let temp = this.filterParams(obj[key][0])
if (key === "imageInfoRelationList") {
let temp = this.filterParams(obj[key][0]);
obj[key] = [temp];
}
p[key] = obj[key]
p[key] = obj[key];
}
}
return p;
......@@ -321,14 +428,13 @@ export default {
onSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
console.log('submit')
this.updateFunc();//上传数据
console.log("submit");
this.updateFunc(); //上传数据
} else {
console.log('error submit!!');
console.log("error submit!!");
return false;
}
});
},
//添加/修改方法
updateFunc() {
......@@ -336,21 +442,20 @@ export default {
let params = JSON.parse(JSON.stringify(this.ruleForm));
params.paramJson = JSON.stringify(params.paramJson);
params.imageInfoRelationList = [params.imageInfoRelationList]
params.imageInfoRelationList = [params.imageInfoRelationList];
// console.log(params)
//执行方法
update(params).then(res => {
if (res.status == 200) {
update(params).then((res) => {
if (res.status == 200) {
//返回上一页,更新列表
this.goBack();
} else {
this.$message.error(res.message);
}
})
}
}
}
});
},
},
};
</script>
<style lang="scss" scoped>
......@@ -373,16 +478,17 @@ export default {
}
}
.body {
padding: 20px 50px 40px
padding: 20px 50px 40px;
}
.grid-content {
border: 1px solid transparent;
}
.grid-content:hover, .grid-content.active {
.grid-content:hover,
.grid-content.active {
border: 1px solid #409eff;
box-sizing: border-box
box-sizing: border-box;
}
.half-width {
width: 50%
width: 50%;
}
</style>
......@@ -117,6 +117,17 @@
></el-input>
</el-col>
</el-form-item>
<el-form-item label="价格" prop="price">
<el-col :span="12">
<el-input-number
v-model="form.price"
:min="0"
:step="0.01"
:precision="2"
placeholder="请输入价格"
></el-input-number>
</el-col>
</el-form-item>
<el-form-item label="是否提供样例" prop="isSample">
<el-radio-group v-model="form.isSample">
<el-radio-button label="是"></el-radio-button>
......@@ -204,6 +215,7 @@ export default {
detailImg: [
{ required: true, message: "请上传详情图", trigger: "blur" },
],
price: [{ required: true, message: "请输入价格", trigger: "blur" }],
industry: [{ required: true, message: "请输入行业", trigger: "blur" }],
region: [{ required: true, message: "请输入地区", trigger: "blur" }],
collectTime: [
......@@ -230,6 +242,7 @@ export default {
],
},
form: {
price: 0, //价格
title: "", // 应用名称
coverImg: "", // 封面图
detailImg: "", // 详情图
......@@ -272,6 +285,9 @@ export default {
this.form.title = info.title;
this.form.coverImg = info.coverImg;
this.form.detailImg = info.icon.url;
console.log(info);
this.form.price = info.price;
this.form.industry = attribute.industry;
this.form.region = attribute.area;
this.form.collectTime = attribute.date;
......@@ -443,6 +459,7 @@ export default {
title: this.form.title,
coverImg: this.form.coverImg,
detailImg: this.form.detailImg,
price: this.form.price,
introduction: this.form.introduction,
attribute: JSON.stringify({
industry: this.form.industry,
......@@ -478,6 +495,7 @@ export default {
coverImg: this.form.coverImg,
detailImg: this.form.detailImg,
introduction: this.form.introduction,
price: this.form.price,
attribute: JSON.stringify({
industry: this.form.industry,
area: this.form.region,
......
......@@ -62,14 +62,18 @@
</div>
</div>
<div class="addApp">
<div class="add" @click.stop="addApp">
新增应用
</div>
<div class="add" @click.stop="addApp">新增应用</div>
</div>
</div>
<!-- 表格 -->
<div class="table">
<el-table :data="tableData" border fit highlight-current-row style="width: 100%">
<el-table
:data="tableData"
border
fit
highlight-current-row
style="width: 100%"
>
<el-table-column label="序号" width="100" align="center">
<template slot-scope="scope">
<span>{{ scope.row.index }}</span>
......@@ -77,7 +81,13 @@
</el-table-column>
<el-table-column label="应用类别" width="200" align="center">
<template slot-scope="scope">
<span>{{ scope.row.firstTitle ? scope.row.secondTitle ? scope.row.firstTitle+"-"+scope.row.secondTitle : scope.row.firstTitle : "" }}</span>
<span>{{
scope.row.firstTitle
? scope.row.secondTitle
? scope.row.firstTitle + "-" + scope.row.secondTitle
: scope.row.firstTitle
: ""
}}</span>
</template>
</el-table-column>
<el-table-column label="应用名称" align="center">
......@@ -103,7 +113,7 @@
</el-table-column>
<el-table-column label="状态" width="150" align="center">
<template slot-scope="scope">
<span>{{ scope.row.status==1?"上架":"下架" }}</span>
<span>{{ scope.row.status == 1 ? "上架" : "下架" }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150" align="center">
......@@ -112,8 +122,20 @@
<span>
<div class="operators">
<div class="edit" @click.stop="editApp(scope.row)">编辑</div>
<div class="offshelf" v-if="scope.row.status==1" @click.stop="changeInfoStatus(scope.row)">下架</div>
<div class="upshelf" v-else @click.stop="changeInfoStatus(scope.row)">上架</div>
<div
class="offshelf"
v-if="scope.row.status == 1"
@click.stop="changeInfoStatus(scope.row)"
>
下架
</div>
<div
class="upshelf"
v-else
@click.stop="changeInfoStatus(scope.row)"
>
上架
</div>
<div class="delete" @click.stop="delInfo(scope.row)">删除</div>
</div>
</span>
......@@ -122,15 +144,16 @@
</el-table>
</div>
<div class="infoPagination" v-show="infoPagination">
<el-pagination
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="infoPagination.currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="infoPagination.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="infoPagination.total">
</el-pagination>
:total="infoPagination.total"
>
</el-pagination>
</div>
<!-- 使用图片查看器预览当前缩略图 -->
<el-image-viewer
......@@ -144,20 +167,20 @@
<script>
// 导入组件
import ElImageViewer from "element-ui/packages/image/src/image-viewer";
import singleImageX from '@/components/Upload/singleImageX';
import singleImageX from "@/components/Upload/singleImageX";
// 导入请求
import {
getAllApplicationType,
getListApplicationType,
addUpdateApplicationType,
getListApplicationInfo,
addUpdateApplicationInfo
addUpdateApplicationInfo,
} from "api/website/industryApplication/index";
export default {
name: "ApplicationList",
components: {
ElImageViewer,
singleImageX
singleImageX,
},
data() {
return {
......@@ -212,80 +235,86 @@ export default {
// },
],
infoPagination: {
currentPage: 1,// 当前页码
pageSize: 10,// 每页查询数量
total: 0,// 总记录数量
currentPage: 1, // 当前页码
pageSize: 10, // 每页查询数量
total: 0, // 总记录数量
},
};
},
mounted() {
this.pullAllApplicationType()
this.pullListApplicationInfo()
this.pullAllApplicationType();
this.pullListApplicationInfo();
},
methods: {
// getAttributeIndustry(attribute){
// return eval("("+attribute+")").industry
// },
editApp(info){
this.$parent.componentName = 'addApp'
this.$parent.info = info
editApp(info) {
this.$parent.componentName = "addApp";
this.$parent.info = info;
},
addApp(){
this.$parent.componentName = 'addApp'
this.$parent.info = null
addApp() {
this.$parent.componentName = "addApp";
this.$parent.info = null;
},
// 获取所有应用类型
pullAllApplicationType(){
this.types = [{
pullAllApplicationType() {
this.types = [
{
value: "",
label: "全部",
}]
getAllApplicationType().then(res => {
if(res.status == 200){
},
];
getAllApplicationType().then((res) => {
if (res.status == 200) {
// console.log("获取所有的应用类型=>",res)
res.data.forEach(element => {
if(element.isDel==0){
res.data.forEach((element) => {
if (element.isDel == 0) {
this.types.push({
value: element.id,
label: element.title
label: element.title,
});
}
});
}
})
});
},
clickOperator(index){
if(index == 1){
this.currentTypeName = ""
this.currentStatus = ""
this.currentType = ""
clickOperator(index) {
if (index == 1) {
this.currentTypeName = "";
this.currentStatus = "";
this.currentType = "";
}
this.screenApplicationInfo()
this.screenApplicationInfo();
},
// 筛选数据
screenApplicationInfo(){
this.tableData = []
let index = 0
this.tableDataCache.forEach(element => {
screenApplicationInfo() {
this.tableData = [];
let index = 0;
this.tableDataCache.forEach((element) => {
// 未被删除的
if(element.isDel==0){
if (element.isDel == 0) {
this.tableData.push({
index: ((this.infoPagination.currentPage-1)*this.infoPagination.pageSize)+(++index),
index:
(this.infoPagination.currentPage - 1) *
this.infoPagination.pageSize +
++index,
id: element.id,
attribute:element.attribute,
examples:element.examples,
attribute: element.attribute,
price: element.price,
examples: element.examples,
examplesJson: element.examplesJson,
indexShow:element.indexShow,
introduction:element.introduction,
isDel:element.isDel,
protection:element.protection,
indexShow: element.indexShow,
introduction: element.introduction,
isDel: element.isDel,
protection: element.protection,
rank: element.rank,
firstTypeId:element.firstTypeId,
firstTypeId: element.firstTypeId,
firstTitle: element.firstTitle,
secondTypeId:element.secondTypeId,
secondTitle:element.secondTitle,
secondTypeId: element.secondTypeId,
secondTitle: element.secondTitle,
title: element.title,
coverImg:element.coverImg,
coverImg: element.coverImg,
icon: {
url: element.detailImg,
showPreview: false,
......@@ -297,42 +326,48 @@ export default {
});
}
});
if(this.currentStatus!=''){
this.tableData = this.tableData.filter(element => element.status == this.currentStatus)
if (this.currentStatus != "") {
this.tableData = this.tableData.filter(
(element) => element.status == this.currentStatus
);
}
if(this.currentType!=''){
if (this.currentType != "") {
// let type = this.types.find(element => element.value == this.currentType)
// this.tableData = this.tableData.filter(element => this.getAttributeIndustry(element.attribute) == type.label)
this.tableData = this.tableData.filter(element => {
let type = element.firstTitle ? element.secondTitle ? element.firstTitle+"-"+element.secondTitle : element.firstTitle : ""
this.tableData = this.tableData.filter((element) => {
let type = element.firstTitle
? element.secondTitle
? element.firstTitle + "-" + element.secondTitle
: element.firstTitle
: "";
//正则表达式
let reg = new RegExp(this.currentType);
return type.match(reg)
})
return type.match(reg);
});
}
if(this.currentTypeName!=''){
this.tableData = this.tableData.filter(element => {
//正则表达式
if (this.currentTypeName != "") {
this.tableData = this.tableData.filter((element) => {
//正则表达式
let reg = new RegExp(this.currentTypeName);
return element.title.match(reg)
})
return element.title.match(reg);
});
}
},
// 分页获取应用详情数据
pullListApplicationInfo(){
pullListApplicationInfo() {
getListApplicationInfo({
page: this.infoPagination.currentPage,
limit: this.infoPagination.pageSize
}).then(res => {
if(res.status==200){
console.log("分页获取到的数据=>",res)
this.tableDataCache = []
this.tableData = []
this.infoPagination.total = res.data.totalCount
res.data.data.forEach(element => {
this.tableDataCache.push(element)
limit: this.infoPagination.pageSize,
}).then((res) => {
if (res.status == 200) {
console.log("分页获取到的数据=>", res);
this.tableDataCache = [];
this.tableData = [];
this.infoPagination.total = res.data.totalCount;
res.data.data.forEach((element) => {
this.tableDataCache.push(element);
});
this.screenApplicationInfo()
this.screenApplicationInfo();
// this.tableDataCache.forEach(element => {
// // 未被删除的
// if(element.isDel==0){
......@@ -364,59 +399,60 @@ export default {
// }
// });
}
})
});
},
// 删除应用详情
delInfo(info){
this.$confirm('确定继续执行该操作吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = {
id: info.id,
title: info.title,
coverImg: info.coverImg,
detailImg: info.icon.url,
introduction: info.introduction,
attribute: info.attribute,
examples: info.examples,
examplesJson: info.examplesJson,
protection: info.protection,
rank: info.rank,
status: info.status,
firstTypeId: info.firstTypeId,
secondTypeId: info.secondTypeId,
indexShow: info.indexShow,
firstTitle: info.firstTitle,
secondTitle: info.secondTitle,
isDel: "1",
customized: info.customized,
delInfo(info) {
this.$confirm("确定继续执行该操作吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let data = {
id: info.id,
title: info.title,
coverImg: info.coverImg,
detailImg: info.icon.url,
introduction: info.introduction,
attribute: info.attribute,
examples: info.examples,
examplesJson: info.examplesJson,
protection: info.protection,
rank: info.rank,
status: info.status,
firstTypeId: info.firstTypeId,
secondTypeId: info.secondTypeId,
indexShow: info.indexShow,
firstTitle: info.firstTitle,
secondTitle: info.secondTitle,
isDel: "1",
customized: info.customized,
};
console.log("删除data=>", data);
addUpdateApplicationInfo(data).then((res) => {
if (res.status == 200) {
this.$message({
message: "删除成功!!!",
type: "success",
});
this.pullListApplicationInfo();
} else {
this.$message.error("操作失败,请稍后重试!!!");
}
console.log("删除data=>",data)
addUpdateApplicationInfo(data).then(res => {
if(res.status==200){
this.$message({
message: "删除成功!!!",
type: 'success'
});
this.pullListApplicationInfo()
}else{
this.$message.error('操作失败,请稍后重试!!!');
}
});
})
});
});
},
// 上下架数据
changeInfoStatus(info){
console.log("info=>",info)
let message = ""
if(info.status==1){// 当前为上架
info.status=2
message = "下架成功!!!"
}else{
info.status=1
message = "上架成功!!!"
changeInfoStatus(info) {
console.log("info=>", info);
let message = "";
if (info.status == 1) {
// 当前为上架
info.status = 2;
message = "下架成功!!!";
} else {
info.status = 1;
message = "上架成功!!!";
}
addUpdateApplicationInfo({
id: info.id,
......@@ -436,29 +472,29 @@ export default {
firstTitle: info.firstTitle,
secondTitle: info.secondTitle,
customized: info.customized,
}).then(res => {
if(res.status==200){
}).then((res) => {
if (res.status == 200) {
this.$message({
message: message,
type: 'success'
message: message,
type: "success",
});
}else{
this.$message.error('操作失败,请稍后重试!!!');
} else {
this.$message.error("操作失败,请稍后重试!!!");
}
});
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`);
this.infoPagination.pageSize = val
this.pullListApplicationInfo()
this.infoPagination.pageSize = val;
this.pullListApplicationInfo();
},
handleCurrentChange(val) {
// console.log(`当前页: ${val}`);
this.infoPagination.currentPage = val
this.pullListApplicationInfo()
this.infoPagination.currentPage = val;
this.pullListApplicationInfo();
},
onPreview(url){
this.form.coverImg = url
onPreview(url) {
this.form.coverImg = url;
},
showPreview(icon) {
this.currentIcon = icon;
......@@ -476,7 +512,7 @@ export default {
margin: 0 1% 0 1%;
width: 98%;
height: auto;
#addCateManager{
#addCateManager {
padding: 0 5%;
width: 90%;
height: auto;
......@@ -489,7 +525,9 @@ export default {
flex-direction: row;
justify-content: flex-start;
align-items: center;
.applyName,.status,.types {
.applyName,
.status,
.types {
width: auto;
height: 46px;
display: flex;
......@@ -501,7 +539,7 @@ export default {
margin: 0 10px 0 20px;
}
}
.addApp{
.addApp {
width: 220px;
height: 46px;
display: flex;
......@@ -509,7 +547,7 @@ export default {
justify-content: flex-end;
align-items: center;
overflow: hidden;
.add{
.add {
width: 50%;
height: 36px;
display: flex;
......@@ -517,8 +555,8 @@ export default {
justify-content: center;
align-items: center;
border-radius: 5px;
background-color: #5178F2;
color: #FFFFFF;
background-color: #5178f2;
color: #ffffff;
cursor: pointer;
}
}
......@@ -579,11 +617,12 @@ export default {
align-items: center;
cursor: pointer;
}
.edit,.upshelf{
.edit,
.upshelf {
color: #1890ff;
}
.offshelf {
color: #A6A9AD;
color: #a6a9ad;
}
.delete {
color: #fe4066;
......@@ -591,10 +630,10 @@ export default {
}
}
}
.infoPagination{
.infoPagination {
margin: 1% 1% 0 1%;
width: 98%;
height: auto;
}
}
</style>
\ No newline at end of file
</style>
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