添加二维码直接下载
This commit is contained in:
parent
63442e3a15
commit
002205c39b
|
|
@ -81,7 +81,9 @@
|
||||||
<el-table-column label="规格型号" align="center" prop="materialModel" sortable show-overflow-tooltip />
|
<el-table-column label="规格型号" align="center" prop="materialModel" sortable show-overflow-tooltip />
|
||||||
<el-table-column label="设备编号" align="center" prop="maCode" sortable show-overflow-tooltip />
|
<el-table-column label="设备编号" align="center" prop="maCode" sortable show-overflow-tooltip />
|
||||||
<el-table-column label="设备状态" align="center" prop="statusName" sortable show-overflow-tooltip />
|
<el-table-column label="设备状态" align="center" prop="statusName" sortable show-overflow-tooltip />
|
||||||
<el-table-column label="固定资产编号" align="center" prop="assetsCode" width="200px" sortable show-overflow-tooltip >
|
<el-table-column label="固定资产编号" align="center" prop="assetsCode" width="200px" sortable
|
||||||
|
show-overflow-tooltip
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div style="display: flex; align-items: center; justify-content: center;">
|
<div style="display: flex; align-items: center; justify-content: center;">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -105,11 +107,16 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="绑定标签" align="center" prop="qrCode" sortable show-overflow-tooltip>
|
<el-table-column label="绑定标签" align="center" prop="qrCode" sortable show-overflow-tooltip>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.qrCode!=null" style="color:blue; cursor: pointer" @click="handleViewQrCode(scope.row)">
|
<span v-if="scope.row.qrCode!=null" style="color:blue; cursor: pointer"
|
||||||
{{ "查看" }}
|
@click="handleViewQrCode(scope.row)"
|
||||||
|
>
|
||||||
|
{{ '查看' }}
|
||||||
|
</span>
|
||||||
|
<span v-if="scope.row.qrCode!=null" style="color:blue; cursor: pointer;margin-left: 10px" @click="downloadQrCode(scope.row)">
|
||||||
|
{{ '下载' }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ "暂无" }}
|
{{ '暂无' }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
@ -160,7 +167,9 @@
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="物品种类" prop="materialType">
|
<el-form-item label="物品种类" prop="materialType">
|
||||||
<el-select v-model="form.materialType" placeholder="请选择物品种类" clearable style="width: 100%;" disabled>
|
<el-select v-model="form.materialType" placeholder="请选择物品种类" clearable style="width: 100%;"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in keeperDataRange"
|
v-for="dict in keeperDataRange"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
|
|
@ -172,7 +181,9 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="设备类型" prop="materialName">
|
<el-form-item label="设备类型" prop="materialName">
|
||||||
<el-select v-model="form.materialName" placeholder="请选择设备类型" clearable style="width: 100%;" disabled>
|
<el-select v-model="form.materialName" placeholder="请选择设备类型" clearable style="width: 100%;"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in keeperDataRange"
|
v-for="dict in keeperDataRange"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
|
|
@ -219,7 +230,8 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="绑定标签" prop="qrCode">
|
<el-form-item label="绑定标签" prop="qrCode">
|
||||||
<div id="qrcode" v-if="form.qrCode" style="display: flex;align-items: center;justify-content: center;" ref="codeItemTwo"
|
<div id="qrcode" v-if="form.qrCode" style="display: flex;align-items: center;justify-content: center;"
|
||||||
|
ref="codeItemTwo"
|
||||||
></div>
|
></div>
|
||||||
<span v-else>暂无</span>
|
<span v-else>暂无</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -239,7 +251,9 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="本次检验时间" prop="thisCheckTime">
|
<el-form-item label="本次检验时间" prop="thisCheckTime">
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="form.thisCheckTime" style="width: 100%;" disabled></el-date-picker>
|
<el-date-picker type="date" placeholder="选择日期" v-model="form.thisCheckTime" style="width: 100%;"
|
||||||
|
disabled
|
||||||
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -247,7 +261,9 @@
|
||||||
<el-row :gutter="24">
|
<el-row :gutter="24">
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="下次检验时间" prop="nextCheckTime">
|
<el-form-item label="下次检验时间" prop="nextCheckTime">
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="form.nextCheckTime" style="width: 100%;" disabled></el-date-picker>
|
<el-date-picker type="date" placeholder="选择日期" v-model="form.nextCheckTime" style="width: 100%;"
|
||||||
|
disabled
|
||||||
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
|
|
@ -264,7 +280,8 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="7">
|
||||||
<el-form-item label="出场时间" prop="outFacTime">
|
<el-form-item label="出场时间" prop="outFacTime">
|
||||||
<el-date-picker type="date" placeholder="选择日期" v-model="form.outFacTime" style="width: 100%;"></el-date-picker>
|
<el-date-picker type="date" placeholder="选择日期" v-model="form.outFacTime" style="width: 100%;"
|
||||||
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -362,13 +379,17 @@
|
||||||
<el-dialog :title="titleSynch" :visible.sync="openSynch" width="500px" append-to-body @close="cancelSynch">
|
<el-dialog :title="titleSynch" :visible.sync="openSynch" width="500px" append-to-body @close="cancelSynch">
|
||||||
<el-form ref="formSynchParams" :model="formSynchParams" :inline="true">
|
<el-form ref="formSynchParams" :model="formSynchParams" :inline="true">
|
||||||
<el-form-item prop="reportCode">
|
<el-form-item prop="reportCode">
|
||||||
<el-input v-model="formSynchParams.reportCode" placeholder="请输入报告编号" maxlength="20" style="width: 340px"/>
|
<el-input v-model="formSynchParams.reportCode" placeholder="请输入报告编号" maxlength="20"
|
||||||
|
style="width: 340px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuerySynch">查询</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuerySynch">查询</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div style="margin-top: 10px; height: 100px; text-align: center; ">
|
<div style="margin-top: 10px; height: 100px; text-align: center; ">
|
||||||
<img v-if="formSynchParams.pdf" src="../../../../assets/img/pdf.png" alt="暂无图片" @click="downloadPdf" style="max-width: 100%; max-height: 100%;" />
|
<img v-if="formSynchParams.pdf" src="../../../../assets/img/pdf.png" alt="暂无图片" @click="downloadPdf"
|
||||||
|
style="max-width: 100%; max-height: 100%;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -382,19 +403,31 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getListDevice,getDeviceDetail,editDevice,addDevice,delDevice,getDeviceType,getZichanType,getSynchReportCode,synchReport,editAssetsCode } from "@/api/ma/device";
|
|
||||||
import { getKeeperIds} from "@/api/ma/typeConfigKeeper";
|
|
||||||
import { getRepairIds } from "@/api/ma/typeConfigRepair";
|
|
||||||
import {
|
import {
|
||||||
getUserTypeList,
|
getListDevice,
|
||||||
} from "@/api/ma/base";
|
getDeviceDetail,
|
||||||
|
editDevice,
|
||||||
|
addDevice,
|
||||||
|
delDevice,
|
||||||
|
getDeviceType,
|
||||||
|
getZichanType,
|
||||||
|
getSynchReportCode,
|
||||||
|
synchReport,
|
||||||
|
editAssetsCode
|
||||||
|
} from '@/api/ma/device'
|
||||||
|
import { getKeeperIds } from '@/api/ma/typeConfigKeeper'
|
||||||
|
import { getRepairIds } from '@/api/ma/typeConfigRepair'
|
||||||
|
import {
|
||||||
|
getUserTypeList
|
||||||
|
} from '@/api/ma/base'
|
||||||
import { downloadFile, downloadFileData } from '@/utils/download'
|
import { downloadFile, downloadFileData } from '@/utils/download'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import QRCode from 'qrcodejs2';
|
import QRCode from 'qrcodejs2'
|
||||||
import html2canvas from 'html2canvas';
|
import html2canvas from 'html2canvas'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Device",
|
name: 'Device',
|
||||||
dicts: ["ma_machine_status"],
|
dicts: ['ma_machine_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -402,20 +435,17 @@
|
||||||
|
|
||||||
loadingTwo: false,
|
loadingTwo: false,
|
||||||
|
|
||||||
|
|
||||||
// 是否显示项目部Id
|
// 是否显示项目部Id
|
||||||
showName: false,
|
showName: false,
|
||||||
|
|
||||||
// 是否显示施工预警信息
|
// 是否显示施工预警信息
|
||||||
showWarn: false,
|
showWarn: false,
|
||||||
|
|
||||||
|
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
|
||||||
|
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
showHouse: false,
|
showHouse: false,
|
||||||
|
|
@ -435,7 +465,7 @@
|
||||||
teamList: [],
|
teamList: [],
|
||||||
teamTempList: [],
|
teamTempList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
|
|
@ -447,7 +477,7 @@
|
||||||
maStatus: null,
|
maStatus: null,
|
||||||
materialType: '',
|
materialType: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
materialModel: '',
|
materialModel: ''
|
||||||
},
|
},
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryTeam: {
|
queryTeam: {
|
||||||
|
|
@ -455,7 +485,7 @@
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
sex: undefined,
|
sex: undefined,
|
||||||
teamId: undefined,
|
teamId: undefined
|
||||||
},
|
},
|
||||||
|
|
||||||
// 用户导入参数
|
// 用户导入参数
|
||||||
|
|
@ -463,57 +493,53 @@
|
||||||
// 是否显示弹出层(用户导入)
|
// 是否显示弹出层(用户导入)
|
||||||
open: false,
|
open: false,
|
||||||
// 弹出层标题(用户导入)
|
// 弹出层标题(用户导入)
|
||||||
title: "",
|
title: '',
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 是否更新已经存在的用户数据
|
// 是否更新已经存在的用户数据
|
||||||
updateSupport: 0,
|
updateSupport: 0,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
headers: { Authorization: 'Bearer ' + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: process.env.VUE_APP_BASE_API + "/material/engineering/excelUpload"
|
url: process.env.VUE_APP_BASE_API + '/material/engineering/excelUpload'
|
||||||
},
|
},
|
||||||
|
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {
|
form: {
|
||||||
qrCode: "",
|
qrCode: '',
|
||||||
keeperArr: [],
|
keeperArr: [],
|
||||||
repairerArr: [],
|
repairerArr: [],
|
||||||
keeperNameArr: [],
|
keeperNameArr: [],
|
||||||
repairerNameArr: [],
|
repairerNameArr: []
|
||||||
},
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
uploadOpen: false,
|
uploadOpen: false,
|
||||||
rowObj: {},
|
rowObj: {},
|
||||||
qrCode:"",
|
qrCode: '',
|
||||||
qrcodeUrl: '',
|
qrcodeUrl: '',
|
||||||
KeeperOptions: [],
|
KeeperOptions: [],
|
||||||
sortedKeeperOptions: [],
|
sortedKeeperOptions: [],
|
||||||
repairerOptions: [],
|
repairerOptions: [],
|
||||||
sortedRepairerOptions: [],
|
sortedRepairerOptions: [],
|
||||||
|
|
||||||
titleSynch: "", //检验报告同步标题
|
titleSynch: '', //检验报告同步标题
|
||||||
openSynch: false, //检验报告同步
|
openSynch: false, //检验报告同步
|
||||||
synchLoading: false, //检验报告同步loading
|
synchLoading: false, //检验报告同步loading
|
||||||
formSynchParams: { //检验报告同步表单
|
formSynchParams: { //检验报告同步表单
|
||||||
reportCode: "", //检验报告编号
|
reportCode: '', //检验报告编号
|
||||||
pdf: "", //检验报告pdf
|
pdf: '', //检验报告pdf
|
||||||
pdfName: "", //检验报告pdf名称
|
pdfName: '' //检验报告pdf名称
|
||||||
},
|
},
|
||||||
dataSynch: {}, //检验报告同步数据
|
dataSynch: {} //检验报告同步数据
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getZichanType();
|
this.getZichanType()
|
||||||
this.getDeviceType();
|
this.getDeviceType()
|
||||||
this.getKeeperData();
|
this.getKeeperData()
|
||||||
this.getRepairerData();
|
this.getRepairerData()
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
// watch: {
|
// watch: {
|
||||||
// // 监听 form.qrCode 的变化,如果有值就生成二维码
|
// // 监听 form.qrCode 的变化,如果有值就生成二维码
|
||||||
|
|
@ -528,102 +554,101 @@
|
||||||
// },
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
async getKeeperData() {
|
async getKeeperData() {
|
||||||
const itemName = "ku_guan_role_ids";
|
const itemName = 'ku_guan_role_ids'
|
||||||
let roleIdsTemp = []
|
let roleIdsTemp = []
|
||||||
await getKeeperIds(itemName).then((response) => {
|
await getKeeperIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[response.rows.length - 1].itemValue
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
.split(",")
|
.split(',')
|
||||||
.map((item) => Number(item));
|
.map((item) => Number(item))
|
||||||
roleIdsTemp = roleIds;
|
roleIdsTemp = roleIds
|
||||||
});
|
})
|
||||||
await getUserTypeList(roleIdsTemp.join(',')).then((response) => {
|
await getUserTypeList(roleIdsTemp.join(',')).then((response) => {
|
||||||
this.KeeperOptions = response.rows;
|
this.KeeperOptions = response.rows
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
async getRepairerData() {
|
async getRepairerData() {
|
||||||
const itemName = "wei_xiu_role_ids";
|
const itemName = 'wei_xiu_role_ids'
|
||||||
let roleIdsTemp = []
|
let roleIdsTemp = []
|
||||||
await getRepairIds(itemName).then((response) => {
|
await getRepairIds(itemName).then((response) => {
|
||||||
const roleIds = response.rows[response.rows.length - 1].itemValue
|
const roleIds = response.rows[response.rows.length - 1].itemValue
|
||||||
.split(",")
|
.split(',')
|
||||||
.map((item) => Number(item));
|
.map((item) => Number(item))
|
||||||
roleIdsTemp = roleIds;
|
roleIdsTemp = roleIds
|
||||||
});
|
})
|
||||||
await getUserTypeList(roleIdsTemp.join(',')).then((response) => {
|
await getUserTypeList(roleIdsTemp.join(',')).then((response) => {
|
||||||
this.repairerOptions = response.rows;
|
this.repairerOptions = response.rows
|
||||||
console.log('4444', this.repairerOptions)
|
console.log('4444', this.repairerOptions)
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
getDeviceType() {
|
getDeviceType() {
|
||||||
getDeviceType({ level: 2, skipPermission: 1 }).then(response => {
|
getDeviceType({ level: 2, skipPermission: 1 }).then(response => {
|
||||||
let matTypeRes = response.data;
|
let matTypeRes = response.data
|
||||||
this.materialTypeList = matTypeRes.map((item) => {
|
this.materialTypeList = matTypeRes.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.typeName,
|
label: item.typeName,
|
||||||
value: item.typeId,
|
value: item.typeId
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
|
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
|
||||||
let matNameRes = response.data;
|
let matNameRes = response.data
|
||||||
this.materialNameList = matNameRes.map((item) => {
|
this.materialNameList = matNameRes.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.typeName,
|
label: item.typeName,
|
||||||
value: item.typeId,
|
value: item.typeId
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
getDeviceType({ level: 4, skipPermission: 1 }).then(response => {
|
getDeviceType({ level: 4, skipPermission: 1 }).then(response => {
|
||||||
let matModelRes = response.data;
|
let matModelRes = response.data
|
||||||
this.materialModelList = matModelRes.map((item) => {
|
this.materialModelList = matModelRes.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.typeName,
|
label: item.typeName,
|
||||||
value: item.typeId,
|
value: item.typeId
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
//查询资产属性下拉框
|
//查询资产属性下拉框
|
||||||
getZichanType() {
|
getZichanType() {
|
||||||
getZichanType({ isAll: 1 }).then(response => {
|
getZichanType({ isAll: 1 }).then(response => {
|
||||||
let matTypeRes = response.data;
|
let matTypeRes = response.data
|
||||||
this.ZichanTypeList = matTypeRes.map((item) => {
|
this.ZichanTypeList = matTypeRes.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.assetName,
|
label: item.assetName,
|
||||||
value: item.id,
|
value: item.id
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 查询岗位列表 */
|
/** 查询岗位列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
getListDevice(this.queryParams).then(response => {
|
getListDevice(this.queryParams).then(response => {
|
||||||
this.deviceList = response.rows;
|
this.deviceList = response.rows
|
||||||
this.total = response.total;
|
this.total = response.total
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
// 固定资产录入
|
// 固定资产录入
|
||||||
handleAssetsCodeChange(row) {
|
handleAssetsCodeChange(row) {
|
||||||
if (!row.assetsCode) {
|
if (!row.assetsCode) {
|
||||||
this.$message.error('请输入资产编号');
|
this.$message.error('请输入资产编号')
|
||||||
} else {
|
} else {
|
||||||
editAssetsCode(row).then(response => {
|
editAssetsCode(row).then(response => {
|
||||||
this.$message.success('固定资产录入成功');
|
this.$message.success('固定资产录入成功')
|
||||||
this.getList();
|
this.getList()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -631,46 +656,46 @@
|
||||||
this.reset()
|
this.reset()
|
||||||
const maId = row.maId
|
const maId = row.maId
|
||||||
getDeviceDetail(maId).then((response) => {
|
getDeviceDetail(maId).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data
|
||||||
if (response.data.keeperId) {
|
if (response.data.keeperId) {
|
||||||
const keeperIds = response.data.keeperId.split(',');
|
const keeperIds = response.data.keeperId.split(',')
|
||||||
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
||||||
const keepers = keeperIds.map((id) =>
|
const keepers = keeperIds.map((id) =>
|
||||||
this.KeeperOptions.find((keeper) => keeper.userId + '' === id)
|
this.KeeperOptions.find((keeper) => keeper.userId + '' === id)
|
||||||
).filter(Boolean); // 过滤掉可能不存在的 keeper
|
).filter(Boolean) // 过滤掉可能不存在的 keeper
|
||||||
|
|
||||||
// 根据 keeperName 中文排序
|
// 根据 keeperName 中文排序
|
||||||
keepers.sort((a, b) =>
|
keepers.sort((a, b) =>
|
||||||
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
||||||
);
|
)
|
||||||
|
|
||||||
// 提取排序后的 keeperId
|
// 提取排序后的 keeperId
|
||||||
this.form.keeperArr = keepers.map((keeper) => keeper.userId + '');
|
this.form.keeperArr = keepers.map((keeper) => keeper.userId + '')
|
||||||
} else {
|
} else {
|
||||||
this.form.keeperArr = []; // 如果不存在,设置为空数组
|
this.form.keeperArr = [] // 如果不存在,设置为空数组
|
||||||
}
|
}
|
||||||
if (response.data.repairId) {
|
if (response.data.repairId) {
|
||||||
const repairerIds = response.data.repairId.split(',');
|
const repairerIds = response.data.repairId.split(',')
|
||||||
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
||||||
const repairers = repairerIds.map((id) =>
|
const repairers = repairerIds.map((id) =>
|
||||||
this.repairerOptions.find((repairer) => repairer.userId + '' === id)
|
this.repairerOptions.find((repairer) => repairer.userId + '' === id)
|
||||||
).filter(Boolean); // 过滤掉可能不存在的 keeper
|
).filter(Boolean) // 过滤掉可能不存在的 keeper
|
||||||
|
|
||||||
// 根据 keeperName 中文排序
|
// 根据 keeperName 中文排序
|
||||||
repairers.sort((a, b) =>
|
repairers.sort((a, b) =>
|
||||||
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
||||||
);
|
)
|
||||||
|
|
||||||
// 提取排序后的 keeperId
|
// 提取排序后的 keeperId
|
||||||
this.form.repairerArr = repairers.map((repairer) => repairer.userId + '');
|
this.form.repairerArr = repairers.map((repairer) => repairer.userId + '')
|
||||||
} else {
|
} else {
|
||||||
this.form.repairerArr = []; // 如果不存在,设置为空数组
|
this.form.repairerArr = [] // 如果不存在,设置为空数组
|
||||||
}
|
}
|
||||||
if (this.form.qrCode) {
|
if (this.form.qrCode) {
|
||||||
this.generateQRCode(this.form.qrCode);
|
this.generateQRCode(this.form.qrCode)
|
||||||
// 将生成的二维码转换为图片URL
|
// 将生成的二维码转换为图片URL
|
||||||
} else {
|
} else {
|
||||||
this.qrcodeUrl = '';
|
this.qrcodeUrl = ''
|
||||||
}
|
}
|
||||||
this.showHouse = true
|
this.showHouse = true
|
||||||
this.title = '修改'
|
this.title = '修改'
|
||||||
|
|
@ -681,46 +706,46 @@
|
||||||
this.reset()
|
this.reset()
|
||||||
const maId = row.maId
|
const maId = row.maId
|
||||||
getDeviceDetail(maId).then((response) => {
|
getDeviceDetail(maId).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data
|
||||||
if (response.data.keeperId) {
|
if (response.data.keeperId) {
|
||||||
const keeperIds = response.data.keeperId.split(',');
|
const keeperIds = response.data.keeperId.split(',')
|
||||||
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
||||||
const keepers = keeperIds.map((id) =>
|
const keepers = keeperIds.map((id) =>
|
||||||
this.KeeperOptions.find((keeper) => keeper.userId + '' === id)
|
this.KeeperOptions.find((keeper) => keeper.userId + '' === id)
|
||||||
).filter(Boolean); // 过滤掉可能不存在的 keeper
|
).filter(Boolean) // 过滤掉可能不存在的 keeper
|
||||||
|
|
||||||
// 根据 keeperName 中文排序
|
// 根据 keeperName 中文排序
|
||||||
keepers.sort((a, b) =>
|
keepers.sort((a, b) =>
|
||||||
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
||||||
);
|
)
|
||||||
|
|
||||||
// 提取排序后的 keeperId
|
// 提取排序后的 keeperId
|
||||||
this.form.keeperArr = keepers.map((keeper) => keeper.userId + '');
|
this.form.keeperArr = keepers.map((keeper) => keeper.userId + '')
|
||||||
} else {
|
} else {
|
||||||
this.form.keeperArr = []; // 如果不存在,设置为空数组
|
this.form.keeperArr = [] // 如果不存在,设置为空数组
|
||||||
}
|
}
|
||||||
if (response.data.repairId) {
|
if (response.data.repairId) {
|
||||||
const repairerIds = response.data.repairId.split(',');
|
const repairerIds = response.data.repairId.split(',')
|
||||||
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
// 根据 keeperIds 从 KeeperOptions 中获取对应的 keeper 对象
|
||||||
const repairers = repairerIds.map((id) =>
|
const repairers = repairerIds.map((id) =>
|
||||||
this.repairerOptions.find((repairer) => repairer.userId + '' === id)
|
this.repairerOptions.find((repairer) => repairer.userId + '' === id)
|
||||||
).filter(Boolean); // 过滤掉可能不存在的 keeper
|
).filter(Boolean) // 过滤掉可能不存在的 keeper
|
||||||
|
|
||||||
// 根据 keeperName 中文排序
|
// 根据 keeperName 中文排序
|
||||||
repairers.sort((a, b) =>
|
repairers.sort((a, b) =>
|
||||||
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
a.nickName.localeCompare(b.nickName, 'zh-CN')
|
||||||
);
|
)
|
||||||
|
|
||||||
// 提取排序后的 keeperId
|
// 提取排序后的 keeperId
|
||||||
this.form.repairerArr = repairers.map((repairer) => repairer.userId + '');
|
this.form.repairerArr = repairers.map((repairer) => repairer.userId + '')
|
||||||
} else {
|
} else {
|
||||||
this.form.repairerArr = []; // 如果不存在,设置为空数组
|
this.form.repairerArr = [] // 如果不存在,设置为空数组
|
||||||
}
|
}
|
||||||
if (this.form.qrCode) {
|
if (this.form.qrCode) {
|
||||||
this.generateQRCode(this.form.qrCode);
|
this.generateQRCode(this.form.qrCode)
|
||||||
// 将生成的二维码转换为图片URL
|
// 将生成的二维码转换为图片URL
|
||||||
} else {
|
} else {
|
||||||
this.qrcodeUrl = '';
|
this.qrcodeUrl = ''
|
||||||
}
|
}
|
||||||
this.showHouse = true
|
this.showHouse = true
|
||||||
this.title = '查看'
|
this.title = '查看'
|
||||||
|
|
@ -737,43 +762,43 @@
|
||||||
height: 55,
|
height: 55,
|
||||||
colorDark: '#000000',
|
colorDark: '#000000',
|
||||||
colorLight: '#ffffff',
|
colorLight: '#ffffff',
|
||||||
correctLevel: QRCode.CorrectLevel.H,
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {};
|
this.form = {}
|
||||||
this.resetForm("form");
|
this.resetForm('form')
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.queryParams.keyWord=null;
|
this.queryParams.keyWord = null
|
||||||
this.queryParams.maStatus=null;
|
this.queryParams.maStatus = null
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
|
|
||||||
//** 提交按钮 */
|
//** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs['form'].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.maId != undefined) {
|
if (this.form.maId != undefined) {
|
||||||
editDevice(this.form).then(response => {
|
editDevice(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess('修改成功')
|
||||||
this.showHouse = false;
|
this.showHouse = false
|
||||||
this.getList();
|
this.getList()
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.showHouse = false;
|
this.showHouse = false
|
||||||
this.reset();
|
this.reset()
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
|
|
@ -788,7 +813,8 @@
|
||||||
this.$modal.msgSuccess('删除成功')
|
this.$modal.msgSuccess('删除成功')
|
||||||
this.getList()
|
this.getList()
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 二维码查看
|
// 二维码查看
|
||||||
|
|
@ -805,11 +831,68 @@
|
||||||
height: 256,
|
height: 256,
|
||||||
colorDark: '#000000',
|
colorDark: '#000000',
|
||||||
colorLight: '#ffffff',
|
colorLight: '#ffffff',
|
||||||
correctLevel: QRCode.CorrectLevel.H,
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
downloadQrCode(row) {
|
||||||
|
try {
|
||||||
|
// 创建外层容器
|
||||||
|
const codeQrContainer = document.createElement('div')
|
||||||
|
codeQrContainer.style.textAlign = 'center'
|
||||||
|
document.body.appendChild(codeQrContainer)
|
||||||
|
|
||||||
|
// 创建二维码容器
|
||||||
|
const uploadImgContainer = document.createElement('div')
|
||||||
|
uploadImgContainer.className = 'uploadImg'
|
||||||
|
codeQrContainer.appendChild(uploadImgContainer)
|
||||||
|
|
||||||
|
// 创建二维码显示容器
|
||||||
|
const qrcodeContainer = document.createElement('div')
|
||||||
|
qrcodeContainer.className = 'qrcode'
|
||||||
|
uploadImgContainer.appendChild(qrcodeContainer)
|
||||||
|
|
||||||
|
// 使用 qrcodejs2 生成二维码
|
||||||
|
new QRCode(qrcodeContainer, {
|
||||||
|
text: row.qrCode,
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
colorDark: '#000000',
|
||||||
|
colorLight: '#ffffff',
|
||||||
|
correctLevel: QRCode.CorrectLevel.H
|
||||||
|
})
|
||||||
|
|
||||||
|
// 创建设备编号容器
|
||||||
|
const boxCodeContainer = document.createElement('div')
|
||||||
|
boxCodeContainer.className = 'boxCode'
|
||||||
|
boxCodeContainer.innerText = `设备编号:${row.maCode || '未知'}`
|
||||||
|
codeQrContainer.appendChild(boxCodeContainer)
|
||||||
|
|
||||||
|
// 为了保证页面不被遮挡,可以通过一些 CSS 来调整布局
|
||||||
|
codeQrContainer.style.display = 'flex'
|
||||||
|
codeQrContainer.style.flexDirection = 'column'
|
||||||
|
codeQrContainer.style.alignItems = 'center'
|
||||||
|
codeQrContainer.style.justifyContent = 'center'
|
||||||
|
codeQrContainer.style.width = '400px'
|
||||||
|
codeQrContainer.style.height = '400px'
|
||||||
|
console.log(codeQrContainer)
|
||||||
|
html2canvas(codeQrContainer).then((canvas) => {
|
||||||
|
// 将canvas转换为图片URL
|
||||||
|
const image = canvas.toDataURL('image/png')
|
||||||
|
const alink = document.createElement('a')
|
||||||
|
alink.href = image
|
||||||
|
alink.download = row.qrCode
|
||||||
|
alink.click()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$message.success('二维码下载成功')
|
||||||
|
} catch (error) {
|
||||||
|
console.error('二维码生成失败:', error)
|
||||||
|
this.$message.error('二维码下载失败,请重试')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
//二维码下载
|
//二维码下载
|
||||||
downloadCode(e) {
|
downloadCode(e) {
|
||||||
if (document.getElementById('qrcode').childNodes[0]) {
|
if (document.getElementById('qrcode').childNodes[0]) {
|
||||||
|
|
@ -835,54 +918,54 @@
|
||||||
|
|
||||||
//检验报告同步
|
//检验报告同步
|
||||||
handleSynch() {
|
handleSynch() {
|
||||||
this.titleSynch = "检验报告同步";
|
this.titleSynch = '检验报告同步'
|
||||||
this.openSynch = true;
|
this.openSynch = true
|
||||||
},
|
},
|
||||||
|
|
||||||
handleQuerySynch() {
|
handleQuerySynch() {
|
||||||
const params = {
|
const params = {
|
||||||
reportCode: this.formSynchParams.reportCode,
|
reportCode: this.formSynchParams.reportCode
|
||||||
}
|
}
|
||||||
getSynchReportCode(params).then((response) => {
|
getSynchReportCode(params).then((response) => {
|
||||||
let data = response.data;
|
let data = response.data
|
||||||
this.dataSynch = data;
|
this.dataSynch = data
|
||||||
if (data.pdf) {
|
if (data.pdf) {
|
||||||
this.formSynchParams.pdf = data.pdf;
|
this.formSynchParams.pdf = data.pdf
|
||||||
this.formSynchParams.pdfName = data.reportName;
|
this.formSynchParams.pdfName = data.reportName
|
||||||
} else {
|
} else {
|
||||||
this.formSynchParams.pdf = "";
|
this.formSynchParams.pdf = ''
|
||||||
this.formSynchParams.pdfName = "";
|
this.formSynchParams.pdfName = ''
|
||||||
this.$message.error('该报告编号暂无文件');
|
this.$message.error('该报告编号暂无文件')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadPdf() {
|
downloadPdf() {
|
||||||
if (this.formSynchParams.pdf) {
|
if (this.formSynchParams.pdf) {
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a')
|
||||||
link.href = this.formSynchParams.pdf;
|
link.href = this.formSynchParams.pdf
|
||||||
// 从 URL 中提取文件名,如果无法提取则使用默认文件名
|
// 从 URL 中提取文件名,如果无法提取则使用默认文件名
|
||||||
const fileName = this.formSynchParams.pdfName;
|
const fileName = this.formSynchParams.pdfName
|
||||||
link.download = fileName;
|
link.download = fileName
|
||||||
// 设置在新页面打开
|
// 设置在新页面打开
|
||||||
link.target = '_blank';
|
link.target = '_blank'
|
||||||
// 将链接添加到文档中
|
// 将链接添加到文档中
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link)
|
||||||
link.click();
|
link.click()
|
||||||
// 移除链接
|
// 移除链接
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link)
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
cancelSynch() {
|
cancelSynch() {
|
||||||
this.openSynch = false;
|
this.openSynch = false
|
||||||
this.formSynchParams = { //检验报告同步表单
|
this.formSynchParams = { //检验报告同步表单
|
||||||
reportCode: "", //检验报告编号
|
reportCode: '', //检验报告编号
|
||||||
pdf: "", //检验报告pdf
|
pdf: '', //检验报告pdf
|
||||||
pdfName: "", //检验报告pdf名称
|
pdfName: '' //检验报告pdf名称
|
||||||
};
|
}
|
||||||
this.dataSynch = {};
|
this.dataSynch = {}
|
||||||
},
|
},
|
||||||
|
|
||||||
//同步
|
//同步
|
||||||
|
|
@ -893,21 +976,21 @@
|
||||||
pdf: this.dataSynch.pdf,
|
pdf: this.dataSynch.pdf,
|
||||||
reportName: this.dataSynch.reportName,
|
reportName: this.dataSynch.reportName,
|
||||||
reportNum: this.dataSynch.reportNum,
|
reportNum: this.dataSynch.reportNum,
|
||||||
samples: this.dataSynch.samples,
|
samples: this.dataSynch.samples
|
||||||
};
|
}
|
||||||
|
|
||||||
synchReport(params).then((response) => {
|
synchReport(params).then((response) => {
|
||||||
if (response.code == 200) {
|
if (response.code == 200) {
|
||||||
this.$modal.msgSuccess(response.msg);
|
this.$modal.msgSuccess(response.msg)
|
||||||
this.openSynch = false;
|
this.openSynch = false
|
||||||
this.formSynchParams = {
|
this.formSynchParams = {
|
||||||
reportCode: "",
|
reportCode: '',
|
||||||
pdf: "",
|
pdf: '',
|
||||||
pdfName: "",
|
pdfName: ''
|
||||||
};
|
|
||||||
this.dataSynch = {};
|
|
||||||
}
|
}
|
||||||
this.getList();
|
this.dataSynch = {}
|
||||||
|
}
|
||||||
|
this.getList()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -917,27 +1000,29 @@
|
||||||
// }, `仓库管理_${new Date().getTime()}.xlsx`)
|
// }, `仓库管理_${new Date().getTime()}.xlsx`)
|
||||||
// },
|
// },
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
::v-deep.el-table .fixed-width .el-button--mini {
|
::v-deep.el-table .fixed-width .el-button--mini {
|
||||||
width: 60px !important;
|
width: 60px !important;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
//隐藏图片上传框的css
|
//隐藏图片上传框的css
|
||||||
::v-deep.disabled {
|
::v-deep.disabled {
|
||||||
.el-upload--picture-card {
|
.el-upload--picture-card {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.uploadImg {
|
.uploadImg {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boxCode {
|
.boxCode {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue