This commit is contained in:
parent
177da9ef49
commit
81aac988d4
|
|
@ -363,3 +363,12 @@ export function getExportZipProgress(data) {
|
|||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 结算-维修单-详情
|
||||
export function getRepairDetailsListApi(query) {
|
||||
return request({
|
||||
url: '/material/repair/getRepairDetailsList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
@ -44,7 +44,13 @@ export function getBoxDetailListApi(query) {
|
|||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function getNumListApi(query) {
|
||||
return request({
|
||||
url: '/material/bm_qrcode_box/getNumList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -672,8 +672,16 @@ export default {
|
|||
},
|
||||
//提交按钮
|
||||
handleAdd() {
|
||||
let settlementType = ''
|
||||
if (this.rowData[0].settlementType == 1) {
|
||||
settlementType = '工器具'
|
||||
} else if (this.rowData[0].settlementType == 2) {
|
||||
settlementType = '安全工器具'
|
||||
} else {
|
||||
settlementType = '总费用'
|
||||
}
|
||||
this.$modal
|
||||
.confirm('是否确认提交?')
|
||||
.confirm(`当前结算类型为【${settlementType}】,是否确认提交?`)
|
||||
.then(() => {
|
||||
const loading = this.$loading()
|
||||
let params = {
|
||||
|
|
|
|||
|
|
@ -304,11 +304,19 @@
|
|||
>
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }" v-if="column.prop == 'repairCode'">
|
||||
<span style="cursor: pointer; color: #409eff" @click="handleView(row)">
|
||||
<span style="cursor: pointer; color: #409eff">
|
||||
{{ row.repairCode }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 操作 -->
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<template v-slot="{ row }">
|
||||
<el-button type="primary" size="mini" @click="handleView(row)">
|
||||
查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
|
|
@ -323,6 +331,35 @@
|
|||
<el-button @click="repairDialogVisible = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :visible.sync="repairView" width="80%" append-to-body>
|
||||
<el-table
|
||||
:data="repairViewList"
|
||||
highlight-current-row
|
||||
style="width: 100%"
|
||||
v-loading="isLoading"
|
||||
:max-height="650"
|
||||
>
|
||||
<el-table-column type="index" width="55" label="序号" align="center" />
|
||||
<el-table-column
|
||||
v-for="(column, index) in repairViewColumns"
|
||||
show-overflow-tooltip
|
||||
:key="index"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
align="center"
|
||||
>
|
||||
<!-- 插槽 -->
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="column.prop == 'manageType'">
|
||||
<span v-if="row.manageType == 0">编码管理</span>
|
||||
<span v-if="row.manageType == 1">数量管理</span>
|
||||
</span>
|
||||
<span v-else>{{ row[column.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -338,7 +375,8 @@ import {
|
|||
getProjectListByUnitIds,
|
||||
getAgreementInfoById,
|
||||
getSltInfo,
|
||||
viewRepairCodeApi
|
||||
viewRepairCodeApi,
|
||||
getRepairDetailsListApi
|
||||
} from '@/api/cost/cost'
|
||||
import { toChineseAmount } from '@/utils/bonus.js'
|
||||
import vueEasyPrint from 'vue-easy-print'
|
||||
|
|
@ -434,9 +472,28 @@ export default {
|
|||
repairTotal: 0,
|
||||
tableColumns: [
|
||||
{ label: '维修单号', prop: 'repairCode' },
|
||||
{ label: '状态', prop: 'repairStatus' }
|
||||
{ label: '状态', prop: 'repairStatus' },
|
||||
{ label: '创建人', prop: 'createBy' },
|
||||
],
|
||||
repairList: []
|
||||
repairList: [],
|
||||
repairView: false,
|
||||
repairViewParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
repairViewColumns: [
|
||||
{ label: '退料单位', prop: 'backUnit' },
|
||||
{ label: '退料工程', prop: 'backPro' },
|
||||
{ label: '类型名称', prop: 'typeName' },
|
||||
{ label: '规格型号', prop: 'type' },
|
||||
{ label: '计量单位', prop: 'unitName' },
|
||||
{ label: '退料数量', prop: 'typeRepairNum' },
|
||||
{ label: '已维修数量', prop: 'typeRepairedNum' },
|
||||
{ label: '报废数量', prop: 'typeScrapNum' },
|
||||
{ label: '待修数量', prop: 'waitRepairNum' },
|
||||
{ label: '管理模式', prop: 'manageType' },
|
||||
],
|
||||
repairViewList: [],
|
||||
}
|
||||
},
|
||||
// updated() {
|
||||
|
|
@ -651,13 +708,26 @@ export default {
|
|||
this.getRepairList()
|
||||
},
|
||||
handleView(row) {
|
||||
this.repairDialogVisible = false
|
||||
this.$router.push({
|
||||
path: '/repair/repairManage',
|
||||
query: {
|
||||
code: row.repairCode
|
||||
}
|
||||
})
|
||||
// this.repairDialogVisible = false
|
||||
// this.$router.push({
|
||||
// path: '/repair/repairManage',
|
||||
// query: {
|
||||
// code: row.repairCode
|
||||
// }
|
||||
// })
|
||||
this.repairView = true
|
||||
this.getRepairDetailsList(row)
|
||||
},
|
||||
async getRepairDetailsList(row) {
|
||||
try {
|
||||
this.isLoading = true
|
||||
const res = await getRepairDetailsListApi({ taskId: row.taskId })
|
||||
this.repairViewList = res.data
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ error:', error)
|
||||
} finally {
|
||||
this.isLoading = false
|
||||
}
|
||||
},
|
||||
//维修任务单打印
|
||||
print() {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="180" v-if="!isView">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="success" @click="pass(scope.row)" v-if="scope.row.status!=14&&scope.row.status!=19">
|
||||
<el-button size="mini" type="success" @click="pass(scope.row)" v-if="scope.row.status!=14&&scope.row.status!=19 && scope.row.status != 23">
|
||||
入库
|
||||
</el-button>
|
||||
<!-- <el-button size="mini" type="danger" @click="reject(scope.row)" v-if="scope.row.status!=14&&scope.row.status!=19">
|
||||
|
|
@ -308,6 +308,7 @@ export default {
|
|||
codeRowData:{},
|
||||
codeTableData:[],
|
||||
inPutList:[],
|
||||
purchaseCheckInfo: null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -365,6 +366,7 @@ export default {
|
|||
// this.queryParams.statusList=[3,13,4,14,19]
|
||||
getPurchaseDetailsList(this.queryParams).then(response => {
|
||||
this.tableList = response.data.purchaseCheckDetailsList;
|
||||
this.purchaseCheckInfo = response.data.purchaseCheckInfo
|
||||
this.tableList.forEach((item) => {
|
||||
item.fixCodeStr = this.fixCodeList[Number(item.fixCode)]
|
||||
})
|
||||
|
|
@ -404,14 +406,22 @@ export default {
|
|||
this.openCode=true
|
||||
})
|
||||
}else{
|
||||
const inputNum = Number(row.checkNum) - Number(row.inputNum)
|
||||
let obj = {
|
||||
taskId: this.taskId,
|
||||
typeId:row.typeId,
|
||||
purchaseId: row.id,
|
||||
typeName: row.maTypeName,
|
||||
typeModelName: row.typeName,
|
||||
manageType: row.manageType
|
||||
manageType: row.manageType,
|
||||
isRs: row.isRs,
|
||||
code: this.purchaseCheckInfo.code,
|
||||
maCode: row.maCode,
|
||||
maTypeName: row.maTypeName,
|
||||
unitName: row.unitName,
|
||||
inputNum
|
||||
};
|
||||
console.log('🚀 ~ obj:', obj)
|
||||
this.$modal.confirm('是否确认新购入库该物资类型?')
|
||||
.then(function() {
|
||||
console.log(obj)
|
||||
|
|
@ -437,7 +447,12 @@ export default {
|
|||
inPutList: this.inPutList,
|
||||
typeName: this.codeRowData.maTypeName,
|
||||
typeModelName: this.codeRowData.typeName,
|
||||
manageType: this.codeRowData.manageType
|
||||
manageType: this.codeRowData.manageType,
|
||||
isRs: this.codeRowData.isRs,
|
||||
code: this.purchaseCheckInfo.code,
|
||||
maCode: this.codeRowData.maCode,
|
||||
maTypeName: this.codeRowData.maTypeName,
|
||||
unitName: this.codeRowData.unitName,
|
||||
};
|
||||
console.log(obj)
|
||||
this.$modal.confirm('是否确认新购入库勾选的编码?')
|
||||
|
|
|
|||
|
|
@ -327,7 +327,11 @@ export default {
|
|||
typeId:this.rowData.typeId,
|
||||
pendingInputNum:this.rowData.pendingInputNum,
|
||||
inputNum:this.numInput,
|
||||
inputCode:this.rowData.inputCode
|
||||
inputCode:this.rowData.inputCode,
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
repairInputWarehouseApi(param).then((response) => {
|
||||
if(response.code==200){
|
||||
|
|
@ -421,7 +425,11 @@ export default {
|
|||
taskId:this.rowData.taskId,
|
||||
typeId:this.rowData.typeId,
|
||||
inputCode:this.rowData.inputCode,
|
||||
maCodeList:[{maId:codeRow.maId,maCode:codeRow.maCode}]
|
||||
maCodeList:[{maId:codeRow.maId,maCode:codeRow.maCode}],
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
this.$modal.confirm("是否确认入库所选择的设备编码?")
|
||||
.then(function () {
|
||||
|
|
@ -505,7 +513,11 @@ export default {
|
|||
let param = {
|
||||
taskId:this.rowData.taskId,
|
||||
typeId:this.rowData.typeId,
|
||||
maCodeList:this.passTemp
|
||||
maCodeList:this.passTemp,
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
this.$modal.confirm("是否确认入库所选择的设备编码?")
|
||||
.then(function () {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
>导出
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
@click="handleFailAll"
|
||||
>批量驳回
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExportInfo">
|
||||
导出
|
||||
|
|
|
|||
|
|
@ -286,7 +286,11 @@ export default {
|
|||
taskId:this.rowData.taskId,
|
||||
typeId:this.rowData.typeId,
|
||||
pendingInputNum:this.rowData.pendingInputNum,
|
||||
inputNum:this.numInput
|
||||
inputNum:this.numInput,
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
repairInputWarehouseApi(param).then((response) => {
|
||||
if(response.code==200){
|
||||
|
|
@ -378,7 +382,11 @@ export default {
|
|||
let param = {
|
||||
taskId:this.rowData.taskId,
|
||||
typeId:this.rowData.typeId,
|
||||
maCodeList:[{maId:codeRow.maId,maCode:codeRow.maCode}]
|
||||
maCodeList:[{maId:codeRow.maId,maCode:codeRow.maCode}],
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
this.$modal.confirm("是否确认入库所选择的设备编码?")
|
||||
.then(function () {
|
||||
|
|
@ -462,7 +470,11 @@ export default {
|
|||
let param = {
|
||||
taskId:this.rowData.taskId,
|
||||
typeId:this.rowData.typeId,
|
||||
maCodeList:this.passTemp
|
||||
maCodeList:this.passTemp,
|
||||
isRs: this.rowData.isRs,
|
||||
maCode: this.rowData.maCode,
|
||||
maTypeName: this.rowData.typeName,
|
||||
unitName: this.rowData.unitName,
|
||||
}
|
||||
this.$modal.confirm("是否确认入库所选择的设备编码?")
|
||||
.then(function () {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,399 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.startTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="开始日期"
|
||||
@change="() => (queryParams.endTime = '')"
|
||||
style="width: 130px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>-</el-form-item>
|
||||
<el-form-item prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.endTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="date"
|
||||
placeholder="结束日期"
|
||||
:picker-options="{ disabledDate: t => t.getTime() < new Date(queryParams.startTime).getTime() - 86400000 }"
|
||||
style="width: 130px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="keyWord">
|
||||
<el-input
|
||||
v-model="queryParams.keyWord"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
maxlength="50"
|
||||
style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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>
|
||||
<el-button type="success" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table border :data="tableList" v-loading="loading" @selection-change="handleSelectionChange">
|
||||
<el-table-column label="序号" align="center" type="index">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准箱类型" align="center" prop="boxType" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.qr_box_type" :value="scope.row.boxType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标准箱名称" align="center" prop="boxName" show-overflow-tooltip />
|
||||
<el-table-column label="标准箱编码" align="center" prop="boxCode" show-overflow-tooltip />
|
||||
<el-table-column label="标准箱机具数" align="center" prop="devNum" show-overflow-tooltip />
|
||||
<el-table-column label="创建日期" align="center" prop="createTime" show-overflow-tooltip />
|
||||
<el-table-column label="本次检验时间" align="center" prop="thisCheckTime" show-overflow-tooltip />
|
||||
<el-table-column label="下次检验时间" align="center" prop="nextCheckTime" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" width="300">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" @click="handleView(row)">查看</el-button>
|
||||
<el-button size="mini" type="primary" @click="downloadQrCode(row)">下载</el-button>
|
||||
<el-button size="mini" type="primary" @click="handleDetail(row)">设备明细</el-button>
|
||||
<el-button size="mini" type="danger" @click="handleNotice(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination
|
||||
:total="total"
|
||||
v-show="total > 0"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 标准箱设备明细 -->
|
||||
<el-dialog title="标准箱设备明细" :visible.sync="open" width="1000px" append-to-body>
|
||||
<el-form :model="queryDialogForm" ref="queryDialogForm" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item prop="keyWord">
|
||||
<el-input v-model="queryDialogForm.keyWord" placeholder="请输入关键字" clearable maxlength="20" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryDialog">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryDialog">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table border :data="tableListDialog">
|
||||
<el-table-column label="序号" align="center" type="index">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ (queryDialogForm.pageNum - 1) * queryDialogForm.pageSize + scope.$index + 1 }}</span>
|
||||
</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="maCode" show-overflow-tooltip />
|
||||
<el-table-column label="录入人" align="center" prop="createBy" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<pagination
|
||||
:total="totalDialog"
|
||||
v-show="totalDialog > 0"
|
||||
:page.sync="queryDialogForm.pageNum"
|
||||
:limit.sync="queryDialogForm.pageSize"
|
||||
@pagination="getDialogList"
|
||||
/>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 二维码下载对话框 -->
|
||||
<el-dialog
|
||||
title="标准箱二维码"
|
||||
:visible.sync="uploadOpen"
|
||||
width="450px"
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<div style="text-align: center" ref="codeBox">
|
||||
<div class="uploadImg">
|
||||
<div id="qrcode" class="qrcode" ref="codeItem"></div>
|
||||
</div>
|
||||
<div class="boxCode">{{ rowObj.boxCode }}</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer" style="text-align: center">
|
||||
<el-button type="primary" @click="downloadQrCode(rowObj)">下 载</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getQrCodeBoxListApi,
|
||||
addQrCodeBoxApi,
|
||||
delQrCodeBoxApi,
|
||||
getNumListApi
|
||||
} from '@/api/ma/standardBox'
|
||||
import QRCode from 'qrcodejs2'
|
||||
|
||||
export default {
|
||||
name: 'Stereoscopic',
|
||||
dicts: ['qr_box_type'],
|
||||
data() {
|
||||
return {
|
||||
total: 0, // 总条数
|
||||
loading: false, // 遮罩层
|
||||
showSearch: true, // 显示搜索条件
|
||||
tableList: [], // 列表数据源
|
||||
queryTime: [], // 日期数据源
|
||||
selectList: [], // 列表选中数据
|
||||
// 列表查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
status: '',
|
||||
endTime: '',
|
||||
keyWord: '',
|
||||
startTime: '',
|
||||
boxType: 2,
|
||||
},
|
||||
open: false,
|
||||
queryDialogForm: {
|
||||
keyWord: '',
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
totalDialog: 0,
|
||||
tableListDialog: [],
|
||||
uploadOpen: false,
|
||||
rowObj: {},
|
||||
boxCode: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 日期change
|
||||
onTimeChange(val) {
|
||||
if (val.length > 0) {
|
||||
const [time_1, time_2] = val
|
||||
this.queryParams.startTime = time_1
|
||||
this.queryParams.endTime = time_2
|
||||
} else {
|
||||
this.queryParams.startTime = ''
|
||||
this.queryParams.endTime = ''
|
||||
}
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
this.loading = true
|
||||
const res = await getQrCodeBoxListApi(this.queryParams)
|
||||
this.tableList = res.data.rows
|
||||
this.total = res.data.total
|
||||
this.loading = false
|
||||
},
|
||||
// 搜索按钮
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 重置按钮
|
||||
resetQuery() {
|
||||
this.queryTime = []
|
||||
this.resetForm('queryForm')
|
||||
this.queryParams.pageNum = 1
|
||||
this.queryParams.endTime = ''
|
||||
this.queryParams.pageSize = 10
|
||||
this.queryParams.startTime = ''
|
||||
this.getList()
|
||||
},
|
||||
handleAdd() {
|
||||
console.log('新增')
|
||||
addQrCodeBoxApi({ boxType: 2 }).then(response => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
//二维码查看
|
||||
handleView(row) {
|
||||
this.rowObj = row
|
||||
this.uploadOpen = true
|
||||
this.boxCode = row.boxCode
|
||||
let str = row.boxCode
|
||||
this.$nextTick(() => {
|
||||
this.$refs.codeItem.innerHTML = ''
|
||||
var qrcode = new QRCode(this.$refs.codeItem, {
|
||||
text: str, //二维码内容
|
||||
width: 256,
|
||||
height: 256,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H
|
||||
})
|
||||
}, 500)
|
||||
},
|
||||
downloadQrCode(row) {
|
||||
const qrContainer = document.createElement('div')
|
||||
document.body.appendChild(qrContainer)
|
||||
|
||||
const qrSize = 512 // 放大二维码
|
||||
const padding = 20 // 边距也放大
|
||||
const fontSize = 59 // 放大文字
|
||||
const maxTextWidth = qrSize
|
||||
|
||||
const qrcode = new QRCode(qrContainer, {
|
||||
text: row.boxCode,
|
||||
width: qrSize,
|
||||
height: qrSize,
|
||||
colorDark: '#000000',
|
||||
colorLight: '#ffffff',
|
||||
correctLevel: QRCode.CorrectLevel.H
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
const img = qrContainer.querySelector('img') || qrContainer.querySelector('canvas')
|
||||
const text = row.boxCode
|
||||
|
||||
// 计算换行
|
||||
const ctxMeasure = document.createElement('canvas').getContext('2d')
|
||||
ctxMeasure.font = `${fontSize}px Arial`
|
||||
const words = text.split('')
|
||||
let line = ''
|
||||
const lines = []
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
const testLine = line + words[i]
|
||||
if (ctxMeasure.measureText(testLine).width > maxTextWidth) {
|
||||
lines.push(line)
|
||||
line = words[i]
|
||||
} else {
|
||||
line = testLine
|
||||
}
|
||||
}
|
||||
lines.push(line)
|
||||
|
||||
// 动态计算画布高度
|
||||
const lineHeight = fontSize + 10
|
||||
const qrCanvas = document.createElement('canvas')
|
||||
qrCanvas.width = qrSize + padding * 2
|
||||
qrCanvas.height = qrSize + padding * 2 + lines.length * lineHeight
|
||||
|
||||
const ctx = qrCanvas.getContext('2d')
|
||||
ctx.fillStyle = '#fff'
|
||||
ctx.fillRect(0, 0, qrCanvas.width, qrCanvas.height)
|
||||
|
||||
ctx.drawImage(img, padding, padding, qrSize, qrSize)
|
||||
|
||||
// 绘制文字
|
||||
ctx.fillStyle = '#000'
|
||||
ctx.font = `${fontSize}px Arial`
|
||||
ctx.textAlign = 'center'
|
||||
lines.forEach((ln, index) => {
|
||||
ctx.fillText(ln, qrCanvas.width / 2, qrSize + padding + fontSize / 1.2 + index * lineHeight)
|
||||
})
|
||||
|
||||
// 下载
|
||||
const a = document.createElement('a')
|
||||
a.href = qrCanvas.toDataURL('image/png')
|
||||
a.download = text + '.png'
|
||||
a.click()
|
||||
|
||||
document.body.removeChild(qrContainer)
|
||||
}, 500)
|
||||
},
|
||||
//二维码下载
|
||||
// downloadCode(e) {
|
||||
// if (document.getElementById('qrcode').childNodes[0]) {
|
||||
// let element = this.$refs.codeBox
|
||||
// html2canvas(element).then((canvas) => {
|
||||
// // 将canvas转换为图片URL
|
||||
// const image = canvas.toDataURL('image/png')
|
||||
// const alink = document.createElement('a')
|
||||
// alink.href = image
|
||||
// alink.download = this.boxCode
|
||||
// alink.click()
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// 设备明细
|
||||
handleDetail(row) {
|
||||
this.open = true
|
||||
this.queryDialogForm.boxId = row.boxId
|
||||
this.resetQueryDialog()
|
||||
},
|
||||
// 获取列表数据
|
||||
async getDialogList() {
|
||||
const res = await getNumListApi(this.queryDialogForm)
|
||||
console.log('🚀 ~ getDialogList ~ res:', res)
|
||||
this.tableListDialog = res.rows
|
||||
// this.tableListDialog = [{maType:"抱杆",typeName:"10t",maCode:"bg121334343",updateBy:"张三"},{maType:"抱杆",typeName:"10t",maCode:"bg121334343",updateBy:"张三"},{maType:"抱杆",typeName:"10t",maCode:"bg121334343",updateBy:"张三"},{maType:"抱杆",typeName:"10t",maCode:"bg121334343",updateBy:"张三"}]
|
||||
this.totalDialog = res.total
|
||||
},
|
||||
//弹窗搜索
|
||||
handleQueryDialog() {
|
||||
this.queryDialogForm.pageNum = 1
|
||||
this.getDialogList()
|
||||
},
|
||||
//弹窗搜索重置
|
||||
resetQueryDialog() {
|
||||
this.resetForm('queryDialogForm')
|
||||
this.queryDialogForm.pageNum = 1
|
||||
this.getDialogList()
|
||||
},
|
||||
|
||||
// 删除
|
||||
handleNotice(row) {
|
||||
this.$confirm('是否确定删除标准箱', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
let param = {
|
||||
boxId: row.boxId
|
||||
}
|
||||
return delQrCodeBoxApi(param)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 导出数据
|
||||
handleExport() {
|
||||
console.log('数据导出')
|
||||
// this.download(
|
||||
// "/material/purchase_check_info/export",
|
||||
// { ...this.queryParams},
|
||||
// `新购到货入库_${new Date().getTime()}.xlsx`
|
||||
// );
|
||||
},
|
||||
// 列表复选框
|
||||
handleSelectionChange(list) {
|
||||
this.selectList = list
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// .qrcode{
|
||||
// height: 300px;
|
||||
// width: 300px;
|
||||
// }
|
||||
.uploadImg {
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.boxCode {
|
||||
margin-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
font-size: 35px;
|
||||
}
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 60px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue