Commit 486550b3 authored by rencs's avatar rencs

Merge branch 'dev_ren' into 'master'

行业价格,验证样式,价格精度

See merge request !20
parents 4e19cb97 c5f191de
...@@ -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 = {
......
...@@ -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>
...@@ -129,7 +151,8 @@ ...@@ -129,7 +151,8 @@
: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>
<!-- 使用图片查看器预览当前缩略图 --> <!-- 使用图片查看器预览当前缩略图 -->
...@@ -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,14 +399,14 @@ export default { ...@@ -364,14 +399,14 @@ 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,
...@@ -392,31 +427,32 @@ export default { ...@@ -392,31 +427,32 @@ export default {
secondTitle: info.secondTitle, secondTitle: info.secondTitle,
isDel: "1", isDel: "1",
customized: info.customized, customized: info.customized,
} };
console.log("删除data=>",data) console.log("删除data=>", data);
addUpdateApplicationInfo(data).then(res => { addUpdateApplicationInfo(data).then((res) => {
if(res.status==200){ if (res.status == 200) {
this.$message({ this.$message({
message: "删除成功!!!", message: "删除成功!!!",
type: 'success' type: "success",
}); });
this.pullListApplicationInfo() this.pullListApplicationInfo();
}else{ } else {
this.$message.error('操作失败,请稍后重试!!!'); 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,7 +630,7 @@ export default { ...@@ -591,7 +630,7 @@ export default {
} }
} }
} }
.infoPagination{ .infoPagination {
margin: 1% 1% 0 1%; margin: 1% 1% 0 1%;
width: 98%; width: 98%;
height: auto; height: auto;
......
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