Commit 301a4552 by wangweidong

计量证书修改

parent 88ff64b8
......@@ -194,6 +194,18 @@ export default {
http.post('meter/v1/sample/submit_receive?ids=' + data).then(res => res),
toReportCheck: data =>
http.post('meter/v1/sample/to_report_check?ids=' + data).then(res => res),
selectToReportCheck: data =>
http
.post(
'meter/v1/sample/select_to_report_check?ids=' +
data.ids +
'&userId=' +
data.userId +
'&user=' +
data.user
)
.then(res => res),
toReportMake: data =>
http.post('meter/v1/sample/to_report_make?ids=' + data).then(res => res),
taskTransfer: data =>
......@@ -321,5 +333,10 @@ export default {
)
.then(res => res),
getCertificateReport: data =>
http.post('meter/v1/sample/get_certificate_report?sampleId=' + data)
http.post('meter/v1/sample/get_certificate_report?sampleId=' + data),
generatePdfAuto: data =>
http.get('meter/v1/report/generate_pdf_auto?id=' + data),
pageCertificate: data =>
http.post('meter/v1/report/page', data).then(res => res)
}
......@@ -99,6 +99,11 @@ export default {
id: '',
name: '在线查看证书'
},
{
type: 'ios-book',
id: '',
name: '预览pdf'
},
// {
// type: 'ios-list-box',
// id: '',
......@@ -267,8 +272,8 @@ export default {
case '在线查看证书':
this._reportMakeLook(data)
break
case '资质项目':
this._itemModal(data.id)
case '预览pdf':
this._pdfPreview(data.id)
break
case '附件':
this._upload(data.id)
......@@ -290,13 +295,21 @@ export default {
this._itemOriginalRecordLook(data)
}
},
_pdfPreview: async function(id) {
const result = await meterSample.generatePdfAuto(id)
if (result) {
this.$pdfView(result)
}
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
isReport: 5
})
}
},
......
......@@ -265,7 +265,7 @@ export default {
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
isReport: 5
})
}
},
......
......@@ -275,7 +275,7 @@ export default {
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
isReport: 5
})
}
},
......
......@@ -108,7 +108,7 @@ export default {
pageColumns: [
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '证书编号', key: 'reportCode', width: 120 },
{ title: '证书编号', key: 'reportCode', width: 150 },
{ title: '型号规格', key: 'spec', width: 100 },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type', width: 100 },
......@@ -276,7 +276,7 @@ export default {
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
isReport: 5
})
}
},
......
<template>
<div>
<Modal v-model="showModal" width="1200" class="modal-footer-none">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入样品编号" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='jobOut'">
{{scope.row[item.key]===1?'是':'否'}}
</div>
<!-- <div v-else-if="item.key==='type'">-->
<!-- <Select v-model="scope.row.type">-->
<!-- <Option v-for="(item,index) in options" :key="item.name" :value="index">-->
<!-- {{ item.name }}-->
<!-- </Option>-->
<!-- </Select>-->
<!-- </div>-->
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
import { meterSample } from '../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
searchOpen: false,
// btn: [
// {type: 'success', id: '', name: '添加', componentName: 'FoodSampleGovernEdit'},
// {id: 'food-gov-sample-batch-add', name: '批量添加', componentName: 'FoodSampleGovernBatchAdd'},
// {id: '', name: '导入样品', componentName: 'FoodImportSample'},
// {id: '', name: '导入检测项目', componentName: 'RelItem'},
// {id: '', name: '导入检测项目包', componentName: 'RelItemPackage'},
// {id: '', name: '复制历史样品检测项目', componentName: 'CopyHisItem'},
// {id: '', name: '删除'},
// ],
iconMsg: [
{
type: 'ios-book',
id: '',
name: '查看当前版本证书'
}
],
btn: [],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
{ title: '修改人', key: 'uname', width: 120 },
{ title: '修改时间', key: 'ctime', width: 140, date: true },
{ title: '证书版本', key: 'version', width: 140 },
{ title: '备注', key: 'remark', width: 140 }
],
dateList: [],
formObj: {
sampleId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 5
})
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '取消分包':
this._subpackageCancelBtn()
break
}
})
},
_subpackageCancelBtn() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const data = {}
data.ids = this.selectIds.join(',')
this._subpackageCancel(data)
}
},
_subpackageCancel: async function(data) {
console.log(data)
const result = await meterSample.subpackageCancel(data)
if (result) {
this.$Message.success('取消成功!')
await this._page()
}
},
_outWarehouse() {
if (this.selectData.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
for (let i = 0; i < this.selectData.length; i++) {
const obj = this.selectData[i]
if (obj.subcontractor === undefined) {
this.$Message.warning('请先填写分包信息在进行此操作!')
return false
}
}
this.$refs.OutWarehouseModal._open(this.selectIds, this.selectData)
}
},
_batchEpiboly() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.batchEditModal._open(this.selectIds, this.selectData)
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '查看当前版本证书':
this._viewReport(data)
break
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj.sampleId = id
this.showModal = true
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
this.selectIds = []
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.pageCertificate(this.formObj)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultChange('删除成功!')
})
}
})
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_editModal(edit, id) {
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(function() {
if (edit) {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
} else {
this.$refs.refModal._open('', this.contractId)
}
})
},
_editLY(id) {
// 粮油的编辑
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
})
},
_search() {
this._page()
},
_searchParams() {
const data = this.$serialize('search-sample-govern')
return this.$extend(data, this.pageParams)
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
}
},
_copy(sampleId, type) {
this.$refs.refModal._open(sampleId, type)
},
// 复制样品
_copySample(data) {
if (data.type === 2) {
// 粮油的编辑页
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$nextTick(function() {
this.$refs.refModal._openCopySample(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$nextTick(function() {
this.$refs.refModal._openCopySample(
this.$store.state.FoodSample.governModel
)
})
})
}
},
_copyAll(data) {
if (data.type === 2) {
// 粮油的编辑页
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel
)
})
})
}
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/government/import_' + this.contractId,
downloadUrl: '/food/v1/excel/template/FoodSampleGovernment',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, 'batch-rel-package-item')
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_itemDetail(id) {
this.$refs.foodItem._open(id)
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
......@@ -57,6 +57,7 @@
</div>
</div>
<CertificateMake ref="itemOriginalRecordModal" @on-result-change="_resultRecord"></CertificateMake>
<MeterCertificateHisVersion ref="meterCertificateHisVersion" @on-result-change="_page"></MeterCertificateHisVersion>
<CertificateMakeLook ref="itemOriginalRecordLookModal" @on-result-change="_resultRecord"></CertificateMakeLook>
<CreateReport ref="CreateReport"></CreateReport>
<SelectOriTempRecord ref="SelectOriTempRecord" @on-result-change="_certificateSelectBack"></SelectOriTempRecord>
......@@ -74,12 +75,14 @@ import operationModal from '../../../components/operation/Operation'
import CreateReport from './CreateReport'
import CarManage from './CarManage'
import InstruMentEdit from './InstrumentEdit'
import MeterCertificateHisVersion from './MeterCertificateHisVersion'
import SelectOriTempRecord from './SelectOriTempRecord'
export default {
components: {
CreateReport,
CarManage,
InstruMentEdit,
MeterCertificateHisVersion,
operationModal,
SelectOriTempRecord,
CertificateMake,
......@@ -104,6 +107,11 @@ export default {
],
iconMsg: [
{
type: 'md-book',
id: '',
name: '历史版本'
},
{
type: 'ios-bookmarks',
id: '',
name: '查看证书'
......@@ -122,7 +130,7 @@ export default {
{ title: '样品编号', key: 'code', width: 120 },
{ title: '型号规格', key: 'spec', width: 100 },
{ title: '证书是否编制', key: 'onlineReported', width: 120 },
{ title: '证书编号', key: 'reportCode', width: 120 },
{ title: '证书编号', key: 'reportCode', width: 150 },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '委托单位', key: 'client', width: 200 },
......@@ -265,6 +273,9 @@ export default {
case '查看证书':
this._makeCertificate(data)
break
case '历史版本':
this._hisVersion(data)
break
case '仪器领用':
this.$refs.InstruEdit._open()
break
......@@ -296,6 +307,12 @@ export default {
_makeCertificate(data) {
this._reportMakeLook(data)
},
_hisVersion(data) {
// 管理样品
this.$refs.meterCertificateHisVersion._open(data.id)
},
_reportMakeLook: async function(data) {
const result = await meterSample.getCertificateReport(data.id)
if (result) {
......
......@@ -76,11 +76,11 @@ export default {
formId: 'meterCertificatePrintIndexFormId',
searchOpen: true,
btn: [
// {
// type: 'success',
// id: '',
// name: '提交'
// }
{
type: 'success',
id: '',
name: '打印'
}
],
iconMsg: [
// {
......@@ -142,8 +142,8 @@ export default {
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
case '打印':
this._printExcel()
break
case '退回':
this._goBack()
......@@ -157,18 +157,12 @@ export default {
_submitToReview() {
this._submitByContractIds()
},
_submitByContractIds() {
_printExcel() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定提交吗?',
onOk: () => {
this._submitEnd(ids)
}
})
this.$pageofficePrint({ ids: ids, type: 'xlsx' })
}
},
......@@ -229,7 +223,7 @@ export default {
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
isReport: 5
})
}
},
......
......@@ -68,7 +68,7 @@
<CertificateMake ref="itemOriginalRecordModal" @on-result-change="_resultRecord"></CertificateMake>
<!--编辑证书-->
<CertificateMakeLook ref="itemOriginalRecordLookModal" @on-result-change="_resultRecord"></CertificateMakeLook>
<assignPerson ref="userModal" is-change @on-result-change="_userData"></assignPerson>
</div>
</template>
<script>
......@@ -76,6 +76,7 @@ import { meterDevice, meterSample } from '../../../api'
import SelEquip from '../../../components/select-equip/SelEquip'
import CertificateMake from '../../meter-certificate/CertificateMake'
import CertificateMakeLook from '../../meter-certificate/CertificateMakeLook'
import assignPerson from '../../../components/user-info-single/assignPerson'
import MeterSubcontractorEdit from './MeterGoOutTestEdit'
import CarManage from './CarManage'
import MeterPersonItemTaskManage from './MeterPersonItemTaskManage'
......@@ -92,6 +93,7 @@ export default {
CarManage,
MeterPersonItemTaskManage,
SelEquip,
assignPerson,
InstruMentEdit
},
data() {
......@@ -110,6 +112,12 @@ export default {
id: 'meter-sample-input-submit-btn',
name: '提交'
},
{
type: 'success',
id: '',
name: '提交至审核'
},
{
type: 'success',
id: 'meter-sample-input-submit-create-btn',
......@@ -204,6 +212,9 @@ export default {
case '提交':
this._submitToReportReview()
break
case '提交至审核':
this._selectToReportReview()
break
case '提交至证书编制':
this._submitToReportMake()
break
......@@ -236,7 +247,10 @@ export default {
this.$Message.warning('请至少选择一条数据!')
} else {
for (let i = 0; i < data.length; i++) {
if (data[i].recordId === undefined) {
if (
data[i].onlineReported === undefined ||
data[i].onlineReported === '否'
) {
this.$Message.warning(
'您选择的样品编号为' + data[i].code + '暂未编制证书,无法提交!'
)
......@@ -252,6 +266,45 @@ export default {
})
}
},
_selectToReportReview() {
const ids = this.selectIds
const data = this.selectData
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
for (let i = 0; i < data.length; i++) {
if (
data[i].onlineReported === undefined ||
data[i].onlineReported === '否'
) {
this.$Message.warning(
'您选择的样品编号为' + data[i].code + '暂未编制证书,无法提交!'
)
return false
}
}
this.$refs.userModal._open('salesman')
}
},
_userData(data, msg) {
if (msg === 'salesman') {
this._distributeCertificateCheck(data)
}
},
_distributeCertificateCheck: async function(data) {
const result = await meterSample.selectToReportCheck({
ids: this.selectIds,
userId: data.id,
user: data.realname
})
if (result) {
await this._page()
this.$Message.success('分配成功!')
}
},
_submitReportCheck: async function(ids) {
const result = await meterSample.toReportCheck(ids)
if (result) {
......
......@@ -162,7 +162,7 @@ export default {
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '证书是否编制', key: 'onlineReported', width: 120 },
{ title: '证书编号', key: 'reportCode', width: 130 },
{ title: '证书编号', key: 'reportCode', width: 140 },
{ title: '型号规格', key: 'spec', width: 115 },
{ title: '出厂编号', key: 'factoryNumber', width: 115 },
{ title: '制造厂商', key: 'manufacturer', width: 125 },
......
......@@ -845,6 +845,23 @@ Vue.prototype.$openWindowModeless = function(data) {
// eslint-disable-next-line no-undef
return POBrowser.openWindowModeless(uri, 'width=1200px;height=800px;')
}
Vue.prototype.$pdfView = function(data) {
if (data) {
// 根据objectKey下载pdf
const fileUrl = encodeURIComponent(
global.baseURL + '/print/v1/download?objectKey='
)
const uri =
global.staticURL +
'/pdf/PDFJS/pdfjs/web/viewer.html?file=' +
fileUrl +
data
return window.open(uri, '_blank')
} else {
this.$Message.warning('暂无PDF生成,不可预览~')
}
}
/**
* pageoffice(打印word,pdf(待定))
* id
......@@ -852,15 +869,30 @@ Vue.prototype.$openWindowModeless = function(data) {
*/
Vue.prototype.$pageofficePrint = function(data) {
// id 为样品id或者委托id
const companyId = global.getUserInfo().companyId
const realname = encodeURI(encodeURI(global.getUserInfo().realname))
const userId = global.getUserInfo().id
const locaName = encodeURI('报告')
// id 为报告id或者委托id
const type = encodeURI(data.type)
const ids = data.ids.join(',')
const uri =
global.baseURL +
'/print/v1/batch_print' +
'/print/v1/batch_print_meter' +
'?sysMark=' +
global.getCode() +
'&location=' +
locaName +
'&companyId=' +
companyId +
'&userId=' +
userId +
'&username=' +
realname +
'&printType=' +
data.type +
type +
'&businessIds=' +
data.id
ids
// eslint-disable-next-line no-undef
return POBrowser.openWindowModeless(uri, 'width=350px;height=300px;')
}
......
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