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