Files
hht-hdyy-uni/pages/hdyy/tygn/kc-query.vue

237 lines
7.1 KiB
Vue
Raw Normal View History

2026-01-07 16:15:05 +08:00
<template>
<view class="zd_container">
<!-- 库存查询 -->
2026-01-13 18:26:22 +08:00
<nav-bar :title="title"></nav-bar>
2026-01-07 16:15:05 +08:00
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">查询类型</span>
</view>
<view class="zd-col-18 filter_select">
2026-01-13 18:26:22 +08:00
<uni-data-select v-model="index1" :localdata="options1" :clear="false"></uni-data-select>
2026-01-07 16:15:05 +08:00
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">点位</span>
</view>
<view class="zd-col-18">
<search-box v-model="val1"/>
</view>
</view>
<view class="zd-row border-bottom">
<view class="zd-col-6">
<span class="filter_label">物料编码</span>
</view>
<view class="zd-col-13">
2026-01-09 10:19:19 +08:00
<!-- <search-box v-model="materialData.material_code"/> -->
2026-01-13 18:26:22 +08:00
<input type="text" class="filter_input" v-model="materialData.material_code">
2026-01-07 16:15:05 +08:00
</view>
2026-01-09 10:19:19 +08:00
<button class="mini-btn" type="primary" @tap="toJump('mater-save?title=物料维护')">查询</button>
2026-01-07 16:15:05 +08:00
</view>
<view class="zd-row border-bottom">
2026-01-09 10:19:19 +08:00
<view class="zd-col-6">
2026-01-07 16:15:05 +08:00
<span class="filter_label">批号</span>
</view>
2026-01-09 10:19:19 +08:00
<view class="zd-col-13">
2026-01-07 16:15:05 +08:00
<input type="text" class="filter_input" v-model="val2">
</view>
2026-01-09 10:19:19 +08:00
<button class="mini-btn" type="primary" @tap="_queryIvt">查询</button>
2026-01-07 16:15:05 +08:00
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
<table>
<thead>
<tr>
<th>序号</th>
<th>点位</th>
<th>物料编码</th>
<th>物料名称</th>
<th>批号</th>
<th>数量</th>
<th>单位</th>
<th>类别</th>
<th>入库时间</th>
<th>载具</th>
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in dataList" :key="i">
<td>{{i+1}}</td>
2026-01-09 10:19:19 +08:00
<td>{{e.struct_code}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.pcsn}}</td>
<td>{{e.canuse_qty}}</td>
<td>{{e.qty_unit_name}}</td>
<td>{{e.class_name}}</td>
<td>{{e.insert_time}}</td>
<td>{{e.storagevehicle_code}}</td>
2026-01-07 16:15:05 +08:00
</tr>
</tbody>
</table>
</view>
</view>
</view>
2026-02-01 17:44:22 +08:00
<view class="zd-row submit-bar" v-if="index1 === 'ZZC01'">
<!-- <button class="zd-col-5 button-default" @tap="toEmpty">清空</button> -->
2026-03-24 16:04:35 +08:00
<button class="zd-col-22 button-primary" :class="{'button-info': !dataList.length}" :disabled="disabled1" @tap="labelPrint">打印</button>
2026-02-01 17:44:22 +08:00
</view>
2026-01-07 16:15:05 +08:00
</view>
</template>
<script>
2026-03-25 09:37:21 +08:00
import {getCLodop} from '@/utils/CLodopfuncs.js'
2026-01-07 16:15:05 +08:00
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
2026-01-09 10:19:19 +08:00
import {queryIvt} from '@/utils/getData3.js'
2026-01-07 16:15:05 +08:00
export default {
components: {
NavBar,
SearchBox
},
data() {
return {
title: '',
2026-01-09 10:19:19 +08:00
// options1: [],
materialData: {},
options1: [{text:'原料', value: 'WYL01'}, {text:'辅料', value: 'WFL01'}, {text:'批料室', value: 'PZC01'}, {text:'中间站', value: 'ZZC01'}, {text:'内包材', value: 'NBC01'}, {text:'外包材', value: 'WBC01'}],
index1: 'WYL01',
2026-01-07 16:15:05 +08:00
val1: '',
val2: '',
2026-02-01 17:44:22 +08:00
dataList: [],
2026-03-23 10:34:10 +08:00
disabled1: false
2026-01-07 16:15:05 +08:00
};
},
onLoad (options) {
this.title = options.title
2026-01-09 10:19:19 +08:00
},
onShow () {
if (this.$store.getters.publicObj !== '') {
this.materialData = this.$store.getters.publicObj
this.$store.dispatch('setPublicObj', '')
}
2026-01-07 16:15:05 +08:00
},
methods: {
toEmpty () {
this.val1 = ''
2026-03-23 10:34:10 +08:00
this.val2 = ''
2026-01-07 16:15:05 +08:00
this.dataList = []
2026-03-23 10:34:10 +08:00
this.materialData = {}
this.disabled1 = false
2026-01-07 16:15:05 +08:00
},
toJump (name) {
uni.navigateTo({
2026-01-09 10:19:19 +08:00
url: `/pages/hdyy/tygn/${name}`
2026-01-07 16:15:05 +08:00
})
},
2026-01-09 10:19:19 +08:00
async _queryIvt () {
2026-01-07 16:15:05 +08:00
try {
2026-01-09 10:19:19 +08:00
let res = await queryIvt(this.index1, this.val1, this.materialData.material_code, this.val2)
2026-01-07 16:15:05 +08:00
if (res && res.data) {
this.dataList = [...res.data]
} else {
this.dataList = []
uni.showToast({
title: res.message,
icon: 'none'
})
}
} catch (e) {
this.dataList = []
}
2026-02-01 17:44:22 +08:00
},
labelPrint () {
this.disabled1 = true
2026-03-24 16:04:35 +08:00
if (!this.dataList.length) {
2026-02-01 17:44:22 +08:00
this.disabled1 = false
return
}
2026-03-23 10:34:10 +08:00
this.toPrint()
2026-02-01 17:44:22 +08:00
},
2026-03-23 10:34:10 +08:00
toPrint () {
2026-03-24 16:04:35 +08:00
let iparr = this.$store.getters.baseUrl.split(":")
2026-02-01 17:44:22 +08:00
let printUrl = iparr[1].slice(2)
let LODOP = getCLodop();
if (!(LODOP.webskt && LODOP.webskt.readyState === 1)) {
2026-04-05 12:19:46 +08:00
// uni.showToast({
// title: '当前配置ip' + printUrl + '网络不通,请检查',
// icon: 'none',
// duration: 5000
// })
2026-02-01 17:44:22 +08:00
this.disabled1 = false
return
}
2026-03-23 10:34:10 +08:00
// 1. 定义静态数据(模拟固定数据):后续需要换实际数据
// const tableData = [
// { struct_code: 'L01-01-01', material_code: '000301000216', material_name: '二甲双胍恩格列净片(Ⅰ)', pcsn: 'AAA', canuse_qty: '67.1', class_name: '制粒', storagevehicle_code: 'LT0004', insert_time: '2026-03-19' },
// { struct_code: 'L01-01-01', material_code: '000301000216', material_name: '二甲双胍恩格列净片中间体素片规格500mg/5mg/片)', pcsn: 'AAA', canuse_qty: '100.06', class_name: '制粒', storagevehicle_code: 'LT0004', insert_time: '2026-03-19 14:43:40' }
// ]
const tableData = this.dataList
// 2. 拼接tbody内容循环数据生成<tr>标签
let tbodyHtml = ''
tableData.forEach(item => {
// 把每个数据项拼接到<tr>中,对应列的位置
tbodyHtml += `
<tr>
<td>${item.struct_code}</td>
<td>${item.material_code}</td>
<td>${item.material_name}</td>
<td>${item.pcsn}</td>
<td>${item.canuse_qty}</td>
<td>${item.class_name}</td>
<td>${item.storagevehicle_code}</td>
<td>${item.insert_time}</td>
</tr>
`
})
const tableHtml = `
<table border="1" cellpadding="8" cellspacing="0" style="width:100%; text-align:center; font-size:14px;">
<thead>
<tr style="background:#f0f0f0; font-weight:bold;">
<th>点位</th>
<th>物料编码</th>
<th>物料名称</th>
<th>批号</th>
<th>数量</th>
<th>类别</th>
<th>载具</th>
<th>入库时间</th>
</tr>
</thead>
<tbody>
${tbodyHtml} <!-- 嵌入动态生成的行 -->
</tbody>
</table>
`
// const LODOP = getLodop()
2026-02-01 17:44:22 +08:00
LODOP.SET_SHOW_MODE('HIDE_DISBUTTIN_SETUP', 1)// 隐藏那些无效按钮
2026-03-23 10:34:10 +08:00
// 纸张大小A4纸
LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '')
// 抬头
LODOP.ADD_PRINT_TEXT('3.15mm', '49.74mm', '112.95mm', '10.58mm', '中 间 站 2 桶 库 存 信 息')
LODOP.SET_PRINT_STYLEA(0, 'FontSize', 20)
// 表格渲染
LODOP.ADD_PRINT_TABLE('15mm', '5mm', '95%', '95%', tableHtml)
2026-02-01 17:44:22 +08:00
2026-03-25 09:37:21 +08:00
LODOP.PRINT()// 打印
// LODOP.PREVIEW()// 预览
2026-02-01 17:44:22 +08:00
// LODOP.PRINT_DESIGN()
uni.showToast({
title: '操作成功',
icon: 'none'
})
2026-03-23 10:34:10 +08:00
this.toEmpty()
2026-02-01 17:44:22 +08:00
this.disabled1 = false
2026-01-07 16:15:05 +08:00
}
}
}
</script>
<style scoped>
.filter_picker {
text-align: center
}
</style>