yudao-dev/src/views/report/glass/inputTable.vue
‘937886381’ df75aa04a1 修改bug
2024-03-11 15:47:46 +08:00

211 lines
5.4 KiB
Vue

<!--
* @Author: Do not edit
* @Date: 2023-12-13 14:10:04
* @LastEditTime: 2024-03-11 14:21:40
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-row style="float: right; margin-bottom: 5px">
<el-button v-if="!edit" size="small" @click="edit = true">编辑</el-button>
<el-button v-if="edit" size="small" @click="edit= false">返回</el-button>
<el-button v-if="edit" size="small" @click="updateData">保存</el-button>
</el-row>
<el-table :data="data" border show-summary style="width: 100%">
<el-table-column v-for="(item, index) in cols" :key="index" :prop="item.prop" :label="item.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(it, index1) in item.children" :key="index1" :prop="it.prop" :label="it.label"
:align="item.align ? item.align : 'left'">
<el-table-column v-for="(y, index2) in it.children" :key="index2" :prop="y.prop" :label="y.label">
<template slot-scope="scope">
<span v-if="!edit">{{ scope.row[y.prop] }}</span>
<el-input v-else v-model="scope.row[y.prop]"></el-input>
</template>
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
<el-input type="textarea" v-model="sum.remark" placeholder="备注" :disabled="!edit"
:autosize="{ minRows: 2, maxRows: 6}"></el-input>
</div>
</template>
<script>
import { updateGlass, updateGlassRemark } from '@/api/report/glass';
const cols = [
{
prop: 'xc',
label: '许昌安彩周原片生产汇总',
align: 'center',
children: [
{
prop: 'lineName',
label: '生产线',
},
{
prop: 'm',
label: '拉引量㎡',
align: 'center',
children: [
{
prop: 'dailyOutputNow',
label: '本周',
},
{
prop: 'dailyOutputHis',
label: '上周',
},
{
prop: 'dailyOutputTrend',
label: '增减',
}
]
},
{
prop: 'y',
label: '原片合计(片/周)',
align: 'center',
children: [
{
prop: 'originalGlassStatisticsNow',
label: '本周',
},
{
prop: 'originalGlassStatisticsHis',
label: '上周',
},
{
prop: 'originalGlassStatisticsTrend',
label: '增减',
// filter:(v)=>{v + '%'}
}
]
},
{
prop: 's',
label: '实际原片产量㎡',
align: 'center',
children: [
{
prop: 'actualProductNow',
label: '本周',
},
{
prop: 'actualProductHis',
label: '上周',
},
{
prop: 'actualProductTrend',
label: '增减',
// filter: (v) => { v + '%' }
}
]
},
{
prop: 'yield',
label: '原片良品率',
children: [
{
prop: 'originalGlassPassNow',
label: '本周',
},
{
prop: 'originalGlassPassHis ',
label: '上周',
},
{
prop: 'originalGlassPassTrend',
label: '增减',
}
]
}
]
}
]
export default {
props: {
data: {
type: Array,
default: () => [],
},
time: {
type: Array,
default: () => [],
},
date: {
type: String,
default:''
},
sum: {
type: Object,
default: () => {},
},
type: {
type: Number,
default: 3,
}
},
data() {
return {
cols,
edit: false,
};
},
watch: {
time: {
immediate: true,
handler(newv, oldv) {
if (newv[0] !== '') {
this.cols[0].label = this.date + '(' + newv[0] + '-' + newv[1] + ')'
} else {
this.cols[0].label = this.date
}
}
},
type: {
immediate: true,
handler(newv, oldv) {
let text1 = '', text2 = '', text3 = ''
if (newv === 3) {
text1 = '本周'
text2 = '上周'
text3 = '原片合计(片/周)'
} else if (newv === 4) {
text1 = '本月'
text2 = '上月'
text3 = '原片合计(片/月)'
} else if (newv === 2) {
text1 = '今日'
text2 = '昨日'
text3 = '原片合计(片/日)'
} else {
text1 = '本年'
text2 = '上年'
text3 = '原片合计(片/年)'
}
this.cols[0].children[1].children[0].label = text1
this.cols[0].children[1].children[1].label = text2
this.cols[0].children[2].children[0].label = text1
this.cols[0].children[2].children[1].label = text2
this.cols[0].children[3].children[0].label = text1
this.cols[0].children[3].children[1].label = text2
this.cols[0].children[2].label = text3
}
}
},
methods: {
updateData() {
updateGlass(this.data).then(response => {
updateGlassRemark(this.sum).then(res => {
this.$modal.msgSuccess("修改成功");
this.edit = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>