成品检验表格宽度修改

This commit is contained in:
shijing 2024-02-22 09:40:06 +08:00
parent 136eff089f
commit 6beafdc9f2
1 changed files with 102 additions and 167 deletions

View File

@ -6,180 +6,108 @@
<el-descriptions-item label="日期">{{ workObj.test_date }}</el-descriptions-item> <el-descriptions-item label="日期">{{ workObj.test_date }}</el-descriptions-item>
<el-descriptions-item label="批次号">{{ workObj.batch }}</el-descriptions-item> <el-descriptions-item label="批次号">{{ workObj.batch }}</el-descriptions-item>
<el-descriptions-item label="总数">{{ workObj.count }}</el-descriptions-item> <el-descriptions-item label="总数">{{ workObj.count }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
</div> </div>
<div style="height:8px"></div> <div style="height:8px"></div>
<div> <div>
<el-card style="width: 100%" header="检验记录" shadow="hover"> <el-card style="width: 100%" header="检验记录" shadow="hover">
<!-- 预制棒 --> <!-- 预制棒 -->
<sc-form-table <sc-form-table ref="formTable" v-if="type == 'bang'" v-model="formTableData" :addTemplate="addTemplate"
ref="formTable" placeholder="暂无数据">
v-if="type=='bang'"
v-model="formTableData"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column prop="val" label="抽检编号" min-width="120"> <el-table-column prop="val" label="抽检编号" min-width="120">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.id">{{scope.row.test_numer}}</span> <span v-if="scope.row.id">{{ scope.row.test_numer }}</span>
<el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input> <el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检验记录" align="center"> <el-table-column label="检验记录" align="center">
<template v-for="(item0,$index) in ftestitems" :key="item0.id"> <template v-for="(item0, $index) in ftestitems" :key="item0.id">
<el-table-column prop="test_val" :label="item0.name"> <el-table-column prop="test_val" :label="item0.name" min-width="130">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.ftestitems[$index].test_val" :disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right"> <el-input-number v-model="scope.row.ftestitems[$index].test_val"
:disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right">
</el-input-number> </el-input-number>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="test_val" label="合格判定" width="100"> <el-table-column prop="test_val" label="合格判定" min-width="90">
<template #default="scope"> <template #default="scope">
<el-select <el-select v-model="scope.row.is_ok" placeholder="是否合格" clearable :disabled="!scope.row.isEdit"
v-model="scope.row.is_ok" style="width:100%">
placeholder="是否合格" <el-option label="是" :value="true" />
clearable <el-option label="否" :value="false" />
:disabled="!scope.row.isEdit" </el-select>
style="width:100%"
>
<el-option label="是" :value="true"/>
<el-option label="否" :value="false"/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="test_user" label="检验人" width="120"> <el-table-column prop="test_user" label="检验人" width="120">
<template #default="scope"> <template #default="scope">
<el-select <el-select v-model="scope.row.test_user" placeholder="检验人" clearable filterable
v-model="scope.row.test_user" :disabled="!scope.row.isEdit" style="width:100%">
placeholder="检验人" <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
clearable </el-select>
filterable
:disabled="!scope.row.isEdit"
style="width:100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="open" label="操作" width="80" align="center"> <el-table-column prop="open" label="操作" fixed="right" width="90" align="center">
<template #default="scope"> <template #default="scope">
<el-button <el-link type="primary" v-if="scope.row.isEdit" @click="saveCheck(scope.row)">保存</el-link>
text type="primary" <el-link type="primary" v-else @click="editCheck(scope.row)">编辑</el-link>
size="small" <el-link type="danger" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
v-if="scope.row.isEdit"
@click="saveCheck(scope.row)"
>保存</el-button>
<el-button
text type="primary"
size="small"
v-else
@click="editCheck(scope.row)"
>编辑</el-button>
<el-button
text
type="danger"
size="small"
@click="delCheck(scope.row.id)"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</sc-form-table> </sc-form-table>
<!-- 预制管 --> <!-- 预制管 -->
<sc-form-table <sc-form-table ref="formTable" v-else-if="type == 'guan'" v-model="formTableData" :addTemplate="addTemplate"
ref="formTable" placeholder="暂无数据">
v-else-if="type=='guan'"
v-model="formTableData"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column prop="val" label="抽检编号"> <el-table-column prop="val" label="抽检编号">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.id">{{scope.row.test_numer}}</span> <span v-if="scope.row.id">{{ scope.row.test_numer }}</span>
<el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input> <el-input v-else v-model="scope.row.test_numer" placeholder="抽检编号"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="检验记录" align="center"> <el-table-column label="检验记录" align="center">
<template v-for="(item,$index) in ftestitems" :key="item.id"> <template v-for="(item, $index) in ftestitems" :key="item.id">
<el-table-column prop="test_val" :label="item.name"> <el-table-column prop="test_val" :label="item.name" min-width="130">
<template #default="scope"> <template #default="scope">
<el-input-number v-model="scope.row.ftestitems[$index].test_val" :disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right"> <el-input-number v-model="scope.row.ftestitems[$index].test_val"
:disabled="!scope.row.isEdit" :min="0" style="width:100%" controls-position="right">
</el-input-number> </el-input-number>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="test_val" label="合格判定" min-width="120" align="center"> <el-table-column prop="test_val" label="合格判定" min-width="90" align="center">
<template #default="scope"> <template #default="scope">
<el-select <el-select v-model="scope.row.is_ok" placeholder="是否合格" clearable :disabled="!scope.row.isEdit"
v-model="scope.row.is_ok" style="width:100%">
placeholder="是否合格" <el-option label="是" :value="true" />
clearable <el-option label="否" :value="false" />
:disabled="!scope.row.isEdit" </el-select>
style="width:100%"
>
<el-option label="是" :value="true"/>
<el-option label="否" :value="false"/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="test_user" label="检验人" min-width="120" align="center"> <el-table-column prop="test_user" label="检验人" min-width="120" align="center">
<template #default="scope"> <template #default="scope">
<el-select <el-select v-model="scope.row.test_user" placeholder="检验人" clearable filterable
v-model="scope.row.test_user" :disabled="!scope.row.isEdit" style="width:100%">
placeholder="检验人" <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id" />
clearable </el-select>
filterable
:disabled="!scope.row.isEdit"
style="width:100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="open" label="操作" width="80" align="center"> <el-table-column prop="open" label="操作" fixed="right" width="90" align="center">
<template #default="scope"> <template #default="scope">
<el-button <el-link type="primary" v-if="scope.row.isEdit" @click="saveCheck(scope.row)">保存</el-link>
text type="primary" <el-link type="primary" v-else @click="editCheck(scope.row)">编辑</el-link>
size="small" <el-link type="danger" @click="delCheck(scope.row.id)" style="margin-left: 2px;">删除</el-link>
v-if="scope.row.isEdit"
@click="saveCheck(scope.row)"
>保存</el-button>
<el-button
text type="primary"
size="small"
v-else
@click="editCheck(scope.row)"
>编辑</el-button>
<el-button
text
type="danger"
size="small"
@click="delCheck(scope.row.id)"
>删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</sc-form-table> </sc-form-table>
</el-card> </el-card>
</div> </div>
</div> </div>
<save-dialog v-if="dialog.save" ref="saveDialog" <save-dialog v-if="dialog.save" ref="saveDialog" :mioId="mioId" :belongDeptId="belongDeptId"
:mioId="mioId" :belongDeptId="belongDeptId" :belongDeptName="mioObj.belong_dept_name" :mioObj="mioObj" :cate="cate" @success="handleSaveSuccess"
:belongDeptName="mioObj.belong_dept_name" @closed="dialog.save = false">
:mioObj="mioObj" :cate="cate"
@success="handleSaveSuccess" @closed="dialog.save = false">
</save-dialog> </save-dialog>
</template> </template>
<script> <script>
@ -191,32 +119,29 @@ export default {
}, },
data() { data() {
return { return {
addTemplate:{ addTemplate: {
ftestitems:[ ftestitems: [
{test_val:'',check_val:'',testitem:''}, { test_val: '', check_val: '', testitem: '' },
{test_val:'',check_val:'',testitem:''},
{test_val:'',check_val:'',testitem:''},
{test_val:'',check_val:'',testitem:''},
], ],
test_date:'',//work test_date: '',//work
test_numer:'', test_numer: '',
is_ok:true, is_ok: true,
test_user:'', test_user: '',
ftest_work:'',//work ftest_work: '',//work
isEdit:true, isEdit: true,
}, },
ftestitems:[], ftestitems: [],
dialog: { dialog: {
check:false, check: false,
save: false, save: false,
}, },
apiObj: null, apiObj: null,
params: {}, params: {},
formTableData: null, formTableData: null,
ftestWork:'', ftestWork: '',
type:'', type: '',
userList:[], userList: [],
workObj:{}, workObj: {},
}; };
}, },
watch: { watch: {
@ -233,19 +158,18 @@ export default {
that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => { that.$API.qm.ftestwork.item.req(that.ftestWork).then((res) => {
that.workObj = res; that.workObj = res;
that.addTemplate.test_date = res.test_date; that.addTemplate.test_date = res.test_date;
that.addTemplate.test_numer = res.batch+'_1'; that.addTemplate.test_numer = res.batch + '_1';
that.getCheckList(); that.getCheckList();
}) })
let tag = that.type == 'bang'?'prod_bang':'prod_guan'; let tag = that.type == 'bang' ? 'prod_bang' : 'prod_guan';
that.getTestItem(tag,that.ftestWork); that.getTestItem(tag, that.ftestWork);
that.getUserList(that.ftestWork); that.getUserList(that.ftestWork);
}, },
methods: { methods: {
// //
getTestItem(tag,ftestWork){ getTestItem(tag, ftestWork) {
let that = this; let that = this;
that.$API.qm.getTestItem.get({tag:tag,page:0,ftest_work:ftestWork}).then(res=>{ that.$API.qm.getTestItem.get({ tag: tag, page: 0, ftest_work: ftestWork }).then(res => {
// console.log(res)
let arr = res; let arr = res;
that.ftestitems = res; that.ftestitems = res;
let ftestitems = []; let ftestitems = [];
@ -259,21 +183,21 @@ export default {
}) })
}, },
// //
getUserList(){ getUserList() {
let that = this; let that = this;
this.$API.system.user.list.req({page:0}).then(res=>{ this.$API.system.user.list.req({ page: 0 }).then(res => {
that.userList = res; that.userList = res;
}); });
}, },
// //
getCheckList(ftestwork){ getCheckList(ftestwork) {
let that = this; let that = this;
that.formTableData = []; that.formTableData = [];
this.$API.qm.ftest.list.req({page:0,type:'prod',ftest_work:ftestwork}).then(res=>{ this.$API.qm.ftest.list.req({ page: 0, type: 'prod', ftest_work: ftestwork }).then(res => {
if(res.length>0){ if (res.length > 0) {
that.addTemplate.test_numer = that.workObj.batch+'_'+(res.length+1); that.addTemplate.test_numer = that.workObj.batch + '_' + (res.length + 1);
console.log('that.addTemplate.test_numer',that.addTemplate.test_numer) console.log('that.addTemplate.test_numer', that.addTemplate.test_numer)
res.forEach(item=>{ res.forEach(item => {
let obj = {}; let obj = {};
obj = item; obj = item;
obj.isEdit = false; obj.isEdit = false;
@ -282,12 +206,12 @@ export default {
} }
}) })
}, },
testNumberChange(){ testNumberChange() {
this.addTemplate.test_numer = this.workObj.batch+'_'+(this.formTableData.length+1); this.addTemplate.test_numer = this.workObj.batch + '_' + (this.formTableData.length + 1);
}, },
editCheck(row){ editCheck(row) {
this.formTableData.forEach((item,index)=>{ this.formTableData.forEach((item, index) => {
if(item.id == row.id){ if (item.id == row.id) {
this.formTableData[index].isEdit = true; this.formTableData[index].isEdit = true;
} }
}) })
@ -306,19 +230,30 @@ export default {
}); });
}).catch(() => { }); }).catch(() => { });
}, },
saveCheck(row){ saveCheck(row) {
this.$API.qm.ftest.create.req(row).then((res) => { console.log(row);
this.$message.success("操作成功"); if (row.id && row.id !== '') {
this.$refs.table.refresh(); this.$API.qm.ftest.update.req(row.id, row).then((res) => {
}).catch((err) => { this.$message.success("操作成功");
return err; this.$refs.table.refresh();
}); }).catch((err) => {
return err;
});
} else {
this.$API.qm.ftest.create.req(row).then((res) => {
this.$message.success("操作成功");
this.$refs.table.refresh();
}).catch((err) => {
return err;
});
}
}, },
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },
handleCheckSuccess(){ handleCheckSuccess() {
this.$refs.table.refresh(); this.$refs.table.refresh();
}, },
handleQuery() { handleQuery() {