优化启动时控制台warning

This commit is contained in:
BianLzhaoMin 2025-03-21 09:09:43 +08:00
parent 69a5603954
commit 3c6b7cb806
1 changed files with 164 additions and 155 deletions

View File

@ -1,17 +1,25 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
<el-form-item prop="dateRange">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
@submit.native.prevent
>
<el-form-item prop="dateRange">
<el-date-picker
v-model="dateRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item prop="keyWord">
<el-form-item prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键词"
@ -19,7 +27,7 @@
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -27,36 +35,36 @@
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" border :span-method="objectSpanMethod">
<el-table v-loading="loading" :data="tableList" ref="multipleTable" border :span-method="objectSpanMethod">
<el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope">
<span v-if="scope.$index==0">合计</span>
<template slot-scope="scope">
<span v-if="scope.$index == 0">合计</span>
<span v-else>{{ (queryParams.pageNum - 1) * 10 + scope.$index }}</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column label="物资名称" align="center" prop="typeName" show-overflow-tooltip />
<el-table-column label="规格型号" align="center" prop="typeModelName" show-overflow-tooltip />
<el-table-column label="计量单位" align="center" prop="unitName" show-overflow-tooltip />
<el-table-column label="报废数量" align="center" prop="scrapNum" show-overflow-tooltip >
<template scope="scope">
<el-table-column label="报废数量" align="center" prop="scrapNum" show-overflow-tooltip>
<template slot-scope="scope">
<!-- manageType '编码' 使用可点击的 span -->
<span class="clickText" v-if="scope.row.manageType =='0'" @click="openRecords(scope.row)">
<span class="clickText" v-if="scope.row.manageType == '0'" @click="openRecords(scope.row)">
{{ scope.row.scrapNum }}
</span>
<!-- 否则直接显示数字 -->
<span v-else>
{{ scope.row.scrapNum }}
</span>
</template>
</template>
</el-table-column>
<el-table-column label="报废时间" align="center" prop="scrapTime" show-overflow-tooltip />
<el-table-column label="报废人员" align="center" prop="scrapPersonName" show-overflow-tooltip />
<el-table-column label="报废人员" align="center" prop="scrapPersonName" show-overflow-tooltip />
<el-table-column label="报废类型" align="center" prop="scrapType" show-overflow-tooltip />
<el-table-column label="报废单号" align="center" prop="scrapCode" show-overflow-tooltip />
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@ -70,39 +78,38 @@
<el-input
v-model="dialogQuery.keyWord"
placeholder="请输入关键字"
clearable :maxlength="30"
style="width: 240px"/>
clearable
:maxlength="30"
style="width: 240px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary"
icon="el-icon-search" size="mini"
@click="handleDialogQuery"
>查询</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogQuery">
查询
</el-button>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetDialogQuery"
>重置</el-button>
</el-form-item>
<el-button icon="el-icon-refresh" size="mini" @click="resetDialogQuery">重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleDialogExport"
>导出</el-button>
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleDialogExport">
导出
</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogList" height="500px">
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)">
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="购置价(元)" align="center" prop="buyPrice" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"/>
<el-table-column
label="序号"
align="center"
width="80"
type="index"
:index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)"
></el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
<el-table-column label="购置价(元)" align="center" prop="buyPrice" :show-overflow-tooltip="true" />
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="dialogTotal > 0"
@ -110,59 +117,59 @@
:page.sync="dialogQuery.pageNum"
:limit.sync="dialogQuery.pageSize"
@pagination="getDialogDataList"
/>
/>
</el-dialog>
</div>
</template>
<script>
import { getScrapListApi,getScrapListNoPageApi,getScrapDetailsListApi } from "@/api/report/report";
export default {
name: "Report",
import { getScrapListApi, getScrapListNoPageApi, getScrapDetailsListApi } from '@/api/report/report'
export default {
name: 'Report',
data() {
return {
//
loading: false,
//
single: true,
//
multiple: true,
//
showSearch: true,
showHouse: false,
dateRange:[],
ids:[],
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:undefined,
},
//
total: 0,
//
tableList: [],
//
title: "",
//
openRecord: false,
dialogList: [], //
dialogQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined,
},
dialogTotal: 0,
};
//
loading: false,
//
single: true,
//
multiple: true,
//
showSearch: true,
showHouse: false,
dateRange: [],
ids: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: undefined
},
//
total: 0,
//
tableList: [],
//
title: '',
//
openRecord: false,
dialogList: [], //
dialogQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined
},
dialogTotal: 0
}
},
created() {
this.getList();
this.getList()
},
methods: {
// rowIndex= columnIndex=
// table +
methods: {
// rowIndex= columnIndex=
// table +
// 0
objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0 && columnIndex == 0) {
let rowspan = 1
let colspan = 4
@ -173,71 +180,74 @@
// 使
else if (rowIndex === 0 && columnIndex < 4) {
return {
rowspan: 0,
colspan: 0
rowspan: 0,
colspan: 0
}
}
},
/** 查询列表 */
/** 查询列表 */
async getList() {
this.loading = true
const params = {
keyWord: this.queryParams.keyWord,
const params = {
keyWord: this.queryParams.keyWord,
startTime: this.dateRange && this.dateRange[0],
endTime: this.dateRange && this.dateRange[1],
pageSize: this.queryParams.pageSize,
pageNum: this.queryParams.pageNum
}
const res = await getScrapListApi(params)
if(res.data.rows.length>0){
this.tableList = res.data.rows;
}else{
this.tableList=[]
if (res.data.rows.length > 0) {
this.tableList = res.data.rows
} else {
this.tableList = []
}
this.total = res.data.total;
let param = {
keyWord: this.queryParams.keyWord,
this.total = res.data.total
let param = {
keyWord: this.queryParams.keyWord,
startTime: this.dateRange && this.dateRange[0],
endTime: this.dateRange && this.dateRange[1],
endTime: this.dateRange && this.dateRange[1]
}
const response = await getScrapListNoPageApi(param)
let obj = {
scrapNum: response.data.scrapNum,
}
this.tableList.unshift(obj)
this.loading = false
let obj = {
scrapNum: response.data.scrapNum
}
this.tableList.unshift(obj)
this.loading = false
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.dateRange=[]
this.queryParams.keyWord=null;
this.handleQuery();
this.resetForm('queryForm')
this.dateRange = []
this.queryParams.keyWord = null
this.handleQuery()
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
handleExport() {
this.download(
"/material/bm_report/exportScrapList",
{keyWord: this.queryParams.keyWord,startTime: this.dateRange && this.dateRange[0],endTime: this.dateRange && this.dateRange[1]},
'/material/bm_report/exportScrapList',
{
keyWord: this.queryParams.keyWord,
startTime: this.dateRange && this.dateRange[0],
endTime: this.dateRange && this.dateRange[1]
},
`报废报表_${new Date().getTime()}.xlsx`
);
)
},
//
openRecords(row) {
this.openRecord = true
this.dialogQuery.keyWord = ""
this.dialogQuery.taskId = row.taskId;
this.dialogQuery.typeId = row.typeId;
this.dialogQuery.keyWord = ''
this.dialogQuery.taskId = row.taskId
this.dialogQuery.typeId = row.typeId
this.getDialogDataList()
},
/** 查询弹框列表 */
getDialogDataList() {
getScrapDetailsListApi(this.dialogQuery).then((response) => {
getScrapDetailsListApi(this.dialogQuery).then(response => {
this.dialogList = response.data.rows
this.dialogTotal = response.data.total
})
@ -248,54 +258,53 @@
this.getDialogDataList()
},
/** 弹框重置操作 */
resetDialogQuery(){
this.dialogQuery.keyWord = "";
resetDialogQuery() {
this.dialogQuery.keyWord = ''
this.handleDialogQuery()
},
/** 弹框导出操作 */
handleDialogExport() {
this.download(
'material/bm_report/exportScrapDetailsList',
{ ...this.dialogQuery},
`报废报表_维修合格设备_${new Date().getTime()}.xlsx`,
{ ...this.dialogQuery },
`报废报表_维修合格设备_${new Date().getTime()}.xlsx`
)
},
}
}
};
}
</script>
<style lang="scss" scoped>
.image-type {
/* 旋转图片 */
transform: rotate(-90deg);
/* 确保旋转后的图片不会超出容器 */
max-width: 100%;
/* 保持图片的宽高比 */
width: 40px;
height: 80px;
}
.sign-type{
width: 80px;
height: 40px;
}
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.clickText {
color: #02a7f0;
cursor: pointer;
}
.image-type {
/* 旋转图片 */
transform: rotate(-90deg);
/* 确保旋转后的图片不会超出容器 */
max-width: 100%;
/* 保持图片的宽高比 */
width: 40px;
height: 80px;
}
.sign-type {
width: 80px;
height: 40px;
}
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.clickText {
color: #02a7f0;
cursor: pointer;
}
</style>