Commit e309d18b by wangweidong

土工试验Lims

parent addfc842
...@@ -15,8 +15,12 @@ export default { ...@@ -15,8 +15,12 @@ export default {
http.post('soil/v1/entrust/page_review', data).then(res => res), http.post('soil/v1/entrust/page_review', data).then(res => res),
pageSampleReceive: data => pageSampleReceive: data =>
http.post('soil/v1/entrust/page_sample_receive', data).then(res => res), http.post('soil/v1/entrust/page_sample_receive', data).then(res => res),
pageSampleReceiveHis: data =>
http.post('soil/v1/entrust/page_sample_receive_his', data).then(res => res),
pageSamplePrepare: data => pageSamplePrepare: data =>
http.post('soil/v1/entrust/page_sample_prepare', data).then(res => res), http.post('soil/v1/entrust/page_sample_prepare', data).then(res => res),
pageSamplePrepareHis: data =>
http.post('soil/v1/entrust/page_sample_prepare_his', data).then(res => res),
getById: data => http.get('soil/v1/entrust/' + data).then(res => res), getById: data => http.get('soil/v1/entrust/' + data).then(res => res),
getVOById: data => http.get('soil/v1/entrust/vo/' + data).then(res => res), getVOById: data => http.get('soil/v1/entrust/vo/' + data).then(res => res),
deleteById: data => deleteById: data =>
...@@ -48,14 +52,20 @@ export default { ...@@ -48,14 +52,20 @@ export default {
samplePage: data => http.post('soil/v1/sample/page', data).then(res => res), samplePage: data => http.post('soil/v1/sample/page', data).then(res => res),
pageReceive: data => pageReceive: data =>
http.post('soil/v1/sample/page_receive', data).then(res => res), http.post('soil/v1/sample/page_receive', data).then(res => res),
pageReceiveHis: data =>
http.post('soil/v1/sample/page_receive_his', data).then(res => res),
pageSend: data => pageSend: data =>
http.post('soil/v1/sample/page_send', data).then(res => res), http.post('soil/v1/sample/page_send', data).then(res => res),
pageSendHis: data =>
http.post('soil/v1/sample/page_send_his', data).then(res => res),
receiveSample: data => receiveSample: data =>
http.post('soil/v1/sample/receive_sample', data).then(res => res), http.post('soil/v1/sample/receive_sample', data).then(res => res),
sendSample: data => sendSample: data =>
http.post('soil/v1/sample/send_sample', data).then(res => res), http.post('soil/v1/sample/send_sample', data).then(res => res),
pagePrepare: data => pagePrepare: data =>
http.post('soil/v1/sample/page_prepare', data).then(res => res), http.post('soil/v1/sample/page_prepare', data).then(res => res),
pagePrepareHis: data =>
http.post('soil/v1/sample/page_prepare_his', data).then(res => res),
sampleEdit: data => sampleEdit: data =>
http.put( http.put(
'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail 'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail
......
...@@ -9,28 +9,13 @@ ...@@ -9,28 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false"> <Form v-show="searchOpen" id="search-sample-company" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable />
</Form-item>
<Form-item label="样品编号:" class="search-item"> <Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable /> <Input v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" />
</Form-item> </Form-item>
<!-- <Form-item label="制单日期:" style="width: 25%">-->
<!-- <Date-picker-->
<!-- v-model="dateList"-->
<!-- type="daterange"-->
<!-- placeholder="制单日期"-->
<!-- format="yyyy-MM-dd"-->
<!-- :editable="false"-->
<!-- style="width:100%"-->
<!-- placement="bottom-end"-->
<!-- @on-change="_dateChange"-->
<!-- ></Date-picker>-->
<!-- </Form-item>-->
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_page" type="primary"> <Button type="primary" @click="_page">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -38,12 +23,12 @@ ...@@ -38,12 +23,12 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list> <btn-list :msg="btn" :open="searchOpen" class="contHide" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data> :get-page="getPage" :icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -61,9 +46,6 @@ ...@@ -61,9 +46,6 @@
<div v-else-if="item.date"> <div v-else-if="item.date">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }} {{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):'' }}
</div> </div>
<div v-else-if="item.key==='describeDetail'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.describeDetail" @change="_inputChange(scope.row)"></el-input>
</div>
<div v-else> <div v-else>
{{ scope.row[item.key] }} {{ scope.row[item.key] }}
</div> </div>
...@@ -97,21 +79,11 @@ export default { ...@@ -97,21 +79,11 @@ export default {
formId: 'soilSampleManage', formId: 'soilSampleManage',
currentComponent: '', currentComponent: '',
btn: [ btn: [
// {
// type: 'success',
// id: '',
// name: '试样制备'
// },
{ {
type: 'success', type: 'success',
id: 'ZBC', id: 'ZBC',
name: '打印标签' name: '打印标签'
} }
// {
// type: 'success',
// id: '',
// name: '批量填写土质描述详情'
// }
], ],
itemList: [], itemList: [],
indexList: [], indexList: [],
...@@ -127,7 +99,7 @@ export default { ...@@ -127,7 +99,7 @@ export default {
} }
// { type: 'md-trash', id: '', name: '删除' } // { type: 'md-trash', id: '', name: '删除' }
], ],
contractId: '', // 委托id entrustId: '', // 委托id
showModal: false, showModal: false,
recordHis: false, recordHis: false,
searchOpen: true, searchOpen: true,
...@@ -146,7 +118,7 @@ export default { ...@@ -146,7 +118,7 @@ export default {
sampleId: '', sampleId: '',
dateList: [], dateList: [],
formObj: { formObj: {
name: undefined, entrustId: undefined,
sampleCode: undefined sampleCode: undefined
} }
} }
...@@ -302,7 +274,7 @@ export default { ...@@ -302,7 +274,7 @@ export default {
} }
}, },
_copyHisSample() { _copyHisSample() {
this.$refs.refModal._open(this.contractId) this.$refs.refModal._open(this.entrustId)
}, },
_iconClick(res, data, componentName, index) { _iconClick(res, data, componentName, index) {
...@@ -369,8 +341,8 @@ export default { ...@@ -369,8 +341,8 @@ export default {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.dateList = [] this.dateList = []
this.showModal = true this.showModal = true
this.contractId = id // 委托id this.formObj.entrustId = id // 委托id
console.log(this.contractId) console.log(this.entrustId)
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this._page() this._page()
}, },
...@@ -378,8 +350,8 @@ export default { ...@@ -378,8 +350,8 @@ export default {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.dateList = [] this.dateList = []
this.showModal = true this.showModal = true
this.contractId = id // 委托id this.formObj.entrustId = id // 委托id
console.log(this.contractId) console.log(this.entrustId)
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.recordHis = true this.recordHis = true
this._page() this._page()
...@@ -388,11 +360,7 @@ export default { ...@@ -388,11 +360,7 @@ export default {
this.$refs.pageTable._pageChange(1) this.$refs.pageTable._pageChange(1)
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) const result = await soilEntrust.pagePrepareHis(this.formObj)
this.formObj.entrustId = this.contractId
const result = await soilEntrust.pagePrepare(
this.$serializeForm(this.formObj)
)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
...@@ -438,7 +406,7 @@ export default { ...@@ -438,7 +406,7 @@ export default {
this.$refs.sampleManageEdit._open(data) this.$refs.sampleManageEdit._open(data)
} else { } else {
// 添加 // 添加
this.$refs.refModal._open('', this.contractId) this.$refs.refModal._open('', this.entrustId)
} }
}, },
// 添加编辑模拟样品 // 添加编辑模拟样品
...@@ -446,10 +414,10 @@ export default { ...@@ -446,10 +414,10 @@ export default {
if (edit) { if (edit) {
// 模拟样品的编辑 // 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝 const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.contractId) this.$refs.imitateModal._open(tempData, this.entrustId)
} else { } else {
// 模拟样品的添加 // 模拟样品的添加
this.$refs.imitateModal._open('', this.contractId) this.$refs.imitateModal._open('', this.entrustId)
} }
}, },
_search() { _search() {
...@@ -497,15 +465,6 @@ export default { ...@@ -497,15 +465,6 @@ export default {
} }
}) })
}, },
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.contractId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目 // 导入检测项目
_importItem() { _importItem() {
if (this.selectIds.length === 0) { if (this.selectIds.length === 0) {
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
:fixed="item.fixed?item.fixed:undefined" sortable> :fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span> <span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<div v-else-if="item.status">
{{ scope.row[item.key].display }}
</div>
<span v-else>{{scope.row[item.key]}}</span> <span v-else>{{scope.row[item.key]}}</span>
</template> </template>
</vxe-table-column> </vxe-table-column>
...@@ -193,7 +196,7 @@ export default { ...@@ -193,7 +196,7 @@ export default {
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj) console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageSamplePrepare(this.formObj) const result = await soilEntrust.pageSamplePrepareHis(this.formObj)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
......
...@@ -6,49 +6,50 @@ ...@@ -6,49 +6,50 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form id="search-form-rel-sample" :label-width="80" v-show="searchOpen" inline onsubmit="return false"> <Form v-show="searchOpen" id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:"> <Form-item class="search-item" label="委托商:">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input> <Input v-model="formObj.client" placeholder="请输入委托编号" clearable @on-enter="_formSearch"></Input>
</Form-item> </Form-item>
<Form-item class="search-item" label="样品名称:"> <Form-item class="search-item" label="委托编号:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input> <Input v-model="formObj.entrustCode" placeholder="请输入委托单位" clearable @on-enter="_formSearch"></Input>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button type="primary" @click="_formSearch">搜索</Button>
</Form-item> </Form-item>
</Form> </Form>
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true" <btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
class="contHide"> @on-result-change="_btnClick">
</btn-list> </btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETable <PTVXETable
ref="pageTable" ref="pageTable"
:tableHeight="tableHeight" :table-height="tableHeight"
@on-result-change="_tableResultChange" :get-page="getPage"
:getPage="getPage" :icon-msg="iconMsg"
select-data> @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
:field="item.key" :field="item.key"
:title="item.title" :title="item.title"
:min-width="item.width?item.width:200" :width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined" :fixed="item.fixed?item.fixed:undefined"
sortable sortable
> >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.contractId,scope.row.type)">{{scope.row[item.key]}}</a> <div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{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>
<div v-else-if="item.sampleDetail"><a @click.stop="_sampleDetailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a> <span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div> </div>
<div v-else>{{scope.row[item.key]}}</div> <div v-else>{{scope.row[item.key]}}</div>
</template> </template>
...@@ -59,30 +60,44 @@ ...@@ -59,30 +60,44 @@
</div> </div>
</div> </div>
<!--组件加载--> <!--组件加载-->
<!--打印(可填打印数量)-->
<!--选择领样人--> <!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo> <UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
<ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage>
<Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div> </div>
</template> </template>
<script> <script>
import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/AssignPerson' import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api' import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleManage from './entrust-sample-manage/SampleManageHis'
import ItemManage from './ItemManage'
export default { export default {
components: { components: {
UserInfo UserInfo,
SampleManage,
ItemManage,
Operation
}, },
data() { data() {
return { return {
formObj: { num: undefined, name: undefined }, formObj: {
iconMsgDis: [], client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [ iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
// { // {
// type: 'md-create', // type: 'md-create',
// id: '', // id: '',
// name: '编辑' // name: '编辑协议'
// }, // },
{ type: 'md-cloud', id: '', name: '附件' }, { type: 'md-cloud', id: '', name: '附件' },
// { type: 'md-trash', id: '', name: '删除' }, // { type: 'md-trash', id: '', name: '删除' },
...@@ -92,82 +107,50 @@ export default { ...@@ -92,82 +107,50 @@ export default {
name: '操作日志' name: '操作日志'
} }
], ],
// 操作列
sampleFile: {
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
sampleFileDis: {
type: 'cloud',
id: '',
name: '样品附件',
disabled: true
},
edit: {
type: 'compose',
id: 'rel-sample-receive-edit-sample',
name: '编辑'
},
del: {
type: 'trash-a',
id: 'rel-sample-receive-del-sample',
name: '删除'
},
copy: {
type: 'ios-copy',
id: 'rel-sample-receive-copy-sample',
name: '复制'
},
record: {
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodSampleRecord'
},
sampleDownloadContract: {
type: 'share',
id: 'food-sample-receive-sample-download-contract',
name: '导出委托协议'
},
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' }, { title: '委托商', key: 'client', width: 200 },
{ title: '试样深度', key: 'sampleDepth', width: 160 }, { title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 }, { title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '样品包装类型', key: 'samplePack', width: 160 }, { title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '现场编号', key: 'siteNo', width: 130 } { title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
], ],
searchOpen: false, searchOpen: false,
btn: [ btn: [
{ type: 'primary', id: 'ZBC', name: '接收并发放', componentName: '' } {
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
], ],
selectIds: [], selectIds: [],
selectData: [],
currentComponent: '', currentComponent: '',
printerVal: '', // 选择的打印机
standard: '',
stdList: [],
acceptSelectUserValue: '' acceptSelectUserValue: ''
} }
}, },
computed: { computed: {
tableHeight: function() { tableHeight: function() {
if (this.searchOpen) { if (this.searchOpen) {
return this.$tableHeight('', 340) return this.$tableHeight('tabSearch')
} else { } else {
return this.$tableHeight('tabNoSearch') return this.$tableHeight('tabNoSearch')
} }
} }
}, },
mounted() { mounted() {
// // 获取当前的执行标准下拉项 // 样品接收是否选择人员
// this._getStdList() // this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
}, },
methods: { methods: {
// 接收的返回保存
_userResult(data, msg) { _userResult(data, msg) {
const sendData = { const sendData = {
ids: this.selectIds.join(',') ids: this.selectIds.join(',')
...@@ -177,453 +160,243 @@ export default { ...@@ -177,453 +160,243 @@ export default {
sendData.personId = data.userId sendData.personId = data.userId
} }
switch (msg) { switch (msg) {
case 'relReceiveSendMan': case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放 // 一键接收并发放
this.$store this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData) .dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => { .then(() => {
this._resultSampleChange('接收并发放成功') this._resultChange('一键接收并发放成功')
}) })
break break
case 'relReceiveSendScanMan': case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放 // 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data) this.$refs.refModal._open('扫码接收发放', data)
break break
} }
}, },
// 抽样日期 // 一键接收并发放
_makeDateChange(data) {
$('input[name=samplingDateBegin]').val(data[0])
$('input[name=samplingDateEnd]').val(data[1])
},
// 组件返回值 // 组件返回值
_componentResult(data, msg) { _componentResult(data, msg) {
switch (this.currentComponent) { switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default: default:
this._page() this._page()
} }
}, },
_btnClick(msg, currentComponent, formTypeObj) { _btnClick(msg, componentName) {
this.currentComponent = currentComponent this.currentComponent = componentName
this.$nextTick(() => { this.$nextTick(() => {
switch (msg) { switch (msg) {
case 'search': case 'search':
this.searchOpen = !this.searchOpen this.searchOpen = !this.searchOpen
break break
default: default:
this._btnOption(msg, formTypeObj) this._btnOption(msg)
} }
}) })
}, },
// btn操作 // btn操作
_btnOption(msg, formTypeObj) { _btnOption(msg) {
console.log(msg)
switch (msg) { switch (msg) {
case '扫码接收并发放': case '一键接收':
// 根据字典判断是否选择人员 this._oneKeyReceive()
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('relReceiveSendScanMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '接收并发放':
this._submitSend()
break break
case '添加': case '一键发放':
if (formTypeObj.uri === 'DLTB-contract-reg') { this._oneKeySend()
this.currentComponent = 'FoodContractCompanyEditByDLTB'
} else if (formTypeObj.uri === 'HES-company-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByHES'
} else {
this.currentComponent = 'FoodContractCompanyEdit'
}
this.$nextTick(() => {
this.$refs.refModal._openReceive()
})
break break
case '导入检测项目': case '一键接收并发放':
this._importItem() this._oneKeyReceiveSend()
break break
case '导入检测项目包': case '扫码接收':
this._importItemPackage() this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break break
case '复制历史样品检测项目': case '扫码发放':
this._copyHisItem() this._scanSend('sampleSendScanMan')
break break
case '删除': case '扫码接收并发放':
this._deleteSelected() this._scanSend('sampleReceiveSendScanMan')
break break
case '打印标签': case '信息维护':
this._selectPrinter('print-label') this._maintainInfo()
break break
case '自定义打印': case '登记协议':
if (this.selectData.length === 0) { this._editModals(msg)
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
break break
} }
}, },
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据, // 扫码接收并发放
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写 _scanSend(msg) {
_cusTomePrint() { if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
this.$store // 扫码接收并发放判断是够选人
.dispatch('FoodSample/preparationButton', { if (this.acceptSelectUserValue === '是') {
sampleIds: this.selectIds.join(',') this.$refs.userModal._open(msg, '请选择领样人')
}) } else {
.then(() => { this.$refs.refModal._open('扫码发放')
const result = this.$store.state.FoodSample.list }
for (let i = 0; i < result.length; i++) { } else {
// 样品制备保存方式 // 其他
result[i].saveWay = '' this.$refs.userModal._open(msg, '请选择领样人')
} }
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
}, },
// 接收并发放 // 一键接收并发放
_submitSend() { _oneKeyReceiveSend() {
if (this.selectIds.length === 0) { if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!') this.$msgTip('warning', '请至少选择一条数据!')
} else { } else {
const data = { // 根据字典是否选择人员
ids: this.selectIds.join(',') // eslint-disable-next-line no-lonely-if
}
if (this.acceptSelectUserValue === '是') { if (this.acceptSelectUserValue === '是') {
// 根据字典接收并发放 // 选择人员接收并发放
this.$store this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data) .dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => { .then(() => {
const result = this.$store.state.FoodSample.success const result = this.$store.state.FoodContract.success
if (result) { if (result) {
// 验证成功 // 验证成功
this.$refs.userModal._open('relReceiveSendMan', '请选择领样人') this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
} }
}) })
} else { } else {
// 不选择人员
this.$store this.$store
.dispatch('FoodSample/sampleReceiveSend', data) .dispatch('FoodContract/oneKeyReceiveSend', {
.then(() => { ids: this.selectIds.join(',')
this._resultSampleChange('接收并发放成功')
})
}
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
/* this.$Modal.confirm({
title: '提示',
content: '确定导出所有记录?',
onOk: () => {
http.open('/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids);
}
}); */
} else {
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
// 单个删除
_deleteById(id) {
this._deleteByIds([id], '确定删除该条记录?')
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultSampleChange('删除成功!')
}) })
} .then(() => {
this._resultChange('一键接收并发放成功')
}) })
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
} }
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
} }
}, },
// 导入检测项目 // 一键发放
_importItem() { _oneKeySend() {
if (this.selectIds.length === 0) { if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!') this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else { } else {
this.$refs.refModal._open(this.selectIds) // 一键发放判断是否选人
} // eslint-disable-next-line no-lonely-if
}, if (this.acceptSelectUserValue === '是') {
_iconClick(res, data, currentComponent, rowIndex, obj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
if (data.type === 0) {
// 企业--编辑的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
this.$store
.dispatch('FoodSample/companyPage', {
contractId: data.contractId
})
.then(() => {
const num = this.$store.state.FoodSample.companyPage
.total
if (num <= 1) {
// 无配置表单 委托的编辑界面
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store this.$store
.dispatch('FoodContract/getBySampleId', data.id) .dispatch('FoodContract/oneKeySendCheck', {
.then(() => { ids: this.selectIds.join(',')
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
}) })
} else {
// 样品的编辑界面
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => { .then(() => {
this.$refs.refModal._open( if (this.$store.state.FoodContract.success) {
this.$store.state.FoodSample.companyModel, this.$refs.userModal._open('contractSendMan', '请选择领样人')
data.contractId,
'receive-his-wait'
)
})
})
} }
}) })
} else if ( } else {
result.length === 1 && // 一键发放
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store this.$store
.dispatch('FoodContract/getBySampleId', data.id) .dispatch('FoodContract/oneKeySend', {
.then(() => { ids: this.selectIds.join(',')
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
}) })
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => { .then(() => {
this.$refs.refModal._openReceive( this._resultChange('发放成功')
this.$store.state.FoodContract.model
)
})
}) })
} }
})
} else if (data.type === 1) {
// 政府--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
} else {
// 粮油--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
} }
break },
case '删除': // 一键接收
this._deleteById(data.id) _oneKeyReceive() {
break if (this.selectIds.length === 0) {
case '复制': this.$msgTip('warning', '请至少选择一条数据!')
if (data.type === 0) { } else {
// 企业--复制的是委托和样品信息 this.$Modal.confirm({
title: '提示',
this.$store content:
.dispatch('SysForm/getByBtnCode', obj.btnId) '确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
.then(() => { onOk: () => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
// 无配置表单
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store this.$store
.dispatch('FoodContract/getBySampleId', data.id) .dispatch('FoodContract/oneKeyReceive', {
.then(() => { ids: this.selectIds.join(',')
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
}) })
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => { .then(() => {
this.$refs.refModal._openReceiveCopy( this._resultChange('接收成功')
this.$store.state.FoodContract.model
)
})
}) })
} }
}) })
} else if (data.type === 1) { }
// 政府--只是复制样品信息 },
this.currentComponent = 'FoodSampleGovernEdit' // 信息维护
this.$nextTick(() => { _maintainInfo() {
this.$store if (this.selectIds.length === 0) {
.dispatch('FoodSample/getByGovernId', data.id) this.$Message.warning('请至少选择一条数据!')
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else { } else {
// 粮油--只是复制样品信息 this.currentComponent = 'MaintainInfoModal'
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => { this.$nextTick(() => {
this.$store this.$refs.refModal._open(this.selectIds, 1)
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
}) })
} }
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break break
case '操作日志': case '项目管理':
this._operationRecord(data.id) this.$refs.itemManageModal._open(data.id)
break break
case '导出委托协议': case '编辑协议':
// this.$Modal.confirm({ this._editModals(res, data)
// title: '提示',
// content: '确认要下载委托单?',
// onOk: () => {
// http.open('/food/v1/sample/export_sample_form?id=' + data.id);
// }
// });
this._downContractForm(data.id)
break break
case '样品附件': case '附件':
this._upload(data.id) this._upload(data.id)
break break
case '操作日志':
this._operationRecord(data.id)
break
} }
}) })
}, },
_downContractForm(id) { _editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store this.$store
.dispatch( .dispatch('FoodContract/verificationEdit', { id: data.id })
'ReportExport/getById',
'food-sample-receive-sample-download-contract'
)
.then(() => { .then(() => {
if (this.$store.state.ReportExport.model) { if (this.$store.state.FoodContract.model === true) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) { this.$refs.editModal._open(res, data)
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
} }
}) })
}
}, },
_tableResultChange(msg, data) { _tableResultChange(msg, data) {
switch (msg) { switch (msg) {
case 'page': case 'page':
this.getPage = this.$store.state.FoodSample.page this.getPage = this.$store.state.FoodContract.page
break break
case 'selectData': case 'selectIds':
this.selectData = data this.selectIds = data
this.selectIds = [] break
for (let i = 0; i < data.length; i++) { case 'iconClick':
this.selectIds.push(data[i].id) this._iconClick(data.name, data.rowData, data.componentName)
}
break break
case 'changeSize': case 'changeSize':
this._page() this._page()
...@@ -635,9 +408,8 @@ export default { ...@@ -635,9 +408,8 @@ export default {
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log(this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj) console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageReceive( const result = await soilEntrust.pageSampleReceiveHis(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
...@@ -645,9 +417,9 @@ export default { ...@@ -645,9 +417,9 @@ export default {
this.getPage = result this.getPage = result
} }
}, },
// 查看委托 _detailModal(id, type) {
_detailModal(contractId, type) { // 查看
this.$store.dispatch('FoodContract/getById', contractId).then(() => { this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) { if (type === 0) {
// 企业委托 ’0‘ // 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail' this.currentComponent = 'FoodContractCompanyDetail'
...@@ -660,34 +432,12 @@ export default { ...@@ -660,34 +432,12 @@ export default {
}) })
}) })
}, },
// 查看样品
_sampleDetailModal(id, type) {
if (type === 0) {
// 政府
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
} else {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
}
},
_editModal(id, type) {
this.$refs.refModal._open(id, type)
},
_search() { _search() {
this._page() this._page()
}, },
_operationRecord(id) { _operationRecord(id) {
// 操作日志 // 操作日志
this.$refs.refModal._open(id) this.$refs.operation._open(id)
}, },
_resultChange(msg) { _resultChange(msg) {
if (this.$store.state.FoodContract.success) { if (this.$store.state.FoodContract.success) {
...@@ -696,58 +446,9 @@ export default { ...@@ -696,58 +446,9 @@ export default {
this.selectIds = [] this.selectIds = []
} }
}, },
_resultSampleChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) { _upload(id) {
// 上传文件 // 上传文件
this.$refs.refModal._open(id, 'sampleId') this.$refs.FileManage._open(id, 'entrustId')
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.standard = data
break
case 'query':
this.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-form-rel-sample'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
} }
} }
} }
......
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait-scan" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</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">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
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.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$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>
<!--选择领样人-->
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
btn: [],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
entrustId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
entrustId: undefined
},
searchOpen: true
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// this._getStdList()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'sampleSendMan':
// 发放
this.$store.dispatch('FoodSample/submitSend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'sampleScanSend':
// 扫码接收并发放
this.$refs.refModal._open('扫码发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
const result = await soilEntrust.pageSendHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '打印标签':
this._selectPrinter('print-label')
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.selectIds = []
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</script>
...@@ -11,9 +11,6 @@ ...@@ -11,9 +11,6 @@
<el-tab-pane label="待发放样品" name="waitScan"> <el-tab-pane label="待发放样品" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan> <WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="已接样样品" name="alreadyIssued">
<AlreadyIssued ref="alreadyIssuedModal"></AlreadyIssued>
</el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
</Modal> </Modal>
...@@ -21,13 +18,11 @@ ...@@ -21,13 +18,11 @@
</template> </template>
<script> <script>
import WaitReceive from './WaitReceive' import WaitReceive from './WaitReceive'
import AlreadyIssued from './AlreadyIssued'
import WaitScan from './WaitScan' import WaitScan from './WaitScan'
export default { export default {
components: { components: {
WaitReceive, WaitReceive,
AlreadyIssued,
WaitScan WaitScan
}, },
data() { data() {
......
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header"> {{name}}--管理样品</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="接收历史" name="waitReceive">
<WaitReceive ref="waitReceiveModal" @on-result-change="_search"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="发放历史" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './WaitReceiveHis'
import WaitScan from './AlreadyIssuedHis'
export default {
components: {
WaitReceive,
WaitScan
},
data() {
return {
type: '',
entrustId: '', // 合同id
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: ''
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(entrustId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = entrustId // 合同id
this.activeName = 'waitReceive'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId, this.type)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId, this.type)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.entrustId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'alreadyIssued') {
this._issuedPage()
} else if (tab.name === 'waitReceive') {
this._waitPage()
} else if (tab.name === 'waitScan') {
this._waitSend()
}
},
_search() {
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</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">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:table-height="tableHeight"
: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.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$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>
<!--选择领样人-->
<SampleReceiveModal ref="locationModal" @on-result-change="_page()"></SampleReceiveModal>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
import SampleReceiveModal from '../SampleReceiveModal'
import SoilSampleItemManage from './SoilSampleItemManage'
export default {
components: { SampleReceiveModal, SoilSampleItemManage },
data() {
return {
btn: [
// { type: 'primary', id: '', name: '收样室收样' }
],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
iconMsg: [{ type: 'ios-list', id: '', name: '试验项目' }],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
name: undefined,
entrustId: ''
},
searchOpen: true,
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
// this._getStdList()
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(','),
contractId: this.contractId
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'sampleMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
console.log('待接收样品')
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
const result = await soilEntrust.pageReceiveHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '试验项目':
this._itemManage(data.id)
break
case '复制':
this._copySample(data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '添加':
this._editModal(false)
break
case '接收并发放':
this._submitSend()
break
case '扫码接收':
this.$refs.refModal._open()
break
case '扫码接收并发放':
if (this.acceptSelectUserValue === '是') {
// 扫码接收并发放根据字典是否选人
this.$refs.userModal._open('sampleMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '收样室收样':
this._sampleReceive(this.selectIds)
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this._cusTomePrint()
}
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据,
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写
_cusTomePrint() {
this.$store
.dispatch('FoodSample/preparationButton', {
sampleIds: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
for (let i = 0; i < result.length; i++) {
// 样品制备保存方式
result[i].saveWay = ''
}
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
},
// 接收并发放
_submitSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
// 判断接收发放是否选人
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data)
.then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'sampleReceiveSendMan',
'请选择领样人'
)
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultChange('接收发放成功')
})
}
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择数据进行导出')
} else {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_deleteById(id) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', id).then(() => {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 添加与编辑
_editModal(edit, data) {
if (edit) {
// 编辑
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.contractId,
'receive-his-wait'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-his-wait')
})
}
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</script>
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