fix:光芯辅料库

This commit is contained in:
shijing 2025-07-01 15:21:20 +08:00
parent ae1964ec92
commit 22bdea774a
4 changed files with 649 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<!-- <div class="left-panel">
<el-select
v-model="query.warehouse"
clearable
@ -16,7 +16,7 @@
:value="item.id"
></el-option>
</el-select>
</div>
</div> -->
<div class="right-panel">
<el-input
v-model="query.search"
@ -135,7 +135,7 @@ export default {
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
params: { count__gte: 1, material__type__in: "40, 50, 60, 70" },
params: { count__gte: 1, material__type__in: "40" },
selection: [],
query: {},
warehouseOptions: [],

View File

@ -0,0 +1,398 @@
<template>
<el-container>
<el-main class="nopadding">
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-form
ref="mioForm"
:model="form"
:rules="rules"
label-width="120px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="编号">
<el-input v-model="form.number" placeholder="编号" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="出入库日期">
<el-date-picker
v-model="form.inout_date"
type="date"
placeholder="出入库日期"
value-format="YYYY-MM-DD"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="urlCode == 'helpso_in'">
<el-form-item label="采购订单">
<el-select
v-model="form.pu_order"
clearable
style="width: 100%"
>
<el-option
v-for="item in puOrderOptions"
:key="item.id"
:label="item.number"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="urlCode == 'helpso_in'">
<el-form-item label="供应商">
<el-select
v-model="form.supplier"
clearable
style="width: 100%"
>
<el-option
v-for="item in supplierOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="urlCode == 'helpso_out'">
<el-form-item label="执行部门">
<el-select
v-model="form.belong_dept"
clearable
style="width: 100%"
@change="deptChange"
>
<el-option
v-for="item in deptOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="urlCode == 'helpso_out'">
<el-form-item label="工段">
<el-select
v-model="form.mgroup"
clearable
style="width: 100%"
placeholder="为空时代表领料/入库到车间"
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="urlCode == 'helpso_out'">
<el-form-item label="部门执行人">
<el-select v-model="form.do_user" clearable style="width: 100%">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="仓库执行人">
<el-select
v-model="form.mio_user"
clearable
style="width: 100%"
>
<el-option
v-for="item in userOption"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-button type="primary" :loading="mioSaveing" @click="mioSubmit">
保存
</el-button>
<el-button @click="visible = false">取消</el-button>
</el-row>
</el-form>
</el-card>
<el-card style="width: 100%;position: relative;" header="物料明细" shadow="never">
<el-button type="primary"
icon="el-icon-plus"
@click="table_add"
v-if="params.mio!==null"
style="position: absolute;right: 20px;top: 10px"
>新增</el-button>
<div style="height: 8px"></div>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="params"
hidePagination
hideDo
>
<el-table-column type="index" width="50" />
<el-table-column
label="物料"
prop="material"
show-overflow-tooltip
>
<template #default="scope"
>{{ scope.row.material_name }}
</template>
</el-table-column>
<el-table-column label="批次号" prop="batch">
</el-table-column>
<el-table-column label="仓库" prop="warehouse_name">
</el-table-column>
<el-table-column label="数量">
<template #default="scope">
<span v-if="scope.row.material_&&scope.row.material_.tracking==10">{{scope.row.count}}</span>
<el-link v-else :underline="false" type="primary" @click="showWpr(scope.row)">{{scope.row.count}}</el-link>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="150px"
>
<template #default="scope">
<el-link type="danger" @click="table_del(scope.row)">删除</el-link>
</template>
</el-table-column>
</scTable>
</el-card>
</el-main>
<el-footer>
<el-button type="primary" :loading="mioitemSaveing" @click="table_submit">提交</el-button>
</el-footer>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:mioId="mioId"
:mgroup="mioObj.mgroup"
:belongDeptId="mioObj.belong_dept"
:belongDeptName="mioObj.belong_dept_name"
:mioObj="mioObj"
:cate="cate"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
</el-container>
</template>
<script>
import saveDialog from "./mioitem_form.vue";
export default {
name: "mio",
components: {
saveDialog
},
data() {
return {
stateDict: {
10: "创建中",
20: "已提交",
},
stateOptions: [
{ id: 10, name: "创建中" },
{ id: 20, name: "已提交" },
],
typeDict: {
pur_in: "采购入库",
do_out: "领料出库",
},
dialog: {
save: false,
record: false,
},
params: {
mio: null,
},
form: {},
query: {},
mioObj:{},
mioId:null,
apiObj: null,
userOption: [],
userOptions: [],
deptOptions: [],
mgroupOptions: [],
puOrderOptions: [],
supplierOptions: [],
mioSaveing: false,
visibleDrawer: false,
mioitemSaveing: false,
urlCode: "helpso_in",
cate: "helpso",
type: "",
};
},
mounted() {
let that = this;
that.getUsers();
that.getDeptOptions();
that.getPuOrderOptions();
that.getSupplierOptions();
that.urlCode = window.location.hash.split('/')[2];
if (that.urlCode == "helpso_out") {
that.form.type = "do_out";
}else{
that.form.type = "pur_in";
}
},
methods: {
getDeptOptions() {
let that = this;
that.$API.system.dept.list.req({ page: 0, type__in: "dept" }).then((res) => {
that.deptOptions = res;
});
},
getmgroupOptions() {
let that = this;
that.$API.mtm.mgroup.list.req({ depts: that.form.belong_dept,page: 0}).then(res=>{
that.mgroupOptions = res;
})
},
getDeptUsers(){
let that = this;
that.$API.system.user.list.req({ depts: that.form.belong_dept, page: 0 }).then((res) => {
that.userOptions = res;
});
},
getUsers(){
let that = this;
that.$API.system.user.list.req({ posts__name: "库管", page: 0 }).then((res) => {
that.userOption = res;
});
},
deptChange(){
this.getDeptUsers();
this.getmgroupOptions();
},
getSupplierOptions() {
let that = this;
that.$API.pum.supplier.list.req({ page: 0 }).then((res) => {
that.supplierOptions = res;
});
},
getPuOrderOptions() {
let that = this;
that.$API.pum.order.list.req({ page: 0, type__in: "20,30" }).then((res) => {
that.puOrderOptions = res;
});
},
mioSubmit(){
let that = this;
that.$refs.mioForm.validate((valid) => {
if (valid) {
that.mioSaveing = true;
that.$API.inm.mio.create.req(that.form).then((res) => {
that.$message.success("保存成功");
that.mioSaveing = false;
that.mioId = res.id;
that.params.mio = res.id;
that.apiObj = that.$API.inm.mioitem.list;
that.$API.inm.mio.item.req(res.id).then((res1) => {
that.mioObj = res1;
})
}).catch((err) => {
that.mioSaveing = false;
});
}
})
},
//
table_add() {
let that = this;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add", that.form.type);
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit", that.form.type).setData(row);
});
},
//
table_detail(row) {
this.type = row.type;
this.mioId = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
//
table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.inm.mioitem.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
}).catch((err) => {
return err;
});
}).catch(() => {});
},
table_submit() {
let that = this;
that.mioitemSaveing = true;
that.$API.inm.mio.submit.req(that.mioObj.id).then((res) => {
that.mioitemSaveing = false;
that.$message.success("提交成功");
that.form.number = "";
that.form.inout_date = "";
that.form.pu_order = "";
that.form.supplier = "";
that.form.belong_dept = "";
that.form.mgroup = "";
that.form.do_user = "";
that.form.mio_user = "";
that.form.mio =null;
that.apiObj = null;
that.params.mio = null;
that.$refs.table.refresh();
}).catch((err) => {
that.mioitemSaveing = false;
});
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
handleSaveSuccess() {
this.$refs.table.refresh();
},
},
};
</script>

247
src/views/inm/materials.vue Normal file
View File

@ -0,0 +1,247 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="add"
v-auth="'material.create'"
>新增</el-button
>
<scFileImport
:templateUrl="materialTemplate"
accept=".xlsx"
:apiObj="$API.common.upload"
@success="upSuccess"
>
</scFileImport>
</div>
<div class="right-panel">
<el-input
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="params"
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料编号" prop="number">
</el-table-column>
<el-table-column label="物料名称" prop="name">
</el-table-column>
<el-table-column label="规格" prop="specification">
</el-table-column>
<el-table-column label="型号" prop="model">
</el-table-column>
<el-table-column label="物料特征">
<template #default="scope">
<el-tag
type="warning"
v-if="scope.row.is_hidden"
effect="plain"
></el-tag>
</template>
</el-table-column>
<el-table-column label="计量单位" prop="unit">
</el-table-column>
<el-table-column label="仓库位号" prop="bin_number_main">
</el-table-column>
<el-table-column label="总库存" prop="count">
</el-table-column>
<el-table-column label="安全库存" prop="count_safe">
</el-table-column>
<el-table-column label="单价" prop="unit_price">
</el-table-column>
<el-table-column label="总价" prop="count_safe">
<template #default="scope">
{{ scope.row.unit_price * scope.row.count }}
</template>
</el-table-column>
<el-table-column
v-if="materialType == ''"
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_edit(scope.row)"
v-auth="'material.update'"
>
编辑
</el-button>
<el-button
link
type="warning"
@click="table_copy(scope.row)"
v-auth="'material.create'"
>
复制
</el-button>
<el-button
link
type="danger"
@click="table_del(scope.row)"
v-auth="'material.delete'"
>
删除
</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</el-container>
</template>
<script>
import scFileImport from "@/components/scFileImport";
import saveDialog from "./../mtm/materials_form_gx.vue";
import { ElLoading } from "element-plus";
export default {
name: "rparty",
props: {
materialType: {
//
type: String,
default() {
return "";
},
},
},
components: {
saveDialog,
scFileImport,
ElLoading,
},
data() {
return {
project_code : this.$TOOL.data.get("BASE_INFO").base.base_code,
materialTemplate: " /media/default/template/material.xlsx",
dialog: {
save: false,
},
apiObj: this.$API.mtm.material.list,
params: { type: 40,is_hidden: false},
query: { is_hidden: false },
state_: {
10: "完好",
20: "限用",
30: "在修",
40: "禁用",
},
materialId: "",
materialName: "",
};
},
mounted() {
this.materialTemplate = this.materialTemplate+"?t=" + new Date().getTime();
},
methods: {
rowClick(row) {
this.materialId = row.id;
this.materialName = row.full_name;
this.$emit("choseChange", row.id);
},
handleClick(pane, ev) {
this.query.type = pane.props.name;
this.query.page = 1;
this.$refs.table.queryData(this.query);
},
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
table_copy(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add").setData(row);
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.mtm.material.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
}).catch((err) => {
return err;
});
}).catch(() => {});
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
upSuccess(res, close) {
close();
const loading = ElLoading.service({
fullscreen: true,
text: "解析中...请稍等",
});
this.$API.mtm.material.daoru.req({ path: res.path }).then((res) => {
loading.close();
this.$message.success("导入成功");
this.$refs.table.queryData(this.query);
}).catch((err) => {
loading.close();
});
},
},
};
</script>

View File

@ -211,7 +211,7 @@
type="danger"
@click="check_revert(scope.row)"
v-if="mioObj.state == 20&&(mioObj.type=='do_out'||mioObj.type=='other_in'||mioObj.type=='pur_in')"
v-auth="'mioitem.update'"
v-auth="'mio.update'"
>
撤回
</el-button>