fix: 子工序操作记录更改

This commit is contained in:
shijing 2025-12-01 16:49:27 +08:00
parent 97c7172306
commit 99f6c740c8
1 changed files with 93 additions and 150 deletions

View File

@ -58,87 +58,20 @@
header="子工序操作记录" header="子工序操作记录"
shadow="never" shadow="never"
> >
<el-button <sc-form-table
type="primary" hideDelete
icon="el-icon-plus" :tableHeight="tableHeight"
@click="table_muser_add" v-model="processLists"
style="position: absolute; left: 150px; top: 5px" :addTemplate="addTemplate"
>新增</el-button> placeholder="暂无数据"
<scTable @add="rowAdd"
ref="tableMuser"
:apiObj="apiObjMuser"
row-key="id"
stripe
height="250px"
:params="paramsMuser"
hidePagination
>
<el-table-column type="index" width="50" />
<el-table-column label="工序" prop="process_name">
</el-table-column>
<el-table-column label="操作人" prop="handle_user_name">
</el-table-column>
<el-table-column label="操作日期" prop="handle_date">
</el-table-column>
<el-table-column label="班次" prop="shift_name">
</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="100px"
> >
<el-table-column label="工序">
<template #default="scope"> <template #default="scope">
<el-button
type="danger"
@click="table_muser_del(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</scTable>
</el-card>
<!-- 日志操作记录编辑 -->
<el-dialog v-model="saveMuserDialog" title="子工序操作记录">
<el-form
:model="muserForm"
:rules="rules"
label-width="100px"
ref="saveInForm"
>
<el-row>
<el-col :span="23">
<el-form-item label="操作时间" prop="work_start_time">
<el-date-picker
v-model="muserForm.work_start_time"
type="datetime"
placeholder="操作时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="操作人" prop="handle_user">
<ehsSelect
v-model="muserForm.handle_user"
:showName="muserForm.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
class="width-100"
></ehsSelect>
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item label="子工序" prop="process">
<el-select <el-select
v-model="muserForm.process" v-if="scope.row.isEdit"
placeholder="请选择" v-model="scope.row.process"
placeholder="请选择子工序"
class="width-100" class="width-100"
> >
<el-option <el-option
@ -148,52 +81,51 @@
:value="item.id" :value="item.id"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> <div v-else>
</el-col> <span v-if="scope.row.process!==null">{{ scope.row.process_name}}</span>
<!-- <el-col :span="23"> </div>
<el-form-item label="关联班次" prop="shift">
<el-select
v-model="muserForm.shift"
placeholder="班次"
class="width-100"
>
<el-option
v-for="item in shiftOtions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="23" v-if="route_code=='pengma'">
<el-form-item label="使用设备" prop="equipment">
<el-select
v-model="muserForm.equipment"
placeholder="设备"
class="width-100"
>
<el-option
v-for="item in equipmentOtions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button
type="primary"
:loading="isSaveing"
@click="saveMuserSubmit()"
> </el-button>
</template> </template>
</el-dialog> </el-table-column>
<el-table-column label="操作人">
<template #default="scope">
<ehsSelect
v-if="scope.row.isEdit"
v-model="scope.row.handle_user"
:showName="scope.row.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
class="width-100"
></ehsSelect>
<div v-else>
<span v-if="scope.row.handle_user_name!==null">{{ scope.row.handle_user_name}}</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作时间">
<template #default="scope">
<el-date-picker
v-if="scope.row.isEdit"
v-model="scope.row.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm"
formatter="YYYY-MM-DD HH:mm"
style="width: 100%;"
/>
<div v-else>
<span v-if="scope.row.work_start_time!==null">{{ scope.row.work_start_time}}</span>
</div>
</template>
</el-table-column>
<el-table-column label="班次"></el-table-column>
<el-table-column label="创建时间"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="150px">
<template #default="scope">
<el-button v-if="scope.row.isEdit" type="success" @click="saveMuserSubmit(scope.row)">保存</el-button>
<el-button v-else type="danger" @click="table_muser_del(scope.row)">删除</el-button>
</template>
</el-table-column>
</sc-form-table>
</el-card>
<!-- 输入物料 --> <!-- 输入物料 -->
<el-card <el-card
style="width: 100%; margin: 1vh 0;position: relative" style="width: 100%; margin: 1vh 0;position: relative"
@ -486,7 +418,6 @@ export default {
loading: false, loading: false,
// //
form: {}, form: {},
muserForm:{},
dialog: { dialog: {
save: false, save: false,
edit: false, edit: false,
@ -530,6 +461,7 @@ export default {
equipmentOtions:[], equipmentOtions:[],
defectOptions:[], defectOptions:[],
qct_testitems:[], qct_testitems:[],
processLists:[],
processOptions:[], processOptions:[],
test_file:'', test_file:'',
deptId: "", deptId: "",
@ -541,7 +473,6 @@ export default {
printVisible:false, printVisible:false,
saveInDialog: false, saveInDialog: false,
checkTableShow:false, checkTableShow:false,
saveMuserDialog:false,
setFiltersVisible: false, setFiltersVisible: false,
rules: { rules: {
count_use: [{required: true,message: "请输入领取数量",trigger: "blur"}], count_use: [{required: true,message: "请输入领取数量",trigger: "blur"}],
@ -564,9 +495,11 @@ export default {
apiObjPrint:this.$API.cm.labelmat.fromWm, apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name"), printer_name:localStorage.getItem("printer_name"),
addTemplate:{ addTemplate:{
defect: "", mlog: "",
count: 1, process: "",
mlogb: "", handle_user: "",
handle_user_name: "",
work_start_time: "",
isEdit: true, isEdit: true,
}, },
qct:null, qct:null,
@ -588,6 +521,11 @@ export default {
this.paramsIn.mlog = this.mlogId; this.paramsIn.mlog = this.mlogId;
this.paramsOut.mlog = this.mlogId; this.paramsOut.mlog = this.mlogId;
this.apiObj = this.$API.wpm.mlogb.list; this.apiObj = this.$API.wpm.mlogb.list;
let userInfo = that.$TOOL.data.get("USER_INFO");
that.addTemplate.mlog = that.mlogItem.id;
that.addTemplate.handle_user = userInfo.id;
that.addTemplate.handle_user_name = userInfo.name;
that.addTemplate.work_start_time = this.$TOOL.dateFormat(new Date());
that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => { that.$API.wpm.mlogb.list.req(that.paramsIn).then((res) => {
that.tableData = res; that.tableData = res;
}) })
@ -595,6 +533,7 @@ export default {
that.getPreocess(); that.getPreocess();
that.getShift(); that.getShift();
that.getEquipment(); that.getEquipment();
that.getProcessList();
}, },
methods: { methods: {
open() { open() {
@ -664,6 +603,12 @@ export default {
} }
}) })
}, },
getProcessList(){
let that = this;
that.$API.wpm.mloguser.list.req({page:0,mlog:that.mlogId}).then((res) => {
that.processLists = res;
})
},
getShift(){ getShift(){
let that = this; let that = this;
that.$API.mtm.shift.list.req({ page: 0 }).then((res) => { that.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
@ -917,23 +862,13 @@ export default {
that.isSaveing = false; that.isSaveing = false;
}); });
}, },
table_muser_add(){ saveMuserSubmit(row){
let that = this;
let userInfo = that.$TOOL.data.get("USER_INFO");
that.muserForm.mlog = that.mlogItem.id;
that.muserForm.handle_user = userInfo.id;
that.muserForm.handle_user_name = userInfo.name;
that.muserForm.work_start_time = this.$TOOL.dateFormat(new Date());
that.saveMuserDialog = true;
},
saveMuserSubmit (){
let that = this; let that = this;
that.isSaveing = true; that.isSaveing = true;
that.$API.wpm.mloguser.create.req(that.muserForm).then((res) => { that.$API.wpm.mloguser.create.req(that.addTemplate).then((res) => {
that.isSaveing = false; that.isSaveing = false;
that.saveMuserDialog = false;
that.$message.success("操作成功"); that.$message.success("操作成功");
that.$refs.tableMuser.refresh(); that.getProcessList();
}).catch(() => { }).catch(() => {
that.isSaveing = false; that.isSaveing = false;
}) })
@ -947,6 +882,14 @@ export default {
}) })
}) })
}, },
table_muser_edit(row){
let that = this;
console.log('row',row);
let index = that.processLists.indexOf(row);
console.log('index',index);
that.processLists[index].isEdit = true;
},
handleSaveSuccess() { handleSaveSuccess() {
this.$refs.tableIn.refresh(); this.$refs.tableIn.refresh();
if(this.mlogItem.material_out_&&this.mlogItem.material_out_.tracking==10){ if(this.mlogItem.material_out_&&this.mlogItem.material_out_.tracking==10){