feat:禅道351日志able显示的列可以选择是隐藏还是显示
This commit is contained in:
parent
8f120e4a1c
commit
315a513c01
|
|
@ -53,14 +53,25 @@
|
|||
<div style="margin-top: 2px;" v-if="hExportCols"><el-button type="primary" size="small" @click="exportExcel(1)">2导出本页数据</el-button></div>
|
||||
<div style="margin-top: 2px;" v-if="hExportCols"><el-button type="primary" size="small" @click="exportExcel(2)">3导出全部数据</el-button></div>
|
||||
</el-popover>
|
||||
<el-popover v-if="column" placement="top" title="列设置" :width="500" trigger="click" :hide-after="0"
|
||||
<el-popover v-if="column || (slotColumns && slotColumns.length)" placement="top" title="列设置"
|
||||
:width="column ? 500 : 260" trigger="click" :hide-after="0"
|
||||
@show="customColumnShow = true" @after-leave="customColumnShow = false">
|
||||
|
||||
<template #reference>
|
||||
<el-button icon="el-icon-set-up" circle style="margin-left: 15px"></el-button>
|
||||
</template>
|
||||
<columnSetting v-if="customColumnShow" ref="columnSetting" @userChange="columnSettingChange"
|
||||
<columnSetting v-if="customColumnShow && column" ref="columnSetting" @userChange="columnSettingChange"
|
||||
@save="columnSettingSave" @back="columnSettingBack" :column="userColumn"></columnSetting>
|
||||
<template v-if="customColumnShow && slotColumns && slotColumns.length">
|
||||
<div v-if="column" style="margin: 12px 0; border-top: 1px solid #eee;"></div>
|
||||
<div v-for="col in slotUserColumn" :key="col.prop" style="padding: 4px 0;">
|
||||
<el-checkbox :model-value="!col.hide" @change="(val) => toggleSlotCol(col, val)">{{col.label}}</el-checkbox>
|
||||
</div>
|
||||
<div style="margin-top: 8px; text-align: right; border-top: 1px solid #eee; padding-top: 8px;">
|
||||
<el-button size="small" @click="resetSlotColumns">重置</el-button>
|
||||
<el-button size="small" type="primary" @click="saveSlotColumns">保存</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
<el-popover v-if="!hideSetting" placement="top" title="表格设置" :width="400" trigger="click" :hide-after="0">
|
||||
|
||||
|
|
|
|||
|
|
@ -57,6 +57,19 @@
|
|||
label="已提交"
|
||||
@change="hiddenChange"
|
||||
/>
|
||||
<el-popover placement="bottom" title="列设置" width="200" trigger="click" popper-class="column-setting-popover">
|
||||
<template #reference>
|
||||
<el-button icon="el-icon-set-up" circle style="margin-left: 5px"></el-button>
|
||||
</template>
|
||||
<div class="column-setting-list">
|
||||
<div v-for="col in columnOptions" :key="col.key" style="padding: 4px 0;">
|
||||
<el-checkbox :model-value="columnVisibility[col.key]" @change="(val) => onColumnVisibilityChange(col.key, val)">{{ col.label }}</el-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 8px; text-align: right; border-top: 1px solid #eee; padding-top: 8px;">
|
||||
<el-button size="small" @click="resetColumnVisibility">重置</el-button>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
|
|
@ -91,7 +104,7 @@
|
|||
></el-table-column>
|
||||
|
||||
-->
|
||||
<el-table-column label="批次号" min-width="100">
|
||||
<el-table-column label="批次号" min-width="100" v-if="columnVisibility.batch">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.mlogb_full!==null">
|
||||
<span v-for="item in scope.row.mlogb_full" :key="item.id">
|
||||
|
|
@ -100,7 +113,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="棒号" min-width="80" v-if="route_code=='paiyicibang'">
|
||||
<el-table-column label="棒号" min-width="80" v-if="route_code=='paiyicibang' && columnVisibility.rodNumber">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.mlogbw_number_list.length>0">
|
||||
<span v-for="item in scope.row.mlogbw_number_list" :key="item">
|
||||
|
|
@ -109,7 +122,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="板段号" min-width="160" v-if="route_code=='paiban'||route_code=='zhuangmo'||route_code=='tuomoceliang'||route_code=='reyatuihuo'||route_code=='zlybcl'">
|
||||
<el-table-column label="板段号" min-width="160" v-if="(route_code=='paiban'||route_code=='zhuangmo'||route_code=='tuomoceliang'||route_code=='reyatuihuo'||route_code=='zlybcl') && columnVisibility.plateNumber">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.mlogbw_number_list.length>0">
|
||||
<span v-for="item in scope.row.mlogbw_number_list" :key="item">
|
||||
|
|
@ -118,7 +131,7 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="原料棒号" min-width="100" v-if="route_code=='ladansi'">
|
||||
<el-table-column label="原料棒号" min-width="100" v-if="route_code=='ladansi' && columnVisibility.rawRodNumber">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.mlogb_full!==null">
|
||||
<span v-for="item in scope.row.mlogb_full" :key="item.id">
|
||||
|
|
@ -128,7 +141,7 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="route_code=='ladansi'||route_code=='yicifusi'||route_code=='ercifusi'||route_code=='zlybcl'"
|
||||
v-if="(route_code=='ladansi'||route_code=='yicifusi'||route_code=='ercifusi'||route_code=='zlybcl') && columnVisibility.equipment"
|
||||
label="生产设备"
|
||||
prop="equipment_name"
|
||||
min-width="130"
|
||||
|
|
@ -136,32 +149,33 @@
|
|||
<el-table-column
|
||||
label="部门/工段"
|
||||
prop="belong_dept_name"
|
||||
v-if="columnVisibility.deptGroup"
|
||||
>
|
||||
<template #default="scope">
|
||||
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否保温" v-if="route_code=='zlybcl'">
|
||||
<el-table-column label="是否保温" v-if="route_code=='zlybcl' && columnVisibility.heatPreservation">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.oinfo_json_">{{scope.row.oinfo_json_.是否保温}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="温度(℃)" v-if="route_code=='zlybcl'">
|
||||
<el-table-column label="温度(℃)" v-if="route_code=='zlybcl' && columnVisibility.temperature">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.oinfo_json_">{{scope.row.oinfo_json_.温度}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="压力(mpa)" v-if="route_code=='zlybcl'">
|
||||
<el-table-column label="压力(mpa)" v-if="route_code=='zlybcl' && columnVisibility.pressure">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.oinfo_json_">{{scope.row.oinfo_json_.压力}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="刻度(mm)" v-if="route_code=='zlybcl'">
|
||||
<el-table-column label="刻度(mm)" v-if="route_code=='zlybcl' && columnVisibility.scale">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.oinfo_json_">{{scope.row.oinfo_json_.刻度}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="压板用时(分)" v-if="route_code=='zlybcl'">
|
||||
<el-table-column label="压板用时(分)" v-if="route_code=='zlybcl' && columnVisibility.pressTime">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.oinfo_json_">{{scope.row.oinfo_json_.压板用时}}</span>
|
||||
</template>
|
||||
|
|
@ -169,8 +183,9 @@
|
|||
<el-table-column
|
||||
label="处理人"
|
||||
prop="handle_user_name"
|
||||
v-if="columnVisibility.handler"
|
||||
></el-table-column>
|
||||
<el-table-column label="保温剩余时间" v-if="mgroup_name=='黑化'||mgroup_name=='退火'">
|
||||
<el-table-column label="保温剩余时间" v-if="(mgroup_name=='黑化'||mgroup_name=='退火') && columnVisibility.remainTime">
|
||||
<template #default="scope">
|
||||
{{ getRemaTime(scope.row) }}
|
||||
</template>
|
||||
|
|
@ -178,12 +193,14 @@
|
|||
<el-table-column
|
||||
label="开始时间"
|
||||
prop="work_start_time"
|
||||
v-if="columnVisibility.startTime"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="结束时间"
|
||||
prop="work_end_time"
|
||||
v-if="columnVisibility.endTime"
|
||||
></el-table-column>
|
||||
<el-table-column label="提交人">
|
||||
<el-table-column label="提交人" v-if="columnVisibility.submitter">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.submit_user_name">{{ scope.row.submit_user_name }}</span>
|
||||
</template>
|
||||
|
|
@ -191,6 +208,7 @@
|
|||
<el-table-column
|
||||
label="提交时间"
|
||||
prop="submit_time"
|
||||
v-if="columnVisibility.submitTime"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
|
|
@ -338,8 +356,53 @@ export default {
|
|||
route_code: "",
|
||||
equipmentId: "",
|
||||
showHidden:false,
|
||||
columnVisibility: {
|
||||
batch: true,
|
||||
rodNumber: true,
|
||||
plateNumber: true,
|
||||
rawRodNumber: true,
|
||||
equipment: true,
|
||||
deptGroup: true,
|
||||
heatPreservation: true,
|
||||
temperature: true,
|
||||
pressure: true,
|
||||
scale: true,
|
||||
pressTime: true,
|
||||
handler: true,
|
||||
remainTime: true,
|
||||
startTime: true,
|
||||
endTime: true,
|
||||
submitter: true,
|
||||
submitTime: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
columnOptions() {
|
||||
const rc = this.route_code;
|
||||
const mg = this.mgroup_name;
|
||||
const allColumns = [
|
||||
{ key: 'batch', label: '批次号', show: true },
|
||||
{ key: 'rodNumber', label: '棒号', show: rc === 'paiyicibang' },
|
||||
{ key: 'plateNumber', label: '板段号', show: /^(paiban|zhuangmo|tuomoceliang|reyatuihuo|zlybcl)$/.test(rc) },
|
||||
{ key: 'rawRodNumber', label: '原料棒号', show: rc === 'ladansi' },
|
||||
{ key: 'equipment', label: '生产设备', show: /^(ladansi|yicifusi|ercifusi|zlybcl)$/.test(rc) },
|
||||
{ key: 'deptGroup', label: '部门/工段', show: true },
|
||||
{ key: 'heatPreservation', label: '是否保温', show: rc === 'zlybcl' },
|
||||
{ key: 'temperature', label: '温度(℃)', show: rc === 'zlybcl' },
|
||||
{ key: 'pressure', label: '压力(mpa)', show: rc === 'zlybcl' },
|
||||
{ key: 'scale', label: '刻度(mm)', show: rc === 'zlybcl' },
|
||||
{ key: 'pressTime', label: '压板用时(分)', show: rc === 'zlybcl' },
|
||||
{ key: 'handler', label: '处理人', show: true },
|
||||
{ key: 'remainTime', label: '保温剩余时间', show: mg === '黑化' || mg === '退火' },
|
||||
{ key: 'startTime', label: '开始时间', show: true },
|
||||
{ key: 'endTime', label: '结束时间', show: true },
|
||||
{ key: 'submitter', label: '提交人', show: true },
|
||||
{ key: 'submitTime', label: '提交时间', show: true },
|
||||
];
|
||||
return allColumns.filter(col => col.show);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
mgroupName: {
|
||||
handler: function (newval,odlval) {
|
||||
|
|
@ -356,6 +419,12 @@ export default {
|
|||
that.route_code = this.$route.path.split("/")[2];
|
||||
that.params.mgroup =that.mgroupId;
|
||||
that.apiObj = that.$API.wpm.mlog.list;
|
||||
const saved = localStorage.getItem('mlogs_columnVisibility');
|
||||
if (saved) {
|
||||
try {
|
||||
Object.assign(that.columnVisibility, JSON.parse(saved));
|
||||
} catch (e) {}
|
||||
}
|
||||
this.getDeptUsers();
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -549,6 +618,20 @@ export default {
|
|||
}
|
||||
this.$refs.table.queryData(this.query);
|
||||
},
|
||||
onColumnVisibilityChange(key, val) {
|
||||
this.columnVisibility[key] = val;
|
||||
localStorage.setItem('mlogs_columnVisibility', JSON.stringify(this.columnVisibility));
|
||||
},
|
||||
resetColumnVisibility() {
|
||||
const defaults = {
|
||||
batch: true, rodNumber: true, plateNumber: true, rawRodNumber: true,
|
||||
equipment: true, deptGroup: true, heatPreservation: true, temperature: true,
|
||||
pressure: true, scale: true, pressTime: true, handler: true,
|
||||
remainTime: true, startTime: true, endTime: true, submitter: true, submitTime: true,
|
||||
};
|
||||
this.columnVisibility = { ...defaults };
|
||||
localStorage.setItem('mlogs_columnVisibility', JSON.stringify(this.columnVisibility));
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection) {
|
||||
this.selection = selection;
|
||||
|
|
@ -578,3 +661,9 @@ export default {
|
|||
<style scoped>
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.column-setting-popover .column-setting-list {
|
||||
max-height: calc(100vh - 200px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue