720 lines
20 KiB
Python
720 lines
20 KiB
Python
<template>
|
|
<div class="app-container">
|
|
<el-card>
|
|
<div>
|
|
<el-button
|
|
v-if="checkPermission(['fifo_in_pur'])"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="handlecgCreate"
|
|
>
|
|
采购入库
|
|
</el-button>
|
|
<el-button
|
|
v-if="checkPermission(['fifo_in_other'])"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="handleCreate"
|
|
>
|
|
其他入库
|
|
</el-button>
|
|
<el-button
|
|
v-if="checkPermission(['fifo_out_other'])"
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="handleoutCreate"
|
|
>
|
|
其他出库
|
|
</el-button>
|
|
<el-input
|
|
v-model="listQuery.search"
|
|
placeholder="仓库名称/仓库编号"
|
|
style="width: 300px"
|
|
class="filter-item"
|
|
@keyup.enter.native="handleFilter"
|
|
/>
|
|
<el-button
|
|
class="filter-item"
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="handleFilter"
|
|
>
|
|
搜索
|
|
</el-button>
|
|
<el-button
|
|
class="filter-item"
|
|
type="primary"
|
|
icon="el-icon-refresh-left"
|
|
@click="resetFilter"
|
|
>
|
|
重置
|
|
</el-button>
|
|
</div>
|
|
</el-card>
|
|
<el-card>
|
|
<el-table
|
|
v-loading="listLoading"
|
|
:data="fifoList.results"
|
|
border
|
|
fit
|
|
stripe
|
|
highlight-current-row
|
|
height="100"
|
|
v-el-height-adaptive-table="{ bottomOffset: 42 }"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column label="记录编号" prop="number"> </el-table-column>
|
|
<el-table-column label="操作人员">
|
|
<template slot-scope="scope" v-if="scope.row.create_by">
|
|
{{ scope.row.create_by_.name }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="出/入库时间" prop="inout_date">
|
|
</el-table-column>
|
|
<el-table-column label="出/入库类型">
|
|
<template slot-scope="scope">{{ types_[scope.row.type] }}</template>
|
|
</el-table-column>
|
|
<el-table-column label="是否审核">
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.is_audited == false">未审核</el-tag>
|
|
<el-tag v-else>已审核</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="创建时间" prop="create_time"> </el-table-column>
|
|
<el-table-column align="center" label="操作" width="220px">
|
|
<template slot-scope="scope">
|
|
<el-link
|
|
v-if="checkPermission(['fifo_pack']) && scope.row.type == 2"
|
|
type="primary"
|
|
@click="handlePack(scope)"
|
|
>
|
|
装箱
|
|
</el-link>
|
|
<el-link
|
|
v-if="checkPermission(['fifo_pack'])"
|
|
type="primary"
|
|
@click="handleDetail(scope)"
|
|
>
|
|
查看
|
|
</el-link>
|
|
<el-link
|
|
v-if="
|
|
checkPermission(['fifo_hear']) && scope.row.is_audited == false
|
|
"
|
|
type="primary"
|
|
@click="handleAudit(scope)"
|
|
>
|
|
审核
|
|
</el-link>
|
|
<el-link
|
|
v-if="checkPermission(['fifo_delete'])"
|
|
type="danger"
|
|
@click="handleDelete(scope)"
|
|
>
|
|
删除
|
|
</el-link>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination
|
|
v-show="fifoList.count > 0"
|
|
:total="fifoList.count"
|
|
:page.sync="listQuery.page"
|
|
:limit.sync="listQuery.page_size"
|
|
@pagination="getList"
|
|
/>
|
|
</el-card>
|
|
<el-dialog
|
|
:visible.sync="dialogVisibles"
|
|
:close-on-click-modal="false"
|
|
title="新增采购入库"
|
|
>
|
|
<el-form
|
|
ref="Form1"
|
|
:model="inpur"
|
|
label-width="80px"
|
|
label-position="right"
|
|
:rules="rule1"
|
|
>
|
|
<el-form-item label="采购订单">
|
|
<el-select v-model="inpur.pu_order">
|
|
<el-option
|
|
v-for="item in puorderoptions"
|
|
:key="item.id"
|
|
:value="item.id"
|
|
:label="item.number"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div style="text-align: right">
|
|
<el-button type="danger" @click="dialogVisibles = false">
|
|
取消
|
|
</el-button>
|
|
<el-button type="primary" @click="confirminpur('Form1')">
|
|
确认
|
|
</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<el-dialog
|
|
:visible.sync="dialogVisibleout"
|
|
:close-on-click-modal="false"
|
|
title="新增出库记录"
|
|
>
|
|
<el-form
|
|
ref="Formout"
|
|
:model="outfifo"
|
|
label-width="80px"
|
|
label-position="right"
|
|
:rules="rule1"
|
|
>
|
|
<div v-for="(item, index) in outfifo.details" :key="index">
|
|
<el-row>
|
|
<el-col :span="10" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="material_batch"
|
|
label="批次:"
|
|
:prop="'details.' + index + '.material_batch'"
|
|
>
|
|
<el-select
|
|
v-model="item.material_batch"
|
|
filterable
|
|
size="small"
|
|
>
|
|
<el-option
|
|
v-for="item in materialbatchoptions"
|
|
:key="item.id"
|
|
:value="item.id"
|
|
:label="item.batch"
|
|
>
|
|
<span style="float: left">{{ item.batch }}</span>
|
|
<span
|
|
style="float: right; color: #8492a6; font-size: 13px"
|
|
>{{ item.material_.name }}</span
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" style="margin-right: 50px">
|
|
<el-form-item
|
|
class="count"
|
|
label="出库数量"
|
|
:prop="'details.' + index + '.count'"
|
|
>
|
|
<el-input-number
|
|
v-model="item.count"
|
|
:min="0"
|
|
></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<!-- 删除按钮 -->
|
|
<el-col :span="1">
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="删除"
|
|
placement="top"
|
|
>
|
|
<el-button
|
|
@click="deleteItem1(index)"
|
|
style="
|
|
border: none;
|
|
background: none;
|
|
padding: 0px;
|
|
margin-top: 4px;
|
|
"
|
|
>
|
|
<i class="el-icon-remove-outline" style="font-size: 20px"></i>
|
|
</el-button>
|
|
</el-tooltip>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
<div>
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="添加条件"
|
|
placement="top"
|
|
>
|
|
<el-button
|
|
@click="addConditions1"
|
|
style="
|
|
cursor: pointer;
|
|
width: 95%;
|
|
color: #fe000c;
|
|
border: 1px dashed #fe000c;
|
|
height: 40px;
|
|
padding: 0px;
|
|
margin-top: 2px;
|
|
margin-left: 20px;
|
|
font-size: 26px;
|
|
"
|
|
>
|
|
+
|
|
</el-button>
|
|
</el-tooltip>
|
|
</div>
|
|
</el-form>
|
|
<div style="text-align: right">
|
|
<el-button type="danger" @click="dialogVisibleout = false">
|
|
取消
|
|
</el-button>
|
|
<el-button type="primary" @click="confirmoutfifo('Formout')">
|
|
确认
|
|
</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
<el-dialog
|
|
:visible.sync="dialogVisible"
|
|
:close-on-click-modal="false"
|
|
width="90%"
|
|
:title="dialogType === 'edit' ? '编辑入库记录' : '新增入库记录'"
|
|
>
|
|
<el-form
|
|
ref="Form"
|
|
:model="inventory"
|
|
label-width="80px"
|
|
label-position="right"
|
|
:rules="rule1"
|
|
>
|
|
<el-form-item class="warehouse" label="供应商">
|
|
<el-select v-model="inventory.vendor" size="small">
|
|
<el-option
|
|
v-for="item in vendoroptions"
|
|
:key="item.id"
|
|
:value="item.id"
|
|
:label="item.name"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<div v-for="(item, index) in inventory.details" :key="index">
|
|
<el-row>
|
|
<el-col :span="5" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="warehouse"
|
|
label="仓库:"
|
|
:prop="'details.' + index + '.warehouse'"
|
|
>
|
|
<el-select v-model="item.warehouse" size="small">
|
|
<el-option
|
|
v-for="item in warehouseData"
|
|
:key="item.value"
|
|
:value="item.value"
|
|
:label="item.label"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="material"
|
|
label="物料:"
|
|
:prop="'details.' + index + '.material'"
|
|
>
|
|
<el-select v-model="item.material" filterable size="small">
|
|
<el-option
|
|
v-for="item in materialoptions"
|
|
:key="item.value"
|
|
:value="item.value"
|
|
:label="item.label"
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="count"
|
|
label="数量"
|
|
:prop="'details.' + index + '.count'"
|
|
>
|
|
<el-input-number
|
|
v-model="item.count"
|
|
:min="0"
|
|
></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="batch"
|
|
label="批次"
|
|
:prop="'details.' + index + '.batch'"
|
|
>
|
|
<el-input v-model="item.batch" placeholder="批次号"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="5" style="margin-right: 10px">
|
|
<el-form-item
|
|
class="expiration_date"
|
|
label="有效期"
|
|
:prop="'details.' + index + '.expiration_date'"
|
|
>
|
|
<el-date-picker
|
|
v-model="item.expiration_date"
|
|
type="date"
|
|
placeholder="选择日期"
|
|
value-format="yyyy-MM-dd"
|
|
style="width: 100%"
|
|
>
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<!-- 删除按钮 -->
|
|
<el-col :span="1">
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="删除"
|
|
placement="top"
|
|
>
|
|
<el-button
|
|
@click="deleteItem(index)"
|
|
style="
|
|
border: none;
|
|
background: none;
|
|
padding: 0px;
|
|
margin-top: 4px;
|
|
"
|
|
>
|
|
<i class="el-icon-remove-outline" style="font-size: 20px"></i>
|
|
</el-button>
|
|
</el-tooltip>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
<div>
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="添加条件"
|
|
placement="top"
|
|
>
|
|
<el-button
|
|
@click="addConditions"
|
|
style="
|
|
cursor: pointer;
|
|
width: 95%;
|
|
color: #fe000c;
|
|
border: 1px dashed #fe000c;
|
|
height: 40px;
|
|
padding: 0px;
|
|
margin-top: 2px;
|
|
margin-left: 20px;
|
|
font-size: 26px;
|
|
"
|
|
>
|
|
+
|
|
</el-button>
|
|
</el-tooltip>
|
|
</div>
|
|
</el-form>
|
|
<div style="text-align: right">
|
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="confirm('Form')">确认</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import {
|
|
getfifoList,
|
|
createInventory,
|
|
createInother,
|
|
getWarehouseList,
|
|
deleteFifoitem,
|
|
getmaterialbatchList,
|
|
deleteFifo,
|
|
audit,
|
|
outOther,
|
|
} from "@/api/inm";
|
|
import { getPuorderList } from "@/api/pum";
|
|
import checkPermission from "@/utils/permission";
|
|
import { getpVendorList } from "@/api/vendor";
|
|
import { getMaterialList } from "@/api/mtm";
|
|
import { getUserList } from "@/api/user";
|
|
import { genTree } from "@/utils";
|
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
|
const defaulteinventory = {
|
|
vendor: null,
|
|
details: [
|
|
{
|
|
warehouse: "", //仓库
|
|
material: "", // 物料
|
|
count: "", //数量
|
|
batch: "", //批次
|
|
},
|
|
],
|
|
};
|
|
const defaulteoutfifo = {
|
|
details: [
|
|
{
|
|
material_batch: null,
|
|
count: null,
|
|
},
|
|
],
|
|
};
|
|
export default {
|
|
components: { Pagination },
|
|
data() {
|
|
return {
|
|
inventory: defaulteinventory,
|
|
outfifo: defaulteoutfifo,
|
|
dialogVisibleout: false,
|
|
fifoList: {
|
|
count: 0,
|
|
},
|
|
types_: {
|
|
1: "生产领料",
|
|
2: "销售提货",
|
|
3: "采购入库",
|
|
4: "生产入库",
|
|
5: "其他入库",
|
|
6:"其他出库",
|
|
},
|
|
inpur: {},
|
|
listQuery: {
|
|
page: 1,
|
|
page_size: 20,
|
|
},
|
|
puorderoptions: [],
|
|
materialbatchoptions: [],
|
|
warehouseData: [],
|
|
materialoptions: [],
|
|
vendoroptions: [],
|
|
listLoading: true,
|
|
dialogVisible: false,
|
|
dialogType: "new",
|
|
dialogVisibles: false,
|
|
rule1: {
|
|
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
|
},
|
|
};
|
|
},
|
|
computed: {},
|
|
watch: {},
|
|
created() {
|
|
this.getlists();
|
|
this.getList();
|
|
this.getListgys();
|
|
this.getmaterialList();
|
|
this.getpuorderList();
|
|
},
|
|
methods: {
|
|
checkPermission,
|
|
|
|
getList() {
|
|
this.listLoading = true;
|
|
|
|
getfifoList(this.listQuery).then((response) => {
|
|
if (response.data) {
|
|
this.fifoList = response.data;
|
|
}
|
|
this.listLoading = false;
|
|
});
|
|
},
|
|
//出入库详情
|
|
handleDetail(scope) {
|
|
this.$router.push({
|
|
name: "fifodetail",
|
|
params: { id: scope.row.id, pu_order: scope.row.pu_order },
|
|
});
|
|
},
|
|
|
|
//供应商列表
|
|
getListgys() {
|
|
getpVendorList({ page: 0 }).then((response) => {
|
|
if (response.data) {
|
|
this.vendoroptions = response.data;
|
|
}
|
|
});
|
|
},
|
|
//采购订单
|
|
getpuorderList() {
|
|
getPuorderList({ page: 0 }).then((response) => {
|
|
if (response.data) {
|
|
this.puorderoptions = response.data;
|
|
}
|
|
});
|
|
},
|
|
//采购入库提交
|
|
confirminpur() {
|
|
createInventory(this.inpur).then((res) => {
|
|
if (res.code >= 200) {
|
|
this.getList();
|
|
this.dialogVisibles = false;
|
|
this.$message.success("成功");
|
|
}
|
|
});
|
|
},
|
|
//仓库
|
|
getlists() {
|
|
getWarehouseList({ page: 0 }).then((response) => {
|
|
if (response.data) {
|
|
this.warehouseData = genTree(response.data);
|
|
}
|
|
this.listLoading = false;
|
|
});
|
|
},
|
|
handlecgCreate() {
|
|
this.dialogVisibles = true;
|
|
},
|
|
addConditions1() {
|
|
if (this.outfifo.details.length <= 10) {
|
|
this.outfifo.details.push({
|
|
material_batch: null,
|
|
count: null,
|
|
});
|
|
} else {
|
|
this.$message("最多可添加十项条件");
|
|
}
|
|
},
|
|
addConditions() {
|
|
|
|
if (this.inventory.details.length <= 10) {
|
|
this.inventory.details.push({
|
|
warehouse: "", //仓库
|
|
material: "", // 物料
|
|
count: "", //数量
|
|
batch: "", // 批次
|
|
});
|
|
} else {
|
|
this.$message("最多可添加十项条件");
|
|
}
|
|
},
|
|
deleteItem(index) {
|
|
this.inventory.details.splice(index, 1);
|
|
},
|
|
deleteItem1(index) {
|
|
this.outfifo.details.splice(index, 1);
|
|
},
|
|
//物料
|
|
getmaterialList() {
|
|
this.listLoading = true;
|
|
getMaterialList({ pageoff: true }).then((response) => {
|
|
if (response.data) {
|
|
this.materialoptions = genTree(response.data);
|
|
}
|
|
this.listLoading = false;
|
|
});
|
|
},
|
|
|
|
//其他入库
|
|
handleCreate() {
|
|
this.inventory.details = [
|
|
{
|
|
warehouse: "", // 仓库
|
|
material: "", // 物料
|
|
count: "", //数量
|
|
batch: "", //批次
|
|
},
|
|
];
|
|
this.inventory = Object.assign({}, defaulteinventory);
|
|
this.dialogType = "new";
|
|
this.dialogVisible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs["Form"].clearValidate();
|
|
});
|
|
},
|
|
//其他出库
|
|
handleoutCreate() {
|
|
this.outfifo.details = [
|
|
{
|
|
material_batch: null,
|
|
count: null,
|
|
},
|
|
];
|
|
this.outfifo = Object.assign({}, defaulteoutfifo);
|
|
this.dialogVisibleout = true;
|
|
|
|
getmaterialbatchList({ page: 0 }).then((response) => {
|
|
if (response.data) {
|
|
this.materialbatchoptions = response.data;
|
|
}
|
|
});
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs["Formout"].clearValidate();
|
|
});
|
|
},
|
|
confirmoutfifo() {
|
|
console.log(this.outfifo);
|
|
outOther(this.outfifo).then((res) => {
|
|
if (res.code >= 200) {
|
|
this.getList();
|
|
this.dialogVisibleout = false;
|
|
this.$message.success("成功");
|
|
}
|
|
});
|
|
},
|
|
|
|
//审核
|
|
handleAudit(scope) {
|
|
this.$confirm("是否通过?", "提示", {
|
|
confirmButtonText: "确认",
|
|
cancelButtonText: "取消",
|
|
type: "success",
|
|
})
|
|
.then(async () => {
|
|
await audit(scope.row.id);
|
|
this.getList();
|
|
this.$message.success("已审核");
|
|
})
|
|
.catch((err) => {
|
|
console.error(err);
|
|
});
|
|
},
|
|
handleFilter() {
|
|
this.listQuery.page = 1;
|
|
this.getList();
|
|
},
|
|
resetFilter() {
|
|
this.listQuery = {
|
|
page: 1,
|
|
page_size: 20,
|
|
};
|
|
this.getList();
|
|
},
|
|
|
|
async confirm(form) {
|
|
console.log(this.inventory);
|
|
|
|
createInother(this.inventory).then((res) => {
|
|
if (res.code >= 200) {
|
|
this.getList();
|
|
this.dialogVisible = false;
|
|
this.$message.success("成功");
|
|
}
|
|
});
|
|
},
|
|
handleDelete(scope) {
|
|
this.$confirm("确认删除?", "警告", {
|
|
confirmButtonText: "确认",
|
|
cancelButtonText: "取消",
|
|
type: "error",
|
|
})
|
|
.then(async () => {
|
|
await deleteFifo(scope.row.id);
|
|
this.getList();
|
|
this.$message.success("成功");
|
|
})
|
|
.catch((err) => {
|
|
console.error(err);
|
|
});
|
|
},
|
|
//装箱
|
|
handlePack(scope) {
|
|
this.$router.push({
|
|
name: "salesdetail",
|
|
params: { id: scope.row.sale },
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|