1、仓库采购单基本curd实现

pull/254/head
xjs 4 years ago
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> </template>
<script> <script>
import {editWarePurchase, getWarePurchase, saveWarePurchase} from "@/api/mall/ware/ware-purchase";
export default { export default {
data() { data() {
return { return {
@ -71,63 +73,35 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (this.dataForm.id) { if (this.dataForm.id) {
this.$http({ getWarePurchase(this.dataForm.id).then(res => {
url: this.$http.adornUrl(`/ware/purchase/info/${this.dataForm.id}`), this.dataForm = res.purchase
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
}
}) })
} }
}) })
}, },
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ if (!this.dataForm.id) {
url: this.$http.adornUrl(`/ware/purchase/${!this.dataForm.id ? 'save' : 'update'}`), saveWarePurchase(this.dataForm).then(res => {
method: 'post', this.$modal.notifySuccess("添加成功")
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
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false this.visible = false
this.$emit('refreshDataList') this.$emit('refreshDataList')
}
}) })
} else { } else {
this.$message.error(data.msg) editWarePurchase(this.dataForm).then(res => {
} this.$modal.notifySuccess("修改成功")
this.visible = false
this.$emit('refreshDataList')
}) })
} }
})
} }
})
},
} }
} }
</script> </script>

@ -43,11 +43,10 @@
style="width: 100%;" style="width: 100%;"
> >
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> <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" :show-overflow-tooltip="true"></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="采购人名" :show-overflow-tooltip="true"></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="联系方式" :show-overflow-tooltip="true"></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="优先级" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="priority" header-align="center" align="center" label="优先级"></el-table-column>
<el-table-column prop="status" header-align="center" align="center" label="状态"> <el-table-column prop="status" header-align="center" align="center" label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.status === 0"></el-tag> <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> <el-tag type="danger" v-if="scope.row.status === 4"></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id"></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="总金额"></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="创建日期"></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="更新日期"></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="操作"> <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -105,7 +104,7 @@
<script> <script>
import AddOrUpdate from "./purchase-add-or-update"; 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 { export default {
name: "Purchase", name: "Purchase",
@ -134,7 +133,6 @@ export default {
}, },
created() { created() {
this.getWares()
this.getDataList(); this.getDataList();
}, },

@ -1,9 +1,13 @@
package com.xjs.mall.ware.controller; 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.entity.PurchaseEntity;
import com.xjs.mall.ware.service.PurchaseService; import com.xjs.mall.ware.service.PurchaseService;
import com.xjs.utils.PageUtils; import com.xjs.utils.PageUtils;
import com.xjs.mall.other.R; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -17,10 +21,11 @@ import java.util.Map;
* *
* @author xiejs * @author xiejs
* @email 1294405880@qq.com * @email 1294405880@qq.com
* @date 2022-03-15 09:56:19 * @since 2022-03-15 09:56:19
*/ */
@RestController @RestController
@RequestMapping("ware/purchase") @RequestMapping("ware/purchase")
@Api(tags = "商城-仓库-采购单")
public class PurchaseController { public class PurchaseController {
@Autowired @Autowired
private PurchaseService purchaseService; private PurchaseService purchaseService;
@ -28,7 +33,8 @@ public class PurchaseController {
/** /**
* *
*/ */
@RequestMapping("/list") @GetMapping("/list")
@ApiOperation("列表")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = purchaseService.queryPage(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){ public R info(@PathVariable("id") Long id){
PurchaseEntity purchase = purchaseService.getById(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){ public R save(@RequestBody PurchaseEntity purchase){
purchaseService.save(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){ public R update(@RequestBody PurchaseEntity purchase){
purchaseService.updateById(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){ public R delete(@RequestBody Long[] ids){
purchaseService.removeByIds(Arrays.asList(ids)); purchaseService.removeByIds(Arrays.asList(ids));

Loading…
Cancel
Save