Commit ca559480 by wangyalan-git

库房,部门,类别增加修改功能

parent 3a62844c
......@@ -100,6 +100,16 @@ export function addGoods(params) {
params
})
}
// 万科后台_根据物品id修改一条数据
export function updateGoods(data) {
return request({
url: 'vankeGoods/updateGoods',
method: 'post',
data
})
}
// 万科后台_插入多条物品信息
export function addGoodList(data) {
return request({
......
......@@ -26,6 +26,9 @@
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="warning"
@click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
......@@ -120,6 +123,9 @@ export default {
handleAdd(){
this.$refs.addDepartment.add()
},
handleUpdate(row){
this.$refs.addDepartment.update(row)
},
// 删除
handleDelete(id){
this.$confirm('是否删除该部门?', '提示', {
......
......@@ -26,7 +26,7 @@
</el-dialog>
</template>
<script>
import { addDepart } from '@/api/inventory'
import { addDepart,editDepart } from '@/api/inventory'
// 移动属性
export default {
name: 'addDepartmentModal',
......@@ -54,6 +54,14 @@ export default {
this.init()
this.visible= true
},
update(row){
let obj = JSON.stringify(row)
this.title="修改部门"
this.init()
this.model = JSON.parse(obj)
this.id = this.model.id
this.visible= true
},
// detail (id) {
// this.id = id
// this.init()
......@@ -73,6 +81,15 @@ export default {
this.$refs.attributeForm.validate((valid) => {
if (valid) {
// 验证通过
if(this.id){
editDepart({id: this.id,name: this.model.name }).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
}).catch(err => {
this.loading = false
})
}else {
addDepart(this.model).then(res => {
this.loading = false
this.visible = false
......@@ -81,6 +98,8 @@ export default {
this.loading = false
})
}
}
})
},
close () {
......
......@@ -18,6 +18,10 @@
align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="创建人"
align="center">
<template slot-scope="scope">{{scope.row.createName }}</template>
</el-table-column>
<el-table-column label="创建时间"
align="center">
<template slot-scope="scope">{{scope.row.createtime | formatTime}}</template>
......@@ -26,6 +30,9 @@
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="warning"
@click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
......@@ -120,6 +127,9 @@ export default {
handleAdd(){
this.$refs.addCategory.add()
},
handleUpdate(row){
this.$refs.addCategory.update(row)
},
// 删除
handleDelete(id){
this.$confirm('是否删除该物品类别?', '提示', {
......
......@@ -108,14 +108,17 @@
align="center">
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template>
</el-table-column>
<!-- <el-table-column label="操作"-->
<!-- align="center">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button size="mini"-->
<!-- type="danger"-->
<!-- @click="handleDelete(scope.row.id)">删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作"
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="warning"
@click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页栏 -->
......@@ -136,16 +139,18 @@
<import-goods-modal ref="importGoods" @ok="getList"></import-goods-modal>
<scan-put-storage ref="scanPut" @ok="getList"></scan-put-storage>
<scan-out-storage ref="scanOut" @ok="getList"></scan-out-storage>
<update-store-modal ref="updateStore" @ok="getList"></update-store-modal>
</div>
</template>
<script>
import moment from 'moment'
import { getGoodsList,getGoodsCategoryList,getStockRooms, editGoods } from '@/api/inventory'
import { getGoodsList,getGoodsCategoryList,getStockRooms, updateGoods } from '@/api/inventory'
import {getSuppliersList} from '@/api/supplier'
import AddGoodsModal from './modules/addGoodsModal'
import ImportGoodsModal from './modules/importGoodsModal'
import ScanPutStorage from './modules/scanPutStorage'
import ScanOutStorage from './modules/scanOutStorage'
import UpdateStoreModal from './modules/updateStoreModal'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
......@@ -162,7 +167,8 @@ export default {
ScanOutStorage,
AddGoodsModal,
ImportGoodsModal,
ScanPutStorage
ScanPutStorage,
UpdateStoreModal
},
data() {
return {
......@@ -212,18 +218,22 @@ export default {
this.multipleSelection = vals
},
// 删除
// handleDelete(id){
// this.$confirm('是否删除该物品?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// editGoods({id: id,deleteStatus: 0 }).then(res=>{
// this.getList()
// })
// }).catch(() => {
// });
// },
handleDelete(id){
this.$confirm('是否删除该物品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateGoods({id: id,deleteStatus: 0 }).then(res=>{
this.getList()
})
}).catch(() => {
});
},
// 修改
handleUpdate(row){
this.$refs.updateStore.update(row)
},
// 物品类别
getGoodsCategoryList(){
getGoodsCategoryList().then(res=>{
......
......@@ -149,7 +149,7 @@
<script>
import moment from 'moment'
import { getOutboundRecordList, getGoodsCategoryList, getStockRooms, getDepartmentList,updateOutboundRecord } from '@/api/inventory'
import UpdateNumModal from './modules/UpdateNumModal'
import UpdateNumModal from './modules/updateNumModal'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
......
......@@ -26,7 +26,7 @@
</el-dialog>
</template>
<script>
import { addGoodsCategory } from '@/api/inventory'
import { addGoodsCategory,editGoodsCategory } from '@/api/inventory'
// 移动属性
export default {
name: 'addCategory',
......@@ -54,6 +54,14 @@ export default {
this.init()
this.visible= true
},
update(row){
let obj = JSON.stringify(row)
this.title="修改物品类别"
this.init()
this.model = JSON.parse(obj)
this.id = this.model.id
this.visible= true
},
// detail (id) {
// this.id = id
// this.init()
......@@ -73,6 +81,15 @@ export default {
this.$refs.attributeForm.validate((valid) => {
if (valid) {
// 验证通过
if(this.id){
editGoodsCategory({id: this.id,name: this.model.name}).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
}).catch(err => {
this.loading = false
})
}else {
addGoodsCategory(this.model).then(res => {
this.loading = false
this.visible = false
......@@ -81,6 +98,8 @@ export default {
this.loading = false
})
}
}
})
},
close () {
......
......@@ -2,6 +2,7 @@
<el-dialog :visible.sync="visible"
:title="title"
center
@close="close"
width="500px">
<!-- start -->
<el-form :model="model"
......@@ -18,7 +19,7 @@
<span>{{model.categoryName}}</span>
</el-form-item>
<el-form-item label="出库数量:"
:rules="[{required: true, trigger: 'blur', message: '请输入出库数量'}]"
:rules="[{validator: validateNum,trigger: 'blur'}]"
prop="outboundNum">
<el-input size="small"
class="input-width"
......@@ -47,9 +48,21 @@
import { updateOutboundRecord } from '@/api/inventory'
// 移动属性
export default {
name: 'UpdateNumModal',
name: 'updateNumModal',
data () {
var validateNum = (rule, value, callback) => {
if (value === '') {
callback(new Error('数量不能为空'))
} else {
let myReg = /^\d{1,}$/
if (!myReg.test(value)) {
callback(new Error('数量必须为正整数'))
}
callback()
}
}
return {
validateNum: validateNum,
visible: false,
title: null,
loading: false,
......@@ -87,7 +100,7 @@ export default {
})
},
close () {
this.$emit('close')
this.$emit('ok')
this.visible = false
}
}
......
<template>
<el-dialog :visible.sync="visible"
:title="title"
center
@close="close"
width="500px">
<!-- start -->
<el-form :model="model"
ref="attributeForm"
v-loading="loading"
label-width="150px">
<el-form-item label="物品名称:"
:rules="[{required: true, trigger: 'blur', message: '请输入物品名称'}]"
prop="name">
<el-input size="small"
class="input-width"
placeholder="请输入物品名称"
v-model="model.name"></el-input>
</el-form-item>
<el-form-item label="型号:"
:rules="[{required: true, trigger: 'blur', message: '请输入型号'}]"
prop="goodsNo">
<el-input size="small"
class="input-width"
placeholder="请输入型号"
v-model="model.goodsNo"></el-input>
</el-form-item>
<el-form-item label="数量:"
:rules="[{validator: validateNum,trigger: 'blur'}]"
prop="goodsNum">
<el-input size="small"
class="input-width"
placeholder="请输入数量"
v-model="model.goodsNum"></el-input>
</el-form-item>
<el-form-item label="条形码:">
<span>{{model.barCode}}</span>
</el-form-item>
<el-form-item label="物品类别:">
<span>{{model.goodsCategoryName}}</span>
</el-form-item>
<el-form-item label="价格:">
<span>{{model.price}}</span>
</el-form-item>
<el-form-item label="供应商:">
<span>{{model.supplierName}}</span>
</el-form-item>
<el-form-item label="所属库房:">
<span>{{model.stockRoomName}}</span>
</el-form-item>
</el-form>
<div slot="footer">
<el-button type="primary"
@click="submit">确认</el-button>
<el-button @click="close">取消</el-button>
</div>
<!-- end -->
</el-dialog>
</template>
<script>
import { updateGoods } from '@/api/inventory'
// 移动属性
export default {
name: 'updateStoreModal',
data () {
var validateNum = (rule, value, callback) => {
if (value === '') {
callback(new Error('数量不能为空'))
} else {
let myReg = /^\d{1,}$/
if (!myReg.test(value)) {
callback(new Error('数量必须为正整数'))
}
callback()
}
}
return {
validateNum: validateNum,
visible: false,
title: null,
loading: false,
id: null,
model: {}
}
},
methods: {
init () {
this.$nextTick(() => {
this.$refs.attributeForm.clearValidate()
})
},
update(row){
this.id = null
this.title="修改出库数量"
this.init()
this.model = row
this.visible= true
},
// 提交保存
submit () {
this.$refs.attributeForm.validate((valid) => {
if (valid) {
// 验证通过
updateGoods(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
}).catch(err => {
this.loading = false
})
}
})
},
close () {
this.$emit('ok')
this.visible = false
}
}
}
</script>
<style scoped>
.input-width {
width: 200px;
}
</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