2025-08-06 14:52:34 +08:00
|
|
|
<template>
|
|
|
|
|
<!-- 表格公共组件 -->
|
|
|
|
|
<div>
|
|
|
|
|
<!-- 表单搜索 -->
|
|
|
|
|
<el-form
|
|
|
|
|
:inline="true"
|
|
|
|
|
size="small"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
v-show="showSearch"
|
|
|
|
|
:model="queryParams"
|
2025-08-08 16:13:24 +08:00
|
|
|
label-width="auto"
|
2025-08-06 14:52:34 +08:00
|
|
|
>
|
|
|
|
|
<el-form-item
|
|
|
|
|
:key="v"
|
|
|
|
|
:prop="item.f_model"
|
|
|
|
|
v-for="(item, v) in formLabel"
|
|
|
|
|
:label="item.isShow ? item.f_label : ''"
|
|
|
|
|
>
|
|
|
|
|
<el-input
|
|
|
|
|
clearable
|
|
|
|
|
:maxlength="item.f_max || 50"
|
|
|
|
|
v-if="item.f_type === 'ipt'"
|
2025-08-15 11:25:39 +08:00
|
|
|
v-model.trim="queryParams[item.f_model]"
|
2025-08-06 14:52:34 +08:00
|
|
|
:placeholder="`请输入${item.f_label}`"
|
2025-08-15 16:19:21 +08:00
|
|
|
:style="{ width: item.f_width || '180px' }"
|
2025-08-06 14:52:34 +08:00
|
|
|
/>
|
|
|
|
|
<el-select
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
2025-08-13 17:32:40 +08:00
|
|
|
v-if="item.f_type === 'sel'"
|
|
|
|
|
v-model="queryParams[item.f_model]"
|
2025-08-06 14:52:34 +08:00
|
|
|
:placeholder="`请选择${item.f_label}`"
|
2025-08-15 16:19:21 +08:00
|
|
|
:style="{ width: item.f_width || '180px' }"
|
2025-08-06 14:52:34 +08:00
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
:key="v"
|
|
|
|
|
:label="sel.label"
|
|
|
|
|
:value="sel.value"
|
|
|
|
|
v-for="(sel, v) in item.f_selList"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
<el-cascader
|
|
|
|
|
clearable
|
2025-08-15 16:19:21 +08:00
|
|
|
style="width: 180px"
|
2025-08-06 14:52:34 +08:00
|
|
|
:show-all-levels="false"
|
|
|
|
|
:props="item.optionProps"
|
|
|
|
|
:options="item.f_selList"
|
|
|
|
|
v-if="item.f_type === 'selCasAdd'"
|
|
|
|
|
v-model="queryParams[item.f_model]"
|
|
|
|
|
@change="
|
|
|
|
|
handleCasAdd(
|
|
|
|
|
$event,
|
|
|
|
|
item.f_model,
|
2025-08-08 10:18:07 +08:00
|
|
|
cascadeFunc,
|
2025-08-06 14:52:34 +08:00
|
|
|
extraTableProp,
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
<el-cascader
|
2025-08-15 16:19:21 +08:00
|
|
|
style="width: 180px"
|
2025-08-06 14:52:34 +08:00
|
|
|
:show-all-levels="false"
|
|
|
|
|
:options="item.f_selList"
|
|
|
|
|
:props="item.optionProps"
|
|
|
|
|
v-if="item.f_type === 'selCas'"
|
|
|
|
|
v-model="queryParams[item.f_model]"
|
|
|
|
|
@change="handleCas($event, item.f_model)"
|
|
|
|
|
/>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
type="date"
|
2025-08-17 14:35:12 +08:00
|
|
|
style="width: 240px"
|
2025-08-06 14:52:34 +08:00
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
v-if="item.f_type === 'date'"
|
|
|
|
|
v-model="queryParams[item.f_model]"
|
2025-08-17 14:35:12 +08:00
|
|
|
:placeholder="`请选择${item.f_label}`"
|
2025-08-06 14:52:34 +08:00
|
|
|
/>
|
|
|
|
|
<el-date-picker
|
|
|
|
|
type="daterange"
|
2025-08-17 14:35:12 +08:00
|
|
|
style="width: 240px"
|
2025-08-06 14:52:34 +08:00
|
|
|
range-separator="至"
|
|
|
|
|
value-format="yyyy-MM-dd"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
v-if="item.f_type === 'dateRange'"
|
|
|
|
|
v-model="queryParams[item.f_model]"
|
|
|
|
|
@change="onChangeTime($event, item.dateType)"
|
|
|
|
|
/>
|
|
|
|
|
<el-input-number
|
|
|
|
|
:min="0"
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
v-if="item.f_type === 'num'"
|
2025-08-17 14:35:12 +08:00
|
|
|
v-model="queryParams[item.f_model]"
|
2025-08-06 14:52:34 +08:00
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item v-if="showBtnCrews">
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="primary"
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
@click="handleQuery"
|
|
|
|
|
>
|
|
|
|
|
查询
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
2025-08-08 17:51:40 +08:00
|
|
|
plain
|
2025-08-06 14:52:34 +08:00
|
|
|
size="mini"
|
|
|
|
|
type="warning"
|
|
|
|
|
icon="el-icon-refresh"
|
|
|
|
|
@click="resetQuery"
|
|
|
|
|
>
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
2025-08-08 16:13:24 +08:00
|
|
|
|
|
|
|
|
<slot name="btn" :queryParams="queryParams"></slot>
|
2025-08-06 14:52:34 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<!-- 按钮集群 -->
|
|
|
|
|
<el-row class="btn-container">
|
|
|
|
|
<ToolbarModel
|
|
|
|
|
v-if="showRightTools"
|
|
|
|
|
:columns="columnCheckList"
|
|
|
|
|
@queryTable="getTableList"
|
|
|
|
|
:showSearch.sync="showSearch"
|
|
|
|
|
:handleShow.sync="handleShow"
|
|
|
|
|
:indexNumShow.sync="indexNumShow"
|
|
|
|
|
:selectionShow.sync="selectionShow"
|
|
|
|
|
/>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- 表格 -->
|
|
|
|
|
<el-table
|
|
|
|
|
border
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
:data="tableList"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
select-on-indeterminate
|
|
|
|
|
@selection-change="handleSelectionChange"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column
|
|
|
|
|
width="45"
|
|
|
|
|
align="center"
|
|
|
|
|
type="selection"
|
|
|
|
|
:selectable="selectable"
|
|
|
|
|
v-if="selectionShow && isSelectShow"
|
|
|
|
|
/>
|
|
|
|
|
<el-table-column
|
|
|
|
|
width="55"
|
|
|
|
|
align="center"
|
|
|
|
|
label="序号"
|
|
|
|
|
type="index"
|
|
|
|
|
:index="
|
|
|
|
|
indexContinuation(queryParams.pageNum, queryParams.pageSize)
|
|
|
|
|
"
|
|
|
|
|
v-if="indexNumShow"
|
|
|
|
|
/>
|
|
|
|
|
<el-table-column
|
|
|
|
|
:key="v"
|
|
|
|
|
align="center"
|
|
|
|
|
:label="item.t_label"
|
|
|
|
|
:prop="item.t_props"
|
|
|
|
|
:width="item.t_width"
|
|
|
|
|
show-overflow-tooltip
|
|
|
|
|
v-for="(item, v) in tableColumCheckProps"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<!-- 判断当前列数据是否需要使用插槽的数据 -->
|
|
|
|
|
<template v-if="item.t_slot">
|
|
|
|
|
<slot :data="scope.row" :name="item.t_slot"></slot>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
{{ scope.row[item.t_props] || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
align="center"
|
|
|
|
|
label="操作"
|
|
|
|
|
:min-width="dynamicWidth"
|
|
|
|
|
:show-overflow-tooltip="false"
|
|
|
|
|
v-if="handleShow && showOperation"
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="{ row }">
|
|
|
|
|
<div class="optionDivRef">
|
|
|
|
|
<slot :data="row" name="handle">-</slot>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
@pagination="getTableList"
|
|
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import ToolbarModel from '../ToolbarModel'
|
|
|
|
|
export default {
|
|
|
|
|
components: { ToolbarModel },
|
|
|
|
|
props: {
|
2025-08-08 10:18:07 +08:00
|
|
|
// 表单查询条件
|
2025-08-06 14:52:34 +08:00
|
|
|
formLabel: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => [],
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 列表请求接口
|
2025-08-06 14:52:34 +08:00
|
|
|
requestApi: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => function () {},
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 列表配置项
|
2025-08-06 14:52:34 +08:00
|
|
|
columnsList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => [],
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 传递参数
|
2025-08-06 14:52:34 +08:00
|
|
|
sendParams: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => null,
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 是否显示查询按钮 默认显示
|
2025-08-06 14:52:34 +08:00
|
|
|
showBtnCrews: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 级联选择
|
|
|
|
|
cascadeFunc: {
|
2025-08-06 14:52:34 +08:00
|
|
|
type: Function,
|
|
|
|
|
default: () => null,
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 级联选择 额外参数
|
2025-08-06 14:52:34 +08:00
|
|
|
extraTableProp: {
|
|
|
|
|
type: Object,
|
|
|
|
|
default: () => null,
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 是否显示操作列 默认不显示
|
2025-08-06 14:52:34 +08:00
|
|
|
showOperation: {
|
|
|
|
|
type: Boolean,
|
2025-08-08 10:18:07 +08:00
|
|
|
default: false,
|
2025-08-06 14:52:34 +08:00
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 是否显示右侧工具栏 默认不显示
|
2025-08-06 14:52:34 +08:00
|
|
|
showRightTools: {
|
|
|
|
|
type: Boolean,
|
2025-08-08 10:18:07 +08:00
|
|
|
default: false,
|
2025-08-06 14:52:34 +08:00
|
|
|
},
|
2025-08-08 14:36:51 +08:00
|
|
|
|
2025-08-08 10:18:07 +08:00
|
|
|
// 复选框是否勾选
|
2025-08-06 14:52:34 +08:00
|
|
|
selectable: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => {
|
|
|
|
|
return true
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 是否显示复选框 由父组件传递 默认不显示
|
2025-08-06 14:52:34 +08:00
|
|
|
isSelectShow: {
|
|
|
|
|
type: Boolean,
|
2025-08-12 18:24:29 +08:00
|
|
|
default: false,
|
2025-08-06 14:52:34 +08:00
|
|
|
},
|
2025-08-08 10:18:07 +08:00
|
|
|
// 测试时使用的数据源
|
2025-08-06 14:52:34 +08:00
|
|
|
testTableList: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => [],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
/* 根据操作栏控制表头是否显示 */
|
|
|
|
|
tableColumCheckProps() {
|
|
|
|
|
return this.columnCheckList.filter((e) => {
|
|
|
|
|
return e.checked != false
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
columnsList: {
|
|
|
|
|
handler(nv, ov) {
|
|
|
|
|
if (nv !== ov) {
|
|
|
|
|
this.columnsList = nv
|
|
|
|
|
this.columnCheckList = this.columnsList.map((e) => {
|
|
|
|
|
this.$set(e, 'checked', true)
|
|
|
|
|
return e
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
},
|
|
|
|
|
/* sendParams: {
|
|
|
|
|
handler(nv, ov) {
|
|
|
|
|
console.log(nv, ov)
|
|
|
|
|
if(nv !== ov) {
|
|
|
|
|
Object.assign(this.queryParams, nv)
|
|
|
|
|
this.getTableList()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deep: true,
|
|
|
|
|
immediate: true
|
|
|
|
|
} */
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
// 表单校验
|
|
|
|
|
formRules: {},
|
|
|
|
|
loading: false,
|
|
|
|
|
// 列表接口查询参数
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
},
|
|
|
|
|
// 列表数据源
|
|
|
|
|
tableList: [],
|
2025-08-12 18:24:29 +08:00
|
|
|
// 选中数据
|
|
|
|
|
selectedData: [],
|
2025-08-06 14:52:34 +08:00
|
|
|
// 列表数据条数
|
|
|
|
|
total: 0,
|
|
|
|
|
// 搜索区域是否隐藏
|
|
|
|
|
showSearch: true,
|
|
|
|
|
// 是否显示复选框
|
2025-08-14 10:24:44 +08:00
|
|
|
selectionShow: this.isSelectShow,
|
2025-08-06 14:52:34 +08:00
|
|
|
// 是否显示序号
|
|
|
|
|
indexNumShow: true,
|
|
|
|
|
// 是否显示操作列
|
|
|
|
|
handleShow: true,
|
|
|
|
|
// 列表每列 label
|
|
|
|
|
columnCheckList: [],
|
|
|
|
|
// 操作列最小宽度
|
|
|
|
|
dynamicWidth: 0,
|
|
|
|
|
idCount: 1,
|
2025-08-17 14:35:12 +08:00
|
|
|
typeList: [], // 日期查询条件
|
2025-08-06 14:52:34 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
created() {
|
|
|
|
|
this.columnCheckList = this.columnsList.map((e) => {
|
|
|
|
|
this.$set(e, 'checked', true)
|
|
|
|
|
return e
|
|
|
|
|
})
|
|
|
|
|
/* 生成查询参数 */
|
|
|
|
|
this.formLabel.map((e) => {
|
|
|
|
|
if (e.f_type === 'dateRange') {
|
|
|
|
|
this.$set(this.queryParams, e.dateType[0], '')
|
|
|
|
|
this.$set(this.queryParams, e.dateType[1], '')
|
2025-08-18 10:50:42 +08:00
|
|
|
|
|
|
|
|
console.log(e.dateType, 'e.dateType')
|
|
|
|
|
console.log(this.queryParams, 'this.queryParams')
|
2025-08-06 14:52:34 +08:00
|
|
|
this.typeList = e.dateType
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(this.queryParams, e.f_model, '')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (this.sendParams !== null) {
|
2025-08-18 10:50:42 +08:00
|
|
|
for (let key in this.sendParams) {
|
|
|
|
|
this.$set(this.queryParams, key, this.sendParams[key])
|
|
|
|
|
}
|
2025-08-06 14:52:34 +08:00
|
|
|
}
|
|
|
|
|
this.getTableList()
|
|
|
|
|
},
|
|
|
|
|
updated() {
|
|
|
|
|
// 更新时重新计算操作列需要的最小宽度 确保展示无误
|
|
|
|
|
this.dynamicWidth = this.getOperatorWidth()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
/** 获取列表数据 */
|
|
|
|
|
async getTableList() {
|
|
|
|
|
try {
|
|
|
|
|
if (
|
|
|
|
|
this.queryParams.time &&
|
|
|
|
|
this.queryParams.time.length !== 0
|
|
|
|
|
) {
|
2025-08-17 14:35:12 +08:00
|
|
|
this.queryParams[this.typeList[0]] =
|
|
|
|
|
this.queryParams.time[0]
|
|
|
|
|
this.queryParams[this.typeList[1]] =
|
|
|
|
|
this.queryParams.time[1]
|
2025-08-06 14:52:34 +08:00
|
|
|
}
|
2025-08-17 14:35:12 +08:00
|
|
|
|
|
|
|
|
const params = { ...this.queryParams }
|
2025-08-18 10:50:42 +08:00
|
|
|
const queryParams = JSON.parse(JSON.stringify(params))
|
|
|
|
|
console.log(this.queryParams, 'queryParams')
|
|
|
|
|
delete queryParams.time
|
2025-08-06 14:52:34 +08:00
|
|
|
console.log(
|
|
|
|
|
`%c🔍 列表查询入参 %c`,
|
|
|
|
|
'background: linear-gradient(90deg, #FF6B6B, #4ECDC4); color: white; padding: 5px 10px; border-radius: 5px; font-weight: bold;',
|
|
|
|
|
'',
|
2025-08-18 10:50:42 +08:00
|
|
|
queryParams,
|
2025-08-06 14:52:34 +08:00
|
|
|
)
|
|
|
|
|
this.loading = true
|
2025-08-18 10:50:42 +08:00
|
|
|
const res = await this.requestApi(queryParams)
|
2025-08-06 14:52:34 +08:00
|
|
|
if (res.code === 200) {
|
|
|
|
|
this.tableList = res.rows
|
|
|
|
|
this.total = res.total
|
|
|
|
|
}
|
|
|
|
|
this.loading = false
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.tableList = this.testTableList
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 查询按钮 */
|
|
|
|
|
handleQuery() {
|
|
|
|
|
this.getTableList()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 重置按钮 */
|
|
|
|
|
resetQuery() {
|
|
|
|
|
this.$refs.queryFormRef.resetFields()
|
|
|
|
|
if (this.typeList.length > 0) {
|
|
|
|
|
this.queryParams[this.typeList[0]] = ''
|
|
|
|
|
this.queryParams[this.typeList[1]] = ''
|
2025-08-18 10:50:42 +08:00
|
|
|
this.queryParams.time = []
|
2025-08-17 14:35:12 +08:00
|
|
|
} else {
|
|
|
|
|
this.queryParams[this.typeList] = ''
|
2025-08-06 14:52:34 +08:00
|
|
|
}
|
|
|
|
|
this.queryParams.pageNum = 1
|
|
|
|
|
this.queryParams.pageSize = 10
|
2025-08-17 14:35:12 +08:00
|
|
|
this.queryParams.time = []
|
2025-08-06 14:52:34 +08:00
|
|
|
this.getTableList()
|
|
|
|
|
},
|
|
|
|
|
/** 级联选择 */
|
|
|
|
|
handleCas(e, val) {
|
|
|
|
|
this.queryParams[val] = e[e.length - 1]
|
|
|
|
|
},
|
|
|
|
|
/** 级联选择只选最后一级 */
|
|
|
|
|
handleCasAdd(e, val, func, prop) {
|
|
|
|
|
if (e.length !== 0) {
|
|
|
|
|
this.queryParams[val] = e[e.length - 1]
|
|
|
|
|
let setObj = {}
|
|
|
|
|
// 合并
|
|
|
|
|
if (prop) {
|
|
|
|
|
Object.assign(setObj, prop)
|
|
|
|
|
}
|
|
|
|
|
// 设置id自增
|
|
|
|
|
this.$set(setObj, 'id', this.idCount)
|
|
|
|
|
this.idCount++
|
|
|
|
|
// 获取单位
|
|
|
|
|
func({
|
|
|
|
|
id: e[e.length - 1],
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.$set(setObj, 'name', res.data.parentName)
|
|
|
|
|
this.$set(setObj, 'unitName', res.data.unitName)
|
|
|
|
|
this.$set(setObj, 'typeName', res.data.name)
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {})
|
|
|
|
|
for (let key in this.queryParams) {
|
|
|
|
|
this.$set(setObj, key, this.queryParams[key])
|
|
|
|
|
}
|
|
|
|
|
this.tableList.unshift(setObj)
|
|
|
|
|
console.log(this.tableList)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 动态设置操作列的列宽 */
|
|
|
|
|
getOperatorWidth() {
|
|
|
|
|
const operatorColumn =
|
|
|
|
|
document.getElementsByClassName('optionDivRef')
|
|
|
|
|
|
|
|
|
|
// 默认宽度
|
|
|
|
|
let width = 100
|
|
|
|
|
// 内间距
|
|
|
|
|
let paddingSpacing = 0
|
|
|
|
|
// 按钮数量
|
|
|
|
|
let buttonCount = 0
|
|
|
|
|
|
|
|
|
|
if (operatorColumn.length > 0) {
|
|
|
|
|
Array.prototype.forEach.call(operatorColumn, function (item) {
|
|
|
|
|
// 最宽的宽度
|
|
|
|
|
width = width > item.offsetWidth ? width : item.offsetWidth
|
|
|
|
|
const buttons = item.getElementsByClassName('el-button')
|
|
|
|
|
buttonCount = buttons.length
|
|
|
|
|
buttonCount =
|
|
|
|
|
buttonCount > buttons.length
|
|
|
|
|
? buttonCount
|
|
|
|
|
: buttons.length
|
|
|
|
|
})
|
|
|
|
|
return width + 10
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
queryTableList(params) {
|
|
|
|
|
Object.assign(this.queryParams, params)
|
|
|
|
|
this.getTableList()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleSelectionChange(e) {
|
2025-08-12 18:24:29 +08:00
|
|
|
this.selectedData = e
|
2025-08-06 14:52:34 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* 时间change事件 */
|
|
|
|
|
onChangeTime(e, type) {
|
2025-08-18 10:50:42 +08:00
|
|
|
console.log(e, '时间', type)
|
2025-08-06 14:52:34 +08:00
|
|
|
const [_1, _2] = type
|
|
|
|
|
const [_time1, _time2] = e
|
|
|
|
|
if (e.length > 0) {
|
2025-08-18 10:50:42 +08:00
|
|
|
this.queryParams[_1] = _time1
|
|
|
|
|
this.queryParams[_2] = _time2
|
2025-08-06 14:52:34 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.btn-container {
|
|
|
|
|
margin-bottom: 6px;
|
|
|
|
|
display: flex;
|
2025-08-08 16:13:24 +08:00
|
|
|
justify-content: flex-end;
|
2025-08-06 14:52:34 +08:00
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
::v-deep .btn-handler {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
|
|
.el-button {
|
|
|
|
|
padding: 6px 18px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep .optionDivRef {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
|
|
|
|
|
.el-button {
|
|
|
|
|
padding: 6px 12px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|