赋码配置

This commit is contained in:
DESKTOP-J7ED0MB\yinjinlu 2022-10-22 12:30:14 +08:00
parent 465c27cda2
commit 71d0dd8f70
3 changed files with 240 additions and 2 deletions

View File

@ -0,0 +1,45 @@
import request from '@/utils/request'
// 查询条码配置列表
export function listBarcodeconfig(query) {
return request({
url: '/mes/wm/barcodeconfig/list',
method: 'get',
params: query
})
}
// 查询条码配置详细
export function getBarcodeconfig(configId) {
return request({
url: '/mes/wm/barcodeconfig/' + configId,
method: 'get'
})
}
// 新增条码配置
export function addBarcodeconfig(data) {
return request({
url: '/mes/wm/barcodeconfig',
method: 'post',
data: data
})
}
// 修改条码配置
export function updateBarcodeconfig(data) {
debugger;
return request({
url: '/mes/wm/barcodeconfig',
method: 'put',
data: data
})
}
// 删除条码配置
export function delBarcodeconfig(configId) {
return request({
url: '/mes/wm/barcodeconfig/' + configId,
method: 'delete'
})
}

View File

@ -0,0 +1,189 @@
<template>
<el-dialog title="赋码设置"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<el-table v-loading="loading" :data="barcodeconfigList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="赋码类型" align="center" prop="barcodeType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_barcode_type" :value="scope.row.barcodeType"/>
</template>
</el-table-column>
<el-table-column label="赋码格式" align="center" prop="barcodeFormart">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_barcode_formart" :value="scope.row.barcodeFormart"/>
</template>
</el-table-column>
<el-table-column label="内容格式" align="center" prop="contentFormart" />
<el-table-column label="内容样例" align="center" prop="contentExample" />
<el-table-column label="是否自动生成" align="center" prop="autoGenFlag">
<template slot-scope="scope">
<el-switch
v-model="scope.row.autoGenFlag"
active-value="Y"
inactive-value="N"
@change="handleAutoGenChange(scope.row)"
></el-switch>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="showFlag=false"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listBarcodeconfig, getBarcodeconfig, delBarcodeconfig, addBarcodeconfig, updateBarcodeconfig } from "@/api/mes/wm/barcodeconfig";
export default {
name: "Barcodeconfig",
dicts: ['sys_yes_no', 'mes_barcode_type','mes_barcode_formart'],
data() {
return {
showFlag: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
barcodeconfigList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
barcodeFormart: null, barcodeType: null, contentFormart: null, contentExample: null, autoGenFlag: null, enableFlag: null, attr1: null, attr2: null, attr3: null, attr4: null, },
//
form: {},
//
rules: {
barcodeFormart: [
{ required: true, message: "条码格式不能为空", trigger: "blur" }
], barcodeType: [
{ required: true, message: "条码类型不能为空", trigger: "change" }
], contentFormart: [
{ required: true, message: "内容格式不能为空", trigger: "blur" }
], }
};
},
created() {
this.getList();
},
methods: {
/** 查询条码配置列表 */
getList() {
this.loading = true;
listBarcodeconfig(this.queryParams).then(response => {
this.barcodeconfigList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
configId: null, barcodeFormart: null, barcodeType: null, contentFormart: null, contentExample: null, autoGenFlag: "0", enableFlag: "0", remark: null, attr1: null, attr2: null, attr3: null, attr4: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.configId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加条码配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const configId = row.configId || this.ids
getBarcodeconfig(configId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改条码配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.configId != null) {
updateBarcodeconfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBarcodeconfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
//
handleAutoGenChange(row) {
let text = row.autoGenFlag === "Y" ? "启用" : "停用";
this.$modal.confirm('确认要' + text + '自动生成吗?').then(function() {
debugger;
updateBarcodeconfig(row).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.autoGenFlag = row.autoGenFlag === "N" ? "Y" : "N";
});
}
}
};
</script>

View File

@ -66,7 +66,7 @@
v-hasPermi="['mes:wm:barcode:edit']"
>条码设置</el-button>
</el-col>
<Barcodeconfig ref="barcodeconf"></Barcodeconfig>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -265,11 +265,12 @@ import { listBarcode, getBarcode, delBarcode, addBarcode, updateBarcode } from "
import ItemSelect from "@/components/itemSelect/single.vue";
import VendorSelect from "@/components/vendorSelect/single.vue";
import PackageSelectSingle from "@/components/package/single.vue";
import Barcodeconfig from "./config.vue"
export default {
name: "Barcode",
dicts: ['mes_barcode_type','mes_barcode_formart','sys_yes_no'],
components: {
ItemSelect,VendorSelect,PackageSelectSingle
ItemSelect,VendorSelect,PackageSelectSingle,Barcodeconfig
},
data() {
return {
@ -469,6 +470,9 @@ export default {
this.form.barcodeContent= "".concat(this.form.barcodeType,'-',this.form.bussinessCode);
}
},
handleConfig(){
this.$refs.barcodeconf.showFlag = true;
}
}
};
</script>