Commit b397bc68 by wangweidong

送样流程

parent 8f61d1f6
...@@ -12,6 +12,12 @@ export default { ...@@ -12,6 +12,12 @@ export default {
http http
.post('meter/v1/entrust/page_send_draft_entrust', data) .post('meter/v1/entrust/page_send_draft_entrust', data)
.then(res => res), .then(res => res),
pageDistributeEntrust: data =>
http
.post('meter/v1/entrust/page_distribute_entrust', data)
.then(res => res),
pageGoOutEntrust: data => pageGoOutEntrust: data =>
http.post('meter/v1/entrust/page_out_draft_entrust', data).then(res => res), http.post('meter/v1/entrust/page_out_draft_entrust', data).then(res => res),
pageOutTaskDistribute: data => pageOutTaskDistribute: data =>
...@@ -20,6 +26,10 @@ export default { ...@@ -20,6 +26,10 @@ export default {
.then(res => res), .then(res => res),
pageEntrustReview: data => pageEntrustReview: data =>
http.post('meter/v1/entrust/page_review_entrust', data).then(res => res), http.post('meter/v1/entrust/page_review_entrust', data).then(res => res),
pageEntrustReceive: data =>
http
.post('meter/v1/entrust/page_sample_receive_entrust', data)
.then(res => res),
pageSubpackageEntrust: data => pageSubpackageEntrust: data =>
http http
.post('meter/v1/entrust/page_subpackage_entrust', data) .post('meter/v1/entrust/page_subpackage_entrust', data)
......
...@@ -8,6 +8,16 @@ import { https } from '../https' ...@@ -8,6 +8,16 @@ import { https } from '../https'
export default { export default {
// page // page
page: data => http.post('meter/v1/sample/page', data).then(res => res), page: data => http.post('meter/v1/sample/page', data).then(res => res),
pageSampleReceive: data =>
http.post('meter/v1/sample/page_sample_receive', data).then(res => res),
pageSampleDistribute: data =>
http.post('meter/v1/sample/page_sample_distribute', data).then(res => res),
pageSampleFlow: data =>
http.post('meter/v1/sample/page_sample_flow', data).then(res => res),
// 报告模板 // 报告模板
pageReport: data => pageReport: data =>
http.post('/base/v1/file_template/page', data).then(res => res), http.post('/base/v1/file_template/page', data).then(res => res),
...@@ -70,6 +80,10 @@ export default { ...@@ -70,6 +80,10 @@ export default {
http http
.post('meter/v1/sample/subpackage_out_stock?ids=' + data.ids, data.obj) .post('meter/v1/sample/subpackage_out_stock?ids=' + data.ids, data.obj)
.then(res => res), .then(res => res),
submitReceive: data =>
http.post('meter/v1/sample/submit_receive?ids=' + data).then(res => res),
reportCheckBack: data => reportCheckBack: data =>
http http
.post( .post(
...@@ -90,5 +104,17 @@ export default { ...@@ -90,5 +104,17 @@ export default {
'&user=' + '&user=' +
data.user data.user
) )
.then(res => res),
sendTaskDistribute: data =>
http
.post(
'meter/v1/sample/send_task_distribute?ids=' +
data.ids +
'&userId=' +
data.userId +
'&user=' +
data.user
)
.then(res => res) .then(res => res)
} }
...@@ -185,6 +185,7 @@ export default { ...@@ -185,6 +185,7 @@ export default {
// this._resultChange('提交成功') // this._resultChange('提交成功')
const result = meterEntrust.submit(ids) const result = meterEntrust.submit(ids)
if (result) { if (result) {
this._resultChange('提交成功')
console.log(result) console.log(result)
} }
// }) // })
...@@ -192,6 +193,10 @@ export default { ...@@ -192,6 +193,10 @@ export default {
}) })
} }
}, },
_resultChange(msg) {
this.$Message.success(msg)
this._page()
},
_record(id) { _record(id) {
this.$refs.operationModal._open(id) this.$refs.operationModal._open(id)
}, },
......
<template>
<div>
<Modal v-model="showDetailModal" :width="1100" title="委托详情" class="modal-footer-none">
<div :style="{height}" style="overflow-y: auto">
<table class="tableClass">
<tbody>
<tr>
<th colspan="6" class="tableClass_back">委托单位信息</th>
</tr>
<tr>
<th>委托单位</th>
<td>{{obj.client}}</td>
<th>联系人</th>
<td>{{obj.person}}</td>
</tr>
<tr>
<th>联系电话</th>
<td>{{obj.tel}}</td>
<th>传真</th>
<td>{{obj.fax}}</td>
</tr>
<tr>
<th>详细地址</th>
<td>{{obj.street}}</td>
<th>E-mail</th>
<td>{{obj.email}}</td>
</tr>
<tr>
<th>是否第一次送检</th>
<td>{{obj.firsted===1? '是':'否'}}</td>
<th>邮编</th>
<td>{{obj.postcode}}</td>
</tr>
<tr>
<th>地址</th>
<td>{{obj.province}}&nbsp;{{obj.city}}&nbsp;{{obj.county}}</td>
<th>委托日期</th>
<td>{{obj.edate}}</td>
</tr>
<tr>
<th>合同号</th>
<td>{{obj.contractCode}}</td>
<th>备注</th>
<td>{{obj.remark}}</td>
</tr>
</tbody>
</table>
</div>
</Modal>
</div>
</template>
<script>
/**
* 政府委托信息表详情
*/
export default {
data() {
return {
obj: {
// detail: {},
// customer: {},
// finance: {},
// tested: {}
firsted: 0,
client: '',
linkman: '',
tel: '',
email: '',
address: '',
remark: '',
province: '',
city: '',
county: '',
street: '',
aptitude: [],
assessFormSn: '',
subArea: '',
personCondition: '',
edate: '',
contractCode: ''
},
showDetailModal: false,
// sampleType:['退样','留样','作废'],
dispose: '',
height: '',
showMoney: false
}
},
methods: {
_open(obj, flag) {
this.showDetailModal = true
this.obj = obj
console.log('传过来的数据')
console.log(this.obj)
// if(obj.dispose !== undefined || ''){
// this.dispose = this.sampleType[obj.dispose];
// }else{
// this.dispose = '';
// }
if (flag === 'showMoney') {
this.showMoney = true
} else {
this.showMoney = false
}
this.height = '550px'
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName">
<el-tab-pane label="待完成" name="wait">
<MeterReviewEntrust ref="waitTabs"></MeterReviewEntrust>
</el-tab-pane>
<el-tab-pane label="历史评审" name="his">
<MeterReviewEntrustHis ref="hisTabs"></MeterReviewEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterReviewEntrust from './MeterReceiveEntrust'
import MeterReviewEntrustHis from './MeterReceiveEntrustHis'
export default {
name: 'MeterSendEntrustIndex',
components: {
MeterReviewEntrust,
MeterReviewEntrustHis
},
data() {
return {
activeName: 'wait'
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<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" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_page"></MeterSampleManage>
<MeterEntrustDetail ref="meterSampleEdit" @on-result-change="_componentResult"></MeterEntrustDetail>
</div>
</template>
<script>
import { meterEntrust, meterSubcontractor } from '../../../api'
import MeterSampleManage from './MeterSampleManage'
import MeterEntrustDetail from './MeterEntrustDetail'
export default {
components: { MeterSampleManage, MeterEntrustDetail },
data() {
return {
currentComponent: 'FoodSampleGovern',
formId: 'meterReviewEntrustFormId',
searchOpen: false,
btn: [
{
// meter-review-entrust-pass-btn
type: 'success',
id: '',
name: '通过'
},
// meter-review-entrust-back-btn
{
type: 'success',
id: '',
name: '驳回'
}
],
iconMsg: [
{
type: 'md-paper',
id: '',
name: '详情'
},
{
type: 'ios-beaker',
id: '',
name: '样品管理'
},
{ type: 'md-cloud', id: '', name: '附件' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_detailModal(data) {
console.log(data)
this.$refs.meterSampleEdit._open(data)
// 查看
// this.$store.dispatch('FoodContract/getById', data.id).then(() => {
// if (data.type === 0) {
// // 企业委托 ’0‘
// this.currentComponent = 'FoodContractCompanyDetail'
// } else {
// // 政府委托 ’1‘
// this.currentComponent = 'FoodContractGovernDetail'
// }
// this.$nextTick(() => {
// this.$refs.refModal._open(this.$store.state.FoodContract.model)
// })
// })
},
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '通过':
this._passReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data) {
this.$nextTick(function() {
switch (res) {
case '样品管理':
this._manageSample(data)
break
case '详情':
this._detailModal(data)
break
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_manageSample(data) {
// 管理样品
this.$refs.meterSampleManageModal._open(data.id)
},
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'FoodContractCompanyEdit':
this._page()
break
case 'FoodContractGovernEdit':
this._page()
break
case 'FoodContractCompanyEditByDLTB':
this._page()
break
case 'FoodContractCompanyEditByHES':
this._page()
break
}
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
case 'selectIds':
this.selectIds = data
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageEntrustReceive(this.formObj)
if (result) {
console.log('结果')
console.log(result)
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
_passReview() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择要通过评审的委托单!')
return false
}
this.$Modal.confirm({
title: '提示',
content: '确定通过该委托单?',
onOk: () => {
this._passEntrustReview(this.selectIds)
}
})
},
_passEntrustReview: async function(ids) {
const result = await meterEntrust.passReview(ids)
if (result) {
this.$Message.success('提交成功!')
await this._page()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
if (result) {
this.$refs.editSubcontractorModal._open(result)
}
},
_delete: async function(ids) {
const result = await meterSubcontractor.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" hide-checkbox>
<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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
import { meterEntrust, meterSubcontractor } from '../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-subcontractor-add-btn',
name: '添加'
}
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '编辑'
},
{
type: 'ios-clock',
id: '',
name: '资质项目'
},
{ type: 'ios-clock', id: '', name: '附件' },
{ type: 'ios-clock', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageSendEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
if (result) {
this.$refs.editSubcontractorModal._open(result)
}
},
_delete: async function(ids) {
const result = await meterSubcontractor.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<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>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
import { meterSample } from '../../../api'
export default {
components: {
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
// 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: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
btn: [
{
// meter-review-entrust-pass-btn
type: 'success',
id: '',
name: '收样'
}
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
{ title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '样品名称', key: 'name', width: 140 },
{ title: '型号规格', key: 'spec', width: 140 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 },
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
],
dateList: [],
formObj: {
entrustId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_cancel() {
this.showModal = false
this.$emit('on-result-change')
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._cancel()
break
}
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '收样':
this._receiveSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
this._editLY(data.id) // 粮油的编辑页
} else {
this._editModal(true, data.id)
}
break
case '复制':
this._copy(data.id, data.type)
break
case '删除':
this._deleteById(data.id)
break
case '检测项目':
this._itemDetail(data.id)
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.entrustId = id
this.showModal = true
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.pageSampleReceive(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 + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_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])
}
},
_receiveSample() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选中一条样品进行接收!')
return false
} else {
this.$Modal.confirm({
title: '提示',
content: '确定接收' + this.selectIds.length + '条记录?',
onOk: () => {
this._receive(this.selectIds)
}
})
}
},
_receive: async function(ids) {
const result = await meterSample.submitReceive(ids)
if (result) {
this.$Message.success('接收成功!')
await this._page()
}
},
_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>
<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>
<span v-else-if="item.key==='singleJudge'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<div v-else-if="item.key==='testValue'">
<el-input
v-model="scope.row.testValue"
size="medium"
placeholder="请输入检测结果"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
/>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row.progress.display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
import { meterItem } from '../../../api'
export default {
components: {
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
// 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: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [
{
// meter-review-entrust-pass-btn
type: 'success',
id: '',
name: '完成'
},
// meter-review-entrust-back-btn
{
type: 'success',
id: '',
name: '填写检测值'
},
{
type: 'success',
id: '',
name: '判定'
}
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
searchOpen: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
// { title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '检定项目', key: 'name', width: 180 },
{ title: '比较符', key: 'compare', width: 100 },
{ title: '限量值', key: 'limitValue', width: 140 },
{ title: '检测值', key: 'testValue', width: 140 },
{ title: '单项判定', key: 'singleJudge', width: 140 },
{ title: '进度', key: 'progress', width: 110 }
],
dateList: [],
formObj: {
sampleId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '完成':
this._testEnd()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
this._editLY(data.id) // 粮油的编辑页
} else {
this._editModal(true, data.id)
}
break
case '复制':
this._copy(data.id, data.type)
break
case '删除':
this._deleteById(data.id)
break
case '检测项目':
this._itemDetail(data.id)
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()
},
_testEnd() {
if (this.selectIds.length === 0) {
this.$Message.success('请选择完成检测的项目')
return false
}
this._testItemEnd(this.selectIds)
},
_testItemEnd: async function() {
const result = await meterItem.testEnd({
ids: this.selectIds,
sampleId: this.formObj.sampleId
})
if (result) {
await this._page()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterItem.pageTest(this.formObj)
console.log('result', result)
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 + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_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)
},
// 导入样品
_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])
}
},
_subpackageSample() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选中一条样品进行分包!')
return false
} else {
for (let i = 0; i < this.selectData.length; i++) {
if (this.selectData[i].jobOut === 1) {
this.$Message.warning(
'样品编号为' +
this.selectData[i].code +
'已经分包了,请选择未分包的样品!'
)
return false
}
}
this._subpackage(this.selectIds)
}
},
_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)
},
// 单个填写检测值
_handleTestValueEdit: async function(id, testValue) {
if (testValue !== '' && undefined !== testValue) {
const data = {}
data.itemIds = id
data.testValue = testValue
const result = await meterItem.testValue(data)
if (result) {
this.$Message.success('保存成功')
await this._page()
} else {
this.$Message.error('保存失败')
}
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<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" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterPersonItemTaskManage ref="personModal"></MeterPersonItemTaskManage>
</div>
</template>
<script>
import { meterDevice, meterSample } from '../../../api'
import MeterPersonItemTaskManage from './MeterPersonItemTaskManage'
export default {
components: {
MeterPersonItemTaskManage
},
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: '',
name: '任务转发'
},
{
type: 'success',
id: '',
name: '流转'
}
],
iconMsg: [
{ type: 'md-cloud', id: '', name: '附件' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '数量', key: 'quantity' },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器领用':
this._receiveApparatus()
break
case '车辆管理':
this._carManage()
break
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_carManage() {
this.$refs.carEdit._open()
},
_receiveApparatus() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.SelEquip._open('sample-input')
}
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterSample.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '仪器领用':
this.$refs.InstruEdit._open()
break
case '车辆管理':
this.$refs.carEdit._open()
break
case '编辑':
// this._editModal(true, data.id)
this._personModal(data)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_personModal(data) {
console.log(data)
this.$refs.personModal._open(data.id)
},
_equipSelectBack(data) {
console.log('_equipSelectBack', data)
const equipData = []
for (let i = 0; i < data.length; i++) {
const object = data[i]
const obj = {}
obj.name = object.name
obj.certificateNo = object.ceNum
obj.measuringRange = object.range
obj.uncertaintyAccuray = object.uncertainty
obj.validUntil = object.effectDate
equipData.push(obj)
}
this._addEquipUse({ sampleIds: this.selectIds, devicesList: equipData })
},
_addEquipUse: async function(data) {
const result = await meterDevice.addEquipUse(data)
if (result) {
await this._page()
}
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.pageSampleFlow(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterSample.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
import { meterEntrust } from '../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-go-out-entrust-add-btn',
name: '添加'
},
{
type: 'success',
id: 'meter-go-out-entrust-submit-btn',
name: '提交'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterEntrust.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageGoOutEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName">
<el-tab-pane label="待完成" name="wait">
<MeterGoOutEntrust ref="waitTabs"></MeterGoOutEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterGoOutEntrustHis ref="hisTabs"></MeterGoOutEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterGoOutEntrust from './MeterSampleFlow'
import MeterGoOutEntrustHis from './MeterSampleFlowHis'
export default {
name: 'MeterGoOutEntrustIndex',
components: {
MeterGoOutEntrust,
MeterGoOutEntrustHis
},
data() {
return {
activeName: 'wait'
}
}
}
</script>
<style scoped>
</style>
<template>
<!--仓库-->
<Modal v-model="showModal" width="1000">
<p slot="header">选择车辆</p>
<Form :label-width="50" onsubmit="return false" inline>
<Form-item label="车牌号">
<Input v-model="license" @on-enter="_search" placeholder="请输入车牌号,回车查询"
icon="ios-search-strong"/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
<Row>
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{$dateformat(scope.row[item.key],'yyyy-mm-dd')}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</template>
<script>
/**
* 选择车辆
*/
import ModalFooter from '../../../components/base/modalFooter'
import { meterSample } from '../../../api'
export default {
components: {
ModalFooter
},
data() {
return {
showModal: false,
license: '',
selectNames: '',
selectIds: '',
getPage: {},
tableHeight: '300',
pageColumns: [
{ title: '车牌号', key: 'license' },
{ title: '品牌', key: 'brand' },
{ title: '所属类型', key: 'type' },
{ title: '购买/租用时间', key: 'buyDate' },
{ title: '备注', key: 'remark' }
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
]
}
},
methods: {
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open() {
this.showModal = true
this.license = ''
this._page()
},
_page: async function() {
const data = {}
if (this.license) {
data.license = this.license
}
// this.$refs.pageTable._page('search-form-car', 'LmsCarInfo/page', data)
const result = await meterSample.pageCarManage(data)
const result2 = await meterSample.pageCarList(data)
console.log('result', result)
console.log('result2', result2)
if (result) {
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.selectNames = []
this.getPage = this.$store.state.LmsCarInfo.page
break
case 'selectData':
const nameList = []
const idList = []
for (let i = 0; i < data.length; i++) {
nameList.push(data[i].license)
idList.push(data[i].id)
}
this.selectIds = idList
this.selectNames = nameList
break
case 'changeSize':
this._page()
break
}
},
_ok() {
this.$emit('on-result-change', {
ids: this.selectIds,
names: this.selectNames
})
this.showModal = false
this._hideLoading()
},
_cancel() {
this.showModal = false
this._hideLoading()
},
_search() {
// tree查询
this._page()
}
}
}
</script>
<template>
<div>
<Modal v-model="showUserGroupModal">
<p slot="header">
{{ modalTitle }}
</p>
<Row>
<!--查询条件-->
<Col span="24">
<Form id="test-item-form" :label-width="90" inline onsubmit="return false">
<label class="label-sign" />
<Form-item :label-width="70" label="授权资质仪器名称" >
<Input
v-model="code"
placeholder="授权资质仪器名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
<Form-item label="检测依据名称">
<Input
v-model="name"
placeholder="请输入检测依据名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
</Form>
</Col>
<Col span="24" style="margin-bottom: 10px">
<el-table
:height="300"
:data="getPage"
border
size="small"
highlight-current-row
style="width: 100%"
@row-click="_rowChange"
@row-dblclick="_dbClick"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:min-width="item.width"
show-overflow-tooltip
>
<template slot-scope="scope">
<span v-if="item.key==='status'">
{{ scope.row[item.key]?scope.row[item.key].display:'' }}
</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</el-table>
</Col>
<Col span="24">
<Page
:total="getPage.total"
:page-size="getPage.size"
placement="top"
show-total
show-elevator
show-sizer
@on-change="_pageChange"
@on-page-size-change="_pageRows"
/>
<div style="clear: both" />
</Col>
</Row>
<div slot="footer" class="btn-width">
<Button style="margin-left: 8px" @click="_cancel">
取消
</Button>
<Button type="primary" @click="_ok">
确定
</Button>
</div>
</Modal>
</div>
</template>
<script>
// import { meterAptitude } from '../../../api'
import { meterManage } from '../../../api'
export default {
name: 'EditModal',
data() {
return {
loading: true,
pageParams: { rows: 20 },
pageColumns: [
{ title: '样品名称', key: 'name' },
{ title: '检定依据', key: 'code' },
{ title: '检定依据名称', key: 'basis' }
],
getPage: [],
showUserGroupModal: false,
modalTitle: '',
currentRowData: {},
name: '',
code: ''
}
},
methods: {
_open() {
this.modalTitle = '选择检测依据'
this.name = ''
this.code = ''
this._judge()
},
_judge() {
this.showUserGroupModal = true
this.currentRowData = {}
this._page()
},
_page: async function() {
const result = await meterManage.page(this._searchParams())
if (result) {
console.log('查询结果')
console.log(result)
this.getPage = result.records
this.loading = false
console.log(this.getPage)
}
},
_pageChange(page) {
this.pageParams.page = page
this._page()
},
_pageRows(rows) {
this.pageParams.rows = rows
this._page()
},
_searchParams() {
const data = this.$serialize('test-item-form')
if (this.name) {
data.name = this.name
}
if (this.code) {
data.code = this.code
}
return this.$extend(data, this.pageParams)
},
_search() {
this._page()
},
_rowChange(data) {
this.currentRowData = data // 选中的行数据;
},
_cancel() {
this.showUserGroupModal = false
},
_ok() {
if (JSON.stringify(this.currentRowData) === '{}') {
switch (this.modalTitle) {
case '选择检测依据':
this.$Message.warning('请选择一条检测依据!')
break
}
} else {
this.$emit('on-result-change', this.currentRowData)
this.showUserGroupModal = false
}
},
// 双击
_dbClick(data, event) {
this.currentRowData = data
// 选中的行数据;
this._ok()
}
}
}
</script>
<style scoped>
</style>
<template>
<!--仓库-->
<Modal v-model="showModal" width="1000">
<p slot="header">仪器领用</p>
<Form :label-width="60" onsubmit="return false" inline>
<Form-item label="仪器名称">
<Input v-model="license" @on-enter="_search" placeholder="请输入仪器名称,回车查询"
icon="ios-search-strong"/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
<Row>
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{$dateformat(scope.row[item.key],'yyyy-mm-dd')}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</template>
<script>
/**
* 选择车辆
*/
import ModalFooter from '../../../components/base/modalFooter'
import { meterSample } from '../../../api'
export default {
components: {
ModalFooter
},
data() {
return {
showModal: false,
license: '',
selectNames: '',
selectIds: '',
getPage: {},
tableHeight: '300',
pageColumns: [
{ title: '仪器名称', key: 'name' },
{ title: '测量范围', key: 'measuringRange' },
{ title: '不确定度/准确度', key: 'uncertaintyAccuray' }
// { title: '购买/租用时间', key: 'buyDate' },
// { title: '备注', key: 'remark' }
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
]
}
},
methods: {
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open() {
this.showModal = true
this.license = ''
this._page()
},
_page: async function() {
const data = {}
if (this.license) {
data.license = this.license
}
// this.$refs.pageTable._page('search-form-car', 'LmsCarInfo/page', data)
const result = await meterSample.pageInstrutEdit(data)
console.log('result', result)
if (result) {
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.selectNames = []
this.getPage = this.$store.state.LmsCarInfo.page
break
case 'selectData':
const nameList = []
const idList = []
for (let i = 0; i < data.length; i++) {
nameList.push(data[i].license)
idList.push(data[i].id)
}
this.selectIds = idList
this.selectNames = nameList
break
case 'changeSize':
this._page()
break
}
},
_ok() {
this.$emit('on-result-change', {
ids: this.selectIds,
names: this.selectNames
})
this.showModal = false
this._hideLoading()
},
_cancel() {
this.showModal = false
this._hideLoading()
},
_search() {
// tree查询
this._page()
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="1230">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<!-- <Form-item label="委托方是否第一次送检" prop="firsted" class="width-48">-->
<!-- <Input v-model="formObj.firsted" name="firsted" placeholder="委托方是否第一次送检"/>-->
<!-- </Form-item>-->
<Form-item label="委托方是否第一次送检" prop="firsted" class="width-48">
<Radio-group v-model="formObj.firsted">
<Radio v-for="item in judgeType" :key="item.value" :label="item.value">{{item.name}}</Radio>
</Radio-group>
</Form-item>
<Form-item label="委托单位" prop="client" class="width-48">
<Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="联系人" prop="operation.person" class="width-48">
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="联系电话" prop="operation.tel" class="width-48">
<Input v-model="formObj.operation.tel" name="operation.tel" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="传真" prop="operation.fax" class="width-48">
<Input v-model="formObj.operation.fax" name="operation.fax" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="省、市、区" prop="name" class="width-48">
<!-- <Input v-model="formObj.client" name="name" placeholder="请输入委托单位"/>-->
<CityNameCascader :value="testedCityData" name="tested" @on-result-change="_cascaderResult">
</CityNameCascader>
</Form-item>
<Form-item label="街道" prop="street" class="width-48">
<Input v-model="formObj.street" name="street" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="邮编" prop="operation.postcode" class="width-48">
<Input v-model="formObj.operation.postcode" name="operation.postcode" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="E-mail" prop="operation.email" class="width-48">
<Input v-model="formObj.operation.email" name="operation.email" placeholder="请输入实验室名称"/>
</Form-item>
<Form-item label="委托日期:" prop="edate" class="width-48">
<Input v-model="formObj.edate" name="edate" placeholder="请输入联系人"/>
</Form-item>
<Form-item label="合同号:" prop="contractCode" class="width-48">
<Input v-model="formObj.contractCode" name="contractCode" placeholder="请输入联系人"/>
</Form-item>
<Form-item label="备注:" prop="remark" style="width: 99.8%">
<Input v-model="formObj.remark" :rows="3" name="remark" type="textarea"
placeholder="请输入备注"/>
</Form-item>
</Form>
<Col span="24">
<!-- <btn-list :msg="btn" :open="searchOpen" :showSearchBtn="false" @on-result-change="_btnClick"-->
<!-- class="contHide"></btn-list>-->
<Button type="success" @click="_add()">添加</Button>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:form-id="formId"
:table-height="500"
:get-page="getPage"
:icon-msg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.key==='name'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.name" blur placeholder="请输入或选择样品名称" @on-result-change="_judgeBasisChange" @click.native="_selectjudgeBasis(scope.$rowIndex)"
></el-input>
</div>
<div v-if="item.key==='spec'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.spec" blur placeholder="请输入或选择型号规格"
></el-input>
</div>
<div v-if="item.key==='factoryNumber'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.factoryNumber" blur placeholder="请输入或选择出厂编号"
></el-input>
</div>
<div v-if="item.key==='type'" @click.stop="_handleRow(scope)">
<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-if="item.key==='quantity'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.quantity"
type="number"
placeholder="请输入或选择数量"
@keydown.native="channelInputLimit"
/>
</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
<EditModal ref="EditModal" is-change @on-result-change="_backData" />
</Modal>
</div>
</template>
<script>
/**
* 添加编辑分包商
*/
import { lmsBaseDict, meterEntrust } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader'
import EditModal from './EditModal'
export default {
components: { EditModal, CityNameCascader },
data() {
return {
formId: 'meterSendTestEditFormId',
getPage: {
records: []
},
testedCityData: [],
testedTemp: {
testedName: '',
testedContactor: '',
testedContactorTel: '',
testedTel: '',
testedProvince: '',
testedCity: '',
testedCounty: '',
testedStreet: ''
},
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [
{ type: 'ios-clock', id: '', name: '编辑' },
{ type: 'ios-clock', id: '', name: '删除' }
],
pageColumns: [
{ title: '样品名称', key: 'name', width: 160 },
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '数量', key: 'quantity' }
// {title: '限制范围或说明', key: 'limitDescription'},
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
index: 0,
id: '',
modalTitle: '',
subcontractorId: '',
formObj: {
firsted: 1,
client: '',
linkman: '',
tel: '',
email: '',
address: '',
remark: '',
street: '',
province: '',
city: '',
county: '',
aptitude: [],
assessFormSn: '',
subArea: '',
personCondition: '',
edate: '',
contractCode: '',
operation: {
person: '',
tel: '',
fax: '',
postcode: '',
email: '',
fee: ''
}
},
ruleValidate: {
client: [
{ required: true, message: '委托单位不能为空', trigger: 'blur' }
]
},
clearingWayList: ['款到后测试', '先测试后付款', '其他情况()'],
clearingWayListTemp: ['款到后测试', '先测试后付款', '其他情况()'],
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
aptitudeData: []
}
},
created() {
this.$set(
this.formObj,
'tested',
JSON.parse(JSON.stringify(this.testedTemp))
)
},
methods: {
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].name = data.name
this.getPage.records[this.index].aptitudeId = data.id
console.log('返回的数据')
console.log(data)
console.log(this.getPage.records)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_cascaderResult(name, data, msg) {
switch (name) {
case 'cus':
this._casChange(data, msg)
break
case 'tested':
this._testedChange(data, msg)
break
}
},
_emptyProvince() {
this.cityData = []
this.testedCityData = []
this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = ''
},
_testedChange(data, msg) {
// 省、市、区
console.log('数据')
console.log(data)
console.log(msg)
if (msg === 'clear') {
this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = ''
this.formObj.province = ''
this.formObj.city = ''
this.formObj.county = ''
this.testedCityData = []
} else {
this.formObj.tested.testedProvince = data.value[0]
this.formObj.tested.testedCity = data.value[1]
this.formObj.tested.testedCounty = data.value[2]
this.formObj.province = data.value[0]
this.formObj.city = data.value[1]
this.formObj.county = data.value[2]
this.testedCityData = [data.value[0], data.value[1], data.value[2]]
}
},
_getJudgeBasisList(data) {
const obj = { classify: 0 }
if (data) {
obj.stdNum = data
}
// this.$store.dispatch('StandardInfo/list', obj).then(() => {
// this.judgeBasisData = this.$store.state.StandardInfo.list
// })
},
_judgeBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.code = data.stdNum
this.formObj.name = data.name
this.$refs.formObj.validateField('code')
break
case 'query':
this.formObj.stdId = ''
this.formObj.code = data.stdNum
this.formObj.name = ''
this._getJudgeBasisList(data.stdNum)
break
case 'focus':
this._getJudgeBasisList()
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.code = ''
this._getJudgeBasisList()
}
this.$refs.formObj.validateField('code')
}
},
_add() {
const data = {
name: '',
spec: '',
factoryNumber: '',
quantity: '',
type: ''
}
this.getPage.records.unshift(data)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
// this.getPage = this.$store.state.FoodJudgeBasis.page
break
case 'selectIds':
// this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex)
break
// case 'changeSize':
// this._page()
// break
}
},
_iconClick(res, data, index) {
switch (res) {
case '编辑':
// this._editModal(true, data.id)
break
case '删除':
// this._deleteById(data.id)
console.log('点击了删除按钮')
console.log(index)
this.getPage.records.splice(index, 1)
break
case '操作日志':
// this._record(data.id)
break
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
channelInputLimit(e) {
const key = e.key
// 不允许输入'e'和'.'
if (key === 'e' || key === '.') {
e.returnValue = false
return false
}
return true
},
/** *modal-footer */
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) {
// 添加
const saveData = this.formObj
saveData.sampleList = this.getPage.records
this._save(saveData)
} else {
const saveData = this.formObj
saveData.sampleList = this.getPage.records
// 编辑
this._edit(saveData)
}
} else {
this.$Message.error('表单验证失败!')
this._hideLoading()
}
})
},
_wayResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.clearingWay = data
break
case 'query':
this.formObj.clearingWay = data
this._wayQuery(data)
break
}
},
_wayQuery(query) {
if (query === '') {
this.clearingWayList = this.clearingWayListTemp
} else {
this.clearingWayList = this.clearingWayListTemp.filter(
item => item.indexOf(query) > -1
)
}
},
_cancel() {
this.showModal = false
},
_open() {
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.getPage.records = []
this.id = ''
this.modalTitle = '出检委托单登记'
},
_openEdit(formObj) {
this.getPage.records = []
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.id = ''
this.modalTitle = '出检委托单编辑'
this.id = formObj.id
this.formObj = formObj
this._showAddress(formObj)
this.getPage.records = formObj.sampleList
},
_getAptitudeList: async function() {
const result = await lmsBaseDict.getItem('subcontractorAptitude')
if (result) {
this.aptitudeData = result
}
},
_showTime(formObj) {
// 回显资质类型
// if (formObj.aptitude !== undefined || '') {
// this.formObj.aptitude = formObj.aptitude.split(',')
// } else {
// this.formObj.aptitude = []
// }
},
_showAddress(formObj) {
this.testedCityData = []
if (
formObj.province !== undefined &&
formObj.city !== undefined &&
formObj.county !== undefined
) {
this.testedCityData.push(formObj.province)
this.testedCityData.push(formObj.city)
this.testedCityData.push(formObj.county)
}
},
_save: async function(data) {
const result = await meterEntrust.saveOutEntrust(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await meterEntrust.editDTO(data)
if (result) {
this._resultChange('编辑成功!')
}
}
}
}
</script>
<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>
<span v-else-if="item.key==='singleJudge'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<div v-else-if="item.key==='testValue'">
<el-input
v-model="scope.row.testValue"
size="medium"
placeholder="请输入检测结果"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
/>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row.progress.display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
import { meterItem } from '../../../api'
export default {
components: {
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
// 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: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [
{
// meter-review-entrust-pass-btn
type: 'success',
id: '',
name: '完成'
},
// meter-review-entrust-back-btn
{
type: 'success',
id: '',
name: '填写检测值'
},
{
type: 'success',
id: '',
name: '判定'
}
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
searchOpen: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
// { title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '检定项目', key: 'name', width: 180 },
{ title: '比较符', key: 'compare', width: 100 },
{ title: '限量值', key: 'limitValue', width: 140 },
{ title: '检测值', key: 'testValue', width: 140 },
{ title: '单项判定', key: 'singleJudge', width: 140 },
{ title: '进度', key: 'progress', width: 110 }
],
dateList: [],
formObj: {
sampleId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '完成':
this._testEnd()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
this._editLY(data.id) // 粮油的编辑页
} else {
this._editModal(true, data.id)
}
break
case '复制':
this._copy(data.id, data.type)
break
case '删除':
this._deleteById(data.id)
break
case '检测项目':
this._itemDetail(data.id)
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()
},
_testEnd() {
if (this.selectIds.length === 0) {
this.$Message.success('请选择完成检测的项目')
return false
}
this._testItemEnd(this.selectIds)
},
_testItemEnd: async function() {
const result = await meterItem.testEnd({
ids: this.selectIds,
sampleId: this.formObj.sampleId
})
if (result) {
await this._page()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterItem.pageTest(this.formObj)
console.log('result', result)
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 + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_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)
},
// 导入样品
_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])
}
},
_subpackageSample() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选中一条样品进行分包!')
return false
} else {
for (let i = 0; i < this.selectData.length; i++) {
if (this.selectData[i].jobOut === 1) {
this.$Message.warning(
'样品编号为' +
this.selectData[i].code +
'已经分包了,请选择未分包的样品!'
)
return false
}
}
this._subpackage(this.selectIds)
}
},
_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)
},
// 单个填写检测值
_handleTestValueEdit: async function(id, testValue) {
if (testValue !== '' && undefined !== testValue) {
const data = {}
data.itemIds = id
data.testValue = testValue
const result = await meterItem.testValue(data)
if (result) {
this.$Message.success('保存成功')
await this._page()
} else {
this.$Message.error('保存失败')
}
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<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" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<SelEquip ref="SelEquip" @on-result-change="_equipSelectBack"></SelEquip>
<CarManage ref="carEdit"></CarManage>
<InstruMentEdit ref="InstruEdit"></InstruMentEdit>
<MeterPersonItemTaskManage ref="personModal"></MeterPersonItemTaskManage>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
</template>
<script>
import { meterDevice, meterSample } from '../../../api'
import SelEquip from '../../../components/select-equip/SelEquip'
import MeterSubcontractorEdit from './MeterGoOutTestEdit'
import CarManage from './CarManage'
import MeterPersonItemTaskManage from './MeterPersonItemTaskManage'
import InstruMentEdit from './InstrumentEdit'
export default {
components: {
MeterSubcontractorEdit,
CarManage,
MeterPersonItemTaskManage,
SelEquip,
InstruMentEdit
},
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: '',
name: '仪器领用'
},
{
type: 'success',
id: '',
name: '车辆管理'
},
{
type: 'success',
id: '',
name: '提交'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'md-car',
id: '',
name: '车辆管理'
},
{
type: 'ios-list-box',
id: '',
name: '仪器领用'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '样品名称', key: 'name', width: 120 },
{ title: '样品编号', key: 'code', width: 120 },
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '数量', key: 'quantity' },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器领用':
this._receiveApparatus()
break
case '车辆管理':
this._carManage()
break
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_carManage() {
this.$refs.carEdit._open()
},
_receiveApparatus() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.SelEquip._open('sample-input')
}
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterSample.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '仪器领用':
this.$refs.InstruEdit._open()
break
case '车辆管理':
this.$refs.carEdit._open()
break
case '编辑':
// this._editModal(true, data.id)
this._personModal(data)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_personModal(data) {
console.log(data)
this.$refs.personModal._open(data.id)
},
_equipSelectBack(data) {
console.log('_equipSelectBack', data)
const equipData = []
for (let i = 0; i < data.length; i++) {
const object = data[i]
const obj = {}
obj.name = object.name
obj.certificateNo = object.ceNum
obj.measuringRange = object.range
obj.uncertaintyAccuray = object.uncertainty
obj.validUntil = object.effectDate
equipData.push(obj)
}
this._addEquipUse({ sampleIds: this.selectIds, devicesList: equipData })
},
_addEquipUse: async function(data) {
const result = await meterDevice.addEquipUse(data)
if (result) {
await this._page()
}
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.pageOutPersonalTask(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterSample.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
</template>
<script>
import { meterEntrust } from '../../../api'
import MeterSubcontractorEdit from './MeterGoOutTestEdit'
export default {
components: { MeterSubcontractorEdit },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-go-out-entrust-add-btn',
name: '添加'
},
{
type: 'success',
id: 'meter-go-out-entrust-submit-btn',
name: '提交'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterEntrust.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageGoOutEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName">
<el-tab-pane label="待完成" name="wait">
<MeterGoOutEntrust ref="waitTabs"></MeterGoOutEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterGoOutEntrustHis ref="hisTabs"></MeterGoOutEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterGoOutEntrust from './MeterSampleInput'
import MeterGoOutEntrustHis from './MeterSampleInputHis'
export default {
name: 'MeterGoOutEntrustIndex',
components: {
MeterGoOutEntrust,
MeterGoOutEntrustHis
},
data() {
return {
activeName: 'wait'
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Modal v-model="showUserGroupModal">
<p slot="header">
{{ modalTitle }}
</p>
<Row>
<!--查询条件-->
<Col span="24">
<Form id="test-item-form" :label-width="90" inline onsubmit="return false">
<label class="label-sign" />
<Form-item :label-width="70" label="授权资质仪器名称" >
<Input
v-model="code"
placeholder="授权资质仪器名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
<Form-item label="检测依据名称">
<Input
v-model="name"
placeholder="请输入检测依据名称"
style="width: 100%"
@on-enter="_pageChange(1)"
/>
</Form-item>
</Form>
</Col>
<Col span="24" style="margin-bottom: 10px">
<el-table
:height="300"
:data="getPage"
border
size="small"
highlight-current-row
style="width: 100%"
@row-click="_rowChange"
@row-dblclick="_dbClick"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:min-width="item.width"
show-overflow-tooltip
>
<template slot-scope="scope">
<span v-if="item.key==='status'">
{{ scope.row[item.key]?scope.row[item.key].display:'' }}
</span>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</el-table>
</Col>
<Col span="24">
<Page
:total="getPage.total"
:page-size="getPage.size"
placement="top"
show-total
show-elevator
show-sizer
@on-change="_pageChange"
@on-page-size-change="_pageRows"
/>
<div style="clear: both" />
</Col>
</Row>
<div slot="footer" class="btn-width">
<Button style="margin-left: 8px" @click="_cancel">
取消
</Button>
<Button type="primary" @click="_ok">
确定
</Button>
</div>
</Modal>
</div>
</template>
<script>
// import { meterAptitude } from '../../../api'
import { meterManage } from '../../../api'
export default {
name: 'EditModal',
data() {
return {
loading: true,
pageParams: { rows: 20 },
pageColumns: [
{ title: '样品名称', key: 'name' },
{ title: '检定依据', key: 'code' },
{ title: '检定依据名称', key: 'basis' }
],
getPage: [],
showUserGroupModal: false,
modalTitle: '',
currentRowData: {},
name: '',
code: ''
}
},
methods: {
_open() {
this.modalTitle = '选择检测依据'
this.name = ''
this.code = ''
this._judge()
},
_judge() {
this.showUserGroupModal = true
this.currentRowData = {}
this._page()
},
_page: async function() {
const result = await meterManage.page(this._searchParams())
if (result) {
console.log('查询结果')
console.log(result)
this.getPage = result.records
this.loading = false
console.log(this.getPage)
}
},
_pageChange(page) {
this.pageParams.page = page
this._page()
},
_pageRows(rows) {
this.pageParams.rows = rows
this._page()
},
_searchParams() {
const data = this.$serialize('test-item-form')
if (this.name) {
data.name = this.name
}
if (this.code) {
data.code = this.code
}
return this.$extend(data, this.pageParams)
},
_search() {
this._page()
},
_rowChange(data) {
this.currentRowData = data // 选中的行数据;
},
_cancel() {
this.showUserGroupModal = false
},
_ok() {
if (JSON.stringify(this.currentRowData) === '{}') {
switch (this.modalTitle) {
case '选择检测依据':
this.$Message.warning('请选择一条检测依据!')
break
}
} else {
this.$emit('on-result-change', this.currentRowData)
this.showUserGroupModal = false
}
},
// 双击
_dbClick(data, event) {
this.currentRowData = data
// 选中的行数据;
this._ok()
}
}
}
</script>
<style scoped>
</style>
<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>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<assignPerson ref="userModal" is-change @on-result-change="_userData"></assignPerson>
</div>
</template>
<script>
import { meterSample } from '../../../api'
import assignPerson from '../../../components/user-info-single/assignPerson'
export default {
components: {
assignPerson
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
// 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: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
footerList: [
{ id: '', name: '关闭', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
btn: [
{
type: 'success',
id: '',
name: '分配任务'
}
],
searchOpen: false,
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
{ title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '样品名称', key: 'name', width: 140 },
{ title: '型号规格', key: 'spec', width: 140 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 },
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
],
dateList: [],
formObj: {
entrustId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_footerResult(name) {
switch (name) {
case '关闭':
this._cancel()
break
case '确定':
this._cancel()
break
}
},
_cancel() {
this.showModal = false
this.$emit('on-result-change')
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '分配任务':
this._changePeople()
break
case '添加':
this._editModal(false)
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_userData(data, msg) {
if (msg === 'salesman') {
this._distributeSample(data)
}
},
_distributeSample: async function(data) {
const userId = data.id
const realname = data.realname
const ids = this.selectIds
const result = await meterSample.sendTaskDistribute({
ids: ids,
userId: userId,
user: realname
})
if (result) {
this.$Message.success('分配成功!')
await this._page()
}
},
_changePeople() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择至少一项数据!')
return false
} else {
this.$refs.userModal._open('salesman')
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
this._editLY(data.id) // 粮油的编辑页
} else {
this._editModal(true, data.id)
}
break
case '复制':
this._copy(data.id, data.type)
break
case '删除':
this._deleteById(data.id)
break
case '检测项目':
this._itemDetail(data.id)
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) {
console.log(id)
this.formObj.entrustId = id
this.showModal = true
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.pageSampleDistribute(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 + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_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>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterOutTaskAlloca ref="taskAllocaModal" @on-result-change="_page"></MeterOutTaskAlloca>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<MeterOutTaskOperation ref="operationModal"></MeterOutTaskOperation>
</div>
</template>
<script>
import { meterEntrust } from '../../../api'
import MeterSubcontractorEdit from './MeterTestEdit'
import MeterOutTaskAlloca from './MeterTaskAlloca'
import MeterOutTaskOperation from './MeterTaskOperation'
export default {
components: {
MeterSubcontractorEdit,
MeterOutTaskAlloca,
MeterOutTaskOperation
},
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-go-out-entrust-add-btn',
name: '添加'
},
{
type: 'success',
id: 'meter-go-out-entrust-submit-btn',
name: '提交'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-contact',
id: '',
name: '任务分配'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterEntrust.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '任务分配':
this._taskAllocaModal(data)
break
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_taskAllocaModal(data) {
// 管理样品
this.$refs.taskAllocaModal._open(data.id)
},
_record(id) {
this.$refs.operationModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageDistributeEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @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">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
</template>
<script>
import { meterEntrust } from '../../../api'
import MeterSubcontractorEdit from './MeterTestEdit'
export default {
components: { MeterSubcontractorEdit },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-go-out-entrust-add-btn',
name: '添加'
},
{
type: 'success',
id: 'meter-go-out-entrust-submit-btn',
name: '提交'
}
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交':
this._submitToReview()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
const result = meterEntrust.submit(ids)
if (result) {
console.log(result)
}
}
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectIds':
this.selectIds = data
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageGoOutEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName">
<el-tab-pane label="待完成" name="wait">
<MeterGoOutEntrust ref="waitTabs"></MeterGoOutEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterGoOutEntrustHis ref="hisTabs"></MeterGoOutEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterGoOutEntrust from './MeterTaskDistribute'
import MeterGoOutEntrustHis from './MeterTaskDistributeHis'
export default {
name: 'MeterGoOutEntrustIndex',
components: {
MeterGoOutEntrust,
MeterGoOutEntrustHis
},
data() {
return {
activeName: 'wait'
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Modal v-model="showModal" width="900" class="modal-footer-none zIndex-1100">
<p slot="header">操作日志</p>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="search-contract-record" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="操作阶段:">
<Input v-model="formObj.origin" @on-enter="_search" placeholder="请输入操作阶段"
style="width: 200px" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" hide-checkbox>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns" :key="item.key">
<template slot-scope="scope">
<span v-if="item.key==='type'">
{{scope.row[item.key] === 0 ? '流转' : scope.row[item.key] === 1 ? '退回': scope.row[item.key] === 2 ?'更新' :
scope.row[item.key] === 3 ? '转发':'文件'}}
</span>
<span v-else-if="item.key==='ctime'">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
/**
* 操作日志-委托
*/
import { meterEntrust } from '../../../api'
export default {
data() {
return {
showModal: false,
getPage: {},
pageColumns: [
{ title: '操作类型', key: 'type', width: 80 },
{ title: '操作阶段', key: 'origin', width: 120 },
{ title: '目标阶段', key: 'target', width: 120 },
{ title: '操作人', key: 'operator', width: 80 },
{ title: '操作时间', key: 'ctime', width: 150 },
{ title: '操作原因', key: 'remark' },
{ title: '责任人', key: 'liable', width: 80 }
],
formObj: {
origin: '',
contractId: ''
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_open(contractId) {
this.showModal = true
this.formObj.contractId = contractId
this.formObj.origin = ''
this._page()
},
_page: async function() {
console.log('要传的参数')
console.log(this.formObj)
const result = await meterEntrust.pageOutTaskOperation(this.formObj)
console.log(result)
if (result) {
this.getPage = result
}
// this.$refs.pageTable._page(
// 'search-contract-record',
// 'FoodContractRecord/page',
// this.$serializeFormSearch(this.formObj)
// )
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContractRecord.page
break
case 'changeSize':
this._page()
break
}
},
_search() {
this.$refs.pageTable._pageChange(1)
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="1230">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<!-- <Form-item label="委托方是否第一次送检" prop="firsted" class="width-48">-->
<!-- <Input v-model="formObj.firsted" name="firsted" placeholder="委托方是否第一次送检"/>-->
<!-- </Form-item>-->
<Form-item label="委托方是否第一次送检" prop="firsted" class="width-48">
<Radio-group v-model="formObj.firsted">
<Radio v-for="item in judgeType" :key="item.value" :label="item.value">{{item.name}}</Radio>
</Radio-group>
</Form-item>
<Form-item label="委托单位" prop="client" class="width-48">
<Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="联系人" prop="operation.person" class="width-48">
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="联系电话" prop="operation.tel" class="width-48">
<Input v-model="formObj.operation.tel" name="operation.tel" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="传真" prop="operation.fax" class="width-48">
<Input v-model="formObj.operation.fax" name="operation.fax" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="省、市、区" prop="name" class="width-48">
<!-- <Input v-model="formObj.client" name="name" placeholder="请输入委托单位"/>-->
<CityNameCascader :value="testedCityData" name="tested" @on-result-change="_cascaderResult">
</CityNameCascader>
</Form-item>
<Form-item label="街道" prop="street" class="width-48">
<Input v-model="formObj.street" name="street" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="邮编" prop="operation.postcode" class="width-48">
<Input v-model="formObj.operation.postcode" name="operation.postcode" placeholder="请输入委托单位"/>
</Form-item>
<Form-item label="E-mail" prop="operation.email" class="width-48">
<Input v-model="formObj.operation.email" name="operation.email" placeholder="请输入实验室名称"/>
</Form-item>
<Form-item label="委托日期:" prop="edate" class="width-48">
<Input v-model="formObj.edate" name="edate" placeholder="请输入联系人"/>
</Form-item>
<Form-item label="合同号:" prop="contractCode" class="width-48">
<Input v-model="formObj.contractCode" name="contractCode" placeholder="请输入联系人"/>
</Form-item>
<Form-item label="备注:" prop="remark" style="width: 99.8%">
<Input v-model="formObj.remark" :rows="3" name="remark" type="textarea"
placeholder="请输入备注"/>
</Form-item>
</Form>
<Col span="24">
<!-- <btn-list :msg="btn" :open="searchOpen" :showSearchBtn="false" @on-result-change="_btnClick"-->
<!-- class="contHide"></btn-list>-->
<Button type="success" @click="_add()">添加</Button>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:form-id="formId"
:table-height="500"
:get-page="getPage"
:icon-msg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.key==='name'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.name" blur placeholder="请输入或选择样品名称" @on-result-change="_judgeBasisChange" @click.native="_selectjudgeBasis(scope.$rowIndex)"
></el-input>
</div>
<div v-if="item.key==='spec'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.spec" blur placeholder="请输入或选择型号规格"
></el-input>
</div>
<div v-if="item.key==='factoryNumber'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.factoryNumber" blur placeholder="请输入或选择出厂编号"
></el-input>
</div>
<div v-if="item.key==='type'" @click.stop="_handleRow(scope)">
<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-if="item.key==='quantity'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.quantity"
type="number"
placeholder="请输入或选择数量"
@keydown.native="channelInputLimit"
/>
</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
<EditModal ref="EditModal" is-change @on-result-change="_backData" />
</Modal>
</div>
</template>
<script>
/**
* 添加编辑分包商
*/
import { lmsBaseDict, meterEntrust } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader'
import EditModal from './EditModal'
export default {
components: { EditModal, CityNameCascader },
data() {
return {
formId: 'meterSendTestEditFormId',
getPage: {
records: []
},
testedCityData: [],
testedTemp: {
testedName: '',
testedContactor: '',
testedContactorTel: '',
testedTel: '',
testedProvince: '',
testedCity: '',
testedCounty: '',
testedStreet: ''
},
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [
{ type: 'ios-clock', id: '', name: '编辑' },
{ type: 'ios-clock', id: '', name: '删除' }
],
pageColumns: [
{ title: '样品名称', key: 'name', width: 160 },
{ title: '型号规格', key: 'spec' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '数量', key: 'quantity' }
// {title: '限制范围或说明', key: 'limitDescription'},
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
index: 0,
id: '',
modalTitle: '',
subcontractorId: '',
formObj: {
firsted: 1,
client: '',
linkman: '',
tel: '',
email: '',
address: '',
remark: '',
street: '',
province: '',
city: '',
county: '',
aptitude: [],
assessFormSn: '',
subArea: '',
personCondition: '',
edate: '',
contractCode: '',
operation: {
person: '',
tel: '',
fax: '',
postcode: '',
email: '',
fee: ''
}
},
ruleValidate: {
client: [
{ required: true, message: '委托单位不能为空', trigger: 'blur' }
]
},
clearingWayList: ['款到后测试', '先测试后付款', '其他情况()'],
clearingWayListTemp: ['款到后测试', '先测试后付款', '其他情况()'],
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
aptitudeData: []
}
},
created() {
this.$set(
this.formObj,
'tested',
JSON.parse(JSON.stringify(this.testedTemp))
)
},
methods: {
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].name = data.name
this.getPage.records[this.index].aptitudeId = data.id
console.log('返回的数据')
console.log(data)
console.log(this.getPage.records)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_cascaderResult(name, data, msg) {
switch (name) {
case 'cus':
this._casChange(data, msg)
break
case 'tested':
this._testedChange(data, msg)
break
}
},
_emptyProvince() {
this.cityData = []
this.testedCityData = []
this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = ''
},
_testedChange(data, msg) {
// 省、市、区
console.log('数据')
console.log(data)
console.log(msg)
if (msg === 'clear') {
this.formObj.tested.testedProvince = ''
this.formObj.tested.testedCity = ''
this.formObj.tested.testedCounty = ''
this.formObj.province = ''
this.formObj.city = ''
this.formObj.county = ''
this.testedCityData = []
} else {
this.formObj.tested.testedProvince = data.value[0]
this.formObj.tested.testedCity = data.value[1]
this.formObj.tested.testedCounty = data.value[2]
this.formObj.province = data.value[0]
this.formObj.city = data.value[1]
this.formObj.county = data.value[2]
this.testedCityData = [data.value[0], data.value[1], data.value[2]]
}
},
_getJudgeBasisList(data) {
const obj = { classify: 0 }
if (data) {
obj.stdNum = data
}
// this.$store.dispatch('StandardInfo/list', obj).then(() => {
// this.judgeBasisData = this.$store.state.StandardInfo.list
// })
},
_judgeBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.code = data.stdNum
this.formObj.name = data.name
this.$refs.formObj.validateField('code')
break
case 'query':
this.formObj.stdId = ''
this.formObj.code = data.stdNum
this.formObj.name = ''
this._getJudgeBasisList(data.stdNum)
break
case 'focus':
this._getJudgeBasisList()
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.code = ''
this._getJudgeBasisList()
}
this.$refs.formObj.validateField('code')
}
},
_add() {
const data = {
name: '',
spec: '',
factoryNumber: '',
quantity: '',
type: ''
}
this.getPage.records.unshift(data)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
// this.getPage = this.$store.state.FoodJudgeBasis.page
break
case 'selectIds':
// this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex)
break
// case 'changeSize':
// this._page()
// break
}
},
_iconClick(res, data, index) {
switch (res) {
case '编辑':
// this._editModal(true, data.id)
break
case '删除':
// this._deleteById(data.id)
console.log('点击了删除按钮')
console.log(index)
this.getPage.records.splice(index, 1)
break
case '操作日志':
// this._record(data.id)
break
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
channelInputLimit(e) {
const key = e.key
// 不允许输入'e'和'.'
if (key === 'e' || key === '.') {
e.returnValue = false
return false
}
return true
},
/** *modal-footer */
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) {
// 添加
const saveData = this.formObj
saveData.sampleList = this.getPage.records
this._save(saveData)
} else {
const saveData = this.formObj
saveData.sampleList = this.getPage.records
// 编辑
this._edit(saveData)
}
} else {
this.$Message.error('表单验证失败!')
this._hideLoading()
}
})
},
_wayResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.clearingWay = data
break
case 'query':
this.formObj.clearingWay = data
this._wayQuery(data)
break
}
},
_wayQuery(query) {
if (query === '') {
this.clearingWayList = this.clearingWayListTemp
} else {
this.clearingWayList = this.clearingWayListTemp.filter(
item => item.indexOf(query) > -1
)
}
},
_cancel() {
this.showModal = false
},
_open() {
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.getPage.records = []
this.id = ''
this.modalTitle = '出检委托单登记'
},
_openEdit(formObj) {
this.getPage.records = []
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.id = ''
this.modalTitle = '出检委托单编辑'
this.id = formObj.id
this.formObj = formObj
this._showAddress(formObj)
this.getPage.records = formObj.sampleList
},
_getAptitudeList: async function() {
const result = await lmsBaseDict.getItem('subcontractorAptitude')
if (result) {
this.aptitudeData = result
}
},
_showTime(formObj) {
// 回显资质类型
// if (formObj.aptitude !== undefined || '') {
// this.formObj.aptitude = formObj.aptitude.split(',')
// } else {
// this.formObj.aptitude = []
// }
},
_showAddress(formObj) {
this.testedCityData = []
if (
formObj.province !== undefined &&
formObj.city !== undefined &&
formObj.county !== undefined
) {
this.testedCityData.push(formObj.province)
this.testedCityData.push(formObj.city)
this.testedCityData.push(formObj.county)
}
},
_save: async function(data) {
const result = await meterEntrust.saveOutEntrust(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await meterEntrust.editDTO(data)
if (result) {
this._resultChange('编辑成功!')
}
}
}
}
</script>
...@@ -20,6 +20,10 @@ import MeterOutPersonalTaskIndex from '../pages/meter-out/personal-task/MeterOut ...@@ -20,6 +20,10 @@ import MeterOutPersonalTaskIndex from '../pages/meter-out/personal-task/MeterOut
import MeterCertificateMakeIndex from '../pages/meter-certificate/make/MeterCertificateMakeIndex' import MeterCertificateMakeIndex from '../pages/meter-certificate/make/MeterCertificateMakeIndex'
import MeterCertificateCheckIndex from '../pages/meter-certificate/check/MeterCertificateCheckIndex' import MeterCertificateCheckIndex from '../pages/meter-certificate/check/MeterCertificateCheckIndex'
import MeterCertificateIssueIndex from '../pages/meter-certificate/issue/MeterCertificateIssueIndex' import MeterCertificateIssueIndex from '../pages/meter-certificate/issue/MeterCertificateIssueIndex'
import MeterEntrustReceiveIndex from '../pages/meter-send/receive-sample/MeterEntrustReceiveIndex'
import MeterTaskDistributeIndex from '../pages/meter-send/task-distribute/MeterTaskDistributeIndex'
import MeterSampleFlowIndex from '../pages/meter-send/sample-flow/MeterSampleFlowIndex'
import MeterSampleInputIndex from '../pages/meter-send/sample-input/MeterSampleInputIndex'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -98,6 +102,26 @@ export default [ ...@@ -98,6 +102,26 @@ export default [
path: 'personal_test_task', path: 'personal_test_task',
component: MeterOutPersonalTaskIndex, component: MeterOutPersonalTaskIndex,
meta: { title: '个人检测任务' } meta: { title: '个人检测任务' }
},
{
path: 'send_sample_receive',
component: MeterEntrustReceiveIndex,
meta: { title: '收样管理' }
},
{
path: 'send_sample_distribute',
component: MeterTaskDistributeIndex,
meta: { title: '任务分配' }
},
{
path: 'send_sample_flow',
component: MeterSampleFlowIndex,
meta: { title: '样品流转' }
},
{
path: 'send_sample_input',
component: MeterSampleInputIndex,
meta: { title: '样品录入' }
} }
] ]
}, },
......
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