java微服务框架之Product

2021-04-22 09:30

阅读:466

标签:微服务   type   var   model   fir   layout   tar   hid   编辑   

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 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

for (var j = 0; 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;
});
}
}
}

.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;
}

java微服务框架之Product

标签:微服务   type   var   model   fir   layout   tar   hid   编辑   

原文地址:https://www.cnblogs.com/whyuan/p/13276822.html


评论


亲,登录后才可以留言!