Commit f19c568f by wangweidong

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	api/soil/soil-statistics.js
parents d612f605 9a9e741d
...@@ -78,5 +78,6 @@ export default { ...@@ -78,5 +78,6 @@ export default {
pagePersonalTaskStatistics: data => pagePersonalTaskStatistics: data =>
http http
.post('soil/v1/statistics/page_personal_task_statistics', data) .post('soil/v1/statistics/page_personal_task_statistics', data)
.then(res => res) .then(res => res),
_getLabel: data => http.post('/res/v1/label/page', data).then(res => res)
} }
...@@ -48,7 +48,17 @@ export default { ...@@ -48,7 +48,17 @@ export default {
.post('soil/v1/experiment/page_allot_by_exp_his', data) .post('soil/v1/experiment/page_allot_by_exp_his', data)
.then(res => res), .then(res => res),
pageExperimentAllot: data => pageExperimentAllot: data =>
http.post('soil/v1/experiment/page_exp_allot', data).then(res => res), http.post('soil/v1/experiment/page_exp_allot_bath', data).then(res => res),
pageExperimentAllotBath: data =>
https
.post(
'soil/v1/experiment/page_exp_allot_bath?page=' +
data.page +
'&rows=' +
data.rows,
JSON.stringify(data.obj)
)
.then(res => res),
pageExperimentAllotHis: data => pageExperimentAllotHis: data =>
http.post('soil/v1/experiment/page_exp_allot_his', data).then(res => res), http.post('soil/v1/experiment/page_exp_allot_his', data).then(res => res),
pageTestByExp: data => pageTestByExp: data =>
......
...@@ -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: [
......
...@@ -4,11 +4,10 @@ ...@@ -4,11 +4,10 @@
<p slot="header">{{modalTitle}}</p> <p slot="header">{{modalTitle}}</p>
<div> <div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="100" inline> <Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<Form-item label="库房号" prop="storehouse" style="width: 100%"> <Form-item @click.native="_storageModel()" label="库房号" prop="storehouse" style="width: 100%">
<Input v-model="formObj.storehouse" name="storehouse" placeholder="请输入库房号" style="width: 95%;"/> <Input v-model="formObj.storehouse" name="storehouse" placeholder="请输入库房号"/>
<span @click="_storageModel()" style="font-size: 20px;color: #00b5ec">+</span>
</Form-item> </Form-item>
<Form-item label="架位号" prop="shelfCode" style="width: 100%"> <Form-item @click.native="_storageModel()" label="架位号" prop="shelfCode" style="width: 100%">
<Input v-model="formObj.shelfCode" name="shelfCode" placeholder="请输入架位号"/> <Input v-model="formObj.shelfCode" name="shelfCode" placeholder="请输入架位号"/>
</Form-item> </Form-item>
<Form-item label="入库人" prop="inStocker" style="width: 100%"> <Form-item label="入库人" prop="inStocker" style="width: 100%">
...@@ -99,7 +98,7 @@ export default { ...@@ -99,7 +98,7 @@ export default {
} }
], ],
ruleValidate: { ruleValidate: {
warehouse: [ storehouse: [
{ required: true, message: '库房号不能为空', trigger: 'blur' } { required: true, message: '库房号不能为空', trigger: 'blur' }
] ]
}, },
......
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
<Input v-model="formObj.alias" @on-enter="_formSearch" name="alias" placeholder="请输入模板名称" clearable></Input> <Input v-model="formObj.alias" @on-enter="_formSearch" name="alias" placeholder="请输入模板名称" clearable></Input>
<input type="hidden" name="classifyId"> <input type="hidden" name="classifyId">
</Form-item> </Form-item>
<Form-item label="类别" prop="classType">
<!-- <Input v-model="formObj.classType" @on-keyup="_onKeyUp" name="classType" placeholder="请选择类别" icon="plus-circled"-->
<!-- ></Input>-->
<el-select v-model="formObj.classType" placeholder="请选择类别" size="small" clearable>
<el-option :label="item.value" :value="item.value" v-for="(item,index) in typeList"
:key="index"></el-option>
</el-select>
</Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
</Form-item> </Form-item>
...@@ -65,7 +73,8 @@ export default { ...@@ -65,7 +73,8 @@ export default {
{ title: '备注', key: 'remark' } { title: '备注', key: 'remark' }
], ],
formObj: { formObj: {
name: undefined name: undefined,
classType: undefined
}, },
iconMsg: [ iconMsg: [
{ type: 'md-create', id: '', name: '编辑' }, { type: 'md-create', id: '', name: '编辑' },
...@@ -79,6 +88,14 @@ export default { ...@@ -79,6 +88,14 @@ export default {
{ type: 'success', id: '', name: '添加' }, { type: 'success', id: '', name: '添加' },
{ type: 'error', id: '', name: '删除' } { type: 'error', id: '', name: '删除' }
], ],
typeList: [
{
value: '力学'
},
{
value: '物性'
}
],
searchOpen: true, searchOpen: true,
selectIds: [] selectIds: []
} }
......
...@@ -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>
<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>
...@@ -149,46 +149,69 @@ export default { ...@@ -149,46 +149,69 @@ export default {
} }
], ],
pageColumns: [ pageColumns: [
{ title: '阶段编号', key: 'stageNumber' }, { title: 'Stage Number', key: 'stageNumber' },
{ title: '试验开始后的时间', key: 'timeSinceStartOfTest' }, { title: 'Time since start of test (s)', key: 'timeSinceStartOfTest' },
{ title: '阶段开始后的时间', key: 'timeSinceStartOfStage' }, {
{ title: '轴向位移(mm)', key: 'axialDisplacement' }, title: 'Time since start of stage (s)',
{ title: '轴向载荷(kN)', key: 'axialLoad' }, key: 'timeSinceStartOfStage'
{ title: '水平位移(mm)', key: 'horizontalDisplacement' }, },
{ title: '水平荷载(kN)', key: 'horizontalLoad' }, { title: 'Axial Displacement (mm)', key: 'axialDisplacement' },
{ title: '孔隙水压力(kPa)', key: 'poreWaterPressure' }, { title: 'Axial Load (kN)', key: 'axialLoad' },
{ title: '背压(kPa)', key: 'backPressure' }, {
{ title: '回流量(mm3)', key: 'backVolume' }, title: 'Horizontal Displacement (mm)',
{ title: '未定义传感器1', key: 'undefinedTransducerOne' }, key: 'horizontalDisplacement'
{ title: '未定义传感器2', key: 'undefinedTransducerTwo' }, },
{ title: '环剪切扭矩(Nm)', key: 'ringShearTorqueNm' }, { title: 'Horizontal Load (kN)', key: 'horizontalLoad' },
{ title: '环剪切角(degs)', key: 'ringShearTorqueDegs' }, { title: 'Pore Water Pressure (kPa)', key: 'poreWaterPressure' },
{ title: '下腔压力(kPa)', key: 'lowerChamberPr' }, { title: 'Back Pressure (kPa)', key: 'backPressure' },
{ title: '下腔容积(mm3)', key: 'lowerChamberVol' }, { title: 'Back Volume (mm3)', key: 'backVolume' },
{ title: '轴向位移2(mm)', key: 'axialDisplacementTwo' }, { title: 'Undefined Transducer 1', key: 'undefinedTransducerOne' },
{ title: '水平位移2(mm)', key: 'horizontalDisplacementTwo' }, { title: 'Undefined Transducer 2', key: 'undefinedTransducerTwo' },
{ title: '环向剪切荷载1(kN)', key: 'ringShearLoadOne' }, { title: 'Ring Shear Torque (Nm)', key: 'ringShearTorqueNm' },
{ title: '环向剪切荷载2(kN)', key: 'ringShearLoadTwo' }, { title: 'Ring Shear Angle (degs)', key: 'ringShearTorqueDegs' },
{ title: '轴向载荷2(kN)', key: 'axialLoadTwo' }, { title: 'Lower Chamber Pr (kPa)', key: 'lowerChamberPr' },
{ title: '水平荷载2(kN)', key: 'horizontalLoadTwo' }, { title: 'Lower Chamber Vol (mm3)', key: 'lowerChamberVol' },
{ title: '水平荷载3(kN)', key: 'horizontalLoadThree' }, { title: 'Axial Displacement 2 (mm)', key: 'axialDisplacementTwo' },
{ title: '轴向行程(mm)', key: 'axialStroke' }, {
{ title: '水平行程(mm)', key: 'horizontalStroke' }, title: 'Horizontal Displacement 2 (mm)',
{ title: '孔隙气压(kPa)', key: 'poreAirPressure' }, key: 'horizontalDisplacementTwo'
{ title: '孔隙气压2(kPa)', key: 'poreAirPressureTwo' }, },
{ title: '大气压力(kPa)', key: 'atmosphericPressure' }, { title: 'Ring Shear Load 1 (kN)', key: 'ringShearLoadOne' },
{ title: '背压差(kPa)', key: 'backToAirDifferential' }, { title: 'Ring Shear Load 2 (kN)', key: 'ringShearLoadTwo' },
{ title: '围压', key: 'cellPressure' }, { title: 'Axial Load 2 (kN)', key: 'axialLoadTwo' },
{ title: 'Horizontal Load 2 (kN)', key: 'horizontalLoadTwo' },
{ title: 'Horizontal Load 3 (kN)', key: 'horizontalLoadThree' },
{ title: 'Axial Stroke (mm)', key: 'axialStroke' },
{ title: 'Horizontal Stroke (mm)', key: 'horizontalStroke' },
{ title: 'Pore Air Pressure (kPa)', key: 'poreAirPressure' },
{ title: 'Pore Air Pressure 2 (kPa)', key: 'poreAirPressureTwo' },
{ title: 'Atmospheric Pressure (kPa)', key: 'atmosphericPressure' },
{
title: 'Back to Air differential (kPa)',
key: 'backToAirDifferential'
},
{ title: 'Cell Pressure (kPa)', key: 'cellPressure' },
{ title: 'Cell Volume (mm3)', key: 'cellVolume' }, { title: 'Cell Volume (mm3)', key: 'cellVolume' },
{ title: '孔隙风量(mm3)', key: 'poreAirVolume' }, { title: 'Pore Air Volume (mm3)', key: 'poreAirVolume' },
{ title: '轴向应变(%)', key: 'axialStrain' }, { title: 'Axial Strain (%)', key: 'axialStrain' },
{ title: '正应力(kPa)', key: 'normalStress' }, { title: 'Normal Stress (kPa)', key: 'normalStress' },
{ title: '环剪机水平应变(%)或水平环位移(mm)', key: 'hsohrdfrsm' }, {
{ title: '环剪机的水平应力(kPa)或剪切应力(kPa)', key: 'hsossfrsm' }, title:
{ title: '水平有效应力(kPa)', key: 'horizontalEffStress' }, 'Horizontal Strain (%) or Horizontal Ring Displacement for Ring Shear Machine (mm)',
{ title: '有效面积(mm2)', key: 'effectiveArea' }, key: 'hsohrdfrsm'
{ title: '法向有效应力(kPa)', key: 'normalEffectiveStress' }, },
{ title: '平均环向剪切荷载(kN)', key: 'averageRingShearLoad' } {
title:
'Horizontal Stress (kPa) or Shear Stress for Ring Shear Machine (kPa)',
key: 'hsossfrsm'
},
{ title: 'Horizontal Eff Stress (kPa)', key: 'horizontalEffStress' },
{ title: 'Effective Area (mm2)', key: 'effectiveArea' },
{
title: 'Normal Effective Stress (kPa)',
key: 'normalEffectiveStress'
},
{ title: 'Average Ring Shear Load (kN)', key: 'averageRingShearLoad' }
], ],
currentIndex: -1, currentIndex: -1,
id: '', id: '',
......
<template>
<div>
<Modal v-model="showBatchModal" v-drag width="900">
<p slot="header">
生成项目报告
</p>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--样品信息-->
<!--报告模板-->
<Col span="24">
<ItemReportTemplate ref="reportTemplate" @on-result-change="_templateResultChange"></ItemReportTemplate>
</Col>
</Row>
</div>
</div>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerBtn" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<!--生成报告的进度条-->
</div>
</template>
<script>
import ItemReportTemplate from './ItemReportTemplate'
/**
* 样品列表--生成报告或者选择模板生成报告
*/
export default {
components: {
ItemReportTemplate
},
data() {
return {
selectIds: [],
getPage: {
records: []
},
showBatchModal: false,
isLoading: false,
footerBtn: [
{ type: '', id: '', name: '取消' },
{ type: 'primary', id: '', name: '确定' }
],
pageColumns: [
{ title: '样品名称', key: 'name', width: 160 },
{ title: '样品编号', key: 'code', width: 150 },
{ title: '证书编号', key: 'certificate', width: 150 }
],
reportModelId: '',
backData: {},
// 样品数据
tableData: [],
// 签发日期
issueDateTemp: '',
issueDate: '',
showIssueModal: false
}
},
methods: {
_open() {
this.getPage.records = []
this.backData = {}
this.showBatchModal = true
this._reportTemplate()
this.reportModelId = ''
this.isLoading = false
},
// 报告模板
_reportTemplate() {
this.$refs.reportTemplate._open()
},
_footerResult(name) {
switch (name) {
case '确定':
this._ok()
break
case '取消':
this.showBatchModal = false
break
}
},
_templateResultChange(selectData) {
this.backData = selectData[0]
},
_issueChange(data) {
if (data) {
this.issueDate = data
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.footerModal._hideLoading()
if (!this.backData.name) {
this.$Message.warning('请选择一个原始记录模板!')
// this._hideLoading()
} else {
this.$emit('on-result-change', this.backData)
this.showBatchModal = false
}
},
_issueCancel() {
this.showIssueModal = false
},
// 选择时间ok
_issueOk() {
this.isLoading = true
this.showIssueModal = false
this._createOk()
},
// 生成报告
_createOk() {
const obj = []
for (let i = 0; i < this.tableData.length; i++) {
obj.push({
sampleId: this.tableData[i].id,
reportSn: this.tableData[i].reportSn,
issueDate: this.issueDate
})
}
this.$layxLoading(true, '数据验证中')
const validateObj = {
sampleReports: obj,
reportModelId: this.reportModelId
}
// 先进行验证
this.$store
.dispatch('FoodSampleReport/createReportValidate', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
this.$refs.progressModal._open(this.tableData.length, currentTime)
validateObj.seriesNo = currentTime
console.log('生成报告的当前序列号,', validateObj.seriesNo)
this.$store
.dispatch('FoodSampleReport/createReport', validateObj)
.then(() => {})
}
this._hideLoading()
this.isLoading = false
this.$layxLoading(false)
})
},
_closeResult() {
this.showBatchModal = false
this.$emit('on-result-change')
}
}
}
</script>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</Form> </Form>
</Col> </Col>
<Col span="24"> <Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list> <btn-list @on-result-change="_btnClick" :msg="btn" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
...@@ -41,13 +41,15 @@ ...@@ -41,13 +41,15 @@
</Col> </Col>
</Row> </Row>
<CreateItemReport ref="createModal" @on-result-change="_certificateSelectExcelBack"></CreateItemReport> <CreateItemReport ref="createModal" @on-result-change="_certificateSelectExcelBack"></CreateItemReport>
<CreateBatchItemReport ref="createBatchModal" @on-result-change="_templateBack"></CreateBatchItemReport>
</div> </div>
</template> </template>
<script> <script>
import { soilSample, soilTest } from '../../../../api' import { soilSample, soilTest } from '../../../../api'
import CreateItemReport from './CreateItemReport' import CreateItemReport from './CreateItemReport'
import CreateBatchItemReport from './CreateBatchItemReport'
export default { export default {
components: { CreateItemReport }, components: { CreateItemReport, CreateBatchItemReport },
data() { data() {
return { return {
currentComponent: '', currentComponent: '',
...@@ -58,7 +60,14 @@ export default { ...@@ -58,7 +60,14 @@ export default {
name: undefined, name: undefined,
entrustId: undefined entrustId: undefined
}, },
formObjBatchSample: {
obj: {
entrustId: '',
nameList: []
}
},
sampleIds: [], sampleIds: [],
batchSampleIds: [],
itemName: '', itemName: '',
tableName: 'food-task-assign-item-left', tableName: 'food-task-assign-item-left',
// 用户自己选中的列 // 用户自己选中的列
...@@ -70,6 +79,13 @@ export default { ...@@ -70,6 +79,13 @@ export default {
], ],
getPage: {}, getPage: {},
iconMsg: [{ type: 'ios-book', id: '', name: '生成项目报告' }], iconMsg: [{ type: 'ios-book', id: '', name: '生成项目报告' }],
btn: [
{
type: 'success',
id: '',
name: '生成项目报告'
}
],
id: '', id: '',
selectId: '', selectId: '',
pageColumns: [{ title: '检测项目', key: 'name', width: 120 }] pageColumns: [{ title: '检测项目', key: 'name', width: 120 }]
...@@ -150,6 +166,10 @@ export default { ...@@ -150,6 +166,10 @@ export default {
}, },
_btnClick(msg) { _btnClick(msg) {
switch (msg) { switch (msg) {
case '生成项目报告':
// this.$emit('on-result-change', data)
this._itemReportMakeBatch()
break
case '自动分配': case '自动分配':
this._autoAssign() this._autoAssign()
break break
...@@ -165,12 +185,43 @@ export default { ...@@ -165,12 +185,43 @@ export default {
} }
}) })
}, },
_itemReportMakeBatch() {
if (this.selectDataName.length > 0) {
// this.itemName = data.name
this._searchBatchSampleId(this.id, this.selectDataName)
// this.selectId = data.id
this.$refs.createBatchModal._open()
} else {
this.$Message.warning('请至少选择一条数据')
}
},
_itemReportMake(data) { _itemReportMake(data) {
this.itemName = data.name this.itemName = data.name
this._searchSampleId(this.id, data.name) this._searchSampleId(this.id, data.name)
// this.selectId = data.id // this.selectId = data.id
this.$refs.createModal._open() this.$refs.createModal._open()
}, },
_searchBatchSampleId: async function(id, name) {
Object.assign(
this.formObjBatchSample,
this.$refs.pageTable._searchParams()
)
this.formObjBatchSample.obj.entrustId = id
this.formObjBatchSample.obj.nameList = name
const result = await soilTest.pageExperimentTestBath(
this.$serializeForm(this.formObjBatchSample)
)
if (result) {
this.batchSampleIds = []
for (let i = 0; i < result.records.length; i++) {
this.batchSampleIds.push(result.records[i].id)
}
console.log('右侧样品id', this.batchSampleIds)
this.$refs.pageTable._hideLoading()
} else {
this.$refs.pageTable._hideLoading()
}
},
_searchSampleId: async function(id, name) { _searchSampleId: async function(id, name) {
Object.assign(this.formObjSample, this.$refs.pageTable._searchParams()) Object.assign(this.formObjSample, this.$refs.pageTable._searchParams())
this.formObjSample.entrustId = id this.formObjSample.entrustId = id
...@@ -188,6 +239,14 @@ export default { ...@@ -188,6 +239,14 @@ export default {
console.log('右侧样品id', this.sampleIds) console.log('右侧样品id', this.sampleIds)
} }
}, },
_templateBack(data) {
if (data) {
this.$refs.pageTable._showLoading()
this._makeBatchCodeExcel(data)
} else {
this.$refs.pageTable._hideLoading()
}
},
_certificateSelectExcelBack(data) { _certificateSelectExcelBack(data) {
if (data) { if (data) {
this.$refs.pageTable._showLoading() this.$refs.pageTable._showLoading()
...@@ -196,6 +255,27 @@ export default { ...@@ -196,6 +255,27 @@ export default {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
} }
}, },
_makeBatchCodeExcel: async function(data) {
const result = await soilSample.saveExcelExpReport({
entrustId: this.id,
expName: this.selectDataName.join(','),
ids: this.batchSampleIds.join(','),
templateId: data.id
})
if (result) {
// await this._page()
if (result === null || result === undefined) {
this.$Message.warning('证书编制失败,请联系管理员!')
this.$refs.pageTable._hideLoading()
return false
} else {
this.$refs.pageTable._hideLoading()
this._viewReport(result)
}
} else {
this.$refs.pageTable._hideLoading()
}
},
_makeCodeExcel: async function(data) { _makeCodeExcel: async function(data) {
const result = await soilSample.saveExcelExpReport({ const result = await soilSample.saveExcelExpReport({
entrustId: this.id, entrustId: this.id,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<Col span="24"> <Col span="24">
<PTVXETable ref="pageTable" :page-columns="pageColumns" :table-name="tableName" <PTVXETable ref="pageTable" :page-columns="pageColumns" :table-name="tableName"
:table-height="tableHeight" :table-height="tableHeight"
:get-page="getPage" :is-radio="true" select-data hide-checkbox @on-result-change="_tableResultChange"> :get-page="getPage" select-data @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns" v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key" :key="item.key"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false"> <Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="试样编号:"> <Form-item class="search-item" label="试样编号:">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入试样编号" clearable></Input> <Input v-model="formObj.obj.sampleCode" @on-enter="_formSearch" placeholder="请输入试样编号" clearable></Input>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
...@@ -67,7 +67,11 @@ export default { ...@@ -67,7 +67,11 @@ export default {
name: '', name: '',
testMethod: '', testMethod: '',
testBasis: '', testBasis: '',
sampleCode: undefined obj: {
nameList: [],
entrustId: undefined,
sampleCode: undefined
}
}, },
entrustId: '', entrustId: '',
// 用户自己选中的列 // 用户自己选中的列
...@@ -355,17 +359,18 @@ export default { ...@@ -355,17 +359,18 @@ export default {
return obj return obj
}, },
_page: async function() { _page: async function() {
const saveName = this.leftSelectData.name const saveName = []
const saveMethod = this.leftSelectData.testMethod for (let i = 0; i < this.leftSelectData.length; i++) {
saveName.push(this.leftSelectData[i].name)
}
// for (let i = 0; i < this.leftSelectData.length; i++) { // for (let i = 0; i < this.leftSelectData.length; i++) {
// saveName.push(this.leftSelectData[i].name) // saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod) // saveMethod.push(this.leftSelectData[i].testMethod)
// } // }
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId this.formObj.obj.entrustId = this.entrustId
this.formObj.name = saveName this.formObj.obj.nameList = saveName
this.formObj.testMethod = saveMethod const result = await soilTest.pageExperimentAllotBath(
const result = await soilTest.pageExperimentAllot(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
......
...@@ -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