后台系统库存管理页面

develop
ddyd 1 week ago
parent 6ebf3e0e62
commit a6aa6cae25

@ -1,8 +1,15 @@
package com.bookstore.bookmall.ware;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@MapperScan("com.bookstore.bookmall.ware.dao")
@EnableDiscoveryClient
@SpringBootApplication
public class BookWareApplication {

@ -1 +1 @@
spring.application.name=book-ware
spring.application.name=mall-ware

@ -7,9 +7,10 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1
server-addr: 127.0.0.1:8848
application:
name: mall-ware
mybatis-plus:
config-locations: classpath*:/mapper/**/*.xml #classpath*中的*指的是不止引用自己路径的mapper依赖的jar包也扫描
global-config:

@ -29,6 +29,15 @@ spring:
filters:
- RewritePath=/api/thirdparty(?<segment>.*), /$\{segment}
#ware服务
- id: ware_route
uri: lb://mall-ware
predicates:
- Path=/api/ware/**
filters:
- RewritePath=/api/(?<segment>.*), /$\{segment}
#member服务
- id: member_route
uri: lb://book-member

@ -0,0 +1,132 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="优先级" prop="priority">
<el-input v-model="dataForm.priority" placeholder="优先级"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
assigneeId: '',
assigneeName: '',
phone: '',
priority: '',
status: 0,
wareId: '',
amount: '',
createTime: '',
updateTime: ''
},
dataRule: {
assigneeId: [
{ required: true, message: '采购人id不能为空', trigger: 'blur' }
],
assigneeName: [
{ required: true, message: '采购人名不能为空', trigger: 'blur' }
],
phone: [
{ required: true, message: '联系方式不能为空', trigger: 'blur' }
],
priority: [
{ required: true, message: '优先级不能为空', trigger: 'blur' }
],
status: [
{ required: true, message: '状态不能为空', trigger: 'blur' }
],
wareId: [
{ required: true, message: '仓库id不能为空', trigger: 'blur' }
],
amount: [
{ required: true, message: '总金额不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: '创建日期不能为空', trigger: 'blur' }
],
updateTime: [
{ required: true, message: '更新日期不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
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
}
})
}
})
},
//
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
})
}).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)
}
})
}
})
}
}
}
</script>

@ -0,0 +1,265 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="状态">
<el-select style="width:120px;" v-model="dataForm.status" placeholder="请选择状态" clearable>
<el-option label="新建" :value="0"></el-option>
<el-option label="已分配" :value="1"></el-option>
<el-option label="已领取" :value="2"></el-option>
<el-option label="已完成" :value="3"></el-option>
<el-option label="有异常" :value="4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字">
<el-input style="width:120px;" v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button
v-if="isAuth('ware:purchase:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button>
<el-button
v-if="isAuth('ware:purchase:delete')"
type="danger"
@click="deleteHandle()"
:disabled="dataListSelections.length <= 0"
>批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="status" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status == 0"></el-tag>
<el-tag type="info" v-if="scope.row.status == 1"></el-tag>
<el-tag type="warning" v-if="scope.row.status == 2"></el-tag>
<el-tag type="success" v-if="scope.row.status == 3"></el-tag>
<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 fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="small"
v-if="scope.row.status==0||scope.row.status==1"
@click="opendrawer(scope.row)"
>分配</el-button>
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog title="分配采购人员" :visible.sync="caigoudialogVisible" width="30%">
<el-select v-model="userId" filterable placeholder="请选择">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.username"
:value="item.userId"
></el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="caigoudialogVisible = false"> </el-button>
<el-button type="primary" @click="assignUser"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from "./purchase-add-or-update";
export default {
data() {
return {
currentRow: {},
dataForm: {
key: "",
status: ""
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
caigoudialogVisible: false,
userId: "",
userList: []
};
},
components: {
AddOrUpdate
},
activated() {
this.getDataList();
},
created() {
},
methods: {
opendrawer(row){
this.getUserList();
this.currentRow = row;
this.caigoudialogVisible = true;
},
assignUser() {
let _this = this;
let user = {};
this.userList.forEach(item=>{
if(item.userId == _this.userId){
user = item;
}
});
this.caigoudialogVisible = false;
this.$http({
url: this.$http.adornUrl(
`/ware/purchase/update`
),
method: "post",
data: this.$http.adornData({
id: this.currentRow.id || undefined,
assigneeId: user.userId,
assigneeName: user.username,
phone: user.mobile,
status: 1
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500
});
this.userId = "";
this.getDataList();
} else {
this.$message.error(data.msg);
}
});
},
getUserList() {
this.$http({
url: this.$http.adornUrl("/sys/user/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.userList = data.page.list;
});
},
//
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/ware/purchase/list"),
method: "get",
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
this.totalPage = data.page.totalCount;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
//
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/ware/purchase/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
}
};
</script>

@ -0,0 +1,148 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="120px"
>
<el-form-item label="采购商品id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="采购商品id"></el-input>
</el-form-item>
<el-form-item label="采购数量" prop="skuNum">
<el-input v-model="dataForm.skuNum" placeholder="采购数量"></el-input>
</el-form-item>
<el-form-item label="仓库" prop="wareId">
<el-select v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<!-- [0新建1已分配2正在采购3已完成4采购失败] -->
<!-- <el-form-item label="状态" prop="status">
<el-select v-model="dataForm.status" placeholder="请选择状态" clearable>
<el-option label="新建" :value="0"></el-option>
<el-option label="已分配" :value="1"></el-option>
<el-option label="正在采购" :value="2"></el-option>
<el-option label="已完成" :value="3"></el-option>
<el-option label="采购失败" :value="4"></el-option>
</el-select>
</el-form-item>-->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
wareList: [],
dataForm: {
id: 0,
purchaseId: "",
skuId: "",
skuNum: "",
skuPrice: "",
wareId: "",
status: 0
},
dataRule: {
skuId: [
{ required: true, message: "采购商品id不能为空", trigger: "blur" }
],
skuNum: [
{ required: true, message: "采购数量不能为空", trigger: "blur" }
],
wareId: [{ required: true, message: "仓库id不能为空", trigger: "blur" }]
}
};
},
created(){
this.getWares();
},
methods: {
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(
`/ware/purchasedetail/info/${this.dataForm.id}`
),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.purchaseId = data.purchaseDetail.purchaseId;
this.dataForm.skuId = data.purchaseDetail.skuId;
this.dataForm.skuNum = data.purchaseDetail.skuNum;
this.dataForm.skuPrice = data.purchaseDetail.skuPrice;
this.dataForm.wareId = data.purchaseDetail.wareId;
this.dataForm.status = data.purchaseDetail.status;
}
});
}
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl(
`/ware/purchasedetail/${!this.dataForm.id ? "save" : "update"}`
),
method: "post",
data: this.$http.adornData({
id: this.dataForm.id || undefined,
purchaseId: this.dataForm.purchaseId,
skuId: this.dataForm.skuId,
skuNum: this.dataForm.skuNum,
skuPrice: this.dataForm.skuPrice,
wareId: this.dataForm.wareId,
status: this.dataForm.status
})
}).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);
}
});
}
});
}
}
};
</script>

@ -0,0 +1,294 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="仓库">
<el-select style="width:120px;" v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select style="width:120px;" v-model="dataForm.status" placeholder="请选择状态" clearable>
<el-option label="新建" :value="0"></el-option>
<el-option label="已分配" :value="1"></el-option>
<el-option label="正在采购" :value="2"></el-option>
<el-option label="已完成" :value="3"></el-option>
<el-option label="采购失败" :value="4"></el-option>
</el-select>
</el-form-item>
<el-form-item label="关键字">
<el-input style="width:120px;" v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button
v-if="isAuth('ware:purchasedetail:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button>
<el-dropdown @command="handleBatchCommand" :disabled="dataListSelections.length <= 0">
<el-button type="danger">
批量操作
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="delete">批量删除</el-dropdown-item>
<el-dropdown-item command="merge">合并整单</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="purchaseId" header-align="center" align="center" label="采购单id"></el-table-column>
<el-table-column prop="skuId" header-align="center" align="center" label="采购商品id"></el-table-column>
<el-table-column prop="skuNum" header-align="center" align="center" label="采购数量"></el-table-column>
<el-table-column prop="skuPrice" header-align="center" align="center" label="采购金额"></el-table-column>
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id"></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>
<el-tag type="info" v-if="scope.row.status==1"></el-tag>
<el-tag type="wanring" v-if="scope.row.status==2"></el-tag>
<el-tag type="success" v-if="scope.row.status==3"></el-tag>
<el-tag type="danger" v-if="scope.row.status==4"></el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog title="合并到整单" :visible.sync="mergedialogVisible">
<!-- id assignee_id assignee_name phone priority status -->
<el-select v-model="purchaseId" placeholder="请选择" clearable filterable>
<el-option
v-for="item in purchasetableData"
:key="item.id"
:label="item.id"
:value="item.id"
>
<span style="float: left">{{ item.id }}</span>
<span
style="float: right; color: #8492a6; font-size: 13px"
>{{ item.assigneeName }}{{item.phone}}</span>
</el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="mergedialogVisible = false"> </el-button>
<el-button type="primary" @click="mergeItem"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import AddOrUpdate from "./purchasedetail-add-or-update";
export default {
data() {
return {
dataForm: {
key: "",
status: "",
wareId: ""
},
wareList: [],
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
mergedialogVisible: false,
purchaseId: "",
purchasetableData: []
};
},
components: {
AddOrUpdate
},
activated() {
this.getDataList();
this.getWares();
},
methods: {
mergeItem() {
let items = this.dataListSelections.map(item => {
return item.id;
});
if (!this.purchaseId) {
this.$confirm(
"没有选择任何【采购单】,将自动创建新单进行合并。确认吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
)
.then(() => {
this.$http({
url: this.$http.adornUrl("/ware/purchase/merge"),
method: "post",
data: this.$http.adornData({ items: items }, false)
}).then(({ data }) => {
this.getDataList();
});
})
.catch(() => {});
} else {
this.$http({
url: this.$http.adornUrl("/ware/purchase/merge"),
method: "post",
data: this.$http.adornData(
{ purchaseId: this.purchaseId, items: items },
false
)
}).then(({ data }) => {
this.getDataList();
});
}
this.mergedialogVisible = false;
},
getUnreceivedPurchase() {
this.$http({
url: this.$http.adornUrl("/ware/purchase/unreceive/list"),
method: "get",
params: this.$http.adornParams({})
}).then(({ data }) => {
this.purchasetableData = data.page.list;
});
},
handleBatchCommand(cmd) {
if (cmd == "delete") {
this.deleteHandle();
}
if (cmd == "merge") {
if (this.dataListSelections.length != 0) {
this.getUnreceivedPurchase();
this.mergedialogVisible = true;
} else {
this.$alert("请先选择需要合并的需求", "提示", {
confirmButtonText: "确定",
callback: action => {}
});
}
}
},
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
//
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/ware/purchasedetail/list"),
method: "get",
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key,
status: this.dataForm.status,
wareId: this.dataForm.wareId
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
this.totalPage = data.page.totalCount;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
//
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/ware/purchasedetail/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
}
};
</script>

@ -0,0 +1,184 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="仓库">
<el-select style="width:160px;" v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="skuId">
<el-input v-model="dataForm.skuId" placeholder="skuId" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button v-if="isAuth('ware:waresku:save')" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button
v-if="isAuth('ware:waresku:delete')"
type="danger"
@click="deleteHandle()"
:disabled="dataListSelections.length <= 0"
>批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="skuId" header-align="center" align="center" label="sku_id"></el-table-column>
<el-table-column prop="wareId" header-align="center" align="center" label="仓库id"></el-table-column>
<el-table-column prop="stock" header-align="center" align="center" label="库存数"></el-table-column>
<el-table-column prop="skuName" header-align="center" align="center" label="sku_name"></el-table-column>
<el-table-column prop="stockLocked" header-align="center" align="center" label="锁定库存"></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
></el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from "./waresku-add-or-update";
export default {
data() {
return {
wareList: [],
dataForm: {
wareId: "",
skuId: ""
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
};
},
components: {
AddOrUpdate
},
activated() {
console.log("接收到", this.$route.query.skuId);
if (this.$route.query.skuId) {
this.dataForm.skuId = this.$route.query.skuId;
}
this.getWares();
this.getDataList();
},
methods: {
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
//
getDataList() {
this.dataListLoading = true;
this.$http({
url: this.$http.adornUrl("/ware/waresku/list"),
method: "get",
params: this.$http.adornParams({
page: this.pageIndex,
limit: this.pageSize,
skuId: this.dataForm.skuId,
wareId: this.dataForm.wareId
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list;
this.totalPage = data.page.totalCount;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//
selectionChangeHandle(val) {
this.dataListSelections = val;
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
//
deleteHandle(id) {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl("/ware/waresku/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
}
});
} else {
this.$message.error(data.msg);
}
});
});
}
}
};
</script>

@ -0,0 +1,239 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button v-if="isAuth('ware:wareordertask:save')" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-if="isAuth('ware:wareordertask:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="orderId"
header-align="center"
align="center"
label="order_id">
</el-table-column>
<el-table-column
prop="orderSn"
header-align="center"
align="center"
label="order_sn">
</el-table-column>
<el-table-column
prop="consignee"
header-align="center"
align="center"
label="收货人">
</el-table-column>
<el-table-column
prop="consigneeTel"
header-align="center"
align="center"
label="收货人电话">
</el-table-column>
<el-table-column
prop="deliveryAddress"
header-align="center"
align="center"
label="配送地址">
</el-table-column>
<el-table-column
prop="orderComment"
header-align="center"
align="center"
label="订单备注">
</el-table-column>
<el-table-column
prop="paymentWay"
header-align="center"
align="center"
label="付款方式">
<template slot-scope="scope">
<el-tag v-if="scope.row.payment==1">线</el-tag>
<el-tag v-if="scope.row.payment==2"></el-tag>
</template>
</el-table-column>
<el-table-column
prop="taskStatus"
header-align="center"
align="center"
label="任务状态">
</el-table-column>
<el-table-column
prop="orderBody"
header-align="center"
align="center"
label="订单描述">
</el-table-column>
<el-table-column
prop="trackingNo"
header-align="center"
align="center"
label="物流单号">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="create_time">
</el-table-column>
<el-table-column
prop="wareId"
header-align="center"
align="center"
label="仓库id">
</el-table-column>
<el-table-column
prop="taskComment"
header-align="center"
align="center"
label="工作单备注">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './wareordertask-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
//
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/ware/wareordertask/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle (val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/ware/wareordertask/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

@ -0,0 +1,102 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="仓库名" prop="name">
<el-input v-model="dataForm.name" placeholder="仓库名"></el-input>
</el-form-item>
<el-form-item label="仓库地址" prop="address">
<el-input v-model="dataForm.address" placeholder="仓库地址"></el-input>
</el-form-item>
<el-form-item label="区域编码" prop="areacode">
<el-input v-model="dataForm.areacode" placeholder="区域编码"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
name: '',
address: '',
areacode: ''
},
dataRule: {
name: [
{ required: true, message: '仓库名不能为空', trigger: 'blur' }
],
address: [
{ required: true, message: '仓库地址不能为空', trigger: 'blur' }
],
areacode: [
{ required: true, message: '区域编码不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/ware/wareinfo/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.name = data.wareInfo.name
this.dataForm.address = data.wareInfo.address
this.dataForm.areacode = data.wareInfo.areacode
}
})
}
})
},
//
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/ware/wareinfo/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'name': this.dataForm.name,
'address': this.dataForm.address,
'areacode': this.dataForm.areacode
})
}).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)
}
})
}
})
}
}
}
</script>

@ -0,0 +1,175 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button v-if="isAuth('ware:wareinfo:save')" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-if="isAuth('ware:wareinfo:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="name"
header-align="center"
align="center"
label="仓库名">
</el-table-column>
<el-table-column
prop="address"
header-align="center"
align="center"
label="仓库地址">
</el-table-column>
<el-table-column
prop="areacode"
header-align="center"
align="center"
label="区域编码">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './wareinfo-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
//
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/ware/wareinfo/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle (val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/ware/wareinfo/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

@ -0,0 +1,192 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="order_id" prop="orderId">
<el-input v-model="dataForm.orderId" placeholder="order_id"></el-input>
</el-form-item>
<el-form-item label="order_sn" prop="orderSn">
<el-input v-model="dataForm.orderSn" placeholder="order_sn"></el-input>
</el-form-item>
<el-form-item label="收货人" prop="consignee">
<el-input v-model="dataForm.consignee" placeholder="收货人"></el-input>
</el-form-item>
<el-form-item label="收货人电话" prop="consigneeTel">
<el-input v-model="dataForm.consigneeTel" placeholder="收货人电话"></el-input>
</el-form-item>
<el-form-item label="配送地址" prop="deliveryAddress">
<el-input v-model="dataForm.deliveryAddress" placeholder="配送地址"></el-input>
</el-form-item>
<el-form-item label="订单备注" prop="orderComment">
<el-input v-model="dataForm.orderComment" placeholder="订单备注"></el-input>
</el-form-item>
<el-form-item label="付款方式【 1:在线付款 2:货到付款】" prop="paymentWay">
<el-input v-model="dataForm.paymentWay" placeholder="付款方式【 1:在线付款 2:货到付款】"></el-input>
</el-form-item>
<el-form-item label="任务状态" prop="taskStatus">
<el-input v-model="dataForm.taskStatus" placeholder="任务状态"></el-input>
</el-form-item>
<el-form-item label="订单描述" prop="orderBody">
<el-input v-model="dataForm.orderBody" placeholder="订单描述"></el-input>
</el-form-item>
<el-form-item label="物流单号" prop="trackingNo">
<el-input v-model="dataForm.trackingNo" placeholder="物流单号"></el-input>
</el-form-item>
<el-form-item label="create_time" prop="createTime">
<el-input v-model="dataForm.createTime" placeholder="create_time"></el-input>
</el-form-item>
<el-form-item label="仓库id" prop="wareId">
<el-input v-model="dataForm.wareId" placeholder="仓库id"></el-input>
</el-form-item>
<el-form-item label="工作单备注" prop="taskComment">
<el-input v-model="dataForm.taskComment" placeholder="工作单备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
orderId: '',
orderSn: '',
consignee: '',
consigneeTel: '',
deliveryAddress: '',
orderComment: '',
paymentWay: '',
taskStatus: '',
orderBody: '',
trackingNo: '',
createTime: '',
wareId: '',
taskComment: ''
},
dataRule: {
orderId: [
{ required: true, message: 'order_id不能为空', trigger: 'blur' }
],
orderSn: [
{ required: true, message: 'order_sn不能为空', trigger: 'blur' }
],
consignee: [
{ required: true, message: '收货人不能为空', trigger: 'blur' }
],
consigneeTel: [
{ required: true, message: '收货人电话不能为空', trigger: 'blur' }
],
deliveryAddress: [
{ required: true, message: '配送地址不能为空', trigger: 'blur' }
],
orderComment: [
{ required: true, message: '订单备注不能为空', trigger: 'blur' }
],
paymentWay: [
{ required: true, message: '付款方式【 1:在线付款 2:货到付款】不能为空', trigger: 'blur' }
],
taskStatus: [
{ required: true, message: '任务状态不能为空', trigger: 'blur' }
],
orderBody: [
{ required: true, message: '订单描述不能为空', trigger: 'blur' }
],
trackingNo: [
{ required: true, message: '物流单号不能为空', trigger: 'blur' }
],
createTime: [
{ required: true, message: 'create_time不能为空', trigger: 'blur' }
],
wareId: [
{ required: true, message: '仓库id不能为空', trigger: 'blur' }
],
taskComment: [
{ required: true, message: '工作单备注不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/ware/wareordertask/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.orderId = data.wareOrderTask.orderId
this.dataForm.orderSn = data.wareOrderTask.orderSn
this.dataForm.consignee = data.wareOrderTask.consignee
this.dataForm.consigneeTel = data.wareOrderTask.consigneeTel
this.dataForm.deliveryAddress = data.wareOrderTask.deliveryAddress
this.dataForm.orderComment = data.wareOrderTask.orderComment
this.dataForm.paymentWay = data.wareOrderTask.paymentWay
this.dataForm.taskStatus = data.wareOrderTask.taskStatus
this.dataForm.orderBody = data.wareOrderTask.orderBody
this.dataForm.trackingNo = data.wareOrderTask.trackingNo
this.dataForm.createTime = data.wareOrderTask.createTime
this.dataForm.wareId = data.wareOrderTask.wareId
this.dataForm.taskComment = data.wareOrderTask.taskComment
}
})
}
})
},
//
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/ware/wareordertask/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'orderId': this.dataForm.orderId,
'orderSn': this.dataForm.orderSn,
'consignee': this.dataForm.consignee,
'consigneeTel': this.dataForm.consigneeTel,
'deliveryAddress': this.dataForm.deliveryAddress,
'orderComment': this.dataForm.orderComment,
'paymentWay': this.dataForm.paymentWay,
'taskStatus': this.dataForm.taskStatus,
'orderBody': this.dataForm.orderBody,
'trackingNo': this.dataForm.trackingNo,
'createTime': this.dataForm.createTime,
'wareId': this.dataForm.wareId,
'taskComment': this.dataForm.taskComment
})
}).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)
}
})
}
})
}
}
}
</script>

@ -0,0 +1,111 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="sku_name" prop="skuName">
<el-input v-model="dataForm.skuName" placeholder="sku_name"></el-input>
</el-form-item>
<el-form-item label="购买个数" prop="skuNum">
<el-input v-model="dataForm.skuNum" placeholder="购买个数"></el-input>
</el-form-item>
<el-form-item label="工作单id" prop="taskId">
<el-input v-model="dataForm.taskId" placeholder="工作单id"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
skuId: '',
skuName: '',
skuNum: '',
taskId: ''
},
dataRule: {
skuId: [
{ required: true, message: 'sku_id不能为空', trigger: 'blur' }
],
skuName: [
{ required: true, message: 'sku_name不能为空', trigger: 'blur' }
],
skuNum: [
{ required: true, message: '购买个数不能为空', trigger: 'blur' }
],
taskId: [
{ required: true, message: '工作单id不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/ware/wareordertaskdetail/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.wareOrderTaskDetail.skuId
this.dataForm.skuName = data.wareOrderTaskDetail.skuName
this.dataForm.skuNum = data.wareOrderTaskDetail.skuNum
this.dataForm.taskId = data.wareOrderTaskDetail.taskId
}
})
}
})
},
//
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/ware/wareordertaskdetail/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'skuId': this.dataForm.skuId,
'skuName': this.dataForm.skuName,
'skuNum': this.dataForm.skuNum,
'taskId': this.dataForm.taskId
})
}).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)
}
})
}
})
}
}
}
</script>

@ -0,0 +1,181 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()"></el-button>
<el-button v-if="isAuth('ware:wareordertaskdetail:save')" type="primary" @click="addOrUpdateHandle()"></el-button>
<el-button v-if="isAuth('ware:wareordertaskdetail:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0"></el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
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="skuId"
header-align="center"
align="center"
label="sku_id">
</el-table-column>
<el-table-column
prop="skuName"
header-align="center"
align="center"
label="sku_name">
</el-table-column>
<el-table-column
prop="skuNum"
header-align="center"
align="center"
label="购买个数">
</el-table-column>
<el-table-column
prop="taskId"
header-align="center"
align="center"
label="工作单id">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)"></el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './wareordertaskdetail-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
//
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/ware/wareordertaskdetail/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
//
selectionChangeHandle (val) {
this.dataListSelections = val
},
// /
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
//
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/ware/wareordertaskdetail/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

@ -0,0 +1,140 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="120px"
>
<el-form-item label="sku_id" prop="skuId">
<el-input v-model="dataForm.skuId" placeholder="sku_id"></el-input>
</el-form-item>
<el-form-item label="仓库" prop="wareId">
<el-select v-model="dataForm.wareId" placeholder="请选择仓库" clearable>
<el-option :label="w.name" :value="w.id" v-for="w in wareList" :key="w.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="库存数" prop="stock">
<el-input v-model="dataForm.stock" placeholder="库存数"></el-input>
</el-form-item>
<el-form-item label="sku_name" prop="skuName">
<el-input v-model="dataForm.skuName" placeholder="sku_name"></el-input>
</el-form-item>
<el-form-item label="锁定库存" prop="stockLocked">
<el-input v-model="dataForm.stockLocked" placeholder="锁定库存"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()"></el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data() {
return {
visible: false,
wareList: [],
dataForm: {
id: 0,
skuId: "",
wareId: "",
stock: 0,
skuName: "",
stockLocked: 0
},
dataRule: {
skuId: [{ required: true, message: "sku_id不能为空", trigger: "blur" }],
wareId: [
{ required: true, message: "仓库id不能为空", trigger: "blur" }
],
stock: [{ required: true, message: "库存数不能为空", trigger: "blur" }],
skuName: [
{ required: true, message: "sku_name不能为空", trigger: "blur" }
]
}
};
},
created(){
this.getWares();
},
methods: {
getWares() {
this.$http({
url: this.$http.adornUrl("/ware/wareinfo/list"),
method: "get",
params: this.$http.adornParams({
page: 1,
limit: 500
})
}).then(({ data }) => {
this.wareList = data.page.list;
});
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/ware/waresku/info/${this.dataForm.id}`),
method: "get",
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.skuId = data.wareSku.skuId;
this.dataForm.wareId = data.wareSku.wareId;
this.dataForm.stock = data.wareSku.stock;
this.dataForm.skuName = data.wareSku.skuName;
this.dataForm.stockLocked = data.wareSku.stockLocked;
}
});
}
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate(valid => {
if (valid) {
this.$http({
url: this.$http.adornUrl(
`/ware/waresku/${!this.dataForm.id ? "save" : "update"}`
),
method: "post",
data: this.$http.adornData({
id: this.dataForm.id || undefined,
skuId: this.dataForm.skuId,
wareId: this.dataForm.wareId,
stock: this.dataForm.stock,
skuName: this.dataForm.skuName,
stockLocked: this.dataForm.stockLocked
})
}).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);
}
});
}
});
}
}
};
</script>
Loading…
Cancel
Save