Commit 764faa81 by lichengming

修改了检测管理

parent 7be7c0c2
...@@ -53,5 +53,6 @@ export default { ...@@ -53,5 +53,6 @@ export default {
.post('soil/v1/experiment/list_experiment_progress', data) .post('soil/v1/experiment/list_experiment_progress', data)
.then(res => res), .then(res => res),
listSampleProgress: data => listSampleProgress: data =>
http.post('soil/v1/sample/list_sample_progress', data).then(res => res) http.post('soil/v1/sample/list_sample_progress', data).then(res => res),
_getLabel: data => http.post('/res/v1/label/page', data).then(res => res)
} }
...@@ -19,7 +19,6 @@ module.exports = { ...@@ -19,7 +19,6 @@ module.exports = {
title: '土工试验LIMS', title: '土工试验LIMS',
meta: [ meta: [
{ charset: 'utf-8' }, { charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description } { hid: 'description', name: 'description', content: pkg.description }
], ],
script: [ script: [
......
...@@ -112,15 +112,17 @@ ...@@ -112,15 +112,17 @@
<!--下载插件--> <!--下载插件-->
<downloadPlugin ref="downloadPlugin" /> <downloadPlugin ref="downloadPlugin" />
<SampleParpareBatchEdit ref="batchEdit" @on-result-change="backData"></SampleParpareBatchEdit> <SampleParpareBatchEdit ref="batchEdit" @on-result-change="backData"></SampleParpareBatchEdit>
<SelectPrinter ref="selectPrint" @on-result-change="_printResult"></SelectPrinter>
</div> </div>
</template> </template>
<script> <script>
import AutoComplete from '../../../components/base/AutoCompletes' import AutoComplete from '../../../components/base/AutoCompletes'
import { soilEntrust, soilSample } from '../../../api' import { soilEntrust, soilSample, soilStatistics } from '../../../api'
import { getLodop } from '../../../plugins/clodop/LodopFuncs' import { getLodop } from '../../../plugins/clodop/LodopFuncs'
// eslint-disable-next-line no-unused-vars
import downloadPlugin from '../../../plugins/download/downloadPlugin' import downloadPlugin from '../../../plugins/download/downloadPlugin'
import SelectPrinter from './SelectPrinter'
// eslint-disable-next-line no-unused-vars
import SampleParpareBatchEdit from './SampleParpareBatchEdit' import SampleParpareBatchEdit from './SampleParpareBatchEdit'
let LODOP let LODOP
...@@ -128,7 +130,8 @@ export default { ...@@ -128,7 +130,8 @@ export default {
components: { components: {
AutoComplete, AutoComplete,
downloadPlugin, downloadPlugin,
SampleParpareBatchEdit SampleParpareBatchEdit,
SelectPrinter
}, },
data() { data() {
return { return {
...@@ -154,6 +157,7 @@ export default { ...@@ -154,6 +157,7 @@ export default {
getPage: { getPage: {
records: [] records: []
}, },
labelCode: {},
currentIndex: -1, currentIndex: -1,
selectData: [], selectData: [],
selectIds: [], selectIds: [],
...@@ -217,6 +221,14 @@ export default { ...@@ -217,6 +221,14 @@ export default {
this.$forceUpdate() this.$forceUpdate()
this.getPage.records[data.$rowIndex].printNum = data.row.printNum this.getPage.records[data.$rowIndex].printNum = data.row.printNum
}, },
_printResult(data) {
console.log(data)
if (data) {
console.log('data.printerVal')
this.printerVal = data.printerVal
this._getLabelInfo()
}
},
// 获取存储位置 // 获取存储位置
_locationChange(msg, data, handleObj) { _locationChange(msg, data, handleObj) {
this.currentRow = handleObj this.currentRow = handleObj
...@@ -441,11 +453,29 @@ export default { ...@@ -441,11 +453,29 @@ export default {
break break
} }
}, },
_getLabelInfo: async function() {
console.log('this._getLabelInfo')
const result = await soilStatistics._getLabel(
this.$serializeForm(this.formObj)
)
if (result) {
for (let i = 0; i < result.records.length; i++) {
if (result.records[i].type.display === '打印上机标签') {
this.labelCode = result.records[i].code
}
}
console.log(result)
}
this._printMessage()
},
_btnClick(msg) { _btnClick(msg) {
switch (msg) { switch (msg) {
case '打印标签': case '打印标签':
if (this.selectData.length > 0) { if (this.selectData.length > 0) {
this._printMessage() // this._goto()
this.$refs.selectPrint._open()
// this._getLabelInfo()
// this._printMessage()
} else { } else {
this.$Message.warning('请至少选择一条数据') this.$Message.warning('请至少选择一条数据')
} }
...@@ -458,6 +488,13 @@ export default { ...@@ -458,6 +488,13 @@ export default {
break break
} }
}, },
_goto(methodId) {
const routeData = this.$router.resolve({
path: '/blank/item_by_method',
query: { id: 123456 }
})
window.open(routeData.href, '_blank')
},
// 下载插件 // 下载插件
_pluginDownload() { _pluginDownload() {
this.$refs.downloadPlugin._open() this.$refs.downloadPlugin._open()
...@@ -475,39 +512,76 @@ export default { ...@@ -475,39 +512,76 @@ export default {
const data = this.selectData const data = this.selectData
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
for (let j = 0; j < data[i].printNum; j++) { for (let j = 0; j < data[i].printNum; j++) {
LODOP.PRINT_INITA( this._printLabelOk(data[i])
'0mm', // LODOP.PRINT_INITA(
'0mm', // '0mm',
'60.01mm', // '0mm',
'40.01mm', // '60.01mm',
'打印控件功能演示_Lodop功能_打印图片3' // '40.01mm',
) // '打印控件功能演示_Lodop功能_打印图片3'
LODOP.ADD_PRINT_BARCODE( // )
'0.08mm', // LODOP.ADD_PRINT_BARCODE(
'18.39mm', // '0.08mm',
'58.87mm', // '18.39mm',
'24.74mm', // '58.87mm',
'QRCode', // '24.74mm',
data[i].sampleCode + '-' + data[i].groupId // 'QRCode',
) // data[i].sampleCode + '-' + data[i].groupId
LODOP.ADD_PRINT_TEXT( // )
130, // LODOP.ADD_PRINT_TEXT(
13, // 130,
186, // 13,
20, // 186,
this._formatDate(data[i].prepareDate) // 20,
) // this._formatDate(data[i].prepareDate)
LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2) // )
LODOP.ADD_PRINT_TEXT(113, 13, 187, 20, data[i].groupName) // LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2) // LODOP.ADD_PRINT_TEXT(113, 13, 187, 20, data[i].groupName)
LODOP.ADD_PRINT_TEXT(95, 12, 188, 20, data[i].sampleCode) // LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2) // LODOP.ADD_PRINT_TEXT(95, 12, 188, 20, data[i].sampleCode)
// LODOP.SET_PRINT_STYLEA(0, 'Alignment', 2)
// LODOP.PRINT_DESIGN() //
LODOP.PRINT() // // LODOP.PRINT_DESIGN()
// LODOP.PRINT()
} }
} }
}, },
_printLabelOk(row) {
LODOP.PRINT_INITA('') // 必须在设置打印机之前
// 返回的标签代码
// eslint-disable-next-line no-eval
eval(this._replaceCodes(row))
// 设置打印机
LODOP.SET_PRINTER_INDEX(this.printerVal)
// 打开设计模式
// LODOP.PRINT_DESIGN()
LODOP.PRINT()
},
_replaceCodes(row) {
// /g表示全局替换
let result = this.labelCode
result = result.replace(
/\$sampleCode\$/g,
undefined !== row.sampleCode ? row.sampleCode : ''
)
result = result.replace(/\$num\$/g, undefined !== row.num ? row.num : '')
result = result.replace(/\$resultDateTemp\$/g, row.resultDateTemp)
result = result.replace(
/\$groupName\$/g,
undefined !== row.groupName ? row.groupName : ''
)
// 检测项目
result = result.replace(
/\$items\$/g,
undefined !== row.specialItems ? row.specialItems : ''
)
// 二维码地址
result = result.replace(
/\$qrCode\$/g,
undefined !== row.qrCode ? row.qrCode : ''
)
return result
},
// 时间戳转换方法 date:时间戳数字 // 时间戳转换方法 date:时间戳数字
_formatDate(time) { _formatDate(time) {
const date = new Date(time) const date = new Date(time)
......
<template>
<div>
<Row>
<!--操作-->
<!--内容-->
<Col span="24">
<element-table
ref="pageTable"
:page-columns="pageColumns"
:table-height="tableHeight"
:get-page="getPage"
show-check-box
hide-page
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
show-overflow-tooltip
sortable
:prop="item.key"
:label="item.title"
:align="item.align"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<span v-if="item.datetime">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):'' }}
</span>
<span v-else-if="item.key==='content'" class="blue-color">
{{ scope.row[item.key]?scope.row[item.key]:'' }}
</span>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</el-table-column>
</element-table>
</Col>
</Row>
</div>
</template>
<script>
export default {
layout: 'blank-layout',
components: {},
data() {
return {
formId: '',
showModal: false,
wayData: new Map(),
formObj: {},
footerList: [],
list: [
{ name: '取消', type: '', id: '' },
{ name: '制备完成', type: 'primary', id: '' }
],
iconMsg: [
// { type: 'md-create', id: '', name: '批量赋值' },
// { type: 'md-trash', id: '', name: '删除' }
],
getPage: {
records: []
},
labelCode: {},
currentIndex: -1,
selectData: [],
selectIds: [],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 130 },
{ title: '试样深度', key: 'sampleDepth', width: 130 },
{ title: '打印数量', key: 'printNum', width: 130, editCell: true },
{ title: '检验科室', key: 'groupName', width: 130 },
// 暂时屏蔽
// {title: '打印份数', key: 'printNum', width: 110},
{ title: '制备类型', key: 'type', width: 130 },
{
title: '制备方式',
key: 'prepareWay',
width: 130,
editCell: true
},
{
title: '制备数量',
key: 'quantity',
width: 150,
editCell: true
},
{ title: '单位', key: 'unit', width: 110, editCell: true },
{ title: '状态', key: 'status', width: 150 },
{ title: '保存方式', key: 'keepWay', width: 150, editCell: true },
{ title: '保存容器', key: 'keepContainer', width: 150, editCell: true },
{
title: '制备时间',
key: 'prepareDate',
width: 200,
date: true,
editCell: true
},
{
title: '制备人',
key: 'preparer',
width: 130,
editCell: true
},
{ title: '备注', key: 'remark', width: 150, editCell: true }
],
currentRow: {},
preparationWayData: [],
resultStateWayData: [],
saveWayData: [],
preparerList: [],
sampleIds: '',
unitData: [],
locationList: [],
packList: [],
isAccurate: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
mounted() {},
methods: {
// 获取存储位置
_locationChange(msg, data, handleObj) {
this.currentRow = handleObj
switch (msg) {
case 'select':
this.$set(this.currentRow, 'storePlace', data)
break
case 'query':
this.$set(this.currentRow, 'storePlace', data)
this._getLocation(data)
break
case 'focus':
this._getLocation()
break
}
},
_getLocation(data) {
const obj = {}
if (data) {
obj.storePlace = data
}
this.$store
.dispatch('FoodSamplePreparation/getPositionList', obj)
.then(() => {
this.locationList = this.$store.state.FoodSamplePreparation.list
})
},
// 单位
_unitChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.unit = data
break
case 'query':
this.currentRow.unit = data
break
}
},
// 多个参数查询
// _dicSearch: async function() {
// const data = ['制备方式', '保存方式', '保存容器']
// const result = await soilSample.getDictList(data)
// if (result) {
// this.keepWayList = result
// }
// },
backData(data) {
this.$forceUpdate()
console.log(data)
console.log(this.selectData)
for (let i = 0; i < this.selectData.length; i++) {
Object.assign(this.selectData[i], data)
}
console.log('合并后', this.selectData)
},
_preparationChange(msg, data, handleObj) {
console.log('data', data)
this._handleRow(handleObj)
this.currentRow.prepareWay = data
},
_testItemChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.resultState = data.name
},
_saveChange(msg, data, handleObj) {
console.log('data', data)
this._handleRow(handleObj)
this.currentRow.keepWay = data
},
_preparerChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.preparer = data
},
timeChange(data) {
console.log(data)
this.$forceUpdate()
this.currentRow.prepareDate = data.prepareDate
console.log(this.getPage.records)
},
_packSaveChange(msg, data, handleObj) {
console.log('data', data)
this._handleRow(handleObj)
this.currentRow.keepContainer = data
},
_open(sampleIds) {
this.sampleIds = sampleIds
this.showModal = true
this.getPage.records = []
this.preparationWayData = []
this.saveWayData = []
this.packList = []
this.unitData = []
this.preparerList = []
this.footerList = []
for (let i = 0; i < this.list.length; i++) {
if (this.$showBtn(this.list[i].id)) {
this.footerList.push(this.list[i])
}
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '仅流转微生物':
this._changeMic()
break
case '制备完成':
this._ok()
break
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
_ok() {
this.$refs.pageTable._showLoading()
const prepareList = []
for (let i = 0; i < this.getPage.records.length; i++) {
prepareList.push(this.getPage.records[i])
}
if (prepareList.length === 0) {
this.$Message.warning('制备数据不能为空')
this.$refs.pageTable._hideLoading()
this._hideLoading()
return false
}
this.save({ prepareList: prepareList })
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
this.$refs.pageTable._hideLoading()
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
break
case 'iconClick':
this._iconClick(
data.name,
data.rowData,
data.componentName,
data.rowIndex
)
break
}
},
_btnClick(msg) {
switch (msg) {
case '打印标签':
if (this.selectData.length > 0) {
this._goto()
// this._getLabelInfo()
// this._printMessage()
} else {
this.$Message.warning('请至少选择一条数据')
}
break
case '批量填写制备信息':
this._writeInfo()
break
case '删除':
this._deleteSelected()
break
}
},
_goto(methodId) {
const routeData = this.$router.resolve({
path: '/blank/item_by_method',
query: { id: 123456 }
})
window.open(routeData.href, '_blank')
},
// 下载插件
_pluginDownload() {
this.$refs.downloadPlugin._open()
},
// 时间戳转换方法 date:时间戳数字
_selectStaff() {
this.$refs.userModal._open('preparationPerson')
},
_userData(data) {
// 选择人员返回数据
this.currentRow.preparationPerson = data.realname
this.currentRow.preparationPersonId = data.userId
},
// 批量赋值(这里用index判断,不用id是因为id有时候没有值,而且id不能随意赋值)
_copyPlan(data) {
const ids = this.selectData
const records = this.getPage.records
if (ids.length === 0) {
this.$Message.warning('请勾选数据进行赋值!')
} else {
for (let i = 0; i < ids.length; i++) {
for (let j = 0; j < records.length; j++) {
if (ids[i].currentIndex === records[j].currentIndex) {
this._singleCopy(j, data)
}
}
}
}
},
// 单独赋值信息
_singleCopy(j, data) {
const tempData = {
preparationWay: data.preparationWay,
resultQuantity: data.resultQuantity ? data.resultQuantity : 0,
unit: data.unit,
resultState: data.resultState ? data.resultState : '',
saveWay: data.saveWay ? data.saveWay : '',
pack: data.pack ? data.pack : '',
storePlace: data.storePlace ? data.storePlace : '',
printNum: data.printNum ? data.printNum : 1,
remark: data.remark ? data.remark : ''
}
this.getPage.records[j].preparationWay = tempData.preparationWay
this.getPage.records[j].resultQuantity = tempData.resultQuantity
this.getPage.records[j].unit = tempData.unit
this.getPage.records[j].resultState = tempData.resultState
this.getPage.records[j].saveWay = tempData.saveWay
this.getPage.records[j].pack = tempData.pack
this.getPage.records[j].storePlace = tempData.storePlace
this.getPage.records[j].printNum = tempData.printNum
this.getPage.records[j].remark = tempData.remark
},
// 操作的序号
_handleRow(data) {
console.log(data)
this.currentIndex = data.index
this.currentRow = data.row
},
_handleTimeRow(data) {
console.log(this.currentRow)
this.currentRow = data.row
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" class="zIndex-1100">
<p slot="header">{{modalTitle}}</p>
<div>
<Alert v-show="isPrinterDownload" type="error"><p @click="_download">未安装打印控件,点此<a>下载</a>,安装完请刷新页面</p></Alert>
<div v-show="!isPrinterDownload">
<Form ref="formObj" :rules="ruleValidate" :label-width="70" onsubmit="return false">
<Form-item label="打印机" prop="printerVal">
<Select v-model="printerVal" @on-change="_printChange" name="printerVal" placeholder="请选择打印机">
<Option v-for="item in printList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
</Form>
</div>
</div>
<div slot="footer" class="btn-width">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
/**
* 选择打印机
*/
import global from '../../../api/config'
import { getLodop } from '../../../plugins/clodop/LodopFuncs'
let LODOP
export default {
components: {},
data() {
const validatePrinter = (rule, value, callback) => {
if (this.printerVal !== null) {
callback()
} else {
callback(new Error('请选择打印机~'))
}
}
return {
modalTitle: '选择打印机',
showModal: false,
ruleValidate: {
printerVal: [
{ required: true, validator: validatePrinter, trigger: 'change' }
]
},
placeholder: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
printList: [],
printerVal: null,
type: '',
isPrinterDownload: false
}
},
methods: {
// 获取打印机对象
_setPrinter() {
// 首先判断是否获取到打印机对象
if (undefined === LODOP || LODOP === 'undefined') {
LODOP = getLodop()
}
// 其次判断是否安装打印机控件
if (undefined === LODOP || LODOP === 'undefined') {
this.isPrinterDownload = true
return false
}
if (LODOP.GET_PRINTER_COUNT() === 0) {
this.$Message.warning('系统未关联打印机,请确认....')
return false
}
this._createPrinterList()
},
// 获取打印机列表
_createPrinterList() {
LODOP = getLodop()
const iPrinterCount = LODOP.GET_PRINTER_COUNT()
const printList = []
for (let i = 0; i < iPrinterCount; i++) {
printList.push({ name: LODOP.GET_PRINTER_NAME(i), value: i })
}
console.log(printList)
this.printList = printList
if (this.printList.length) {
// 默认第一个打印机
this.printerVal = this.printList[0].value
}
},
_open(type) {
this.showModal = true
this.isPrinterDownload = false
this.type = type // 打印标签还是自定义打印
this._setPrinter()
this._createPrinterList()
},
_printChange(data) {
this.printerVal = data
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
this.$refs.footerModal._hideLoading()
},
_cancel() {
this.showModal = false
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
this.$emit('on-result-change', {
printerVal: this.printerVal,
type: this.type
})
this.showModal = false
} else {
this.$Message.error('表单验证失败!')
}
})
},
// 下载打印机
_download() {
window.open(
global.staticURL + '/clodop/CLodop_Setup_for_Win32NT.exe',
'_blank'
)
}
}
}
</script>
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* 地址路由 * 地址路由
*/ */
import Lock from '../pages/Lock.vue' // 锁屏 import Lock from '../pages/Lock.vue' // 锁屏
import workbench from '../pages/soil-sample-manage/sample-preparation/PreparationOther'
import Index from '~/pages/index' import Index from '~/pages/index'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
import SoilRouters from '~/router/soil-routes' import SoilRouters from '~/router/soil-routes'
export default [ export default [
{ path: '/lock', name: 'Lock', component: Lock, meta: { allowBack: false } }, { path: '/lock', name: 'Lock', component: Lock, meta: { allowBack: false } },
{ {
...@@ -25,5 +25,9 @@ export default [ ...@@ -25,5 +25,9 @@ export default [
children: SoilRouters, children: SoilRouters,
meta: { title: '土工试验LIMS' } meta: { title: '土工试验LIMS' }
}, },
{
path: '/blank/item_by_method',
component: workbench
},
{ path: '*', redirect: '/' } { path: '*', redirect: '/' }
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment