This commit is contained in:
shijing 2023-12-18 13:14:34 +08:00
commit 825364b137
1 changed files with 80 additions and 73 deletions

View File

@ -63,7 +63,7 @@
<span>任务信息</span>
<span>
<el-button type="primary" link @click="addMtaskInfo"
v-if="currentMtask && (currentMtask.state == 20||currentMtask.state==10)">编辑</el-button>
v-if="currentMtask && (currentMtask.state == 20 || currentMtask.state == 10)">编辑</el-button>
</span>
</div>
</template>
@ -83,7 +83,7 @@
<el-descriptions-item label="配粉料数">{{ currentMtask.peifen_kg
}}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-header>
<el-main class="nopadding">
@ -111,7 +111,8 @@
</el-table-column>
<el-table-column label="合格率" prop="count">
<template #default="scope">
<span>{{ Math.floor(scope.row.count_ok / scope.row.count_real*100) }}%</span>
<span>{{ Math.floor(scope.row.count_ok / scope.row.count_real * 100)
}}%</span>
</template>
</el-table-column>
<el-table-column label="不合格原因及数量" align="center">
@ -137,15 +138,20 @@
<el-table-column label="碎料" prop="count_break"> </el-table-column>
<el-table-column label="操作" fixed="right" width="120" align="center">
<template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)"
<el-button link type="primary" @click="table_edit(scope.row)"
v-auth="'mlog.update'" v-if="scope.row.submit_time == null">编辑
</el-link>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'mlog.delete'"
v-if="scope.row.submit_time == null">删除
</el-link>
<el-link type="primary" @click="mlog_submit(scope.row)"
v-auth="'mlog.submit'" v-if="scope.row.submit_time == null">提交
</el-link>
</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="primary" @click="mlog_submit(scope.row)"
v-auth="'mlog.submit'" v-if="scope.row.submit_time == null"
:loading="mlogHandleLoading">提交
</el-button>
<el-button link type="danger" @click="mlog_revert(scope.row)"
v-auth="'mlog.submit'" v-if="scope.row.submit_time != null"
:loading="mlogHandleLoading">撤回
</el-button>
<el-button link type="success" @click="table_show(scope.row)">
日志记录
</el-button>
@ -243,43 +249,23 @@
</el-main>
</el-container>
</el-main>
<save-dialog
v-if="dialogSave"
ref="saveDialog"
:mtask="mtask"
:mgroup="mgroup"
:material_out="material_out"
:brothersList="brothersList"
:activeType="activeName"
@success="handleSaveSuccess"
@closed="dialogSave = false"
></save-dialog>
<showDrawer ref="showDrawer"
v-if="visibleDrawer"
:mlogId="mlogId"
@closed="visibleDrawer = false">
<save-dialog v-if="dialogSave" ref="saveDialog" :mtask="currentMtask.id" :mgroup="mgroup"
:material_out="material_out" :brothersList="brothersList" :activeType="activeName" @success="handleSaveSuccess"
@closed="dialogSave = false"></save-dialog>
<showDrawer ref="showDrawer" v-if="visibleDrawer" :mlogId="mlogId" @closed="visibleDrawer = false">
</showDrawer>
<el-dialog title="编辑任务" v-model="addMtaskInfoVisible">
<el-form :model="addMtaskInfoForm">
<el-form-item label="配分料数(kg)" width="100">
<el-input-number
v-model="addMtaskInfoForm.peifen_kg"
controls-position="right"
:min="0"
:step="1"
:step-strictly="true"
style="width: 100%"
placeholder="请输入"
>
</el-input-number>
</el-form-item>
<el-input-number v-model="addMtaskInfoForm.peifen_kg" controls-position="right" :min="0" :step="1"
:step-strictly="true" style="width: 100%" placeholder="请输入">
</el-input-number>
</el-form-item>
</el-form>
<el-footer>
<el-button type="primary" @click="updateMtaskSubmit"
>确定</el-button
>
<el-button @click="addMtaskInfoVisible = false">取消</el-button>
</el-footer>
<el-button type="primary" @click="updateMtaskSubmit">确定</el-button>
<el-button @click="addMtaskInfoVisible = false">取消</el-button>
</el-footer>
</el-dialog>
</el-container>
</template>
@ -288,14 +274,15 @@ import saveDialog from "./worktask_form.vue";
import showDrawer from "./mlog_drawer.vue";
export default {
components: {
saveDialog,showDrawer
saveDialog, showDrawer
},
data() {
return {
mlogHandleLoading: false,
addMtaskInfoForm: {},
addMtaskInfoVisible: false,
activeName:'10车间',
mlogs:[],
activeName: '10车间',
mlogs: [],
currentDept: {},
currentMtask: {},
apiMtask: null,
@ -307,30 +294,40 @@ export default {
30: "生产中",
40: "已提交",
},
brothersList:[],
brothersListorigin:[],
brothersList: [],
brothersListorigin: [],
apiObjHandover: null,
apiObjWm: null,
visibleDrawer:false,
dialogSave:false,
visibleDrawer: false,
dialogSave: false,
paramsHandover: {},
paramsWm: {},
mtask:'',
mgroup:'',
mlogId:'',
material_out:''
mgroup: '',
mlogId: '',
material_out: ''
}
},
mounted() {
this.initDept()
},
methods: {
mlog_revert(row) {
this.mlogHandleLoading = true;
this.$API.wpm.mlog.revert.req(row.id).then(res => {
this.$message.success("撤回成功");
this.mtaskClick(this.currentMtask)
this.$refs.table_wm.refresh()
this.mlogHandleLoading = false;
}).catch(e => {
this.mlogHandleLoading = false;
})
},
addMtaskInfo() {
this.addMtaskInfoForm.peifen_kg = this.currentMtask.peifen_kg
this.addMtaskInfoVisible = true
},
updateMtaskSubmit() {
this.$API.pm.mtask.addInfo.req(this.currentMtask.id, this.addMtaskInfoForm).then(res=>{
this.$API.pm.mtask.addInfo.req(this.currentMtask.id, this.addMtaskInfoForm).then(res => {
this.currentMtask.peifen_kg = this.addMtaskInfoForm.peifen_kg
this.addMtaskInfoVisible = false
this.$message.success('操作成功')
@ -339,7 +336,7 @@ export default {
tomio() {
this.$router.push({ name: "mainso_mio" });
},
tomioin(){
tomioin() {
this.$router.push({ name: "halfgood_mio" });
},
initDept() {
@ -371,25 +368,30 @@ export default {
})
},
getMlogs() {
this.$API.wpm.mlog.list.req({ mtask: this.mtask, page: 0 }).then(res => {
this.$API.wpm.mlog.list.req({ mtask: this.currentMtask.id, page: 0 }).then(res => {
this.mlogs = res
})
},
getMtask() {
this.$API.pm.mtask.item.req(this.currentMtask.id).then(res => {
this.currentMtask = res
})
},
mtaskClick(row) {
this.currentMtask = row;
this.mtask = row.id;
this.brothersListorigin=[];
this.getMtask()
this.brothersListorigin = [];
this.brothersListorigin = this.currentMtask.material_out_.brothers;
this.getMlogs()
},
addMlog(){
addMlog() {
let that = this;
if (that.currentMtask && that.currentMtask.id) {
that.mgroup = that.currentMtask.mgroup;
that.material_out = that.currentMtask.material_out;
let arr = [];
this.brothersList =[];
this.brothersListorigin.forEach(item=>{
this.brothersList = [];
this.brothersListorigin.forEach(item => {
let obj = {};
obj.count_ok = null;
obj.material_out = item;
@ -422,15 +424,15 @@ export default {
this.$refs.showDrawer.open();
});
},
table_edit(row){
table_edit(row) {
let arr = [];
let mlogb = row.mlogb;
this.brothersListorigin.forEach(item=>{
this.brothersListorigin.forEach(item => {
let obj = {};
obj.count_ok = null;
obj.material_out = item;
for(let i=0;i<mlogb.length;i++){
if(mlogb[i].material_out==item){
for (let i = 0; i < mlogb.length; i++) {
if (mlogb[i].material_out == item) {
obj.count_ok = mlogb[i].count_ok;
}
}
@ -449,22 +451,27 @@ export default {
type: "warning",
}).then(() => {
that.$API.wpm.mlog.delete.req(row.id).then((res) => {
that.$message.success("删除成功");
that.getMlogs();
return res;
that.$message.success("删除成功");
that.getMlogs();
return res;
}).catch((err) => {
return err;
return err;
});
}).catch(() => { });
},
handleSaveSuccess(){
handleSaveSuccess() {
this.getMlogs();
},
mlog_submit(row){
mlog_submit(row) {
this.mlogHandleLoading = true
this.$API.wpm.mlog.submit.req(row.id).then(res => {
this.$message.success('操作成功')
this.$refs.table_mlog.refresh()
}).catch(err => {})
this.mtaskClick(this.currentMtask)
this.$refs.table_wm.refresh()
this.mlogHandleLoading = false
}).catch(err => {
this.mlogHandleLoading = false
})
},
}
}