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