refactor(库房管理): 库房类型完善
This commit is contained in:
parent
1a6eafc2a9
commit
12d682a96d
@ -32,7 +32,8 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['mes:wm:warehouse:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -43,7 +44,8 @@
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['mes:wm:warehouse:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -54,26 +56,32 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['mes:wm:warehouse:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="warehouseList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="库房编码" align="center" prop="warehouseCode" >
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="库房编码" align="center" prop="warehouseCode">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="handleView(scope.row)"
|
||||
v-hasPermi="['mes:wm:warehouse:query']"
|
||||
>{{scope.row.warehouseCode}}</el-button>
|
||||
>{{ scope.row.warehouseCode }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库房名称" align="center" prop="warehouseName" />
|
||||
<el-table-column label="负责人" align="center" prop="charge" />
|
||||
<el-table-column label="类型" align="center" prop="attr2" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="备注" align="center" prop="remark" ></el-table-column>
|
||||
<el-table-column label="库房名称" align="center" prop="warehouseName"/>
|
||||
<el-table-column label="负责人" align="center" prop="charge"/>
|
||||
<el-table-column label="类型" align="center" prop="attr2" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.warehouse_type" :value="scope.row.attr2"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark"></el-table-column>
|
||||
<el-table-column label="是否有效" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<i :class="scope.row.attr3==1?'el-icon-circle-check':'el-icon-circle-close'"></i>
|
||||
@ -88,21 +96,24 @@
|
||||
icon="el-icon-s-shop"
|
||||
@click="handleLocation(scope.row.warehouseId)"
|
||||
v-hasPermi="['mes:wm:location:edit','mes:wm:location:list']"
|
||||
>库区</el-button>
|
||||
>库区
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['mes:wm:warehouse:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['mes:wm:warehouse:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -117,65 +128,35 @@
|
||||
|
||||
<!-- 添加或修改库房设置对话框 -->
|
||||
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body width="960px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="14">
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="库房编码" prop="warehouseCode">
|
||||
<el-input v-model="form.warehouseCode" placeholder="请输入库房编码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="库房名称" prop="warehouseName">
|
||||
<el-input v-model="form.warehouseName" placeholder="请输入库房名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="负责人" prop="charge">
|
||||
<el-input v-model="form.charge" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="库房类型" prop="location">
|
||||
<div style="display: flex">
|
||||
<el-input v-model="form.attr2" placeholder="请选择库区名称" />
|
||||
<el-button @click="selectWareHouseVisible=true" icon="el-icon-search"></el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否有效" prop="area">
|
||||
<el-switch @change="isFig" v-model="fig"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" inline>
|
||||
<el-form-item label="库房编码" prop="warehouseCode">
|
||||
<el-input v-model="form.warehouseCode" placeholder="请输入库房编码"/>
|
||||
</el-form-item>
|
||||
<el-form-item label-width="80">
|
||||
<el-switch v-model="autoGenFlag"
|
||||
active-color="#13ce66"
|
||||
active-text="自动生成"
|
||||
@change="handleAutoGenChange(autoGenFlag)" v-if="optType != 'view'">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="库房名称" prop="warehouseName">
|
||||
<el-input v-model="form.warehouseName" placeholder="请输入库房名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="负责人" prop="charge">
|
||||
<el-input v-model="form.charge" placeholder="请输入负责人"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="库房类型" prop="attr2">
|
||||
<el-select v-model="form.attr2" placeholder="请选择库房类型">
|
||||
<el-option :label="item.label" :value="item.value" v-for="item in dict.type.warehouse_type"
|
||||
:key="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否有效" prop="area">
|
||||
<el-switch @change="isFig" v-model="fig"></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
|
||||
@ -204,14 +185,15 @@ import InOutTypeCmps from "@/components/wm/InOutTypeCmps.vue";
|
||||
|
||||
export default {
|
||||
name: "Warehouse",
|
||||
components: {InOutTypeCmps, BarcodeImg } ,
|
||||
components: {InOutTypeCmps, BarcodeImg},
|
||||
dicts: ['warehouse_type'],
|
||||
data() {
|
||||
return {
|
||||
selectWareHouseVisible:false,
|
||||
selectWareHouseVisible: false,
|
||||
//是否有效
|
||||
fig:false,
|
||||
fig: false,
|
||||
//自动生成编码
|
||||
autoGenFlag:false,
|
||||
autoGenFlag: false,
|
||||
optType: undefined,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
@ -262,10 +244,10 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
warehouseCode: [
|
||||
{ required: true, message: "库房编码不能为空", trigger: "blur" }
|
||||
{required: true, message: "库房编码不能为空", trigger: "blur"}
|
||||
],
|
||||
warehouseName: [
|
||||
{ required: true, message: "库房名称不能为空", trigger: "blur" }
|
||||
{required: true, message: "库房名称不能为空", trigger: "blur"}
|
||||
],
|
||||
}
|
||||
};
|
||||
@ -281,8 +263,8 @@ export default {
|
||||
this.selectWareHouseVisible = false;
|
||||
},
|
||||
//修改库房是否有效
|
||||
isFig(val){
|
||||
this.form.attr3=val?1:0
|
||||
isFig(val) {
|
||||
this.form.attr3 = val ? 1 : 0
|
||||
},
|
||||
/** 查询库房设置列表 */
|
||||
getList() {
|
||||
@ -333,7 +315,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.warehouseId)
|
||||
this.single = selection.length!==1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@ -344,7 +326,7 @@ export default {
|
||||
this.optType = "add";
|
||||
},
|
||||
// 查询明细按钮操作
|
||||
handleView(row){
|
||||
handleView(row) {
|
||||
debugger;
|
||||
this.reset();
|
||||
const warehouseId = row.warehouseId || this.ids
|
||||
@ -391,13 +373,13 @@ export default {
|
||||
* 冻结状态变更
|
||||
* @param row
|
||||
*/
|
||||
handleFrozenChange(row){
|
||||
handleFrozenChange(row) {
|
||||
let text = row.frozenFlag === "Y" ? "冻结" : "解冻";
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.warehouseName + '"库房吗?').then(function() {
|
||||
return changeFrozenState(row.warehouseId,row.frozenFlag);
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.warehouseName + '"库房吗?').then(function () {
|
||||
return changeFrozenState(row.warehouseId, row.frozenFlag);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function() {
|
||||
}).catch(function () {
|
||||
row.frozenFlag = row.frozenFlag === "N" ? "Y" : "N";
|
||||
});
|
||||
|
||||
@ -405,12 +387,13 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const warehouseIds = row.warehouseId || this.ids;
|
||||
this.$modal.confirm('是否确认删除库房设置编号为"' + warehouseIds + '"的数据项?').then(function() {
|
||||
this.$modal.confirm('是否确认删除库房设置编号为"' + warehouseIds + '"的数据项?').then(function () {
|
||||
return delWarehouse(warehouseIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
@ -418,17 +401,17 @@ export default {
|
||||
...this.queryParams
|
||||
}, `warehouse_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleLocation(warehouseId){
|
||||
this.$router.push({ path: '/mes/wm/location/index', query: { warehouseId: warehouseId || 0 ,optType: this.optType} })
|
||||
handleLocation(warehouseId) {
|
||||
this.$router.push({path: '/mes/wm/location/index', query: {warehouseId: warehouseId || 0, optType: this.optType}})
|
||||
},
|
||||
|
||||
//自动生成编码
|
||||
handleAutoGenChange(autoGenFlag){
|
||||
if(autoGenFlag){
|
||||
genCode('WAREHOUSE_CODE').then(response =>{
|
||||
handleAutoGenChange(autoGenFlag) {
|
||||
if (autoGenFlag) {
|
||||
genCode('WAREHOUSE_CODE').then(response => {
|
||||
this.form.warehouseCode = response;
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
this.form.warehouseCode = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user