1、仓库采购单基本curd实现
This commit is contained in:
parent
69f0859f67
commit
1efab04d66
|
|
@ -0,0 +1,47 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
//获取仓库采购单列表
|
||||
export function getWarePurchaseList(parms) {
|
||||
return request({
|
||||
url: '/mall-ware/ware/purchase/list',
|
||||
method: 'get',
|
||||
params: parms
|
||||
})
|
||||
}
|
||||
|
||||
//删除仓库采购单
|
||||
export function delWarePurchase(ids) {
|
||||
return request({
|
||||
url: '/mall-ware/ware/purchase/delete',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
//获取仓库采购单详情
|
||||
export function getWarePurchase(id) {
|
||||
return request({
|
||||
url: `/mall-ware/ware/purchase/info/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//保存仓库采购单
|
||||
export function saveWarePurchase(data) {
|
||||
return request({
|
||||
url: `/mall-ware/ware/purchase/save`,
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
//修改仓库采购单
|
||||
export function editWarePurchase(data) {
|
||||
return request({
|
||||
url: `/mall-ware/ware/purchase/update`,
|
||||
method: 'put',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -17,6 +17,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {editWarePurchase, getWarePurchase, saveWarePurchase} from "@/api/mall/ware/ware-purchase";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -71,63 +73,35 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/ware/purchase/info/${this.dataForm.id}`),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams()
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataForm.assigneeId = data.purchase.assigneeId
|
||||
this.dataForm.assigneeName = data.purchase.assigneeName
|
||||
this.dataForm.phone = data.purchase.phone
|
||||
this.dataForm.priority = data.purchase.priority
|
||||
this.dataForm.status = data.purchase.status
|
||||
this.dataForm.wareId = data.purchase.wareId
|
||||
this.dataForm.amount = data.purchase.amount
|
||||
this.dataForm.createTime = data.purchase.createTime
|
||||
this.dataForm.updateTime = data.purchase.updateTime
|
||||
}
|
||||
getWarePurchase(this.dataForm.id).then(res => {
|
||||
this.dataForm = res.purchase
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http({
|
||||
url: this.$http.adornUrl(`/ware/purchase/${!this.dataForm.id ? 'save' : 'update'}`),
|
||||
method: 'post',
|
||||
data: this.$http.adornData({
|
||||
'id': this.dataForm.id || undefined,
|
||||
'assigneeId': this.dataForm.assigneeId,
|
||||
'assigneeName': this.dataForm.assigneeName,
|
||||
'phone': this.dataForm.phone,
|
||||
'priority': this.dataForm.priority,
|
||||
'status': this.dataForm.status,
|
||||
'wareId': this.dataForm.wareId,
|
||||
'amount': this.dataForm.amount,
|
||||
'createTime': this.dataForm.createTime,
|
||||
'updateTime': this.dataForm.updateTime
|
||||
if (!this.dataForm.id) {
|
||||
saveWarePurchase(this.dataForm).then(res => {
|
||||
this.$modal.notifySuccess("添加成功")
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
})
|
||||
}).then(({data}) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.error(data.msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
editWarePurchase(this.dataForm).then(res => {
|
||||
this.$modal.notifySuccess("修改成功")
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@
|
|||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="采购单id"></el-table-column>
|
||||
<el-table-column prop="assigneeId" header-align="center" align="center" label="采购人id"></el-table-column>
|
||||
<el-table-column prop="assigneeName" header-align="center" align="center" label="采购人名"></el-table-column>
|
||||
<el-table-column prop="phone" header-align="center" align="center" label="联系方式"></el-table-column>
|
||||
<el-table-column prop="priority" header-align="center" align="center" label="优先级"></el-table-column>
|
||||
<el-table-column prop="assigneeId" header-align="center" align="center" label="采购人id" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="assigneeName" header-align="center" align="center" label="采购人名" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="phone" header-align="center" align="center" label="联系方式" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="priority" header-align="center" align="center" label="优先级" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="status" header-align="center" align="center" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.status === 0">新建</el-tag>
|
||||
|
|
@ -57,10 +56,10 @@
|
|||
<el-tag type="danger" v-if="scope.row.status === 4">有异常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id"></el-table-column>
|
||||
<el-table-column prop="amount" header-align="center" align="center" label="总金额"></el-table-column>
|
||||
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期"></el-table-column>
|
||||
<el-table-column prop="updateTime" header-align="center" align="center" label="更新日期"></el-table-column>
|
||||
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="amount" header-align="center" align="center" label="总金额" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="createTime" header-align="center" align="center" label="创建日期" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column prop="updateTime" header-align="center" align="center" label="更新日期" :show-overflow-tooltip="true"></el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
|
@ -105,7 +104,7 @@
|
|||
|
||||
<script>
|
||||
import AddOrUpdate from "./purchase-add-or-update";
|
||||
import {delWarePurchase, getWarePurchaseList} from "@/api/mall/ware/ware-purchase-detail";
|
||||
import {delWarePurchase, getWarePurchaseList} from "@/api/mall/ware/ware-purchase";
|
||||
|
||||
export default {
|
||||
name: "Purchase",
|
||||
|
|
@ -134,7 +133,6 @@ export default {
|
|||
},
|
||||
|
||||
created() {
|
||||
this.getWares()
|
||||
this.getDataList();
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.xjs.mall.ware.controller;
|
||||
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.xjs.mall.ware.entity.PurchaseEntity;
|
||||
import com.xjs.mall.ware.service.PurchaseService;
|
||||
import com.xjs.utils.PageUtils;
|
||||
import com.xjs.mall.other.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -17,10 +21,11 @@ import java.util.Map;
|
|||
*
|
||||
* @author xiejs
|
||||
* @email 1294405880@qq.com
|
||||
* @date 2022-03-15 09:56:19
|
||||
* @since 2022-03-15 09:56:19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("ware/purchase")
|
||||
@Api(tags = "商城-仓库-采购单")
|
||||
public class PurchaseController {
|
||||
@Autowired
|
||||
private PurchaseService purchaseService;
|
||||
|
|
@ -28,7 +33,8 @@ public class PurchaseController {
|
|||
/**
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("列表")
|
||||
public R list(@RequestParam Map<String, Object> params){
|
||||
PageUtils page = purchaseService.queryPage(params);
|
||||
|
||||
|
|
@ -39,7 +45,8 @@ public class PurchaseController {
|
|||
/**
|
||||
* 信息
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
@GetMapping("/info/{id}")
|
||||
@ApiOperation("信息")
|
||||
public R info(@PathVariable("id") Long id){
|
||||
PurchaseEntity purchase = purchaseService.getById(id);
|
||||
|
||||
|
|
@ -49,7 +56,9 @@ public class PurchaseController {
|
|||
/**
|
||||
* 保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("保存")
|
||||
@Log(title = "采购单", businessType = BusinessType.INSERT)
|
||||
public R save(@RequestBody PurchaseEntity purchase){
|
||||
purchaseService.save(purchase);
|
||||
|
||||
|
|
@ -59,7 +68,9 @@ public class PurchaseController {
|
|||
/**
|
||||
* 修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改")
|
||||
@Log(title = "采购单", businessType = BusinessType.UPDATE)
|
||||
public R update(@RequestBody PurchaseEntity purchase){
|
||||
purchaseService.updateById(purchase);
|
||||
|
||||
|
|
@ -69,7 +80,9 @@ public class PurchaseController {
|
|||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除")
|
||||
@Log(title = "采购单", businessType = BusinessType.DELETE)
|
||||
public R delete(@RequestBody Long[] ids){
|
||||
purchaseService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue