Commit 71eb5542 authored by rencs's avatar rencs

Merge branch 'dev_ren' into 'dev'

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

See merge request !21
parents ffa8f948 c5f191de
......@@ -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 = {
......
......@@ -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