Commit ca559480 by wangyalan-git

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

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