|
|
|
@ -0,0 +1,305 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-form :inline="true" :model="query" class="query-form" size="mini">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-form-item class="query-form-item">
|
|
|
|
|
<el-input v-model="query.name" style="width: 300px;" placeholder="搜索" clearable="true"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button-group>
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
icon="el-icon-refresh"
|
|
|
|
|
@click="onReset"
|
|
|
|
|
></el-button>
|
|
|
|
|
<el-button type="primary" icon="search" @click="search"
|
|
|
|
|
>查询
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button type="primary" icon="search" @click="handleAddClick"
|
|
|
|
|
>新建规则
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
</el-button-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:data="list"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column label="序号" type="index" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="规则名称" prop="name" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="前缀" prop="prefix" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="起始数" prop="startNum" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="步长" prop="step" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="顺序号" prop="serialNum" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="状态" prop="status" fixed>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<span>{{ statusMap[scope.row.status] }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="备注" prop="remark" fixed></el-table-column>
|
|
|
|
|
<el-table-column label="操作" fixed="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
type="text"
|
|
|
|
|
size="small"
|
|
|
|
|
@click.native.stop="handleModifyClick(scope.row)"
|
|
|
|
|
>编辑
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button
|
|
|
|
|
type="text"
|
|
|
|
|
size="small"
|
|
|
|
|
@click.native.stop="deleteDialog(scope.row)"
|
|
|
|
|
>删除
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<el-pagination
|
|
|
|
|
:page-size="query.limit"
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
layout="prev, pager, next"
|
|
|
|
|
:total="total"
|
|
|
|
|
:current-page="query.page"
|
|
|
|
|
></el-pagination>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
:title="formMap[formName]"
|
|
|
|
|
:visible.sync="editRulesVisible"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:close-on-press-escape="false"
|
|
|
|
|
width="40%"
|
|
|
|
|
>
|
|
|
|
|
<el-form :model="formData" ref="formData">
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<el-form-item label="规则名称" prop="name" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.name" style="width: 80%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<el-form-item label="规则前缀" prop="prefix" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.prefix" style="width: 80%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<el-form-item label="起始编号" prop="startNum" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.startNum" style="width: 80%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="10" class="el-col">
|
|
|
|
|
<el-form-item label="编号间隔" prop="step" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.step" style="width: 65%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
type="number"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="10" class="el-col">
|
|
|
|
|
<el-form-item label="状态" prop="status" class="query-form-item">
|
|
|
|
|
<el-radio v-model="formData.status" :label="0">禁用</el-radio>
|
|
|
|
|
<el-radio v-model="formData.status" :label="1">启用</el-radio>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<el-form-item label="顺序号码" prop="serialNum" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.serialNum" style="width: 80%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<el-form-item label="备注信息" prop="step" class="query-form-item">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="formData.remark" style="width: 80%"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20" class="el-row" type="flex">
|
|
|
|
|
<el-col :span="20" class="el-col">
|
|
|
|
|
<span>预览:{{ previewStockNum }}</span>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click.native.stop="cancelDialog" size="small">取消</el-button>
|
|
|
|
|
<el-button type="primary" size="small" @click.native="submit()"
|
|
|
|
|
>提交
|
|
|
|
|
</el-button
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {getStockRulesList, saveStockRules, deleteStockRules} from "@/api/basic/stockRules";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
query: {
|
|
|
|
|
name: "",
|
|
|
|
|
customerId: this.$store.getters.customerId,
|
|
|
|
|
status: null,
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 20
|
|
|
|
|
},
|
|
|
|
|
loading: false,
|
|
|
|
|
editRulesVisible: false,
|
|
|
|
|
list: [],
|
|
|
|
|
total: 0,
|
|
|
|
|
formData: {
|
|
|
|
|
id: null,
|
|
|
|
|
name: null,
|
|
|
|
|
prefix: null,
|
|
|
|
|
startNum: null,
|
|
|
|
|
step: 1,
|
|
|
|
|
serialNum: null,
|
|
|
|
|
status: 1,
|
|
|
|
|
remark: null
|
|
|
|
|
},
|
|
|
|
|
multipleSelection: [],
|
|
|
|
|
statusMap: {
|
|
|
|
|
0: '禁用',
|
|
|
|
|
1: '启用'
|
|
|
|
|
},
|
|
|
|
|
formMap: {
|
|
|
|
|
add: "添加建垛规则",
|
|
|
|
|
edit: "编辑建垛规则"
|
|
|
|
|
},
|
|
|
|
|
formName: null,
|
|
|
|
|
previewStockNum: null
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
onReset() {
|
|
|
|
|
this.$router.push({
|
|
|
|
|
path: ""
|
|
|
|
|
});
|
|
|
|
|
this.query = {
|
|
|
|
|
name: "",
|
|
|
|
|
customerId: this.$store.getters.customerId,
|
|
|
|
|
status: null,
|
|
|
|
|
page: 1,
|
|
|
|
|
limit: 20
|
|
|
|
|
};
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
resetForm() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs['formData'].resetFields();
|
|
|
|
|
this.$refs["formData"].clearValidate();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
search() {
|
|
|
|
|
this.query.page = 1;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
getList() {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
getStockRulesList(this.query).then((res) => {
|
|
|
|
|
if (res.code === 20000) {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.list = res.data.list || [];
|
|
|
|
|
this.total = res.data.total || 0;
|
|
|
|
|
} else {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
cancelDialog() {
|
|
|
|
|
this.editRulesVisible = false;
|
|
|
|
|
},
|
|
|
|
|
handleModifyClick(row) {
|
|
|
|
|
this.editRulesVisible = true;
|
|
|
|
|
this.formData = row;
|
|
|
|
|
},
|
|
|
|
|
handleAddClick() {
|
|
|
|
|
this.editRulesVisible = true;
|
|
|
|
|
this.formName = 'add';
|
|
|
|
|
this.resetForm();
|
|
|
|
|
},
|
|
|
|
|
change() {
|
|
|
|
|
},
|
|
|
|
|
//新建规则
|
|
|
|
|
submit() {
|
|
|
|
|
saveStockRules(this.formName, this.formData).then((res) => {
|
|
|
|
|
if (res.code === 20000) {
|
|
|
|
|
this.editRulesVisible = false;
|
|
|
|
|
this.$message.success(res.message);
|
|
|
|
|
this.getList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
deleteDialog(row) {
|
|
|
|
|
this.$confirm("此操作将删除规则, 是否继续?", "提示", {
|
|
|
|
|
confirmButtonText: "确定",
|
|
|
|
|
cancelButtonText: "取消",
|
|
|
|
|
type: "warning"
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
let params = {id: row.id};
|
|
|
|
|
deleteStockRules(params).then((res) => {
|
|
|
|
|
if (res.code === 20000) {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$message.success(res.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleSelectionChange(val) {
|
|
|
|
|
this.multipleSelection = val;
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(val) {
|
|
|
|
|
this.query.page = val;
|
|
|
|
|
this.getList();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
|
|
</style>
|