433 lines
15 KiB
Vue
433 lines
15 KiB
Vue
<!--
|
|
* @Descripttion: (毛坯库存表/wm_blank_inventory)
|
|
* @version: (1.0)
|
|
* @Author: (admin)
|
|
* @Date: (2024-05-13)
|
|
* @LastEditors: (admin)
|
|
* @LastEditTime: (2024-05-13)
|
|
-->
|
|
<template>
|
|
<div class="app-container">
|
|
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
|
<el-form :model="queryParams" size="small" label-position="right" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
|
<el-form-item label="毛坯号" prop="blankNum">
|
|
<el-input v-model.trim="queryParams.blankNum" placeholder="请输入毛坯号" clearable />
|
|
</el-form-item>
|
|
<el-form-item label="类别" prop="type">
|
|
<el-select v-model="queryParams.type" placeholder="请选择类别" @change="handleQuery">
|
|
<el-option v-for="item in typeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
|
<el-option label="全部" :value="0"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="状态" prop="status">
|
|
<el-radio-group v-model="queryParams.status" @change="handleQuery">
|
|
<el-radio-button v-for="item in statusOptions" :key="item.dictValue" :label="parseInt(item.dictValue)">{{item.dictLabel}}</el-radio-button>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<div>
|
|
<el-form-item label=" ">
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</div>
|
|
|
|
</el-form>
|
|
<!-- 工具区域 -->
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button type="primary" v-hasPermi="['business:wmblankinventory:add']" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="success" :disabled="single" v-hasPermi="['business:wmblankinventory:edit']" icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="danger" :disabled="multiple" v-hasPermi="['business:wmblankinventory:delete']" icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button type="info" icon="el-icon-refresh" v-hasPermi="['business:wmblankinventory:edit']" size="mini" @click="handleSynchronous">清单列表同步</el-button>
|
|
</el-col>
|
|
<!-- <el-col :span="1.5">
|
|
<el-button type="warning" icon="el-icon-refresh" v-hasPermi="['business:wmblankinventory:edit']" size="mini" @click="handleBlankInventoryRenew">毛坯库存更新</el-button>
|
|
</el-col> -->
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<!-- 数据区域 -->
|
|
<el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @sort-change="sortChange" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="50" align="center" />
|
|
<el-table-column prop="blankNum" label="毛坯号" align="center" min-width="160" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="description" label="产品描述" align="center" min-width="280" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="specification" label="规格" align="center" :show-overflow-tooltip="true" />
|
|
<!-- <el-table-column prop="unit" label="单位" align="center" :show-overflow-tooltip="true" /> -->
|
|
<el-table-column prop="quantity" label="库存数量" align="center" />
|
|
<!-- <el-table-column prop="maxNum" label="最大库存" align="center" />
|
|
<el-table-column prop="minNum" label="最小库存" align="center" />
|
|
<el-table-column prop="warnNum" label="预警库存" align="center" /> -->
|
|
<el-table-column prop="type" label="类别" align="center">
|
|
<template slot-scope="scope">
|
|
<el-tag effect="plain" v-if="scope.row.type === 1" type="primary">毛坯</el-tag>
|
|
<el-tag effect="plain" v-if="scope.row.type === 2" type="warning">返工件</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="status" label="状态" align="center">
|
|
<template slot-scope="scope">
|
|
<el-tag effect="plain" v-if="scope.row.status === 0" type="info">停用</el-tag>
|
|
<el-tag effect="plain" v-if="scope.row.status === 1" type="success">启用</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="remark" label="备注" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column prop="updatedTime" label="修改时间" width="200" align="center" :show-overflow-tooltip="true" />
|
|
<el-table-column label="操作" align="center" width="240">
|
|
<template slot-scope="scope">
|
|
<el-button size="mini" v-hasPermi="['business:wmblankinventory:edit']" type="primary" @click="handleDetail(scope.row)">库存记录</el-button>
|
|
<el-button size="mini" v-hasPermi="['business:wmblankinventory:edit']" type="success" icon="el-icon-edit" title="编辑" @click="handleUpdate(scope.row)"></el-button>
|
|
<el-button size="mini" v-hasPermi="['business:wmblankinventory:delete']" type="danger" icon="el-icon-delete" title="删除" @click="handleDelete(scope.row)"></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
|
|
<!-- 添加或修改毛坯库存表对话框 -->
|
|
<el-dialog :title="title" :lock-scroll="false" :visible.sync="open" :close-on-click-modal="false">
|
|
<el-form ref="form" :model="form" :rules="rules" :label-width="formLabelWidth">
|
|
<el-row :gutter="20">
|
|
<el-col :lg="12">
|
|
<el-form-item label="毛坯号" prop="blankNum">
|
|
<el-input v-model.trim="form.blankNum" placeholder="请输入毛坯号" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :lg="12">
|
|
<el-form-item label="库存数量" prop="quantity">
|
|
<el-input :disabled="opertype === 2" v-model.number="form.quantity" placeholder="请输入库存数量" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<!-- <el-col :lg="12">
|
|
<el-form-item label="最大库存" prop="maxNum">
|
|
<el-input v-model="form.maxNum" placeholder="请输入最大库存" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="最小库存" prop="minNum">
|
|
<el-input v-model="form.minNum" placeholder="请输入最小库存" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="预警库存" prop="warnNum">
|
|
<el-input v-model="form.warnNum" placeholder="请输入预警库存" />
|
|
</el-form-item>
|
|
</el-col> -->
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="类别" prop="type">
|
|
<el-select v-model="form.type" placeholder="请选择类别">
|
|
<el-option v-for="item in typeOptions" :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="状态" prop="status">
|
|
<el-radio-group v-model="form.status">
|
|
<el-radio v-for="item in statusOptions" :key="item.dictValue" :label="parseInt(item.dictValue)">{{item.dictLabel}}</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :lg="12">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input :autosize="{ minRows: 2, maxRows: 6}" type="textarea" maxlength="240" v-model="form.remark" placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="text" @click="cancel">取 消</el-button>
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<TheWmBlankRecord :ItemData="detailData" :visible.sync="TheWmBlankRecordShow" @refresh="getList"></TheWmBlankRecord>
|
|
<TheWmBlankInventoryRenew :visible.sync="TheWmBlankInventoryRenewShow" @refresh="getList"></TheWmBlankInventoryRenew>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {
|
|
listWmBlankInventory,
|
|
addWmBlankInventory,
|
|
delWmBlankInventory,
|
|
updateWmBlankInventory,
|
|
getWmBlankInventory,
|
|
synchronousMaterial,
|
|
} from '@/api/wmsManagement/wmBlankInventory.js';
|
|
import TheWmBlankRecord from './components/TheWmBlankRecord/TheWmBlankRecord.vue'
|
|
import TheWmBlankInventoryRenew from './components/TheWmBlankInventoryRenew/TheWmBlankInventoryRenew.vue'
|
|
export default {
|
|
name: "wmBlankInventory",
|
|
components: {
|
|
TheWmBlankRecord,
|
|
TheWmBlankInventoryRenew
|
|
},
|
|
data() {
|
|
return {
|
|
labelWidth: "100px",
|
|
formLabelWidth: "100px",
|
|
// 选中id数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 遮罩层
|
|
loading: false,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
type: 1,
|
|
status: 1,
|
|
sort: undefined,
|
|
sortType: undefined,
|
|
},
|
|
// 弹出层标题
|
|
title: "",
|
|
// 操作类型 1、add 2、edit
|
|
opertype: 0,
|
|
// 是否显示弹出层
|
|
open: false,
|
|
TheWmBlankRecordShow: false,
|
|
TheWmBlankInventoryRenewShow: false,
|
|
// 表单参数
|
|
form: {},
|
|
columns: [
|
|
{ index: 0, key: 'id', label: `主键`, checked: true },
|
|
{ index: 1, key: 'fkPaintId', label: `油漆id`, checked: true },
|
|
{ index: 2, key: 'blankNum', label: `毛坯号`, checked: true },
|
|
{ index: 3, key: 'quantity', label: `库存数量`, checked: true },
|
|
{ index: 4, key: 'maxNum', label: `最大库存`, checked: true },
|
|
{ index: 5, key: 'minNum', label: `最小库存`, checked: true },
|
|
{ index: 6, key: 'warnNum', label: `预警库存`, checked: true },
|
|
{ index: 7, key: 'type', label: `类别`, checked: true },
|
|
{ index: 8, key: 'status', label: `状态`, checked: true },
|
|
{ index: 9, key: 'remark', label: `备注`, checked: false },
|
|
{ index: 10, key: 'createdBy', label: `创建人`, checked: false },
|
|
{ index: 11, key: 'createdTime', label: `创建时间`, checked: false },
|
|
{ index: 12, key: 'updatedBy', label: `更新人`, checked: false },
|
|
{ index: 13, key: 'updatedTime', label: `更新时间`, checked: false },
|
|
],
|
|
// 类别选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
|
typeOptions: [
|
|
{ dictLabel: '毛坯', dictValue: 1 },
|
|
{ dictLabel: '返工件', dictValue: 2 },
|
|
],
|
|
// 状态选项列表 格式 eg:{ dictLabel: '标签', dictValue: '0'}
|
|
statusOptions: [
|
|
{ dictLabel: '启用', dictValue: 1 },
|
|
{ dictLabel: '停用', dictValue: 0 },
|
|
],
|
|
// 数据列表
|
|
dataList: [],
|
|
// 总记录数
|
|
total: 0,
|
|
// 提交按钮是否显示
|
|
btnSubmitVisible: true,
|
|
// 表单校验
|
|
rules: {
|
|
blankNum: [
|
|
{ required: true, message: "毛坯号不能为空", trigger: "blur" }
|
|
],
|
|
quantity: [
|
|
{ required: true, message: "库存数量不能为空", trigger: "blur" }
|
|
],
|
|
},
|
|
// 详情数据
|
|
detailData: {
|
|
|
|
}
|
|
};
|
|
},
|
|
created() {
|
|
// 列表数据查询
|
|
this.getList();
|
|
|
|
var dictParams = [];
|
|
},
|
|
methods: {
|
|
// 查询数据
|
|
getList() {
|
|
this.loading = true;
|
|
listWmBlankInventory(this.queryParams).then(res => {
|
|
if (res.code == 200) {
|
|
this.dataList = res.data.result;
|
|
this.total = res.data.totalNum;
|
|
this.loading = false;
|
|
}
|
|
})
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 重置数据表单
|
|
reset() {
|
|
this.form = {
|
|
id: undefined,
|
|
fkPaintId: undefined,
|
|
blankNum: undefined,
|
|
quantity: 0,
|
|
maxNum: 0,
|
|
minNum: 0,
|
|
warnNum: 0,
|
|
type: 1,
|
|
status: 1,
|
|
remark: undefined,
|
|
createdBy: undefined,
|
|
createdTime: undefined,
|
|
updatedBy: undefined,
|
|
updatedTime: undefined,
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
// 重置查询操作
|
|
resetQuery() {
|
|
this.timeRange = [];
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map((item) => item.id);
|
|
this.single = selection.length != 1
|
|
this.multiple = !selection.length;
|
|
},
|
|
// 自定义排序
|
|
sortChange(column) {
|
|
if (column.prop == null || column.order == null) {
|
|
this.queryParams.sort = undefined;
|
|
this.queryParams.sortType = undefined;
|
|
} else {
|
|
this.queryParams.sort = column.prop;
|
|
this.queryParams.sortType = column.order;
|
|
}
|
|
|
|
this.handleQuery();
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset();
|
|
this.open = true;
|
|
this.title = "添加";
|
|
this.opertype = 1;
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const Ids = row.id || this.ids;
|
|
|
|
this.$confirm('是否确认删除数据项?')
|
|
.then(function () {
|
|
return delWmBlankInventory(Ids);
|
|
})
|
|
.then(() => {
|
|
this.handleQuery();
|
|
this.msgSuccess("删除成功");
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
const id = row.id || this.ids;
|
|
getWmBlankInventory(id).then((res) => {
|
|
const { code, data } = res;
|
|
if (code == 200) {
|
|
this.open = true;
|
|
this.title = "修改数据";
|
|
this.opertype = 2;
|
|
|
|
this.form = {
|
|
...data,
|
|
};
|
|
}
|
|
});
|
|
},
|
|
// 毛坯数据同步
|
|
handleSynchronous() {
|
|
this.loading = true;
|
|
setTimeout(() => {
|
|
this.loading = false;
|
|
}, 30000)
|
|
const data = {};
|
|
synchronousMaterial(data).then(res => {
|
|
if (res.code === 200)
|
|
{
|
|
this.$message.success(res.msg);
|
|
this.handleQuery();
|
|
this.loading = false;
|
|
} else {
|
|
this.loading = false;
|
|
}
|
|
}).catch(() => {
|
|
this.loading = false;
|
|
})
|
|
},
|
|
// 毛坯数据详情-库存记录
|
|
handleDetail(row) {
|
|
console.log(row);
|
|
this.detailData = row;
|
|
this.TheWmBlankRecordShow = true;
|
|
},
|
|
// 毛坯数据同步
|
|
handleBlankInventoryRenew() {
|
|
this.TheWmBlankInventoryRenewShow = true;
|
|
},
|
|
// 类别字典翻译
|
|
typeFormat(row, column) {
|
|
return this.selectDictLabel(this.typeOptions, row.type);
|
|
},
|
|
// 状态字典翻译
|
|
statusFormat(row, column) {
|
|
return this.selectDictLabel(this.statusOptions, row.status);
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm: function () {
|
|
this.$refs["form"].validate((valid) => {
|
|
if (valid) {
|
|
console.log(JSON.stringify(this.form));
|
|
|
|
if (this.form.id != undefined && this.opertype === 2) {
|
|
updateWmBlankInventory(this.form)
|
|
.then((res) => {
|
|
this.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.getList();
|
|
})
|
|
.catch((err) => {
|
|
//TODO 错误逻辑
|
|
});
|
|
} else {
|
|
addWmBlankInventory(this.form)
|
|
.then((res) => {
|
|
this.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.getList();
|
|
})
|
|
.catch((err) => {
|
|
//TODO 错误逻辑
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script> |