array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 java微服务框架之Product - 爱码网
whyuan

<template>
<div class="product">
<el-col :span="2">
<el-button type="success" @click="openInsertDialog">添加</el-button>
</el-col>
<el-col :span="2">
<el-button type="danger" @click="delecteObjects">批量删除</el-button>
</el-col>
<el-col :span="18">
<el-form :inline="true" :model="formInline">
<el-form-item label="产品名">
<el-input v-model="formInline.name" placeholder="产品名"></el-input>
</el-form-item>
<el-form-item label="价格查询">
<el-input v-model="formInline.start" placeholder="¥" style="width: 6.25rem;"></el-input>
-<el-input v-model="formInline.end" placeholder="¥" style="width: 6.25rem;"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit">查询</el-button>
</el-form-item>
</el-form>
</el-col>
<el-table :data="tableData" style="width: 100%" ref="row" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55">
</el-table-column>
<el-table-column prop="id" label="编号" width="180">
</el-table-column>
<el-table-column prop="name" label="商品名称" width="180">
</el-table-column>
<el-table-column prop="pic" label="商品图片" width="180">
<template slot-scope="scope">
<el-image style="width: 100px; height: 100px" :src="scope.row.pic"></el-image>
</template>
</el-table-column>
<el-table-column prop="price" label="商品价格" width="180">
</el-table-column>
<el-table-column prop="createTime" label="商品上架时间" width="180">
</el-table-column>
<el-table-column prop="price" label="促销类型" width="180">
<template slot-scope="scope">
<span v-for="item in scope.row.salesList">{{item.name}}/</span>
</template>
</el-table-column>
<el-table-column label="产地" width="180">
<template slot-scope="scope">
<span>{{scope.row.province.cityName}}/{{scope.row.city.cityName}}/{{scope.row.xian.cityName}}</span>
</template>
</el-table-column>

<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="primary" @click="editOpen(scope.row)">编辑</el-button>
<el-button type="success">详情</el-button>
</template>
</el-table-column>
</el-table>
<el-row>
<el-col>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
:page-sizes="sizes" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</el-col>
</el-row>


<el-dialog title="添加对话框" :visible.sync="dialogVisibleInsert" width="50%">

<el-form ref="insertForm" :model="insertForm" label-width="80px">
<el-form-item label="商品名称">
<el-input v-model="insertForm.name"></el-input>
</el-form-item>
<el-form-item label="商品图片">
<el-upload class="avatar-uploader" action="http://localhost:8800/api/product/upload" :show-file-list="false"
:on-success="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="进货时间">
<el-date-picker v-model="insertForm.createTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="商品价格">
<el-input v-model="insertForm.price"></el-input>
</el-form-item>
<el-form-item label="产地">
<el-cascader v-model="values" :options="options" :props="props" @change="handleChange"></el-cascader>
</el-form-item>
<el-form-item label="促销">
<el-checkbox-group v-model="checkedSales" @change="handlechangeChecked">
<el-checkbox v-for="sale in sales" :label="sale">{{sale.name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="insertData(\'insertForm\')">确定</el-button>
<el-button @click="dialogVisibleInsert = false">取 消</el-button>
</el-form-item>
</el-form>
</el-dialog>

<el-dialog title="修改对话框" :visible.sync="dialogVisibleUpdate" width="50%">

<el-form ref="updateForm" :model="updateForm" label-width="80px">
<el-form-item label="商品名称">
<el-input v-model="updateForm.name"></el-input>
</el-form-item>
<el-form-item label="商品图片">
<el-upload class="avatar-uploader" action="http://localhost:8800/api/product/upload" :show-file-list="false"
:on-success="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item label="进货时间">
<el-date-picker v-model="updateForm.createTime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="商品价格">
<el-input v-model="updateForm.price"></el-input>
</el-form-item>
<el-form-item label="产地">
<el-cascader v-model="values" :options="options" :props="props" @change="handleChange"></el-cascader>
</el-form-item>
<el-form-item label="促销">
<el-checkbox-group v-model="checkedSales" @change="handlechangeChecked">
<el-checkbox v-for="sale in sales" :label="sale.id">{{sale.name}}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="updateData(\'updateForm\')">确定</el-button>
<el-button @click="dialogVisibleUpdate = false">取 消</el-button>
</el-form-item>
</el-form>
</el-dialog>

</div>
</template>

<script>
export default {
data() {
return {

dialogVisibleUpdate: false,
checkedSales: [],
sales: [],
options: [],
values: [],
props: {
value: \'id\',
label: \'cityName\',
children: \'cityList\'
},
imageUrl: \'\',
updateForm: {
id: \'\',
createTime: \'\',
name: \'\',
pic: \'\',
price: \'\',
pid: 0,
cid: 0,
xid: 0,
salesList: []
},
insertForm: {
createTime: \'\',
name: \'\',
pic: \'\',
price: \'\',
pid: 0,
cid: 0,
xid: 0,
salesList: []
},
dialogVisibleInsert: false,
row: [],
tableData: [],
total: 0,
page: 1,
size: 3,
sizes: [2, 3, 5],
formInline: {
name: \'\',
start: \'\',
end: \'\'
}
}
},
created: function() {
this.initData();
this.initCity();
this.initSales();
},
methods: {

editOpen(row) {
this.values[0] = row.pid;
this.values[1] = row.cid;
this.values[2] = row.xid;
this.dialogVisibleUpdate = true;
Object.assign(this.updateForm, row);
this.imageUrl = row.pic;

//促销回显
this.checkedSales = [];


for (var i = 0; i < row.salesList.length; i++) {
this.checkedSales[i] = row.salesList[i].id;
}

},
handlechangeChecked() {
if (this.dialogVisibleInsert) {
this.insertForm.salesList = [];
this.insertForm.salesList = this.checkedSales;
} else if (this.dialogVisibleUpdate) {
this.updateForm.salesList = [];
this.updateForm.salesList = this.checkedSales;
}
},
initSales() {
this.axios.get(\'http://localhost:8800/api/product/sales\').then((response) => {
this.sales = response.data.result;
})
},
handleChange(value) {
console.log(value);
if (this.dialogVisibleInsert) {
this.insertForm.pid = value[0];
this.insertForm.cid = value[1];
this.insertForm.xid = value[2];
} else if (this.dialogVisibleUpdate) {
this.updateForm.pid = value[0];
this.updateForm.cid = value[1];
this.updateForm.xid = value[2];
}

},
initCity() {
this.axios.get(\'http://localhost:8800/api/product/city\').then((response) => {
this.options = response.data.result;
})
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
if (this.dialogVisibleInsert) {
this.insertForm.pic = res.result;
} else if (this.dialogVisibleUpdate) {
this.updateForm.pic = res.result;
}
},
updateData() {
for (var n = 0; n < this.sales.length; n++) {

for (var j = 0; j < this.checkedSales.length; j++) {

if (this.sales[n].id == this.checkedSales[j]) {

this.updateForm.salesList[j] = this.sales[n];

}
}
}
this.axios.post(\'http://localhost:8800/api/product/insert\', this.updateForm).then((response) => {

if (response.data.result) {
this.$message({
type: \'success\',
message: \'修改成功!\'
});
this.dialogVisibleUpdate = false;
this.initData();
} else {
this.$message({
message: \'警告哦,修改失败\',
type: \'warning\'
});
}
});
},
insertData() {
console.log(this.insertForm);
this.axios.post(\'http://localhost:8800/api/product/insert\', this.insertForm).then((response) => {

if (response.data.result) {
this.$message({
type: \'success\',
message: \'添加成功!\'
});
this.dialogVisibleInsert = false;
this.initData();
} else {
this.$message({
message: \'警告哦,添加失败\',
type: \'warning\'
});
}
});
},
openInsertDialog() {
this.dialogVisibleInsert = true;
},
// 批量删除
delecteObjects() {
this.$confirm(\'此操作将永久删除该文件, 是否继续?\', \'提示\', {
confirmButtonText: \'确定\',
cancelButtonText: \'取消\',
type: \'warning\'
}).then(() => {
this.axios.post(\'http://localhost:8800/api/product/delete\', this.row).then((response) => {
if (response.data.result) {
this.$message({
type: \'success\',
message: \'删除成功!\'
});
this.initData();
}
})

}).catch(() => {
this.$message({
type: \'info\',
message: \'已取消删除\'
});
});
},
onSubmit() {
this.initData();
},
handleSelectionChange(val) {
console.log(val);
this.row = val;
},
handleSizeChange(val) {
this.size = val;
this.initData();
},
handleCurrentChange(val) {
this.page = val;
this.initData();
},
initData() {
this.axios.get(\'http://localhost:8800/api/product/list\', {
params: {
page: this.page,
size: this.size,
name: this.formInline.name,
start: this.formInline.start,
end: this.formInline.end
}
}).then((res) => {
console.log(res);
this.tableData = res.data.result.content;
this.total = res.data.result.totalElements;
});
}
}
}
</script>

<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}

.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}

.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}

.avatar {
width: 178px;
height: 178px;
display: block;
}
</style>

分类:

技术点:

相关文章: