664 lines
16 KiB
Vue
664 lines
16 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header style="height: 50%; padding: 0">
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
@click="add"
|
|
v-auth="'mlog.create'"
|
|
>新增</el-button
|
|
>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<scTable
|
|
ref="table"
|
|
:apiObj="apiObj"
|
|
row-key="id"
|
|
stripe
|
|
:params="params"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column
|
|
label="物料名"
|
|
prop="material_out_name"
|
|
>
|
|
<template #default="scope">
|
|
<span v-if="scope.row.material_out_">
|
|
{{ scope.row.material_out_.full_name }}
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="设备名" prop="equipment_name">
|
|
</el-table-column>
|
|
<el-table-column label="批次号" prop="batch">
|
|
</el-table-column>
|
|
<el-table-column label="操作日期" prop="handle_date">
|
|
</el-table-column>
|
|
<el-table-column label="退火数" prop="count_real">
|
|
</el-table-column>
|
|
<el-table-column label="合格数" prop="count_ok">
|
|
</el-table-column>
|
|
<el-table-column label="不合格数" prop="count_notok">
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
fixed="right"
|
|
align="center"
|
|
width="180"
|
|
>
|
|
<template #default="scope">
|
|
<el-button
|
|
link
|
|
type="primary"
|
|
v-if="scope.row.submit_time == null"
|
|
@click="table_edit(scope.row)"
|
|
v-auth="'mlog.update'"
|
|
>
|
|
编辑
|
|
</el-button>
|
|
<el-button
|
|
link
|
|
type="danger"
|
|
@click="table_del(scope.row)"
|
|
v-auth="'mlog.delete'"
|
|
v-if="scope.row.submit_time == null"
|
|
>
|
|
删除
|
|
</el-button>
|
|
<el-button
|
|
link
|
|
type="success"
|
|
v-if="scope.row.submit_user == null"
|
|
@click="table_submit(scope.row)"
|
|
v-auth="'mlog.submit'"
|
|
>
|
|
提交
|
|
</el-button>
|
|
<el-button
|
|
link
|
|
type="warning"
|
|
v-if="scope.row.submit_time != null"
|
|
@click="table_revert(scope.row)"
|
|
v-auth="'mlog.submit'"
|
|
>
|
|
撤回
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<el-container>
|
|
<el-aside style="width: 60%">
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<span style="font-size: 14px">交接记录</span>
|
|
<el-button
|
|
type="primary"
|
|
@click="addHandover"
|
|
v-auth="'handover.create'"
|
|
>新增</el-button
|
|
>
|
|
</div>
|
|
<div class="right-panel">
|
|
<el-input
|
|
v-model="queryHandover.search"
|
|
placeholder="批次号"
|
|
clearable
|
|
style="margin-right: 5px"
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="queryHandoverChange"
|
|
></el-button>
|
|
<el-button
|
|
type="primary"
|
|
@click="materialsChoses('handover')"
|
|
>选择物料</el-button
|
|
>
|
|
</div>
|
|
</el-header>
|
|
<el-main>
|
|
<scTable
|
|
ref="table2"
|
|
:apiObj="apiObjHandover"
|
|
row-key="id"
|
|
stripe
|
|
:params="paramsHandover"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column
|
|
label="送料日期"
|
|
prop="send_date"
|
|
width="120"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="产物"
|
|
prop="material_name"
|
|
show-overflow-tooltip
|
|
width="120"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column label="批次" prop="batch">
|
|
</el-table-column>
|
|
<el-table-column label="数量" prop="count">
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="交送人"
|
|
prop="send_user_name"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="接收部门"
|
|
prop="recive_dept_name"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="接收人"
|
|
prop="recive_user_name"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="是否确认"
|
|
prop="submit_time"
|
|
>
|
|
<template #default="scope">
|
|
<span v-if="scope.row.submit_time"
|
|
>是</span
|
|
>
|
|
<span v-else>否</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="操作"
|
|
fixed="right"
|
|
align="left"
|
|
width="100"
|
|
>
|
|
<template #default="scope">
|
|
<!-- <el-button link type="primary" @click="handover_edit(scope.row)"
|
|
v-auth="'handover.update'" v-if="scope.row.submit_time == null">
|
|
编辑
|
|
</el-button> -->
|
|
<el-button
|
|
link
|
|
type="danger"
|
|
@click="handover_delete(scope.row)"
|
|
v-auth="'handover.delete'"
|
|
v-if="scope.row.submit_time == null"
|
|
>
|
|
删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
</el-aside>
|
|
<el-main class="nopadding">
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<span style="font-size: 14px">车间库存</span>
|
|
</div>
|
|
<div class="right-panel">
|
|
<el-input
|
|
v-model="queryWm.search"
|
|
placeholder="批次号"
|
|
clearable
|
|
style="margin-right: 5px"
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="paramsWmChange"
|
|
></el-button>
|
|
<el-button
|
|
type="primary"
|
|
@click="materialsChoses('wm')"
|
|
>选择物料</el-button
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
@click="tomio"
|
|
v-auth="'mio.do'"
|
|
>领料</el-button
|
|
>
|
|
<el-button
|
|
type="primary"
|
|
@click="tomio"
|
|
v-auth="'mio.do'"
|
|
>入库</el-button
|
|
>
|
|
</div>
|
|
</el-header>
|
|
<el-main>
|
|
<scTable
|
|
ref="table_wm"
|
|
:apiObj="apiObjWm"
|
|
row-key="id"
|
|
:params="paramsWm"
|
|
stripe
|
|
hidePagination
|
|
>
|
|
<el-table-column
|
|
label="物料"
|
|
prop="material_name"
|
|
>
|
|
</el-table-column>
|
|
<el-table-column label="批次" prop="batch">
|
|
</el-table-column>
|
|
<el-table-column
|
|
label="数量"
|
|
prop="count"
|
|
width="80"
|
|
>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
</el-main>
|
|
</el-container>
|
|
</el-main>
|
|
</el-container>
|
|
<el-dialog
|
|
:title="titleOptions[handoverType]"
|
|
ref="handoverDialog"
|
|
v-model="handoverVisible"
|
|
:size="1000"
|
|
destroy-on-close
|
|
@closed="handoverVisible = false"
|
|
>
|
|
<el-form
|
|
ref="dialogForm"
|
|
:model="handoverForm"
|
|
:rules="rules"
|
|
label-width="120px"
|
|
>
|
|
<el-row>
|
|
<el-col :md="24" :sm="24">
|
|
<el-form-item label="交送物料" prop="wm">
|
|
<el-select
|
|
v-model="selectWm"
|
|
placeholder="交送物料"
|
|
clearable
|
|
style="width: 100%"
|
|
:disabled="handoverType == 'edit'"
|
|
value-key="id"
|
|
@change="selectWmChange"
|
|
>
|
|
<el-option
|
|
v-for="item in wmaterialList"
|
|
:key="item.id"
|
|
:label="item.material_name + '---' + item.batch"
|
|
:value="item"
|
|
>
|
|
<span style="float: left"
|
|
>{{ item.material_name }}---{{
|
|
item.batch
|
|
}}</span
|
|
>
|
|
<span
|
|
style="
|
|
float: right;
|
|
color: var(--el-text-color-secondary);
|
|
font-size: 13px;
|
|
"
|
|
>{{ item.count }}</span
|
|
>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="送料日期" prop="send_date">
|
|
<el-date-picker
|
|
v-model="handoverForm.send_date"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
style="width: 100%"
|
|
:disabled="handoverType == 'edit'"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="交送数量" prop="count">
|
|
<el-input-number
|
|
v-model="handoverForm.count"
|
|
controls-position="right"
|
|
:min="0"
|
|
step="1"
|
|
:step-strictly="true"
|
|
style="width: 100%"
|
|
placeholder="数量"
|
|
>
|
|
</el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="交送人" prop="send_user">
|
|
<el-select
|
|
v-model="handoverForm.send_user"
|
|
placeholder="交送人"
|
|
clearable
|
|
style="width: 100%"
|
|
:disabled="handoverType == 'edit'"
|
|
>
|
|
<el-option
|
|
v-for="item in userList"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24">
|
|
<el-form-item label="接收部门" prop="recive_dept">
|
|
<el-select
|
|
v-model="handoverForm.recive_dept"
|
|
placeholder="接收部门"
|
|
clearable
|
|
style="width: 100%"
|
|
@change="getUserList2"
|
|
:disabled="handoverType == 'edit'"
|
|
>
|
|
<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">
|
|
<el-form-item label="接收人" prop="recive_user">
|
|
<el-select
|
|
v-model="handoverForm.recive_user"
|
|
placeholder="接收人"
|
|
clearable
|
|
style="width: 100%"
|
|
:disabled="handoverType == 'edit'"
|
|
>
|
|
<el-option
|
|
v-for="item in userList2"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<el-footer>
|
|
<el-button @click="handoverVisible = false">取消</el-button>
|
|
<el-button type="primary" @click="submitHandover">提交</el-button>
|
|
</el-footer>
|
|
</el-dialog>
|
|
<save-dialog
|
|
v-if="dialogSave"
|
|
ref="saveDialog"
|
|
:belongdept="currentMgroup.belong_dept"
|
|
:mgroup="currentMgroup.id"
|
|
:mgroupShiftRule="currentMgroup.shift_rule"
|
|
:activeType="activeName"
|
|
@success="handleSaveSuccess"
|
|
@closed="dialogSave = false"
|
|
>
|
|
</save-dialog>
|
|
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
|
|
<materials
|
|
style="height: 500px"
|
|
:materialType="materialType"
|
|
ref="materialsChose"
|
|
@choseChange="choseChange"
|
|
></materials>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
import saveDialog from "./worktask_form.vue";
|
|
import materials from "./../mtm/materials.vue";
|
|
export default {
|
|
components: {
|
|
saveDialog,
|
|
materials,
|
|
},
|
|
data() {
|
|
return {
|
|
activeName: "退火",
|
|
handoverType: "add",
|
|
titleOptions: {
|
|
add: "新增",
|
|
edit: "编辑",
|
|
},
|
|
currentMgroup: {},
|
|
apiObj: null,
|
|
params: {},
|
|
apiObjHandover: null,
|
|
paramsHandover: {},
|
|
queryHandover: {
|
|
search: "",
|
|
material: "",
|
|
},
|
|
apiObjWm: null,
|
|
paramsWm: {},
|
|
queryWm: {
|
|
search: "",
|
|
material: "",
|
|
},
|
|
handoverForm: {},
|
|
dialogSave: false,
|
|
handoverVisible: false,
|
|
deptOptions: [],
|
|
userList: [],
|
|
userList2: [],
|
|
wmaterialList: [],
|
|
selectWm: null,
|
|
materialsVisible: false,
|
|
};
|
|
},
|
|
mounted() {
|
|
this.initMgroup();
|
|
this.getDepts();
|
|
},
|
|
methods: {
|
|
materialsChoses(str) {
|
|
this.materialType = str;
|
|
this.materialsVisible = true;
|
|
},
|
|
choseChange(data) {
|
|
if (this.materialType == "wm") {
|
|
this.queryWm.material = data;
|
|
this.$refs.table_wm.queryData(this.queryWm);
|
|
} else {
|
|
this.queryHandover.material = data;
|
|
this.$refs.table2.queryData(this.queryHandover);
|
|
}
|
|
|
|
this.materialsVisible = false;
|
|
},
|
|
queryHandoverChange() {
|
|
this.$refs.table2.queryData(this.queryHandover);
|
|
},
|
|
paramsWmChange() {
|
|
this.$refs.table_wm.queryData(this.queryWm);
|
|
},
|
|
add() {
|
|
this.dialogSave = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("add");
|
|
});
|
|
},
|
|
//编辑
|
|
table_edit(row) {
|
|
this.dialogSave = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("edit").setData(row);
|
|
});
|
|
},
|
|
tomio() {
|
|
this.$router.push({ name: "halfgood_mio" });
|
|
},
|
|
table_submit(row) {
|
|
this.$API.wpm.mlog.submit.req(row.id).then((res) => {
|
|
this.$message.success("提交成功");
|
|
this.$refs.table.refresh();
|
|
this.$refs.table_wm.refresh();
|
|
});
|
|
},
|
|
table_revert(row) {
|
|
this.$API.wpm.mlog.revert
|
|
.req(row.id)
|
|
.then((res) => {
|
|
this.$message.success("撤回成功");
|
|
this.$refs.table.refresh();
|
|
this.$refs.table_wm.refresh();
|
|
})
|
|
.catch((e) => {});
|
|
},
|
|
async table_del(row) {
|
|
this.$confirm(`确定删除吗?`, "提示", {
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
this.$API.wpm.mlog.delete
|
|
.req(row.id)
|
|
.then((res) => {
|
|
this.$message.success("删除成功");
|
|
this.$refs.table.refresh();
|
|
return res;
|
|
})
|
|
.catch((err) => {
|
|
return err;
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
handleSaveSuccess() {
|
|
this.$refs.table.refresh();
|
|
},
|
|
getDepts() {
|
|
this.$API.system.dept.list
|
|
.req({ page: 0, name__in: "6车间,7车间,10车间" })
|
|
.then((res) => {
|
|
this.deptOptions = res;
|
|
});
|
|
},
|
|
getUserList2() {
|
|
this.$API.system.user.list
|
|
.req({ belong_dept: this.handoverForm.recive_dept, page: 0 })
|
|
.then((res) => {
|
|
this.userList2 = res;
|
|
});
|
|
},
|
|
initMgroup() {
|
|
this.$API.mtm.mgroup.list
|
|
.req({ page: 0, name: "管料退火" })
|
|
.then((res) => {
|
|
if (res.length == 1) {
|
|
this.currentMgroup = res[0];
|
|
this.params.mgroup = this.currentMgroup.id;
|
|
this.apiObj = this.$API.wpm.mlog.list;
|
|
|
|
this.paramsHandover.send_mgroup = this.currentMgroup.id;
|
|
this.apiObjHandover = this.$API.wpm.handover.list;
|
|
|
|
this.paramsWm.belong_dept =
|
|
this.currentMgroup.belong_dept;
|
|
this.paramsWm.material__process__name__contains =
|
|
"管料";
|
|
this.paramsWm.count__gte = 1;
|
|
this.apiObjWm = this.$API.wpm.wmaterial.list;
|
|
|
|
this.$API.system.user.list
|
|
.req({
|
|
page: 0,
|
|
belong_dept: this.currentMgroup.belong_dept,
|
|
})
|
|
.then((res) => {
|
|
this.userList = res;
|
|
});
|
|
} else {
|
|
this.$message.error("未找到工段");
|
|
}
|
|
});
|
|
},
|
|
//创建交接记录
|
|
addHandover(row) {
|
|
this.getWmaterial();
|
|
this.handoverForm.wm = "";
|
|
this.handoverForm.send_date = "";
|
|
this.handoverForm.send_user = "";
|
|
|
|
this.handoverForm.recive_user = ""; //接收人
|
|
this.handoverForm.recive_dept = ""; //接收车间
|
|
this.handoverForm.send_mgroup = this.currentMgroup.id;
|
|
this.handoverType = "add";
|
|
this.handoverVisible = true;
|
|
},
|
|
selectWmChange(item) {
|
|
this.handoverForm.count = item.count;
|
|
this.handoverForm.count_eweight = item.count_eweight;
|
|
this.handoverForm.wm = item.id;
|
|
this.handoverForm.send_dept = this.currentMgroup.belong_dept;
|
|
this.handoverForm.send_mgroup = this.currentMgroup.id;
|
|
this.handoverForm.material = item.material;
|
|
this.handoverForm.batch = item.batch;
|
|
},
|
|
getWmaterial() {
|
|
let obj = {};
|
|
obj.belong_dept = this.currentMgroup.belong_dept;
|
|
obj.material__process = this.currentMgroup.process;
|
|
obj.page = 0;
|
|
obj.count__gte = 1;
|
|
this.$API.wpm.wmaterial.list.req(obj).then((res) => {
|
|
this.wmaterialList = res;
|
|
});
|
|
},
|
|
submitHandover() {
|
|
this.$API.wpm.handover.create.req(this.handoverForm).then((res) => {
|
|
this.$message.success("创建成功");
|
|
this.handoverVisible = false;
|
|
this.$refs.table2.refresh();
|
|
});
|
|
},
|
|
handover_edit(row) {
|
|
Object.assign(this.handoverForm, row);
|
|
this.getUserList2(row.recive_dept);
|
|
this.handoverType = "edit";
|
|
this.handoverVisible = true;
|
|
},
|
|
handover_delete(row) {
|
|
this.$confirm(`确定删除吗?`, "提示", {
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
this.$API.wpm.handover.delete
|
|
.req(row.id)
|
|
.then((res) => {
|
|
this.$message.success("删除成功");
|
|
this.$refs.table2.refresh();
|
|
return res;
|
|
})
|
|
.catch((err) => {
|
|
return err;
|
|
});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
},
|
|
};
|
|
</script>
|