Commit 6218d051 by wangweidong

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

parents 0cb96a75 6536f21f
function test() {
console.log(123)
}
function waveImg(dataPersonal) {
const xData = []
const yData = []
const sevenList = dataPersonal
for (let i = 0; i < sevenList.length; i++) {
const obj = sevenList[i]
xData.push(obj.dayIns)
yData.push(obj.insNum)
}
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('waveImg'))
myChart.setOption({
title: {
text: ''
},
tooltip: {},
xAxis: {
data: xData,
boundaryGap: false,
show: false,
splitLine: {
show: false
}
},
yAxis: {
show: false,
splitLine: {
show: false
}
},
series: [
{
name: '',
type: 'line',
smooth: true,
areaStyle: {},
itemStyle: {
normal: {
color: 'lightblue', // 圈圈的颜色
lineStyle: {
color: 'lightblue' // 线的颜色
}
}
},
data: yData
}
],
grid: {
top: 30,
// left: 0,
height: 60
}
})
// setTimeout(() => {
// myChart.resize()
// }, 1000)
}
function histogram(listSevenReceive) {
const xData = []
const yData = []
const sevenList = listSevenReceive
for (let i = 0; i < sevenList.length; i++) {
const obj = sevenList[i]
xData.push(obj.dayIns)
yData.push(obj.insNum)
}
console.log(xData)
console.log(yData)
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('histogram'))
myChart.setOption({
title: {
text: ''
},
tooltip: {},
xAxis: {
data: xData,
type: 'category',
boundaryGap: true,
show: false,
splitLine: {
show: false
}
},
yAxis: {
show: false,
splitLine: {
show: false
}
},
series: [
{
name: '',
type: 'bar',
smooth: true,
areaStyle: {},
itemStyle: {
normal: {
color: 'lightblue', // 圈圈的颜色
lineStyle: {
color: 'lightblue' // 线的颜色
}
}
},
data: yData
}
],
grid: {
top: 30,
// left: 0,
height: 60
}
})
}
function saleImg(itemNotOk) {
const xData = []
const yData = []
const sevenList = itemNotOk
for (let i = 0; i < sevenList.length; i++) {
const obj = sevenList[i]
xData.push(obj.name)
yData.push(obj.number)
}
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('saleImg'))
myChart.setOption({
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: xData,
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '不合格数量',
type: 'bar',
barWidth: '60%',
data: yData
}
]
})
}
function salesTrendImg(sampleList) {
const xData = []
const yData = []
const sevenList = sampleList
for (let i = 0; i < sevenList.length; i++) {
const obj = sevenList[i]
xData.push(obj.name)
yData.push(obj.number)
}
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('salesTrendImg'))
myChart.setOption({
color: ['lightblue'],
tooltip: {
trigger: 'axis',
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
top: 10,
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: xData,
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '',
type: 'bar',
barWidth: '60%',
data: yData
}
]
})
}
function visitImg(data) {
const xData = []
const yData = []
const zData = []
const sevenList = data.sampleRank
const sevenListItem = data.itemRank
for (let i = 0; i < sevenList.length; i++) {
const obj = sevenList[i]
xData.push(obj.name)
yData.push(obj.number)
}
for (let i = 0; i < sevenListItem.length; i++) {
const obj = sevenListItem[i]
zData.push(obj.number)
}
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('visitImg'))
myChart.setOption({
title: {
// text: '折线图堆叠'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['报检量', '项目量']
},
grid: {
top: 20,
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
// height: 320
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: xData
},
yAxis: {
type: 'value'
},
series: [
{
name: '报检量',
type: 'line',
data: yData
},
{
name: '项目量',
type: 'line',
data: zData
}
]
})
console.log('js加载完成')
}
export { test, waveImg, histogram, saleImg, salesTrendImg, visitImg }
...@@ -30,3 +30,4 @@ export { default as soilAptitude } from './soil/soil-aptitude' ...@@ -30,3 +30,4 @@ export { default as soilAptitude } from './soil/soil-aptitude'
export { default as soilEntrust } from './soil/soil-entrust' export { default as soilEntrust } from './soil/soil-entrust'
export { default as soilSample } from './soil/soil-sample' export { default as soilSample } from './soil/soil-sample'
export { default as soilTest } from './soil/soil-test' export { default as soilTest } from './soil/soil-test'
export { default as soilStatistics } from './soil/soil-statistics'
/**
* 工作台
*/
import http from '../http'
// import { https } from '../https'
export default {
// 检测依据管理
standardPage: data =>
http.post('soil/v1/standard/page', data).then(res => res),
standardGetById: data =>
http.get('soil/v1/standard/' + data).then(res => res),
standardSave: data => http.post('soil/v1/standard/', data).then(res => res),
standardEdit: data =>
http.put('soil/v1/standard/' + data.id, data.obj).then(res => res),
standardDeleteById: data =>
http.delete('soil/v1/standard/?ids=' + data).then(res => res),
// 试验项目
// page
page: data => http.post('soil/v1/aptitude_exp/page', data).then(res => res),
getById: data => http.get('soil/v1/aptitude_exp/' + data).then(res => res),
deleteById: data =>
http.delete('soil/v1/aptitude_exp/?ids=' + data).then(res => res),
// 保存
save: data => http.post('soil/v1/aptitude_exp/', data).then(res => res),
edit: data =>
http.put('soil/v1/aptitude_exp/' + data.id, data.obj).then(res => res),
// 指标页面
expItemPage: data =>
http.post('soil/v1/exp_item/page', data).then(res => res),
expItemDeleteByIds: data =>
http.delete('soil/v1/exp_item/?ids=' + data).then(res => res),
expItemSave: data => http.post('soil/v1/exp_item/', data).then(res => res),
expItemEdit: data =>
http.put('soil/v1/exp_item/' + data.id, data.obj).then(res => res),
expItemGetById: data => http.get('soil/v1/exp_item/' + data).then(res => res)
}
...@@ -43,5 +43,23 @@ export default { ...@@ -43,5 +43,23 @@ export default {
.post('/env/v1/env_item/search_all_common_sample_count', data) .post('/env/v1/env_item/search_all_common_sample_count', data)
.then(res => res), .then(res => res),
saveItem: data => saveItem: data =>
http.post('/env/v1/env_item/save_form_for_item', data).then(res => res) http
.post('soil/v1/original_record/save_original_record', data)
.then(res => res),
recordPage: data =>
http.post('soil/v1/original_record/page', data).then(res => res),
pageTest: data =>
http.post('soil/v1/experiment/page_test', data).then(res => res),
updateItem: data =>
http
.post('soil/v1/original_record/update_original_record', data)
.then(res => res),
pageOriginalExp: data =>
http.post('soil/v1/experiment/page_original_exp', data).then(res => res),
// 查看指标分页列表
itemPage: data => http.post('soil/v1/item/page', data).then(res => res),
itemSave: data => http.post('soil/v1/item/', data).then(res => res),
itemEdit: data =>
http.put('soil/v1/item/' + data.id, data.obj).then(res => res),
itemGetById: data => http.get('soil/v1/item/' + data).then(res => res)
} }
...@@ -27,6 +27,9 @@ module.exports = { ...@@ -27,6 +27,9 @@ module.exports = {
{ {
src: src:
'http://static.patzn.com/thirdparty/ztree/zTree_v3-3.5.29/js/jquery.ztree.all.min.js' 'http://static.patzn.com/thirdparty/ztree/zTree_v3-3.5.29/js/jquery.ztree.all.min.js'
},
{
src: 'http://static.patzn.com/thirdparty/layx/layx-2.5.3.min.js'
} }
], ],
link: [ link: [
...@@ -52,7 +55,11 @@ module.exports = { ...@@ -52,7 +55,11 @@ module.exports = {
rel: 'stylesheet', rel: 'stylesheet',
href: 'http://static.patzn.com/theme/my-theme/main.css' href: 'http://static.patzn.com/theme/my-theme/main.css'
}, },
{ rel: 'stylesheet', href: '', name: 'theme' } { rel: 'stylesheet', href: '', name: 'theme' },
{
rel: 'stylesheet',
href: 'http://static.patzn.com/thirdparty/layx/layx-2.5.3.min.css'
}
] ]
}, },
......
...@@ -121,10 +121,7 @@ export default { ...@@ -121,10 +121,7 @@ export default {
return { return {
formId: 'SampleItemManage', formId: 'SampleItemManage',
currentComponent: '', currentComponent: '',
btn: [ btn: [],
{ type: 'success', id: '', name: '提交分包' },
{ type: 'success', id: '', name: '取消分包' }
],
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }], iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }],
sampleId: '', // 样品id sampleId: '', // 样品id
showModal: false, showModal: false,
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<!-- 表格 --> <!-- 表格 -->
<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"> :get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -90,21 +90,21 @@ export default { ...@@ -90,21 +90,21 @@ export default {
formId: 'soilSampleManage', formId: 'soilSampleManage',
currentComponent: '', currentComponent: '',
btn: [ btn: [
{ // {
type: 'success', // type: 'success',
id: '', // id: '',
name: '导入检测项目' // name: '导入检测项目'
}, // }
{ // {
type: 'success', // type: 'success',
id: '', // id: '',
name: '导入检测项目包' // name: '导入检测项目包'
}, // },
{ // {
type: 'success', // type: 'success',
id: '', // id: '',
name: '打印标签' // name: '打印标签'
} // }
], ],
itemList: [], itemList: [],
indexList: [], indexList: [],
......
...@@ -314,7 +314,7 @@ export default { ...@@ -314,7 +314,7 @@ export default {
_upload(id) { _upload(id) {
// 上传文件 // 上传文件
this.$refs.FileManage._open(id, 'contractId') this.$refs.FileManage._open(id, 'entrustId')
}, },
_exportEntrust(id) { _exportEntrust(id) {
this.$Modal.confirm({ this.$Modal.confirm({
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
import { soilEntrust } from '../../../api' import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation' import Operation from '../../../components/operation/Operation'
import Reason from '../../../components/base/Reason' import Reason from '../../../components/base/Reason'
import SampleManage from '../SoilSampleManage'
import EntrustDetail from './EntrustDetail' import EntrustDetail from './EntrustDetail'
import SampleManage from './SampleManage'
export default { export default {
components: { Operation, Reason, EntrustDetail, SampleManage }, components: { Operation, Reason, EntrustDetail, SampleManage },
data() { data() {
...@@ -313,7 +313,7 @@ export default { ...@@ -313,7 +313,7 @@ export default {
_upload(id) { _upload(id) {
// 上传文件 // 上传文件
this.$refs.FileManage._open(id, 'contractId') this.$refs.FileManage._open(id, 'entrustId')
} }
// _getById: async function(id) { // _getById: async function(id) {
// const result = await meterSubcontractor.getById(id) // const result = await meterSubcontractor.getById(id)
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
</div> </div>
</template> </template>
<script> <script>
import { soilEntrust } from '../../../api'
export default { export default {
components: { components: {
// FoodSampleGovernDetail, // FoodSampleGovernDetail,
...@@ -136,14 +137,11 @@ export default { ...@@ -136,14 +137,11 @@ export default {
selectData: [], selectData: [],
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '样品编号', key: 'code', width: 140 }, { title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '样品名称', key: 'name', width: 140 }, { title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '型号规格', key: 'spec', width: 140 }, { title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 }, { title: '样品包装类型', key: 'samplePack', width: 160 },
// { title: '检测项目', key: 'itemNames', width: 140 }, { title: '现场编号', key: 'siteNo', width: 130 }
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
], ],
dateList: [], dateList: [],
formObj: { formObj: {
...@@ -259,8 +257,15 @@ export default { ...@@ -259,8 +257,15 @@ export default {
_formSearch() { _formSearch() {
this.$refs.pageTable._pageChange(1) this.$refs.pageTable._pageChange(1)
}, },
_page() { _page: async function() {
console.log(123) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.samplePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
}, },
// _page: async function() { // _page: async function() {
// this.selectIds = [] // this.selectIds = []
......
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="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.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<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 v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
export default {
components: {
UserInfo,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ 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,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// 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 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_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
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_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 soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按委托编制" name="check">
<ReportMakeByEntrust ref="checkTabs"></ReportMakeByEntrust>
</el-tab-pane>
<el-tab-pane label="历史报告" name="checkHis">
<ReportMakeHis ref="checkHisTabs"></ReportMakeHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import ReportMakeByEntrust from './tabs/ReportMakeByEntrust'
import ReportMakeHis from './ReportMakeHis'
export default {
components: {
ReportMakeByEntrust,
ReportMakeHis
},
data() {
return {
activeName: 'check'
}
},
mounted() {
this.activeName = 'check'
this.$refs.checkTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'check') {
this.$refs.checkTabs._open()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.checkHisTabs._page()
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<Modal v-model="showModal" :width="100" class="modal-footer-none modal-top-0">
<p slot="header">{{modalTitle}}</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="样品台账" name="sample">
<ReportMakeBySample ref="sampleTabs" @on-result-change="_sampleTabResult"></ReportMakeBySample>
</el-tab-pane>
<el-tab-pane label="报告台账" name="report">
<ReportInfoMake ref="reportTabs"></ReportInfoMake>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import ReportInfoMake from './tabs/ReportInfoMake'
import ReportMakeBySample from './tabs/ReportMakeBySample'
export default {
components: {
ReportMakeBySample,
ReportInfoMake
},
data() {
return {
showModal: false,
modalTitle: '',
activeName: '',
contractId: '',
type: '',
personal: ''
}
},
computed: {
tableHeight: function() {
return document.documentElement.clientHeight - 135
}
},
methods: {
_open(contractId, title, type, personal) {
this.modalTitle = '管理样品和报告'
this.showModal = true
this.activeName = 'sample'
this.contractId = contractId
this.type = type
this.personal = personal
// 先初始化样品台账的数据
// this.$nextTick(() =>
// this.$refs.sampleTabs._getPage(
// this.contractId,
// this.type,
// this.personal
// )
// )
// this._sampleData(contractId)
},
// 判断待编样品是否为0
_sampleData(contractId) {
const data = {
contractId: contractId,
onlyReportMake: 1,
reported: 0,
page: 1,
rows: 50,
personal: this.personal
}
this.$store.dispatch('FoodSample/pageSampleReportMake', data).then(() => {
const records = this.$store.state.FoodSample.page.records
if (records.length === 0) {
this.activeName = 'report'
this.$nextTick(() => this._report())
} else {
this.activeName = 'sample'
this.$nextTick(() =>
this.$refs.sampleTabs._getPage(
this.contractId,
this.type,
this.personal
)
)
}
})
},
_report() {
this.$refs.reportTabs._open(this.contractId, this.personal)
},
_sample() {
this.$refs.sampleTabs._open(this.contractId, this.type, this.personal)
},
_changeTabs(tab, event) {
switch (tab.name) {
case 'sample':
this._sample()
break
case 'report':
this._report()
break
}
},
_sampleTabResult(msg) {
if (msg === 'changeTab') {
this.activeName = 'report'
this.$refs.reportTabs._open(this.contractId, this.personal)
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="报告编号:">
<Input @on-enter="_formSearch" v-model="formObj.reportSn" placeholder="请输入报告编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" v-model="formObj.sampleNum" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.sampleName" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-item" label="任务来源:">
<Input @on-enter="_formSearch" v-model="formObj.taskSource" placeholder="请输入任务来源" clearable/>
</Form-item>
<Form-item label="细类:" class="search-item" style="margin-left: 8px">
<Input @on-enter="_formSearch" v-model="formObj.detectType"
placeholder="请输入细类" clearable/>
</Form-item>
<Form-item label="已推国抽:" class="search-item">
<Select v-model="formObj.dataPushed" clearable placeholder="请选择是否已推国抽">
<Option v-for="item in dataPushedList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="应出报告日期:" class="search-item">
<Date-picker :editable="false" @on-change="_reportDateChange" v-model="dateList"
type="daterange" placeholder="应出报告日期" format="yyyy-MM-dd"
style="width:100%" placement="bottom-start"></Date-picker>
<input v-model="formObj.reportDueDateBegin" type="hidden">
<input v-model="formObj.reportDueDateEnd" type="hidden">
</Form-item>
<Form-item class="search-item" label="结果判定:">
<Select v-model="formObj.notOkCount" clearable placeholder="请选择结果判定">
<Option v-for="item in notOkCountList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<BtnList :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
<!--切换待认领任务-->
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.personal" @change="_page" :true-label="1" :false-label="0"
size="medium">
个人任务
</el-checkbox>
</div>
</template>
</BtnList>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg" :tableName="tableName" :rows="100"
select-data is-report>
<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 (userColumns.length>0?userColumns: pageColumns)"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'): ''}}
</div>
<div v-else-if="item.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'): ''}}
</div>
<div v-else-if="item.judge">{{Number(scope.row[item.key])===1?'是':'否'}}
</div>
<div v-else-if="item.notOkCount">
<span v-if="scope.row[item.key] === 0" class="blue-color">合格</span>
<span v-else class="red-color">不合格</span>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row[item.key].display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<template slot="setting">
<VXESettingCol :pageColumns="pageColumns" :userColumns="userColumns" @on-result-change="_resetColumn"
:table-name="tableName"></VXESettingCol>
</template>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<Modal v-model="showIssueModal" @on-cancel="_issueCancel"
@on-ok="_issueOk"
class="zIndex-1100">
<p slot="header">请选择签发日期</p>签发日期:
<DatePicker :editable="false"
v-model="issueDateTemp"
@on-change='_issueChange'
placeholder="请选择签发日期"
style="width:400px">
</DatePicker>
</Modal>
</div>
</template>
<script>
import global from '../../../../api/config'
import http from '../../../../api/http'
import { soilTest } from '../../../../api'
/**
* 报告编制的-待办-报告台账
*/
export default {
components: {},
data() {
return {
notOkCountList: [
{ value: 0, name: '合格' },
{ value: 1, name: '不合格' }
],
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-submit-to-gc-platform-by-contract',
name: '推送至国抽平台'
},
{ type: 'primary', id: 'food-report-make-submit', name: '提交' },
{
type: 'primary',
id: 'food-report-make-to-pdf',
name: '盖章',
componentName: 'SignatureToPDF'
},
{
type: 'primary',
id: 'food-report-make-to-auditor',
name: '选择审核人',
componentName: 'AssignPerson'
},
{
type: 'primary',
id: 'food-report-make-submit-to-issue',
name: '提交至报告签发'
},
{
type: 'success',
id: 'food-report-make-batch-create-report',
name: '重新生成',
componentName: 'ReportTemplateModal'
},
{
type: 'error',
id: 'food-report-make-batch-del-report',
name: '删除'
},
{ id: 'food-report-make-batch-down', name: '下载' },
{ id: 'food-report-make-batch-achieve-by-contract', name: '完成' },
{
id: 'food-report-make-batch-overdue-reason',
name: '记录报告超期原因',
componentName: 'Reason'
},
{
id: 'food-report-make-edit-report-aptitude',
name: '修改报告资质要求',
componentName: 'EditReportAptitude'
}
],
getPage: {},
pageColumns: [
{ title: '报告编号', key: 'reportSn', width: 180, fixed: 'left' },
{ title: '样品编号', key: 'sampleNum', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 160 },
{ title: '是否合格', key: 'notOkCount', width: 120, notOkCount: true },
{ title: '信息维护状态', key: 'infoMaintain', width: 130 },
{ title: '应出报告日期', key: 'reportDate', width: 120, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{ title: '已盖章', key: 'signStatus', width: 100 },
{ title: '盖章类型', key: 'signType', width: 180 },
{ title: '所需资质', key: 'aptitudeType', width: 180 },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 120 },
{ title: '任务来源', key: 'taskSource', width: 120 },
{ title: '已推国抽', key: 'dataPushed', width: 150, judge: true },
{ title: '报告语言', key: 'reportType', width: 120 },
{ title: '报告要求', key: 'reportRequire', width: 120 },
{ title: '是否带照片', key: 'havePhoto', width: 120, judge: true },
{ title: '编制人', key: 'maker', width: 100 },
{ title: '编制时间', key: 'makDate', width: 140, dateTime: true },
{ title: '样品备注', key: 'sampleRemark' },
{ title: '委托备注', key: 'contractRemark' }
],
selectIds: [],
selectData: [],
formObj: {
contractId: '',
reportSn: '',
sampleNum: '',
sampleName: '',
taskSource: '',
detectType: '',
reportDateBegin: '',
reportDateEnd: '',
notOkCount: '',
personal: 0,
dataPushed: ''
},
dateList: [],
iconMsg: [
{ type: 'ios-book', id: '', name: '预览/编辑报告' },
// {
// type: 'loop',
// id: '',
// name: '重新生成',
// componentName: 'ReportTemplateModal'
// },
{
type: 'ios-document',
id: '',
name: '项目台账',
componentName: 'ItemModalByReportMake'
},
{
type: 'ios-cloud-upload',
id: '',
name: '上传',
componentName: 'UploadByReport'
},
// {
// type: 'information-circled',
// id: '',
// name: '历史版本',
// componentName: 'HisRevision'
// },
{
type: 'cloud',
id: '',
name: '附件',
componentName: 'ReportFileManage'
},
{
type: 'ios-clock',
id: '',
name: '操作记录',
componentName: 'FoodReportRecord'
}
],
// 签发日期
issueDateTemp: '',
issueDate: '',
showIssueModal: false,
reportId: '',
tempId: '',
reportType: 'FOOD_REPORT_MAKE',
// 批量还是单个生成报告
reportBatch: false,
reportBatchData: {},
dataPushedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
userColumns: [],
tableName: 'food-report-make-report-info-by-contract',
reportStatus: 'FLOW_REPORT_MAKE'
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 盖章
_toPDF() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_reportDateChange(data) {
this.formObj.reportDueDateBegin = data[0]
this.formObj.reportDueDateEnd = data[1]
},
// 签发日期
_issueChange(data) {
if (data) {
this.issueDate = data
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'Reason':
this._overdueReason(data)
break
case 'ReportTemplateModal':
this._regenerate(data)
break
case 'AssignPerson':
this._auditorResult(data)
break
default:
this._page()
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '上传':
this._upload(data.id)
break
case '重新生成':
this.$refs.refModal._open(data)
break
case '预览/编辑报告':
this._viewReport(data.id)
break
case '操作记录':
this._record(data.id)
break
case '项目台账':
this.$refs.refModal._open(data.id)
break
case '历史版本':
this.$refs.refModal._open(data.id, this.reportType)
break
case '附件':
this.$refs.refModal._open(data.id, 'reportId')
break
case '档案查看':
this.reportViewFiles(data, {
location: 'report',
archivesType: 'reportManage'
})
break
}
})
},
_upload(id) {
this.$refs.refModal._open(id)
},
_viewReport(id) {
this.$store.dispatch('FoodSampleReport/viewReport', id).then(() => {
const data = this.$store.state.FoodSampleReport.page
if (data !== undefined) {
// 查询token,后台使用pageoffice调接口查询数据,需要token,否则提示未登录
this.$store.dispatch('Redirect/getAccessToken').then(() => {
const token = this.$store.state.Redirect.str
if (token) {
if (localStorage.getItem('reportReadOnly')) {
// 只读
this.$openWindowModeless({ objectKey: data.objectKey, id: id })
} else {
// 编辑
this.$openWindowModeless({
objectKey: data.objectKey,
id: id,
isReport: 1,
token: token,
reportStatus: this.reportStatus
})
}
}
})
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.reportBatch = false
this.reportBatchData = {}
this.getPage = this.$store.state.FoodSampleReport.page
break
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 'table-col':
this.userColumns = data
break
case 'changeSize':
this._page()
break
}
},
_open(contractId, personal) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.contractId = contractId
this.dateList = []
this.formObj.personal = personal
this.showIssueModal = false
this.reportId = ''
this.tempId = ''
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_record(id) {
// 操作记录
this.$refs.refModal._open(id)
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '提交':
this._submit('submit')
break
case '提交至报告签发':
this._submit('submit-to-issue')
break
case '下载':
this._downloadBatch()
break
case '删除':
this._deleteSelected()
break
case '记录报告超期原因':
this._batchOverdueReason()
break
case '修改报告资质要求':
this._editReportAptitude()
break
case '选择审核人':
this._selectAuditor()
break
case '重新生成':
if (this.selectData.length > 0) {
this.$refs.refModal._open({
reportBatch: true,
id: '',
tempId: this.selectData[0].tempId
})
} else {
this.$msgTip('warning')
}
break
case '推送至国抽平台':
this._selectToGc()
break
case '完成':
this._achieveReport()
break
case '盖章':
this._toPDF()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 完成报告
_achieveReport() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定完成这' + this.selectIds.length + '个报告?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeToEnd', {
reportIds: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
}
},
// 推送至国抽
_selectToGc() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确认提交这' + this.selectIds.length + '条数据至国抽平台?',
loading: true,
onOk: () => {
this._submitToGc()
}
})
}
},
_submitToGc() {
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSample/pushDataToGcReport', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
},
// 选择审核人
_selectAuditor() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('auditor', '选择审核人')
}
},
_auditorResult(data) {
const tempData = {
auditorId: data.userId,
auditor: data.realname,
ids: this.selectIds.join(',')
}
this.$layxLoading()
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSampleReport/submitMakeToAuditor', tempData)
.then(() => {
this._resultChange('提交成功')
})
} else {
this.$layxLoading(false)
}
})
},
_editReportAptitude() {
this.$refs.refModal._open(this.formObj.contractId)
},
_batchOverdueReason() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('超期原因')
}
},
_overdueReason(reason) {
this.$layxLoading()
this.$store
.dispatch('FoodReportSummary/addReason', {
ids: this.selectIds.join(','),
reason: reason
})
.then(() => {
if (this.$store.state.FoodReportSummary.success) {
this.$Message.success('操作成功!')
this._page()
}
this.$layxLoading(false)
})
},
_resultChange(msg) {
if (this.$store.state.FoodSampleReport.success) {
this.$Message.success(msg)
this._page()
}
this.$Modal.remove()
this.$layxLoading(false)
},
// 重新生成报告ok(多个)
_regenerateBatch() {
const validateObj = {
ids: this.selectIds.join(','),
issueDate: this.issueDate,
reportModelId: this.reportBatchData.tempId
}
// 先进行验证
this.$store
.dispatch('FoodSampleReport/generateAgainBatchCheck', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
// true --- 建立连接
this.currentComponent = 'ProgressByRegenerateReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds.length, currentTime)
})
validateObj.seriesNo = currentTime
this.$store
.dispatch('FoodSampleReport/generateAgainBatch', validateObj)
.then(() => {})
}
})
},
// 重新生成报告(单个、批量)
_regenerate(data) {
this.reportBatch = data.reportBatch
this.reportBatchData = data
if (!data.reportBatch) {
// 单个生成
this.reportId = data.id
this.tempId = data.tempId
}
// 判断字典中是否配置报告编制日期
this.$store
.dispatch('LmsBaseDict/getItem', '编制时选择签发日期')
.then(() => {
const result = this.$store.state.LmsBaseDict.item
if (result.length !== 0 && result[0].code === 'yes') {
// 配置为yes弹出
this.showIssueModal = true
this.issueDateTemp = ''
this.issueDate = ''
} else {
// 配置为no不弹出
this.showIssueModal = false
this.issueDate = ''
this._createOk()
}
})
},
_issueCancel() {
this.showIssueModal = false
},
// 选择时间ok
_issueOk() {
this.showIssueModal = false
this._createOk()
},
// 生成报告
_createOk() {
if (!this.reportBatch) {
// 单个生成报告
const obj = {
id: this.reportId,
issueDate: this.issueDate,
reportModelId: this.tempId
}
this.$store.dispatch('FoodSampleReport/generateAgain', obj).then(() => {
this._resultChange('报告重新生成成功')
})
} else {
// 批量改生成报告
this._regenerateBatch()
}
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids.join(','), '确定删除 ' + ids.length + ' 条记录?')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/sampleReportDeletes', { ids: ids })
.then(() => {
this._resultChange('删除成功!')
})
}
})
},
_downloadBatch() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要下载这 ' + ids.length + ' 个报告?',
onOk: () => {
const obj = {
ids: ids.join(','),
contractId: this.formObj.contractId,
flag: 0
}
http.open(
global.baseURL +
'/food/v1/sample_report/download_batch_by_sampleIds',
obj,
'_blank'
)
}
})
}
},
_submit(msg) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
let url = ''
let successMsg = ''
let content = ''
switch (msg) {
case 'submit':
// 提交
url = 'FoodSampleReport/submitMake'
successMsg = '提交成功'
content = '确定要提交这 ' + ids.length + ' 条数据?'
break
case 'submit-to-issue':
// 提交至报告签发
url = 'FoodSampleReport/submitToIssue'
successMsg = '成功提交至报告签发'
content = '确定要将这 ' + ids.length + ' 条数据提交至报告签发?'
break
}
this.$Modal.confirm({
title: '提示',
content: content,
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch(url, { ids: this.selectIds.join(',') })
.then(() => {
this._resultChange(successMsg)
})
}
})
}
})
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-make-contract" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托单位:">
<Input @on-enter="_formSearch" name="cname" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input @on-enter="_formSearch" name="code" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" name="num" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
:msg="btn" class="contHide">
<!-- <template slot="processTask">-->
<!-- <div class="fr process-task">-->
<!-- <el-checkbox v-model="personal" @change="_page" :true-label="1" :false-label="0" size="medium">-->
<!-- 个人任务-->
<!-- </el-checkbox>-->
<!-- <el-checkbox v-model="onlyReportMake" @change="_page" :true-label="1"-->
<!-- :false-label="0" size="medium">只显示待编报告-->
<!-- </el-checkbox>-->
<!-- </div>-->
<!-- </template>-->
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange" :rows="100">
<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">
<a @click.stop="_detailModal(scope.row.id,scope.row.type)"
v-if="item.detail">{{scope.row[item.key]}}</a>
<div v-else-if="item.type">{{scope.row[item.key]?'政府':'企业'}}</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==='havePhoto'">{{scope.row[item.key]===1?'是':
scope.row[item.key]===0?'否':''}}
</div>
<div v-else-if="item.status">
{{scope.row[item.key].display}}
</div>
<div v-else-if="item.judge">
{{Number(scope.row[item.key]) === 0? '否':'是'}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<SampleByMakeModal ref="sampleByMakeModal"></SampleByMakeModal>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
import SampleByMakeModal from '../SampleByMakeModal'
export default {
components: { SampleByMakeModal },
data() {
return {
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
currentComponent: '',
getPage: {},
formObj: {},
pageColumns: [
{
title: '委托单位',
key: 'cname',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '委托名称', key: 'name', width: 160 },
{ title: '委托编号', key: 'code', width: 180 },
{ title: '类型', key: 'type', width: 80, type: true },
{ title: '状态', key: 'progress', width: 110, status: true },
{ title: '应出报告日期', key: 'reportDueDate', width: 130, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{
title: '报告剩余天数',
key: 'reportRemainDay',
width: 130,
day: true
},
{ title: '报告进度统计', key: 'reportProgress', width: 450 },
{ title: '主联系人', key: 'linkman', width: 100 },
{ title: '联系手机', key: 'tel', width: 120 },
{ title: '检测类型', key: 'detectType', width: 130 },
{ title: '服务类型', key: 'serviceType', width: 120 },
{ title: '是否带照片', key: 'havePhoto', width: 120 },
{ title: '报告语言', key: 'reportType', width: 100 },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '备注', key: 'remark' }
],
iconMsg: [
{
type: 'ios-flask-outline',
id: '',
name: '管理样品和报告'
},
{
type: 'ios-document-outline',
id: '',
name: '检测项目'
},
{ type: 'ios-cloud-outline', id: '', name: '附件' },
{
type: 'ios-clock-outline',
id: '',
name: '操作记录',
componentName: 'FoodContractRecord'
}
],
onlyReportMake: 1,
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-maintain-info',
name: '信息维护'
}
],
selectIds: [],
personal: 0
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
_open() {
// this._dicSearch()
},
_reportDateChange(data) {
$('input[name="reportDueDateBegin"]').val(data[0])
$('input[name="reportDueDateEnd"]').val(data[1])
},
// 从字典查预警期
_dicSearch() {
// 食品报告编制个人任务是否勾选
const data = ['食品报告编制个人任务是否勾选']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
const personalList = result[0]
// 食品报告编制个人任务是否勾选
if (personalList.length && personalList[0].name === '是') {
this.personal = 1
} else {
this.personal = 0
}
this._page()
})
},
_btnClick(msg) {
switch (msg) {
case '信息维护':
this._maintainInfo()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理样品和报告':
this.$refs.sampleByMakeModal._open(
data.id,
data.cname + '【' + data.code + '】',
data.type,
this.personal
)
break
case '检测项目':
this.$refs.refModal._open(data)
break
case '操作记录':
this.$refs.refModal._open(data.id)
break
case '附件':
this._upload(data.id)
break
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
this.selectIds = []
break
case 'selectIds':
this.selectIds = data
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())
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'contractId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-make-sample" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" v-model="formObj.num" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-item" label="任务来源:">
<Input @on-enter="_formSearch" v-model="formObj.taskSource" placeholder="请输入任务来源" clearable></Input>
</Form-item>
<Form-item label="细类:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.detectType"
placeholder="请输入细类" clearable/>
</Form-item>
<Form-item label="已推国抽:" class="search-item margin-left-6">
<Select v-model="formObj.dataPushed" clearable placeholder="请选择是否已推国抽">
<Option v-for="item in dataPushedList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="应出报告日期:" class="search-item">
<Date-picker :editable="false" @on-change="_reportDateChange" v-model="dateList"
type="daterange" placeholder="应出报告日期" format="yyyy-MM-dd"
style="width:100%" placement="bottom-start"></Date-picker>
<input v-model="formObj.reportDateBegin" type="hidden">
<input v-model="formObj.reportDateEnd" type="hidden">
</Form-item>
<Form-item label="已生成报告:" class="search-item">
<Select v-model="formObj.reported" clearable>
<Option :value="0"></Option>
<Option :value="1"></Option>
</Select>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<BtnList :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
<!--切换待认领任务-->
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.personal" @change="_page" :true-label="1" :false-label="0"
size="medium">
个人任务
</el-checkbox>
<el-checkbox v-model="formObj.onlyReportMake" @change="_page" :true-label="1"
:false-label="0" size="medium">只显示待编样品
</el-checkbox>
</div>
</template>
</BtnList>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight" @on-result-change="_tableResultChange"
:getPage="getPage" :rows="100" select-data is-report>
<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.display">{{scope.row[item.key]? scope.row[item.key].display: ''}}</div>
<div v-else-if="item.key==='reportDueDate'"
:style="{color:$reportDueDateColor(scope.row.reportDueDate)}">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</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.judge">{{Number(scope.row[item.key])===1?'是':'否'}}
</div>
<div v-else-if="item.reported">
<div v-if="scope.row[item.key]>0" class="green-color"></div>
<div v-else></div>
</div>
<div v-else-if="item.key === 'infoMaintain'">
<label v-if="scope.row.infoMaintain === 'no'" class="green-color">信息已维护</label>
<label v-else-if="scope.row.infoMaintain === 'yes'" class="red-color">信息待维护</label>
<label v-else-if="scope.row.infoMaintain === 'none'"></label>
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<vxe-table-column
:width="140"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="type === 0?iconMsg1:iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
/**
* 按委托编制----管理样品
*/
export default {
components: {},
data() {
return {
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-push-to-gc',
name: '推送至国抽平台'
},
{ type: 'success', id: '', name: '生成' },
{
type: 'success',
id: 'food-report-make-select-template-create',
name: '选择模板生成',
componentName: 'CreateReport'
},
{
type: 'primary',
id: 'food-report-make-create-samples',
name: '多样品生成',
componentName: 'CreateReportBySamples'
},
{
type: 'primary',
id: 'food-report-make-edit-items',
name: '批量维护检测项目',
componentName: 'FoodItemBatchEditModal'
},
{
type: '',
id: 'food-report-make-sample-maintain-info',
name: '信息维护',
componentName: 'MaintainInfoModal'
}
],
getPage: {},
detectionDate: '',
pageColumns: [
{ title: '样品编号', key: 'num', width: 180, fixed: 'left' },
{ title: '样品名称', key: 'name', width: 160 },
{ title: '报告已生成', key: 'reported', width: 120, reported: true },
{ title: '是否合格', key: 'isEligible', width: 120 },
{ title: '状态', key: 'progress', width: 100 },
{ title: '信息维护状态', key: 'infoMaintain', width: 130 },
{ title: '应出报告日期', key: 'reportDueDate', width: 120, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '所需资质', key: 'aptitudeType', width: 120 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '任务来源', key: 'taskSource', width: 150 },
{ title: '已推国抽', key: 'dataPushed', width: 150, judge: true },
{
title: '抽样单状态',
key: 'samplingStatus',
width: 120,
display: true
},
{ title: '报告语言', key: 'reportType', width: 100 },
{ title: '报告要求', key: 'reportRequire', width: 150 },
{ title: '是否带照片', key: 'havePhoto', width: 120, judge: true },
{ title: '备注', key: 'remark' }
],
selectIds: [],
selectData: [],
formObj: {
contractId: '',
num: '',
name: '',
detectType: '',
taskSource: '',
onlyReportMake: 1,
reportDateBegin: '',
reportDateEnd: '',
reported: 0,
personal: 0,
dataPushed: ''
},
dateList: [],
type: '',
iconMsg: [
{ type: 'cloud', id: '', name: '样品附件', disabled: true },
{ type: 'compose', id: '', name: '编辑' }, // food-report-make-sample-edit
{
type: 'ios-upload',
id: '',
name: '上传',
componentName: 'UploadReport'
},
{
type: 'document-text',
id: '',
name: '项目台账',
componentName: 'FoodItemEditModal'
},
{
type: 'ios-clock',
id: '',
name: '操作记录',
componentName: 'FoodSampleRecord'
}
],
iconMsg1: [
{
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
{ type: 'compose', id: '', name: '编辑' }, // food-report-make-sample-edit
{
type: 'ios-upload',
id: '',
name: '上传',
componentName: 'UploadReport'
},
{
type: 'document-text',
id: '',
name: '项目台账',
componentName: 'FoodItemEditModal'
},
{
type: 'ios-clock',
id: '',
name: '操作记录',
componentName: 'FoodSampleRecord'
}
],
dataPushedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
postUrl: 'FoodSample/pageSampleReportMake',
currentId: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {},
methods: {
// 初始化值
_resetData(contractId, type, personal) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.contractId = contractId
this.formObj.reported = 0
this.formObj.onlyReportMake = 1
this.formObj.personal = personal
this.type = type
this.dateList = []
},
// 当前列表有值,则不会重新调page接口
_getPage(contractId, type, personal) {
this._resetData(contractId, type, personal)
this.getPage = this.$store.state.FoodSample.page
},
_reportDateChange(data) {
this.formObj.reportDateBegin = data[0]
this.formObj.reportDateEnd = data[1]
},
_modalResult(data, msg) {
switch (this.currentComponent) {
case 'CreateReport':
this.$emit('on-result-change', 'changeTab')
break
case 'ProgressByReport':
// 进度条
this.$emit('on-result-change', 'changeTab')
break
case 'FoodSampleCompanyEdit':
case 'FoodSampleGovernLYEdit':
case 'FoodSampleGovernEdit':
case 'UploadReport':
// 单个编辑
this._updateRows()
break
default:
this._page()
}
},
// 更新ids数据
_updateRows() {
const obj = {
url: this.postUrl,
params: this.$serializeFormSearch(this.formObj)
}
obj.params.ids = this.currentId
this.$refs.pageTable._updateRows(obj)
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '上传':
this.currentId = data.id
this.$refs.refModal._open(data.id)
break
case '项目台账':
this.$refs.refModal._open(data)
break
case '操作记录':
this._record(data.id)
break
case '编辑':
this.currentId = data.id
this._edit(data)
break
case '样品附件':
this._upload(data.id)
break
}
})
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
_edit(data) {
if (data.type === 0) {
this.currentComponent = 'FoodSampleCompanyEdit'
this.$store.dispatch('FoodSample/getByCompanyId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.formObj.contractId
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.formObj.contractId
)
})
})
} else {
this.currentComponent = 'FoodSampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.formObj.contractId
)
})
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.getPage = this.$store.state.FoodSample.page
break
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
}
},
_open(contractId, type, personal) {
// 初始化数据
this._resetData(contractId, type, personal)
// this._page()
},
_page() {
const data = this.$serializeFormSearch(this.formObj)
this.$refs.pageTable._page('', this.postUrl, data)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_record(id) {
// 操作记录
this.$refs.refModal._open(id)
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '生成':
this._createReport()
break
case '选择模板生成':
this._judgeReport('create')
break
case '推送至国抽平台':
this._pushToGC()
break
case '多样品生成':
this._judgeReport('create-samples')
break
case '批量维护检测项目':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(this.selectIds)
}
break
case '信息维护':
this._maintainInfo()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds, 2)
}
},
// 推送至国抽平台
_pushToGC() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要推送这' + ids.length + '条数据至国抽平台?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSample/pushDataToGC', { ids: ids.join(',') })
.then(() => {
this._resultChange('信息推送成功')
})
}
})
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this.$Message.success(msg)
this._page()
this.selectIds = []
}
this.$Modal.remove()
},
// 生成报告
_judgeReport(name) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
switch (name) {
case 'create':
this.$refs.refModal._open(this.selectData)
break
case 'create-samples':
this.$refs.refModal._open(this.selectIds)
break
}
}
},
_createReport() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const validateObj = { sampleIds: this.selectIds }
// 先进行验证
this.$store
.dispatch('FoodSampleReport/generateAutomaticValidate', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
// true --- 建立连接
this.currentComponent = 'ProgressByReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds.length, currentTime)
})
validateObj.seriesNo = currentTime
this.$store
.dispatch('FoodSampleReport/generateAutomatic', validateObj)
.then(() => {})
} else {
// false --- 弹出选择模板框
this.currentComponent = 'CreateReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectData)
})
}
})
}
}
}
}
</script>
...@@ -166,20 +166,20 @@ export default { ...@@ -166,20 +166,20 @@ export default {
pageColumns: [ pageColumns: [
{ title: '委托商', key: 'client', width: 180 }, { title: '委托商', key: 'client', width: 180 },
{ title: '委托编号', key: 'entrustCode', width: 180 }, { title: '委托编号', key: 'entrustCode', width: 180 },
{ title: '存储条件', key: 'conditions', width: 180 },
{ title: '试样编号', key: 'sampleCode', width: 180 }, { title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 }, { title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '样品包装类型', key: 'samplePack', width: 180 }, { title: '样品包装类型', key: 'samplePack', width: 180 },
{ title: '现场编号', key: 'siteNo', width: 180 }, { title: '现场编号', key: 'siteNo', width: 180 },
{ title: '存储条件', key: 'conditions', width: 180 },
{ title: '备样位置', key: 'backupLocation', width: 180 }, { title: '备样位置', key: 'backupLocation', width: 180 },
{ title: '备样数量', key: 'quantity', width: 180 }, { title: '备样数量', key: 'quantity', width: 180 },
{ title: '备样人', key: 'backupUser', width: 140 }, { title: '备样人', key: 'backupUser', width: 140 },
{ title: '钻孔位置', key: 'boreholeLocation', width: 110 }, { title: '钻孔位置', key: 'boreholeLocation', width: 110 },
{ title: '钻孔名称', key: 'boreholeName', width: 160 }, { title: '钻孔名称', key: 'boreholeName', width: 160 },
{ title: '水深(米)', key: 'waterDepth', width: 160 }, { title: '水深(米)', key: 'waterDepth', width: 160 },
{ title: '状态', key: 'status', width: 160 }, { title: '状态', key: 'status', width: 160 }
{ title: '备份开始日期', key: 'startTime', width: 170 }, // { title: '备份开始日期', key: 'startTime', width: 170 },
{ title: '备份结束日期', key: 'endTime', width: 170 } // { title: '备份结束日期', key: 'endTime', width: 170 }
/* {title: '处置方式', key: 'handleMethod', width: 120,}, */ /* {title: '处置方式', key: 'handleMethod', width: 120,}, */
], ],
conditionList: [], conditionList: [],
......
...@@ -144,12 +144,12 @@ export default { ...@@ -144,12 +144,12 @@ export default {
{ title: '水深(米)', key: 'waterDepth', width: 120 }, { title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 }, { title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true }, { title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 }, // { title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 }, // { title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true }, { title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 }, { title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true }, // { title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 }, // { title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 } { title: '检验类别', key: 'testType', width: 120 }
] ]
} }
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage> <SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
<ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage> <ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage>
<Operation ref="operation"></Operation> <Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div> </div>
</template> </template>
<script> <script>
...@@ -98,13 +99,13 @@ export default { ...@@ -98,13 +99,13 @@ export default {
id: '', id: '',
name: '项目管理' 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: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
...@@ -452,7 +453,7 @@ export default { ...@@ -452,7 +453,7 @@ export default {
}, },
_upload(id) { _upload(id) {
// 上传文件 // 上传文件
this.$refs.refModal._open(id, 'contractId') this.$refs.FileManage._open(id, 'entrustId')
} }
} }
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
:tableHeight="tableHeight" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" @on-result-change="_tableResultChange"
:getPage="getPage" :getPage="getPage"
:icon-msg="iconMsg"
select-data> select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
...@@ -80,13 +79,13 @@ export default { ...@@ -80,13 +79,13 @@ export default {
formObj: { num: undefined, name: undefined }, formObj: { num: undefined, name: undefined },
iconMsgDis: [], iconMsgDis: [],
iconMsg: [ iconMsg: [
{ // {
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: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
:tableHeight="tableHeight" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" @on-result-change="_tableResultChange"
:getPage="getPage" :getPage="getPage"
:iconMsg="iconMsg"
select-data> select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
:tableHeight="tableHeight" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" @on-result-change="_tableResultChange"
:getPage="getPage" :getPage="getPage"
:iconMsg="iconMsg"
select-data> select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
...@@ -82,7 +81,6 @@ export default { ...@@ -82,7 +81,6 @@ export default {
], ],
iconMsg: [ iconMsg: [
{ type: 'md-create', id: '', name: '编辑' }, { type: 'md-create', id: '', name: '编辑' },
{ type: 'ios-browsers', id: '', name: '复制' },
{ type: 'md-trash', id: '', name: '删除' }, { type: 'md-trash', id: '', name: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
:tableHeight="tableHeight" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" @on-result-change="_tableResultChange"
:getPage="getPage" :getPage="getPage"
:iconMsg="iconMsg"
select-data> select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
......
...@@ -120,12 +120,12 @@ export default { ...@@ -120,12 +120,12 @@ export default {
{ title: '水深(米)', key: 'waterDepth', width: 120 }, { title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 }, { title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true }, { title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 }, // { title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 }, // { title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true }, { title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 }, { title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true }, // { title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 }, // { title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 } { title: '检验类别', key: 'testType', width: 120 }
], ],
searchOpen: false, searchOpen: false,
......
...@@ -166,20 +166,18 @@ export default { ...@@ -166,20 +166,18 @@ export default {
pageColumns: [ pageColumns: [
{ title: '委托商', key: 'client', width: 180 }, { title: '委托商', key: 'client', width: 180 },
{ title: '委托编号', key: 'entrustCode', width: 180 }, { title: '委托编号', key: 'entrustCode', width: 180 },
{ title: '存储条件', key: 'conditions', width: 180 },
{ title: '试样编号', key: 'sampleCode', width: 180 }, { title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 }, { title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '样品包装类型', key: 'samplePack', width: 180 }, { title: '样品包装类型', key: 'samplePack', width: 180 },
{ title: '现场编号', key: 'siteNo', width: 180 }, { title: '现场编号', key: 'siteNo', width: 180 },
{ title: '存储条件', key: 'conditions', width: 180 },
{ title: '备样位置', key: 'backupLocation', width: 180 }, { title: '备样位置', key: 'backupLocation', width: 180 },
{ title: '备样数量', key: 'quantity', width: 180 }, { title: '备样数量', key: 'quantity', width: 180 },
{ title: '备样人', key: 'backupUser', width: 140 }, { title: '备样人', key: 'backupUser', width: 140 },
{ title: '钻孔位置', key: 'boreholeLocation', width: 110 }, { title: '钻孔位置', key: 'boreholeLocation', width: 110 },
{ title: '钻孔名称', key: 'boreholeName', width: 160 }, { title: '钻孔名称', key: 'boreholeName', width: 160 },
{ title: '水深(米)', key: 'waterDepth', width: 160 }, { title: '水深(米)', key: 'waterDepth', width: 160 },
{ title: '状态', key: 'status', width: 160 }, { title: '状态', key: 'status', width: 160 }
{ title: '备份开始日期', key: 'startTime', width: 170 },
{ title: '备份结束日期', key: 'endTime', width: 170 }
/* {title: '处置方式', key: 'handleMethod', width: 120,}, */ /* {title: '处置方式', key: 'handleMethod', width: 120,}, */
], ],
conditionList: [], conditionList: [],
......
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<Row style="margin-top: 10px;">
<!--查询条件-->
<Col span="24">
<div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="委托日期:">
<DatePicker
v-model="entrustDate"
:editable="false"
:clearable="false"
@on-change="_dateChange"
type="year"
style="width:90px"
></DatePicker>
</Form-item>
</Form>
</div>
<div class="clear"></div>
</Col>
<!--内容-->
<Col span="24">
<Row :gutter="16">
<Col span="16" style="margin-bottom: 10px">
<!--bar-->
<YearContractBar ref="barModal"></YearContractBar>
</Col>
<Col span="8">
<!--bar-->
<YearContractPie ref="pieModal"></YearContractPie>
</Col>
<Col span="24">
<!--table-->
<YearContractTable ref="tableModal"></YearContractTable>
</Col>
</Row>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
// eslint-disable-next-line import/named
import { soilStatistics } from '../../../api'
import YearContractTable from './YearContractTable'
import YearContractBar from './YearContractBar'
import YearContractPie from './YearContractPie'
export default {
components: {
YearContractTable,
YearContractBar,
YearContractPie
},
data() {
return {
entrustDate: new Date(),
formObj: {}
}
},
mounted() {
// this._getData(this.entrustDate.getFullYear())
},
methods: {
_getData: async function(data) {
this.formObj.entrustDate = data
const result = await soilStatistics.pageAnnualEntrustStatistics(
this.formObj
)
console.log('result', result)
if (result) {
this._open(result)
}
},
_open(data) {
this.$refs.tableModal._openTable(this.entrustDate.getFullYear(), data)
this.$refs.barModal._openBar(this.entrustDate.getFullYear(), data)
this.$refs.pieModal._openPie(this.entrustDate.getFullYear(), data)
},
_dateChange(data) {
this._getData(data)
},
_export() {
this.$refs.tableModal._exportSampleForm()
}
}
}
</script>
<style>
.border-chart-color {
border: 1px solid #e9eaec;
}
.chartTitle {
height: 32px;
line-height: 32px;
background: #f8f8f9;
padding-left: 15px;
border-bottom: 1px solid #e9eaec;
}
.chartTitle label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: 700;
}
</style>
<template>
<div class="border-chart-color" style="border: 1px solid #e9eaec">
<div class="chartTitle">
<label>{{ year }}年度委托量统计</label>
</div>
<div :style="heightObj" class="chartCont">
<div style="width:85%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
</div>
</div>
</template>
<script>
// import IEcharts from '../../../../../../node_modules/vue-echarts-v3/src/full.js';
export default {
// components: {IEcharts},
data() {
return {
name: 'A',
heightObj: {
height: '300px'
},
option: {
color: this.$echartColor,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
x: 130
},
legend: {
data: ['合同量']
},
xAxis: [
{
type: 'category',
data: [],
axisPointer: {
type: ''
},
axisLine: {
lineStyle: {
color: 'gray'
}
},
splitLine: { show: false }
}
],
yAxis: [
{
type: 'value',
name: '委托量(份)',
min: 0,
axisLabel: {
formatter: '{value}'
},
axisLine: {
lineStyle: {
color: 'gray'
}
},
splitLine: { show: false }
},
{
type: 'value',
name: '委托金额(元)',
min: 0,
axisLabel: {
formatter: '{value}'
},
axisLine: {
lineStyle: {
color: 'gray'
}
},
splitLine: { show: false }
}
],
series: [
{
name: '委托量',
type: 'bar',
data: []
},
{
name: '委托金额',
type: 'line',
yAxisIndex: 1,
data: []
}
]
},
optionObj: {
height: ''
},
year: ''
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height =
(document.documentElement.clientHeight - 300) * (2 / 3) + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 1.6 + 'px'
this.heightObj.height =
(document.documentElement.clientHeight - 272) * (2 / 3) + 'px'
},
_openBar(data, result) {
this.year = data
this.option.xAxis[0].data = []
if (result.length === 0) {
this.option.xAxis[0].data = []
this.option.series[0].data = []
this.option.series[1].data = []
} else {
for (let i = 0; i < result.length; i++) {
this.option.xAxis[0].data.push(result[i].entrustDate)
this.option.series[0].data.push(result[i].quantity)
this.option.series[1].data.push(result[i].fee)
}
}
// this.$store
// .dispatch('StatisticContract/pageYearContract', { year: data })
// .then(() => {
// const bar = this.$store.state.StatisticContract.page
// this.option.series[0].data = []
// this.option.series[1].data = []
// for (let j = 0; j < bar.length; j++) {
// for (let k = 0; k < this.option.xAxis[0].data.length; k++) {
// if (bar[j].yearMonth === this.option.xAxis[0].data[k]) {
// this.option.series[0].data[k] = bar[j].total
// this.option.series[1].data[k] = bar[j].price
// }
// }
// }
// })
}
}
}
</script>
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>{{year}}年度委托量统计</label>
</div>
<div :style="heightObj" class="chartCont">
<div v-if="showStatistic" style="width:90%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
<div v-else class="no-statistic-bg" style="margin-top: 100px"></div>
</div>
</div>
</template>
<script>
// import IEcharts from '../../../../../../node_modules/vue-echarts-v3/src/full.js';
export default {
// components: {IEcharts},
data() {
return {
name: 'A',
heightObj: {
height: '300px'
},
option: {
title: {
textStyle: {
fontSize: 14,
fontWeight: 'normal'
},
text: '',
x: 'center'
},
tooltip: {
trigger: 'item',
// formatter: "{b}<br/> : {c} ({d}%)"
formatter: function(a) {
return (
a.name +
'<br>委托额: ' +
a.value +
'</br>占比: ' +
a.percent +
'%'
)
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: 20,
bottom: 20,
data: []
},
color: this.$echartColor,
series: [
{
name: '',
type: 'pie',
radius: ['30%', '65%'],
center: ['40%', '50%'],
data: [],
label: {
normal: {
show: false
}
},
labelLine: {
normal: {
show: false
}
}
}
]
},
optionObj: {
height: ''
},
pageParams: {},
pie: [],
year: '',
showStatistic: true
}
},
mounted() {
console.log(this.option.series[0].data)
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height =
(document.documentElement.clientHeight - 300) * (2 / 3) + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 3.2 + 'px'
this.heightObj.height =
(document.documentElement.clientHeight - 272) * (2 / 3) + 'px'
},
_openPie(data, result) {
this.showStatistic = true
this._page(data, result)
},
_page(data, result) {
this.year = data
if (result.length === 0) {
this.option.series[0].data = []
} else {
let total = 0
const testerList = []
for (let i = 0; i < result.length; i++) {
testerList.push(result[i].entrustDate)
total = total + result[i].quantity
const obj = {}
obj.name = result[i].entrustDate
obj.value = result[i].quantity
obj.fee = result[i].fee
this.option.series[0].data.push(obj)
}
this.option.title.text = '检测项目总量(个):' + total
this.option.legend.data = testerList
}
},
_searchParams() {
const data = this.$serialize('customer-contract-pie')
return this.$extend(data, this.pageParams)
}
}
}
</script>
<template>
<div>
<Form id="year-contract-table">
<input name="year" type="hidden">
</Form>
<!--<PTVXETable id="table-year" :tableHeight="tableHeight" @on-result-change="_tableResultChange"-->
<!--ref="pageTable" :getPage="getPage" hide-checkbox hide-page :show-footer="true">-->
<!--<vxe-table-column-->
<!--sortable-->
<!--: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">-->
<!--<div v-if="item.detail"><a @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a></div>-->
<!--<span v-else>{{scope.row[item.key]}}</span>-->
<!--</template>-->
<!--</vxe-table-column>-->
<!--</PTVXETable>-->
<!--合计 暂时用此表格-->
<element-table
id="table-year"
ref="pageTable"
show-summary="true"
sum="true"
:get-page="getPage"
hide-checkbox
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</element-table>
<!-- <Details ref="detailsModal"></Details>-->
</div>
</template>
<script>
export default {
components: {
// Details
},
data() {
return {
// tableHeight: '260',
pageColumns: [
{
title: '签订日期',
key: 'entrustDate',
width: 200,
detail: true,
month: true
},
{ title: '委托数量', key: 'quantity' },
{ title: '委托额度', key: 'fee' }
],
getPage: {
records: []
},
year: ''
}
},
mounted() {
this.$refs.pageTable._hideLoading()
},
methods: {
_openTable(data, result) {
this.year = data
this.$refs.pageTable._hideLoading()
this._page(result)
},
_page(data) {
this.getPage.records = data
},
_tableResultChange(msg, data) {
switch (msg) {
case 'changeSize':
// this._page()
this.$refs.pageTable._hideLoading()
break
}
},
_detailModal(data) {
console.log(data)
// this.$refs.detailsModal._open(data)
},
/** *********************************导出-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch('StatisticContract/pageYearContract', this._searchParams())
.then(() => {
result = this.$store.state.StatisticContract.page
if (result.length === 0) {
this.$Message.warning('暂无数据,不可导出!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据(最多导出5000条)?',
onOk: () => {
this.$exportExcel(
'table-year',
'年度委托量统计表',
this.pageColumns,
result
)
}
})
}
})
},
// 参数
_searchParams() {
const data = this.$serialize('year-contract-table')
if (this.year) {
data.year = this.year
}
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<Row style="margin-top: 10px;">
<!--查询条件-->
<Col span="24">
<div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="委托日期:">
<el-date-picker
v-model="queryDate"
@change="_dateChange"
type="monthrange"
range-separator="-"
start-placeholder="开始月份"
end-placeholder="结束月份"
size="small"
value-format="yyyy-MM"
>
</el-date-picker>
</Form-item>
<Form-item class="search-btn">
<Button @click="_getData" type="primary" class="width-80">
搜索
</Button>
</Form-item>
</Form>
</div>
<div class="clear"></div>
</Col>
<!--内容-->
<Col span="24">
<Row :gutter="16">
<Col span="14">
<element-table
id="table-year"
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
@on-result-change="_tableResultChange"
hide-checkbox
>
<el-table-column fixed type="index" label="序号" width="100">
</el-table-column>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</element-table>
</Col>
<Col span="10">
<!--pie-->
<UserTestPie ref="testPieModal"></UserTestPie>
</Col>
</Row>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
// eslint-disable-next-line import/named
import { soilStatistics } from '../../../api'
import UserTestPie from './UserTestPie'
export default {
components: {
UserTestPie
},
data() {
const date = this.$dateformat(new Date(), 'yyyy-mm')
const nextMonth = this.$dateformat(
new Date().setMonth(new Date().getMonth() + 1),
'yyyy-mm'
)
return {
beginDate: new Date(),
endDate: new Date(),
groupId: '',
groupName: '',
tester: '',
testerId: '',
pageColumns: [
{ title: '委托单位', key: 'client', detail: true },
{ title: '委托数量', key: 'quantity' },
{ title: '委托额度', key: 'fee' }
],
groupData: [],
getPage: {
records: []
},
formObj: {
edateBegin: undefined,
edateEnd: undefined
},
tempData: {
groupId: '',
groupName: '',
beginDate: date,
endDate: nextMonth
},
testerData: [],
queryDate: [date, nextMonth],
serviceType: '',
serviceTypeList: []
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('search')
}
},
mounted() {
this.$refs.pageTable._hideLoading()
const str = this.tempData.endDate
const arr = str.split('-')
const lastday = this.mGetDate(arr[0], arr[1]).getTime() - 1
// this._contHide()
// this._getUserGroup()
this.formObj.edateBegin = this.tempData.beginDate
this.formObj.edateEnd = this.$dateformat(lastday, 'yyyy-mm-dd HH:MM:ss')
// this._getData()
// this._getServiceTypeList()
},
methods: {
mGetDate(year, month) {
const d = new Date(year, month, 1)
return d
},
// 服务类型
_getData: async function() {
console.log('753951')
console.log('选择时间后的请求', this.formObj)
const result = await soilStatistics.pageCustomerEntrustStatistics(
this.formObj
)
if (result) {
this.getPage.records = result
this.$refs.testPieModal._openPie(this.getPage.records)
}
},
// 检测项目详情
_detailModal(data) {
const obj = {
testerIds: [data.testerId],
groupIds: this.groupIds,
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate
}
console.log(obj)
// this.$refs.detailModal._open(obj)
},
_dateChange(data) {
if (data) {
this.formObj.edateBegin = data[0]
this.formObj.edateEnd = data[1]
const str = data[1]
const arr = str.split('-')
const lastday = this.mGetDate(arr[0], arr[1]).getTime() - 1
this.formObj.edateEnd = this.$dateformat(lastday, 'yyyy-mm-dd HH:MM:ss')
} else {
this.tempData.edateBegin = ''
this.tempData.edateEnd = ''
this.formObj.edateBegin = undefined
this.formObj.edateEnd = undefined
}
},
_contHide() {
this.tempData.beginDate = this.$dateformat(new Date(), 'yyyy-mm')
this.tempData.endDate = this.$dateformat(new Date(), 'yyyy-mm')
// this._page()
// this._getById()
},
_page() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
if (this.serviceType) {
data.serviceType = this.serviceType
}
this.$refs.pageTable._page(
'search-form',
'FoodItem/pagePersonalTask',
data
)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_search() {
this.tempData.groupId = this.groupId
this.tempData.groupName = this.groupId ? this.groupName : ''
this.tempData.serviceType = this.serviceType ? this.serviceType : ''
this.$refs.testPieModal._openPie(this.tempData)
this._formSearch()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'changeSize':
// this._page()
break
}
},
/** *********************************导出-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch('FoodItem/pagePersonalTask', this._searchParams())
.then(() => {
result = this.$store.state.FoodItem.page.records
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据?',
onOk: () => {
this.$exportExcel(
'personalTestNum',
'个人检测量统计表',
this.pageColumns,
result
)
}
})
})
},
// 参数
_searchParams() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
return this.$extend(data, { page: 1, rows: 5000 })
},
/** *********************************导出样品台账-end*********************************************/
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.groupId = data.value
this.testerId = ''
this.tester = ''
this._getUserList(data.value)
}
},
_getUserList(groupId, realname) {
const data = { page: 1, rows: 50 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
if (realname) {
Object.assign(data, { realname: realname })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.testerData = this.$store.state.LmsUserGroup.userPage.records
})
},
_testerChange(msg, data) {
switch (msg) {
case 'select':
this.tester = data.realname
this.testerId = data.userId
break
case 'blur':
this.tester = ''
break
case 'query':
this.tester = data.realname
this._getUserList('', data.realname)
break
}
}
}
}
</script>
<style>
.border-chart-color {
border: 1px solid #e9eaec;
}
.chartTitle {
height: 32px;
line-height: 32px;
background: #f8f8f9;
padding-left: 15px;
border-bottom: 1px solid #e9eaec;
}
.chartTitle label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: 700;
}
</style>
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>{{ groupName }} 客户委托量比率</label>
</div>
<div :style="heightObj" class="chartCont">
<div v-if="showStatistic" style="width:90%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
<div v-else :style="noDataObj" class="no-statistic-bg"></div>
</div>
<form id="persontal-task-pie">
<input name="groupId" type="hidden" />
<input name="beginDate" type="hidden" />
<input name="endDate" type="hidden" />
<input name="groupName" type="hidden" />
<input name="serviceType" type="hidden" />
</form>
</div>
</template>
<script>
// import IEcharts from 'vue-echarts-v3/src/full'
export default {
// components: { IEcharts },
data() {
return {
// 科室名称
groupName: '',
showStatistic: true,
heightObj: {
height: '300px'
},
option: {
title: {
x: 'center',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
},
tooltip: {
trigger: 'item',
formatter: function(a) {
return (
a.name +
'</br>样品量: ' +
a.data.value +
'<br>占比: ' +
a.percent +
'%'
)
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: 20,
bottom: 20,
data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
},
color: this.$echartColor,
series: [
{
name: '访问来源',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 335, name: '直接访问' },
{ value: 310, name: '邮件营销' },
{ value: 234, name: '联盟广告' },
{ value: 135, name: '视频广告' },
{ value: 1548, name: '搜索引擎' }
]
}
]
},
optionObj: {
height: ''
},
noDataObj: {
marginTop: ''
}
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height = document.documentElement.clientHeight - 300 + 'px'
this.heightObj.height = document.documentElement.clientHeight - 272 + 'px'
this.noDataObj.marginTop =
(document.documentElement.clientHeight - 450) / 2 + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
const testerList = []
const seriesList = []
let total = 0
for (let i = 0; i < data.length; i++) {
testerList.push(data[i].client)
total = total + data[i].quantity
seriesList.push({
value: data[i].quantity,
name: data[i].client,
total: data[i].quantity
})
}
this.option.title.text = '委托单总量(个):' + total
this.option.legend.data = testerList
this.option.series[0].data = seriesList
console.log(this.option.series[0].data)
},
_searchParams() {
const data = this.$serialize('persontal-task-pie')
return this.$extend(data)
}
}
}
</script>
<template>
<div>
<div class="tabBox clearfix" style="position: relative;background-color: white;margin-bottom: 20px;margin-top: 20px;">
<el-tabs v-model="activeName">
<el-tab-pane label="不合格项目" name="first">
<div class="saleBox" style="padding-left: 20px;float: left;background-color: lightblue">
<p style="font-size: 14px;">
<!-- {{ range }}不合格数量-->
不合格数量
</p>
<div id="saleImg" style="width: 660px;height: 260px;" />
</div>
</el-tab-pane>
</el-tabs>
<div class="timeBox" style="float: right;position: absolute;right: 0px;top: 0px;">
<div style="float: left;line-height: 34px;">
<!-- <a @click="_rangeDayChange" :class="{actived:pitch=='_rangeDayChange'}">今日</a>-->
<!-- <a @click="_rangeWeekChange" :class="{actived:pitch=='_rangeWeekChange'}">本周</a>-->
<!-- <a @click="_rangeMonthChange" :class="{actived:pitch=='_rangeMonthChange'}">本月</a>-->
<!-- <a @click="_rangeYearChange" :class="{actived:pitch=='_rangeYearChange'}">本年</a>-->
<a>今日</a>
<a>本周</a>
<a>本月</a>
<a>本年</a>
</div>
<div class="calendar" style="overflow: hidden">
<div class="block">
<el-date-picker
v-model="value1"
:default-time="['12:00:00']"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 200px;margin-left: 20px;"
/>
</div>
</div>
</div>
</div>
<div class="failTable">
<Form
v-show="searchOpen"
:label-width="70"
inline
onsubmit="return false"
class="search-form"
>
<label class="label-sign" />
<Form-item class="search-item" label="物料类型:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入物料类型" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
<element-table
ref="pageTable"
:page-columns="pageColumns"
:table-height="tableHeight"
:get-page="getPage"
:opt-col-width="80"
@on-result-change="_tableResultChange"
>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
show-overflow-tooltip
sortable
>
<template slot-scope="scope">
<div v-if="item.dateTime">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):'' }}
</div>
<span v-else-if="item.type" class="blue-color">
{{ scope.row[item.key] === undefined ? '': scope.row[item.key].display }}
</span>
<div v-else>
{{ scope.row[item.key] }}
</div>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- slot="col"-->
<!-- label="操作"-->
<!-- align="center"-->
<!-- :width="100"-->
<!-- fixed="right"-->
<!-- >-->
<!-- <template slot-scope="scope">-->
<!-- <icon-list-->
<!-- :msg="iconMsg"-->
<!-- :row-data="scope.row"-->
<!-- @on-result-change="_iconClick"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
</element-table>
</div>
</div>
</template>
<script>
// eslint-disable-next-line import/named
import { soilStatistics } from '../../api'
import { saleImg } from '../../api/homePage'
export default {
name: 'FailItem',
data() {
return {
activeName: 'first',
value1: '',
searchOpen: false,
pageColumns: [
{ title: '项目名称', key: 'name', width: '150' },
{ title: '样品编号', key: 'sampleCode', width: '130' },
{ title: '物料名称', key: 'sampleName', width: '130' },
{ title: '检测值', key: 'testValue', width: '100' },
{ title: '限量值', key: 'limitValue', width: '190' },
{ title: '检测依据', key: 'code', width: '350' },
{ title: '检测依据名称', key: 'standardName', width: '350' }
],
formObj: {
name: ''
},
getPage: {},
iconMsg: [
// { type: 'pt-a-edit', id: '', name: '编辑' },
// { type: 'pt-a-trash', id: '', name: '删除' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search') - 200
} else {
return this.$tableHeight('noSearch') - 200
}
}
},
mounted() {
// this._getItemFail()
// this._page()
},
methods: {
_getItemFail: async function() {
const result = await soilStatistics.getItemFail(this.queryRange)
if (result) {
console.log('getItemFail', result)
this.itemNotOk = result
saleImg(result)
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilStatistics.pageItemFail(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._initTable()
}
},
_formSearch() {},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(data.id)
break
case '删除':
this._deleteById(data.id)
break
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
}
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<Row style="margin-top: 10px;">
<!--查询条件-->
<Col span="24">
<div class="fl">
<Form id="search-form" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<!-- <Form-item class="search-item" label="人员:">-->
<!-- <AutoCompletes :value="tester" :blur="true" :down-data="testerData" show-key="realname"-->
<!-- placeholder="请选择人员" @on-result-change="_testerChange"-->
<!-- ></AutoCompletes>-->
<!-- </Form-item>-->
<!-- <Form-item class="search-item" label="服务类型:">-->
<!-- <Select v-model="serviceType" placeholder="请选择服务类型" clearable>-->
<!-- <Option v-for="item in serviceTypeList" :value="item.name" :key="item.name">{{ item.name }}</Option>-->
<!-- </Select>-->
<!-- </Form-item>-->
<Form-item label="委托日期:">
<el-date-picker
v-model="queryDate"
@change="_dateChange"
type="monthrange"
range-separator="-"
start-placeholder="开始月份"
end-placeholder="结束月份"
size="small"
value-format="yyyy-MM"
>
</el-date-picker>
</Form-item>
<Form-item class="search-btn">
<Button @click="_getData" type="primary" class="width-80">
搜索
</Button>
</Form-item>
</Form>
</div>
<div class="clear"></div>
</Col>
<!--内容-->
<Col span="24">
<Row :gutter="16">
<Col span="14">
<element-table
id="table-year"
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
@on-result-change="_tableResultChange"
hide-checkbox
>
<el-table-column fixed type="index" label="序号" width="100">
</el-table-column>
<el-table-column
v-for="item in pageColumns"
:key="item.key"
:prop="item.key"
:label="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
>
<template slot-scope="scope">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<span v-else>{{ scope.row[item.key] }}</span>
</template>
</el-table-column>
</element-table>
</Col>
<Col span="10">
<!--pie-->
<UserTestPie ref="testPieModal"></UserTestPie>
</Col>
</Row>
</Col>
</Row>
</div>
</div>
<!--检测项目详情-->
<!-- <Detail ref="detailModal"></Detail>-->
</div>
</template>
<script>
// eslint-disable-next-line import/named
import { soilStatistics } from '../../../api'
import UserTestPie from './UserTestPie'
export default {
components: {
UserTestPie
},
data() {
const date = this.$dateformat(new Date(), 'yyyy-mm')
const nextMonth = this.$dateformat(
new Date().setMonth(new Date().getMonth() + 1),
'yyyy-mm'
)
return {
beginDate: new Date(),
endDate: new Date(),
groupId: '',
groupName: '',
tester: '',
testerId: '',
pageColumns: [
{ title: '姓名', key: 'tester', detail: true },
{ title: '样品量', key: 'total' },
{ title: '样品占比(%)', key: 'ratio' }
],
groupData: [],
// getPage: [
// {
// tester: 'wwd',
// total: '12',
// ratio: '10%',
// price: '3500'
// },
// {
// tester: 'wwd',
// total: '12',
// ratio: '10%',
// price: '3500'
// },
// {
// tester: 'wwd',
// total: '12',
// ratio: '10%',
// price: '3500'
// }
// ],
getPage: {
records: [
{
tester: '李承明',
total: '12',
ratio: '10%',
price: '3500'
},
{
tester: '李成明',
total: '12',
ratio: '10%',
price: '3500'
}
]
},
tempData: {
groupId: '',
groupName: '',
beginDate: date,
endDate: nextMonth
},
formObj: {
edateBegin: undefined,
edateEnd: undefined
},
testerData: [],
queryDate: [date, nextMonth],
serviceType: '',
serviceTypeList: []
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('search')
}
},
mounted() {
this.$refs.pageTable._hideLoading()
// this._contHide()
// this._getUserGroup()
const str = this.tempData.endDate
const arr = str.split('-')
const lastday = this.mGetDate(arr[0], arr[1]).getTime() - 1
this.formObj.edateBegin = this.tempData.beginDate
this.formObj.edateEnd = this.$dateformat(lastday, 'yyyy-mm-dd HH:MM:ss')
// this._getData()
// this._getServiceTypeList()
},
methods: {
mGetDate(year, month) {
const d = new Date(year, month, 1)
return d
},
// 服务类型
_getData: async function() {
const result = await soilStatistics.pagePersonalTaskStatistics(
this.formObj
)
if (result) {
this.getPage.records = result
this.$refs.testPieModal._openPie(this.getPage.records)
}
},
// 检测项目详情
_detailModal(data) {
const obj = {
testerIds: [data.testerId],
groupIds: this.groupIds,
beginDate: this.tempData.beginDate,
endDate: this.tempData.endDate
}
console.log(obj)
// this.$refs.detailModal._open(obj)
},
_dateChange(data) {
if (data) {
this.tempData.beginDate = data[0]
this.tempData.endDate = data[1]
this.formObj.edateBegin = data[0]
const str = data[1]
const arr = str.split('-')
const lastday = this.mGetDate(arr[0], arr[1]).getTime() - 1
this.formObj.edateEnd = this.$dateformat(lastday, 'yyyy-mm-dd HH:MM:ss')
} else {
this.tempData.beginDate = ''
this.tempData.endDate = ''
this.formObj.edateBegin = undefined
this.formObj.edateEnd = undefined
}
},
_contHide() {
this.tempData.beginDate = this.$dateformat(new Date(), 'yyyy-mm')
this.tempData.endDate = this.$dateformat(new Date(), 'yyyy-mm')
// this._page()
// this._getById()
},
_page() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
if (this.serviceType) {
data.serviceType = this.serviceType
}
this.$refs.pageTable._page(
'search-form',
'FoodItem/pagePersonalTask',
data
)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_search() {
this.tempData.groupId = this.groupId
this.tempData.groupName = this.groupId ? this.groupName : ''
this.tempData.serviceType = this.serviceType ? this.serviceType : ''
this.$refs.testPieModal._openPie(this.tempData)
this._formSearch()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'changeSize':
// this._page()
break
}
},
/** *********************************导出-begin*********************************************/
_exportSampleForm() {
let result = []
this.$store
.dispatch('FoodItem/pagePersonalTask', this._searchParams())
.then(() => {
result = this.$store.state.FoodItem.page.records
this.$Modal.confirm({
title: '提示',
content: '确定导出全部数据?',
onOk: () => {
this.$exportExcel(
'personalTestNum',
'个人检测量统计表',
this.pageColumns,
result
)
}
})
})
},
// 参数
_searchParams() {
const data = {}
if (this.groupId) {
data.groupId = this.groupId
}
if (this.tester && this.testerId) {
data.testerId = this.testerId
} else {
this.testerId = ''
}
if (this.tempData.beginDate) {
data.beginDate = this.tempData.beginDate
}
if (this.tempData.endDate) {
data.endDate = this.tempData.endDate
}
return this.$extend(data, { page: 1, rows: 5000 })
},
/** *********************************导出样品台账-end*********************************************/
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.groupId = data.value
this.testerId = ''
this.tester = ''
this._getUserList(data.value)
}
},
_getUserList(groupId, realname) {
const data = { page: 1, rows: 50 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
if (realname) {
Object.assign(data, { realname: realname })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.testerData = this.$store.state.LmsUserGroup.userPage.records
})
},
_testerChange(msg, data) {
switch (msg) {
case 'select':
this.tester = data.realname
this.testerId = data.userId
break
case 'blur':
this.tester = ''
break
case 'query':
this.tester = data.realname
this._getUserList('', data.realname)
break
}
}
}
}
</script>
<template>
<div class="border-chart-color">
<div class="chartTitle">
<label>{{groupName}} 员工工作量比率</label>
</div>
<div :style="heightObj" class="chartCont">
<div v-if="showStatistic" style="width:90%">
<IEcharts :option="option" :style="optionObj"></IEcharts>
</div>
<div v-else :style="noDataObj" class="no-statistic-bg"></div>
</div>
<form id="persontal-task-pie">
<input name="groupId" type="hidden"/>
<input name="beginDate" type="hidden"/>
<input name="endDate" type="hidden"/>
<input name="groupName" type="hidden"/>
<input name="serviceType" type="hidden"/>
</form>
</div>
</template>
<script>
// import IEcharts from 'vue-echarts-v3/src/full'
export default {
// components: { IEcharts },
data() {
return {
// 科室名称
groupName: '',
showStatistic: true,
heightObj: {
height: '300px'
},
option: {
title: {
x: 'center',
textStyle: {
fontSize: 14,
fontWeight: 'normal'
}
},
tooltip: {
trigger: 'item',
formatter: function(a) {
return (
a.name +
'</br>样品量: ' +
a.data.value +
'<br>占比: ' +
a.percent +
'%'
)
}
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 0,
top: 20,
bottom: 20,
data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎']
},
color: this.$echartColor,
series: [
{
name: '访问来源',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '30',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 335, name: '直接访问' },
{ value: 310, name: '邮件营销' },
{ value: 234, name: '联盟广告' },
{ value: 135, name: '视频广告' },
{ value: 1548, name: '搜索引擎' }
]
}
]
},
optionObj: {
height: ''
},
noDataObj: {
marginTop: ''
}
}
},
mounted() {
this._contHide()
},
methods: {
_contHide() {
this.optionObj.height = document.documentElement.clientHeight - 300 + 'px'
this.heightObj.height = document.documentElement.clientHeight - 272 + 'px'
this.noDataObj.marginTop =
(document.documentElement.clientHeight - 450) / 2 + 'px'
this.optionObj.width =
(document.documentElement.clientWidth - 200) / 2.6 + 'px'
},
_openPie(data) {
// alert(this.option.series[0].data)
const testerList = []
const seriesList = []
let total = 0
for (let i = 0; i < data.length; i++) {
testerList.push(data[i].tester)
total = total + data[i].total
seriesList.push({
value: data[i].total,
name: data[i].tester,
total: data[i].total,
ratio: data[i].ratio
})
}
this.option.title.text = '检测项目总量(个):' + total
this.option.legend.data = testerList
this.option.series[0].data = seriesList
console.log(this.option.series[0].data)
},
_searchParams() {
const data = this.$serialize('persontal-task-pie')
return this.$extend(data)
}
}
}
</script>
<template>
<div>
<div class="dateBox">
<div class="block">
<span class="demonstration">签订日期</span>
<el-date-picker
v-model="dateValue"
type="year"
style="width: 150px;"
placeholder="选择年"
/>
</div>
</div>
<div class="chartBox clearfix">
<div class="barChartBox" style="width: 700px;height: 240px;margin-top: 20px;border: 1px solid lightgray;float: left">
<div class="barChartTitle" style="height: 32px;background-color: #f8f8f9;line-height: 32px;border-bottom: 1px solid lightgray">
<span style="font-size: 14px;color: #333333;font-weight: bold;">年度委托量统计</span>
</div>
<div class="barChartBody" style="padding: 15px;">
<div id="barChart" style="width: 100%;height: 180px;" />
</div>
</div>
<div class="pieChartBox" style="width: 350px;height: 240px;margin-top: 20px;border: 1px solid lightgray;float: left">
<div class="pieChartTitle" style="height: 32px;background-color: #f8f8f9;line-height: 32px;border-bottom: 1px solid lightgray">
<span style="font-size: 14px;color: #333333;font-weight: bold;">年度委托量统计</span>
</div>
<div class="pieChartBody" style="padding: 15px;">
<div id="pieChart" style="width: 100%;height: 180px;" />
</div>
</div>
</div>
<div class="tableBox">
<el-table
:data="tableData"
border
show-summary
style="width: 100%;"
>
<el-table-column
v-for="(item,index) in tableColumn"
:key="index"
:prop="item.key"
:label="item.title"
sortable
class="tablecolumn"
/>
</el-table>
</div>
</div>
</template>
<script>
export default {
name: 'YearDeclara',
data() {
return {
dateValue: ' ',
tableColumn: [
{ title: '签订日期', key: 'date' },
{ title: '委托数量', key: 'entrustNum' },
{ title: '委托额度', key: 'entrustLimit' },
{ title: '实收额度', key: 'chargedLImit' },
{ title: '未收额度', key: 'unchargedLImit' }
],
tableData: [
{
date: '2020-1',
entrustNum: 1,
entrustLimit: 1,
chargedLImit: 1,
unchargedLImit: 1
},
{
date: '2020-2',
entrustNum: 2,
entrustLimit: 2,
chargedLImit: 2,
unchargedLImit: 2
},
{
date: '2020-3',
entrustNum: 3,
entrustLimit: 3,
chargedLImit: 3,
unchargedLImit: 3
},
{
date: '2020-4',
entrustNum: 4,
entrustLimit: 4,
chargedLImit: 4,
unchargedLImit: 4
}
]
}
},
mounted() {
// this.barChart()
// this.pieChart()
},
methods: {
barChart() {
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('barChart'))
myChart.setOption({
// color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
grid: {
// left: '2%',
// right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
splitLine: {
show: false
},
data: [
'2020-1',
'2020-2',
'2020-3',
'2020-4',
'2020-5',
'2020-6',
'2020-7',
'2020-8',
'2020-9',
'2020-10',
'2020-11',
'2020-12'
],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value',
splitLine: {
show: false
},
name: '委托量(份)'
},
{
type: 'value',
splitLine: {
show: false
},
name: '委托金额(元)'
}
],
series: [
{
name: '委托量',
type: 'bar',
barWidth: '60%',
data: [9, 16, 59, 39, 89],
itemStyle: {
normal: {
color: 'lightblue'
}
}
},
{
name: '委托金额',
type: 'line',
// barWidth: '60%',
yAxisIndex: 1,
data: [0, 0, 0, 100000, 2000],
itemStyle: {
normal: {
color: 'red'
}
}
}
]
})
},
pieChart() {
const echarts = require('echarts')
const myChart = echarts.init(document.getElementById('pieChart'))
myChart.setOption({
title: {
text: '委托总金额',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 'right',
data: ['2020-1', '2020-2', '2020-3', '2020-4', '2020-5']
},
series: [
{
name: '委托金额',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
labelLine: {
show: false
},
data: [
{ value: 0, name: '2020-1' },
{ value: 0, name: '2020-2' },
{ value: 0, name: '2020-3' },
{ value: 100000, name: '2020-4' },
{ value: 2000, name: '2020-5' }
]
}
]
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header">数据审核</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目审核" name="waitReceive">
<WaitReceive ref="waitReceiveModal"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品审核" name="waitScan">
<WaitScan ref="waitScanModal"></WaitScan>
</el-tab-pane>
<!-- <el-tab-pane label="查看原始记录" name="viewRecord">-->
<!-- <OriginalRecordView ref="recordModal"></OriginalRecordView>-->
<!-- </el-tab-pane>-->
</el-tabs>
<!-- <keep-alive>-->
<!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;-->
<!-- <component ref="refModal" :is="currentComponent"></component>-->
<!-- </keep-alive>-->
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './item-tabs/ItemTabs'
import WaitScan from './sample-tabs/SampleTabs'
// import OriginalRecordView from './OriginalRecordView'
export default {
components: {
WaitReceive,
WaitScan
// OriginalRecordView
},
data() {
return {
type: '',
contractId: '', // 合同id
entrustId: '',
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: '',
currentComponent: ''
}
},
mounted() {
// this.currentComponent = 'waitScan'
},
methods: {
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = contractId // 合同id
this.activeName = 'waitReceive'
// this.currentComponent = 'waitScan'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.contractId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'viewRecord') {
// this._issuedPage()
this.$refs.recordModal._open(this.entrustId)
} else if (tab.name === 'waitReceive') {
// this._waitPage()
this.$refs.waitScanModal._clearTable()
this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend()
}
},
_search() {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._clearTable()
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="数据审核" name="check">
<SampleBackupsManage ref="checkTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="历史任务" name="checkHis">
<SampleBackupsQuery ref="checkHisTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import SampleBackupsManage from './DataAudit'
import SampleBackupsQuery from './DataAuditHis'
export default {
components: {
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
activeName: 'check'
}
},
mounted() {
this.activeName = 'check'
this.$refs.checkTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'check') {
this.$refs.checkTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.checkHisTabs._page()
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="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.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<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 v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<AuditDataModal ref="sampleManageModal" @on-result-change="_page"></AuditDataModal>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import AuditDataModal from './AuditDataModal'
export default {
components: {
UserInfo,
Operation,
// eslint-disable-next-line vue/no-unused-components
AuditDataModal
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '审核数据'
},
{ type: 'md-cloud', id: '', name: '附件' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ 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,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// 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 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '审核数据':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, '数据录入')
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_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 soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="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.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<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 v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
export default {
components: {
UserInfo,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ 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,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// 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 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_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
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_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 soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入类别" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<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==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.experimentId = this.id
const result = await soilTest.itemPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" @on-visible-change="_visibleChange" width="900">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :id="formId" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<div>
<Form-item label="试验指标名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="试验指标大类" prop="mainType" class="width-48">
<Input v-model="formObj.mainType" name="mainType"
placeholder="请输入试验指标大类"/>
</Form-item>
<Form-item label="试验指标小类" prop="smallType" class="width-48">
<Input v-model="formObj.smallType" name="smallType" placeholder="请输入试验指标小类"/>
</Form-item>
<Form-item label="状态" prop="status" class="width-48">
<Input v-model="formObj.status" name="status"
placeholder="请输入状态"/>
</Form-item>
<Form-item label="检测值" prop="testValue" class="width-48">
<Input v-model="formObj.testValue" name="testValue"
placeholder="请输入检测值"/>
</Form-item>
<Form-item label="单位" prop="unit" class="width-48">
<Input v-model="formObj.unit"
name="unit" placeholder="请输入单位"/>
</Form-item>
</div>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑环境资质项目表
*/
import { soilTest } from '../../../api'
export default {
components: {},
data() {
return {
activeName: '',
hideUserSel: true,
id: '',
modalTitle: '',
expId: '',
formObj: {
name: '',
unit: '',
status: '',
mainType: '',
smallType: '',
testValue: ''
},
ruleValidate: {
name: [{ required: true, message: '指标名称不能为空', trigger: 'blur' }]
},
showModal: false,
footerList: [
{ name: '取消', type: '' },
{ name: '保存', type: 'primary' }
],
microbedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
// 检测依据
testBasisData: [],
// 类别下拉数组
typeData: [],
// 检测科室
groupData: [],
groupName: '',
// 主检人
userData: [],
// 单位
unitData: [],
aptitudeData: [],
aptitude: '',
// testBasisName: '',
computeTypeList: [],
tester: '',
marksList: [],
detectionTypeList: [],
testItemData: [],
formId: ''
}
},
mounted() {
// 检测科室
// this._getUserGroup()
// 检测依据
// this._getTestBasisList()
// 资质
// this._getAptitudeList()
// this._getType()
},
methods: {
// 字典
_dicSearch() {
this.$store.dispatch('LmsBaseDict/getItem', '食品检出类别').then(() => {
const result = this.$store.state.LmsBaseDict.item
this.detectionTypeList = result
if (this.$string(this.id).isEmpty()) {
// 添加界面默认第一个
this.formObj.detectionType = result.length > 0 ? result[0].name : ''
}
})
},
_testBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = data.name
this.formObj.testMethod = data.stdNum
this.$refs.formObj.validateField('testBasis')
break
case 'query':
this.formObj.stdId = ''
this.formObj.testMethod = ''
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = ''
this._getTestBasisList(data)
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.testBasis = ''
this.formObj.testMethod = ''
this._getTestBasisList()
}
this.$refs.formObj.validateField('testBasis')
}
},
_selectJudgeType(data) {
this.formObj.microbed = data
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
case '填写说明':
this.$refs.introduction._open()
this._hideLoading()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(id, formObj) {
this.formId = 'edit-form'
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.expId = id
this.modalTitle = '添加试验指标'
} else {
this.hideUserSel = true
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '编辑试验指标'
}
this.showModal = true
},
// 获取检测项目
_getItemList(value) {
const data = {}
if (value) {
Object.assign(data, { name: value })
}
this.$store.dispatch('FoodAptitudeItem/getTestItem', data).then(() => {
this.testItemData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测项目结果
_testItemChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.name = data
this.$refs.formObj.validateField('name')
this._changeMicrobed()
break
case 'query':
this.formObj.name = data
this._getItemList(data)
break
case 'blur':
this._changeMicrobed()
break
}
},
_changeMicrobed() {
// 新增或者导入新增资质时 如果检测项目名称带‘菌’字,则是否微生物默认为‘是’
if (this.id === '') {
if (this.formObj.name.indexOf('菌') > -1) {
this.$set(this.formObj, 'microbed', 1)
} else {
this.$set(this.formObj, 'microbed', 0)
}
}
},
_clearMarks() {
this.marksList = []
},
_getMarks() {
if (this.formObj.computeMark) {
this.$store
.dispatch('AptitudeFood/getMarks', {
computeMark: this.formObj.computeMark
})
.then(() => {
if (this.$store.state.AptitudeFood.model) {
this.marksList = this.$store.state.AptitudeFood.model
}
})
}
},
_getType() {
this.$store
.dispatch('LmsEnum/getByType', 'ItemCalculateType')
.then(() => {
this.computeTypeList = this.$store.state.LmsEnum.model
})
},
// 资质
_getAptitudeList() {
this.$store.dispatch('LmsBaseDict/getItem', '所需资质').then(() => {
this.aptitudeData = this.$store.state.LmsBaseDict.item
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.formObj.groupId = data.value
this.formObj.tester = ''
this.formObj.testerId = ''
this._getUserList(data.value)
}
},
_userChange(data) {
if (data) {
this.formObj.testerId = data.value
this.formObj.tester = data.label
}
},
_getUserList(groupId) {
const data = { rows: 500 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.userData = this.$store.state.LmsUserGroup.userPage.records
})
},
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 单位
_unitChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.unit = data
break
case 'query':
this._getUnitList(data)
break
}
},
_getUnitList(data) {
this.unitData = []
if (data) {
this.$store
.dispatch('AptitudeFood/historyUnit', { unit: data })
.then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
} else {
this.$store.dispatch('AptitudeFood/historyUnit').then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
}
},
// 检测依据
_getTestBasisList(data) {
const obj = { classify: 1 }
if (data) {
obj.stdNum = data.stdNum
}
this.$store.dispatch('StandardInfo/page', obj).then(() => {
this.testBasisData = this.$store.state.StandardInfo.page.records
})
},
// 获取表数据
_resultChange(msg) {
this.showModal = false
this.$refs.footerModal._hideLoading()
this.$Message.success(msg)
this.$emit('on-result-change')
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
data.experimentId = this.expId
// 添加
this._save(data)
} else {
// 编辑
this._edit({ id: this.formObj.id, obj: data })
}
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
},
_save: async function(data) {
console.log(data)
const result = await soilTest.itemSave(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilTest.itemEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
// 切换tab
_changeTabs(tab, event) {
if (tab.name === 'testStep') {
this.$refs.testStepByAptitude._open(
this.formObj.stepId,
this.formObj.id
)
}
},
_visibleChange(data) {
if (!data && this.$showBtn('food-aptitude-item-step-edit')) {
this.$emit('on-result-change')
this.$refs.testStepByAptitude._clear()
}
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :isRadio="true" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :hide-checkbox="true" :rows="100" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{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>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
name: undefined
},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
id: '',
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测方法', key: 'testMethod', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.id = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.id
const result = await soilTest.pageTestByExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
this.$emit('on-result-change', data)
break
case 'singleSelect':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
console.log('自动分配')
// this.$refs.autoAssignModal._open()
// this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
// const num = this.$store.state.FoodItem.count
// if (num !== undefined) {
// this.$refs.refModal._open(num)
// }
// })
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input @on-enter="_formSearch" name="name" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :icon-msg="iconMsg" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{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.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<!-- <SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>-->
<!-- <OriginalRecordEdit ref="editModal"></OriginalRecordEdit>-->
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
// import SelectOriTempRecord from '../SelectOriTempRecord'
// import OriginalRecordEdit from '../OriginalRecordEdit'
import IndexManage from '../IndexManage'
export default {
components: {
AssignPerson,
// SelectOriTempRecord,
// OriginalRecordEdit,
IndexManage
},
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {
entrustId: '',
name: '',
testMethod: '',
testBasis: ''
},
entrustId: '',
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '提交' },
{ type: 'waring', id: '', name: '退回' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
{ type: 'md-apps', id: '', name: '查看指标' }
],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '试样包装类型', key: 'samplePack', width: 180 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '原始记录是否填写', key: 'recorded', width: 140 },
{ title: '检测方法', key: 'testMethod', width: 260 },
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 }
],
leftSelectData: {},
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
_iconClick(res, data, currentComponent) {
this.$nextTick(() => {
switch (res) {
case '查看原始记录':
console.log(data)
this._viewRecord('1309434759937146882')
break
case '查看指标':
this._indexManage(data)
break
}
})
},
_indexManage(data) {
this.$refs.indexModal._open(data)
},
_viewRecord(originalRecordId) {
// layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
Global.recordURL +
'/print/v1/form/' +
originalRecordId +
'?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
},
async _btnClick(msg) {
switch (msg) {
case '按人分配':
this._allotByPerson()
// await this._reportDueDate()
// await this._userAssign()
break
case '试验项目分配':
this._userAssign()
break
case '填写原始记录':
this._addRecord()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
_addRecord() {
if (this.selectIds.length === 0) {
this.$message.warning('请至少选择一条数据')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds, this.entrustId)
}
},
_allotByPerson() {
const user = Global.getUserInfo('userInfo')
this.$refs.personModal._openGoupByUserId('分配人员', user.id, 'itemTree')
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.leftSelectData = data
this.entrustId = id
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._formSearch()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
// const saveName = []
// const saveMethod = []
// for (let i = 0; i < this.leftSelectData.length; i++) {
// saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod)
// }
// const data = this.$serialize('task-assign-item-right')
// console.log(data)
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
this.formObj.name = this.leftSelectData.name
this.formObj.testMethod = this.leftSelectData.testMethod
const result = await soilTest.pageExperimentTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="leftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="rightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './ItemLeftList'
import ItemRightList from './ItemRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
console.log('ItemTabs', data)
this.$refs.rightModal._open(this.id, data)
},
_rightResult() {
this.$refs.leftModal._page()
},
_open(id) {
this.id = id
console.log(id)
this.$refs.leftModal._open(this.id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.rightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :rows="100">
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{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>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
entrustId: undefined
},
entrustId: '',
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
selectIds: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 120 },
{ title: '委托编号', key: 'entrustCode', width: 140 },
{ title: '委托商', key: 'client', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.entrustId = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
const result = await soilTest.pageExpTestSample(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
// case 'selectData':
// this.$emit('on-result-change', data)
// break
case 'selectIds':
this.selectIds = data
this.$emit('on-result-change', this.selectIds.join(','))
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this.currentComponent = 'AutoAssignModal'
this.$nextTick(function() {
this._autoAssign()
})
break
}
},
_autoAssign() {
this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
const num = this.$store.state.FoodItem.count
if (num !== undefined) {
this.$refs.refModal._open(num)
}
})
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.key==='status'">{{scope.row[item.key].display}}</span>
<span
v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
export default {
components: { AssignPerson },
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {},
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '试验项目分配' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
getPage: {},
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
leftSelectData: [],
sampleIds: [],
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
this.selectIds = []
},
async _btnClick(msg) {
switch (msg) {
case '试验项目分配':
this._userAssign()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.getPage.records = []
console.log(id)
this.sampleIds = data
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._page()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.sampleIds = this.sampleIds
const result = await soilTest.pageTest(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="SampleleftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="SamplerightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './SampleLeftList'
import ItemRightList from './SampleRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
this.$refs.SamplerightModal._open(this.id, data)
},
_rightResult() {
this.$refs.SampleleftModal._page()
},
_open(id) {
this.id = id
this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.SamplerightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header">数据复核</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目复核" name="waitReceive">
<WaitReceive ref="waitReceiveModal"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品复核" name="waitScan">
<WaitScan ref="waitScanModal"></WaitScan>
</el-tab-pane>
<!-- <el-tab-pane label="查看原始记录" name="viewRecord">-->
<!-- <OriginalRecordView ref="recordModal"></OriginalRecordView>-->
<!-- </el-tab-pane>-->
</el-tabs>
<!-- <keep-alive>-->
<!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;-->
<!-- <component ref="refModal" :is="currentComponent"></component>-->
<!-- </keep-alive>-->
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './item-tabs/ItemTabs'
import WaitScan from './sample-tabs/SampleTabs'
// import OriginalRecordView from './OriginalRecordView'
export default {
components: {
WaitReceive,
WaitScan
// OriginalRecordView
},
data() {
return {
type: '',
contractId: '', // 合同id
entrustId: '',
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: '',
currentComponent: ''
}
},
mounted() {
// this.currentComponent = 'waitScan'
},
methods: {
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = contractId // 合同id
this.activeName = 'waitReceive'
// this.currentComponent = 'waitScan'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.contractId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'viewRecord') {
// this._issuedPage()
this.$refs.recordModal._open(this.entrustId)
} else if (tab.name === 'waitReceive') {
// this._waitPage()
this.$refs.waitScanModal._clearTable()
this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend()
}
},
_search() {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._clearTable()
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="数据复核" name="check">
<SampleBackupsManage ref="checkTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="历史任务" name="checkHis">
<SampleBackupsQuery ref="checkHisTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import SampleBackupsManage from './DataCheck'
import SampleBackupsQuery from './DataCheckHis'
export default {
components: {
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
activeName: 'check'
}
},
mounted() {
this.activeName = 'check'
this.$refs.checkTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'check') {
this.$refs.checkTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.checkHisTabs._page()
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="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.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<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 v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<AuditDataModal ref="sampleManageModal" @on-result-change="_page"></AuditDataModal>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import AuditDataModal from './CheckDataModal'
export default {
components: {
UserInfo,
Operation,
// eslint-disable-next-line vue/no-unused-components
AuditDataModal
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '审核数据'
},
{ type: 'md-cloud', id: '', name: '附件' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ 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,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// 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 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '审核数据':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, '数据录入')
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_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 soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="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.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<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 v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
export default {
components: {
UserInfo,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ 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,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// 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 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_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
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_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 soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入类别" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<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==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.experimentId = this.id
const result = await soilTest.itemPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" @on-visible-change="_visibleChange" width="900">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :id="formId" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<div>
<Form-item label="试验指标名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="试验指标大类" prop="mainType" class="width-48">
<Input v-model="formObj.mainType" name="mainType"
placeholder="请输入试验指标大类"/>
</Form-item>
<Form-item label="试验指标小类" prop="smallType" class="width-48">
<Input v-model="formObj.smallType" name="smallType" placeholder="请输入试验指标小类"/>
</Form-item>
<Form-item label="状态" prop="status" class="width-48">
<Input v-model="formObj.status" name="status"
placeholder="请输入状态"/>
</Form-item>
<Form-item label="检测值" prop="testValue" class="width-48">
<Input v-model="formObj.testValue" name="testValue"
placeholder="请输入检测值"/>
</Form-item>
<Form-item label="单位" prop="unit" class="width-48">
<Input v-model="formObj.unit"
name="unit" placeholder="请输入单位"/>
</Form-item>
</div>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑环境资质项目表
*/
import { soilTest } from '../../../api'
export default {
components: {},
data() {
return {
activeName: '',
hideUserSel: true,
id: '',
modalTitle: '',
expId: '',
formObj: {
name: '',
unit: '',
status: '',
mainType: '',
smallType: '',
testValue: ''
},
ruleValidate: {
name: [{ required: true, message: '指标名称不能为空', trigger: 'blur' }]
},
showModal: false,
footerList: [
{ name: '取消', type: '' },
{ name: '保存', type: 'primary' }
],
microbedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
// 检测依据
testBasisData: [],
// 类别下拉数组
typeData: [],
// 检测科室
groupData: [],
groupName: '',
// 主检人
userData: [],
// 单位
unitData: [],
aptitudeData: [],
aptitude: '',
// testBasisName: '',
computeTypeList: [],
tester: '',
marksList: [],
detectionTypeList: [],
testItemData: [],
formId: ''
}
},
mounted() {
// 检测科室
// this._getUserGroup()
// 检测依据
// this._getTestBasisList()
// 资质
// this._getAptitudeList()
// this._getType()
},
methods: {
// 字典
_dicSearch() {
this.$store.dispatch('LmsBaseDict/getItem', '食品检出类别').then(() => {
const result = this.$store.state.LmsBaseDict.item
this.detectionTypeList = result
if (this.$string(this.id).isEmpty()) {
// 添加界面默认第一个
this.formObj.detectionType = result.length > 0 ? result[0].name : ''
}
})
},
_testBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = data.name
this.formObj.testMethod = data.stdNum
this.$refs.formObj.validateField('testBasis')
break
case 'query':
this.formObj.stdId = ''
this.formObj.testMethod = ''
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = ''
this._getTestBasisList(data)
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.testBasis = ''
this.formObj.testMethod = ''
this._getTestBasisList()
}
this.$refs.formObj.validateField('testBasis')
}
},
_selectJudgeType(data) {
this.formObj.microbed = data
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
case '填写说明':
this.$refs.introduction._open()
this._hideLoading()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(id, formObj) {
this.formId = 'edit-form'
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.expId = id
this.modalTitle = '添加试验指标'
} else {
this.hideUserSel = true
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '编辑试验指标'
}
this.showModal = true
},
// 获取检测项目
_getItemList(value) {
const data = {}
if (value) {
Object.assign(data, { name: value })
}
this.$store.dispatch('FoodAptitudeItem/getTestItem', data).then(() => {
this.testItemData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测项目结果
_testItemChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.name = data
this.$refs.formObj.validateField('name')
this._changeMicrobed()
break
case 'query':
this.formObj.name = data
this._getItemList(data)
break
case 'blur':
this._changeMicrobed()
break
}
},
_changeMicrobed() {
// 新增或者导入新增资质时 如果检测项目名称带‘菌’字,则是否微生物默认为‘是’
if (this.id === '') {
if (this.formObj.name.indexOf('菌') > -1) {
this.$set(this.formObj, 'microbed', 1)
} else {
this.$set(this.formObj, 'microbed', 0)
}
}
},
_clearMarks() {
this.marksList = []
},
_getMarks() {
if (this.formObj.computeMark) {
this.$store
.dispatch('AptitudeFood/getMarks', {
computeMark: this.formObj.computeMark
})
.then(() => {
if (this.$store.state.AptitudeFood.model) {
this.marksList = this.$store.state.AptitudeFood.model
}
})
}
},
_getType() {
this.$store
.dispatch('LmsEnum/getByType', 'ItemCalculateType')
.then(() => {
this.computeTypeList = this.$store.state.LmsEnum.model
})
},
// 资质
_getAptitudeList() {
this.$store.dispatch('LmsBaseDict/getItem', '所需资质').then(() => {
this.aptitudeData = this.$store.state.LmsBaseDict.item
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.formObj.groupId = data.value
this.formObj.tester = ''
this.formObj.testerId = ''
this._getUserList(data.value)
}
},
_userChange(data) {
if (data) {
this.formObj.testerId = data.value
this.formObj.tester = data.label
}
},
_getUserList(groupId) {
const data = { rows: 500 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.userData = this.$store.state.LmsUserGroup.userPage.records
})
},
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 单位
_unitChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.unit = data
break
case 'query':
this._getUnitList(data)
break
}
},
_getUnitList(data) {
this.unitData = []
if (data) {
this.$store
.dispatch('AptitudeFood/historyUnit', { unit: data })
.then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
} else {
this.$store.dispatch('AptitudeFood/historyUnit').then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
}
},
// 检测依据
_getTestBasisList(data) {
const obj = { classify: 1 }
if (data) {
obj.stdNum = data.stdNum
}
this.$store.dispatch('StandardInfo/page', obj).then(() => {
this.testBasisData = this.$store.state.StandardInfo.page.records
})
},
// 获取表数据
_resultChange(msg) {
this.showModal = false
this.$refs.footerModal._hideLoading()
this.$Message.success(msg)
this.$emit('on-result-change')
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
data.experimentId = this.expId
// 添加
this._save(data)
} else {
// 编辑
this._edit({ id: this.formObj.id, obj: data })
}
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
},
_save: async function(data) {
console.log(data)
const result = await soilTest.itemSave(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilTest.itemEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
// 切换tab
_changeTabs(tab, event) {
if (tab.name === 'testStep') {
this.$refs.testStepByAptitude._open(
this.formObj.stepId,
this.formObj.id
)
}
},
_visibleChange(data) {
if (!data && this.$showBtn('food-aptitude-item-step-edit')) {
this.$emit('on-result-change')
this.$refs.testStepByAptitude._clear()
}
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :isRadio="true" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :hide-checkbox="true" :rows="100" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{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>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
name: undefined
},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
id: '',
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测方法', key: 'testMethod', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.id = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.id
const result = await soilTest.pageTestByExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
this.$emit('on-result-change', data)
break
case 'singleSelect':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
console.log('自动分配')
// this.$refs.autoAssignModal._open()
// this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
// const num = this.$store.state.FoodItem.count
// if (num !== undefined) {
// this.$refs.refModal._open(num)
// }
// })
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input @on-enter="_formSearch" name="name" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :icon-msg="iconMsg" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{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.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<!-- <SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>-->
<!-- <OriginalRecordEdit ref="editModal"></OriginalRecordEdit>-->
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
// import SelectOriTempRecord from '../SelectOriTempRecord'
// import OriginalRecordEdit from '../OriginalRecordEdit'
import IndexManage from '../IndexManage'
export default {
components: {
AssignPerson,
// SelectOriTempRecord,
// OriginalRecordEdit,
IndexManage
},
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {
entrustId: '',
name: '',
testMethod: '',
testBasis: ''
},
entrustId: '',
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '提交' },
{ type: 'waring', id: '', name: '退回' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
{ type: 'md-apps', id: '', name: '查看指标' }
],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '试样包装类型', key: 'samplePack', width: 180 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '原始记录是否填写', key: 'recorded', width: 140 },
{ title: '检测方法', key: 'testMethod', width: 260 },
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 }
],
leftSelectData: {},
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
_iconClick(res, data, currentComponent) {
this.$nextTick(() => {
switch (res) {
case '查看原始记录':
console.log(data)
this._viewRecord('1309434759937146882')
break
case '查看指标':
this._indexManage(data)
break
}
})
},
_indexManage(data) {
this.$refs.indexModal._open(data)
},
_viewRecord(originalRecordId) {
// layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
Global.recordURL +
'/print/v1/form/' +
originalRecordId +
'?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
},
async _btnClick(msg) {
switch (msg) {
case '按人分配':
this._allotByPerson()
// await this._reportDueDate()
// await this._userAssign()
break
case '试验项目分配':
this._userAssign()
break
case '填写原始记录':
this._addRecord()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
_addRecord() {
if (this.selectIds.length === 0) {
this.$message.warning('请至少选择一条数据')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds, this.entrustId)
}
},
_allotByPerson() {
const user = Global.getUserInfo('userInfo')
this.$refs.personModal._openGoupByUserId('分配人员', user.id, 'itemTree')
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.leftSelectData = data
this.entrustId = id
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._formSearch()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
// const saveName = []
// const saveMethod = []
// for (let i = 0; i < this.leftSelectData.length; i++) {
// saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod)
// }
// const data = this.$serialize('task-assign-item-right')
// console.log(data)
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
this.formObj.name = this.leftSelectData.name
this.formObj.testMethod = this.leftSelectData.testMethod
const result = await soilTest.pageExperimentTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="leftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="rightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './ItemLeftList'
import ItemRightList from './ItemRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
console.log('ItemTabs', data)
this.$refs.rightModal._open(this.id, data)
},
_rightResult() {
this.$refs.leftModal._page()
},
_open(id) {
this.id = id
console.log(id)
this.$refs.leftModal._open(this.id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.rightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :rows="100">
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{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>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
entrustId: undefined
},
entrustId: '',
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
selectIds: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 120 },
{ title: '委托编号', key: 'entrustCode', width: 140 },
{ title: '委托商', key: 'client', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.entrustId = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
const result = await soilTest.pageExpTestSample(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
// case 'selectData':
// this.$emit('on-result-change', data)
// break
case 'selectIds':
this.selectIds = data
this.$emit('on-result-change', this.selectIds.join(','))
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this.currentComponent = 'AutoAssignModal'
this.$nextTick(function() {
this._autoAssign()
})
break
}
},
_autoAssign() {
this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
const num = this.$store.state.FoodItem.count
if (num !== undefined) {
this.$refs.refModal._open(num)
}
})
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.key==='status'">{{scope.row[item.key].display}}</span>
<span
v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
export default {
components: { AssignPerson },
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {},
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '试验项目分配' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
getPage: {},
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
leftSelectData: [],
sampleIds: [],
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
this.selectIds = []
},
async _btnClick(msg) {
switch (msg) {
case '试验项目分配':
this._userAssign()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.getPage.records = []
console.log(id)
this.sampleIds = data
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._page()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.sampleIds = this.sampleIds
const result = await soilTest.pageTest(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="SampleleftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="SamplerightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './SampleLeftList'
import ItemRightList from './SampleRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
this.$refs.SamplerightModal._open(this.id, data)
},
_rightResult() {
this.$refs.SampleleftModal._page()
},
_open(id) {
this.id = id
this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.SamplerightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入类别" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<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==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.experimentId = this.id
const result = await soilTest.itemPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" @on-visible-change="_visibleChange" width="900">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :id="formId" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<div>
<Form-item label="试验指标名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="试验指标大类" prop="mainType" class="width-48">
<Input v-model="formObj.mainType" name="mainType"
placeholder="请输入试验指标大类"/>
</Form-item>
<Form-item label="试验指标小类" prop="smallType" class="width-48">
<Input v-model="formObj.smallType" name="smallType" placeholder="请输入试验指标小类"/>
</Form-item>
<Form-item label="状态" prop="status" class="width-48">
<Input v-model="formObj.status" name="status"
placeholder="请输入状态"/>
</Form-item>
<Form-item label="检测值" prop="testValue" class="width-48">
<Input v-model="formObj.testValue" name="testValue"
placeholder="请输入检测值"/>
</Form-item>
<Form-item label="单位" prop="unit" class="width-48">
<Input v-model="formObj.unit"
name="unit" placeholder="请输入单位"/>
</Form-item>
</div>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑环境资质项目表
*/
import { soilTest } from '../../../api'
export default {
components: {},
data() {
return {
activeName: '',
hideUserSel: true,
id: '',
modalTitle: '',
expId: '',
formObj: {
name: '',
unit: '',
status: '',
mainType: '',
smallType: '',
testValue: ''
},
ruleValidate: {
name: [{ required: true, message: '指标名称不能为空', trigger: 'blur' }]
},
showModal: false,
footerList: [
{ name: '取消', type: '' },
{ name: '保存', type: 'primary' }
],
microbedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
// 检测依据
testBasisData: [],
// 类别下拉数组
typeData: [],
// 检测科室
groupData: [],
groupName: '',
// 主检人
userData: [],
// 单位
unitData: [],
aptitudeData: [],
aptitude: '',
// testBasisName: '',
computeTypeList: [],
tester: '',
marksList: [],
detectionTypeList: [],
testItemData: [],
formId: ''
}
},
mounted() {
// 检测科室
// this._getUserGroup()
// 检测依据
// this._getTestBasisList()
// 资质
// this._getAptitudeList()
// this._getType()
},
methods: {
// 字典
_dicSearch() {
this.$store.dispatch('LmsBaseDict/getItem', '食品检出类别').then(() => {
const result = this.$store.state.LmsBaseDict.item
this.detectionTypeList = result
if (this.$string(this.id).isEmpty()) {
// 添加界面默认第一个
this.formObj.detectionType = result.length > 0 ? result[0].name : ''
}
})
},
_testBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = data.name
this.formObj.testMethod = data.stdNum
this.$refs.formObj.validateField('testBasis')
break
case 'query':
this.formObj.stdId = ''
this.formObj.testMethod = ''
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = ''
this._getTestBasisList(data)
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.testBasis = ''
this.formObj.testMethod = ''
this._getTestBasisList()
}
this.$refs.formObj.validateField('testBasis')
}
},
_selectJudgeType(data) {
this.formObj.microbed = data
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
case '填写说明':
this.$refs.introduction._open()
this._hideLoading()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(id, formObj) {
this.formId = 'edit-form'
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.expId = id
this.modalTitle = '添加试验指标'
} else {
this.hideUserSel = true
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '编辑试验指标'
}
this.showModal = true
},
// 获取检测项目
_getItemList(value) {
const data = {}
if (value) {
Object.assign(data, { name: value })
}
this.$store.dispatch('FoodAptitudeItem/getTestItem', data).then(() => {
this.testItemData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测项目结果
_testItemChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.name = data
this.$refs.formObj.validateField('name')
this._changeMicrobed()
break
case 'query':
this.formObj.name = data
this._getItemList(data)
break
case 'blur':
this._changeMicrobed()
break
}
},
_changeMicrobed() {
// 新增或者导入新增资质时 如果检测项目名称带‘菌’字,则是否微生物默认为‘是’
if (this.id === '') {
if (this.formObj.name.indexOf('菌') > -1) {
this.$set(this.formObj, 'microbed', 1)
} else {
this.$set(this.formObj, 'microbed', 0)
}
}
},
_clearMarks() {
this.marksList = []
},
_getMarks() {
if (this.formObj.computeMark) {
this.$store
.dispatch('AptitudeFood/getMarks', {
computeMark: this.formObj.computeMark
})
.then(() => {
if (this.$store.state.AptitudeFood.model) {
this.marksList = this.$store.state.AptitudeFood.model
}
})
}
},
_getType() {
this.$store
.dispatch('LmsEnum/getByType', 'ItemCalculateType')
.then(() => {
this.computeTypeList = this.$store.state.LmsEnum.model
})
},
// 资质
_getAptitudeList() {
this.$store.dispatch('LmsBaseDict/getItem', '所需资质').then(() => {
this.aptitudeData = this.$store.state.LmsBaseDict.item
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.formObj.groupId = data.value
this.formObj.tester = ''
this.formObj.testerId = ''
this._getUserList(data.value)
}
},
_userChange(data) {
if (data) {
this.formObj.testerId = data.value
this.formObj.tester = data.label
}
},
_getUserList(groupId) {
const data = { rows: 500 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.userData = this.$store.state.LmsUserGroup.userPage.records
})
},
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 单位
_unitChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.unit = data
break
case 'query':
this._getUnitList(data)
break
}
},
_getUnitList(data) {
this.unitData = []
if (data) {
this.$store
.dispatch('AptitudeFood/historyUnit', { unit: data })
.then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
} else {
this.$store.dispatch('AptitudeFood/historyUnit').then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
}
},
// 检测依据
_getTestBasisList(data) {
const obj = { classify: 1 }
if (data) {
obj.stdNum = data.stdNum
}
this.$store.dispatch('StandardInfo/page', obj).then(() => {
this.testBasisData = this.$store.state.StandardInfo.page.records
})
},
// 获取表数据
_resultChange(msg) {
this.showModal = false
this.$refs.footerModal._hideLoading()
this.$Message.success(msg)
this.$emit('on-result-change')
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
data.experimentId = this.expId
// 添加
this._save(data)
} else {
// 编辑
this._edit({ id: this.formObj.id, obj: data })
}
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
},
_save: async function(data) {
console.log(data)
const result = await soilTest.itemSave(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilTest.itemEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
// 切换tab
_changeTabs(tab, event) {
if (tab.name === 'testStep') {
this.$refs.testStepByAptitude._open(
this.formObj.stepId,
this.formObj.id
)
}
},
_visibleChange(data) {
if (!data && this.$showBtn('food-aptitude-item-step-edit')) {
this.$emit('on-result-change')
this.$refs.testStepByAptitude._clear()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1200">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<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">
<Input v-model="formObj.code" @on-enter="_formSearch" placeholder="请输入检测依据" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" @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)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.key==='epibolyItem'" @click.stop="_handleRow(scope)">
<el-select v-if="showOption" v-model="scope.row.epibolyItem" @change="_optionChange(scope.row)" placeholder="请选择">
<el-option
v-for="(item,index) in subOptions"
:key="index"
:label="item.label"
:value="index"
/>
</el-select>
<span v-if="!showOption">{{ scope.row[item.key]===0? '否':'是' }}</span>
</div>
<div v-else-if="item.key==='status'">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.judged">
{{ scope.row[item.key]===0? '否':'是' }}
</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==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
@blur="_codeEdit({id:scope.row.id, obj :{code:scope.row.code}})"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.row.id,scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
@blur="_compareSymbolEdit({id:scope.row.id, obj :{compareSymbol:scope.row.compareSymbol}})"
blur
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
@blur="_limitValueEdit({id:scope.row.id, obj :{limitValue:scope.row.limitValue}})"
blur
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
@blur="_unitEdit({id:scope.row.id, obj :{unit:scope.row.unit}})"
blur
placeholder="请输入单位"
/>
</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" />
</div>
</Modal>
</div>
</template>
<script>
import http from '../../../api/http'
import { soilEntrust, soilTest } from '../../../api'
export default {
components: {},
data() {
return {
formId: 'SampleItemManage',
currentComponent: '',
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }],
sampleId: '', // 样品id
showModal: false,
modalTitle: '管理检测项目',
selectIds: [],
itemId: '',
recordId: '',
index: '',
showOption: true,
searchOpen: true,
selectData: {},
getPage: {},
currentRow: '',
currentIndex: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '关闭', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType' },
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
subOptions: [
{
value: '0',
label: '否'
},
{
value: '1',
label: '是'
}
],
dateList: [],
formObj: {
name: undefined,
recordId: undefined,
code: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_selectjudgeBasis(id, index) {
console.log(id)
this.itemId = id
this.index = index
this.$refs.EditModal._open()
},
_optionChange(data) {
console.log(data)
if (data.epibolyItem === 1) {
this._submit(data.id)
} else {
this._cancelSub(data.id)
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '关闭':
this._cancel()
break
}
},
_cancel() {
this.$emit('on-result-change')
this.$refs.pageTable._hideLoading()
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_ok() {
console.log(this.getPage.records)
},
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_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._submitOutPack()
break
case '取消分包':
this._cancelOutPack()
break
case '添加':
this._editModal(false)
break
case '复制历史样品':
this._copyHisSample()
break
case '导入样品':
this._importSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_backData(data) {
this.getPage.records[this.index].code = data.code
this._codeEdit({ id: this.itemId, obj: { code: data.code } })
},
_codeEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_compareSymbolEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_limitValueEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_unitEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_submitOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定分包这' + this.selectIds.length + '条',
onOk: () => {
this._submit()
}
})
}
},
_cancelOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定取消这' + this.selectIds.length + '条分包',
onOk: () => {
this._cancelSub()
}
})
}
},
_submit: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.submitOutPack(this.selectIds)
if (result) {
this._resultChange('分包成功')
}
},
_cancelSub: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.cancelOutPack(this.selectIds)
if (result) {
this._resultChange('取消分包成功')
}
},
_exportSample() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条样品')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出这' + this.selectIds.length + '条样品',
onOk: () => {
http.open(
'/food/v1/sample/company/export',
{ ids: this.selectIds.join(',') },
'_blank'
)
}
})
}
},
_copyHisSample() {
this.$refs.refModal._open(this.sampleId)
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '导出样品委托协议':
this._exportAgreement(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_exportAgreement(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-contract-company-export-sample-agreement'
)
.then(() => {
if (this.$store.state.ReportExport.model) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) {
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
}
})
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'selectData':
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 'page':
this._page()
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.recordId = id
this.$refs.pageTable._hideLoading()
this._page()
},
_openRecord(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.$refs.pageTable._hideLoading()
this.showOption = false
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj = this.$serializeForm(this.formObj)
this.formObj.recordId = this.recordId
const result = await soilTest.pageOriginalExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
console.log(result)
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteOk: async function(ids) {
const result = await soilEntrust.deleteById(ids)
if (result) {
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(data) {},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
// localStorage.setItem('type', data.type)
// // 编辑
// this.$store.dispatch('FoodSample/getByCompanyId', data.id).then(() => {
// const result = this.$store.state.FoodSample.companyModel
// if (data.type === 0) {
// // 普通企业样品
// this.$refs.refModal._open(result, this.sampleId)
// } else if (data.type === 3) {
// // 模拟样品
// this._editImitateModal(true, result)
// }
// })
} else {
// 添加
this.$refs.refModal._open('', this.sampleId)
}
},
// 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.sampleId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.sampleId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.$emit('on-result-change')
},
_copy(data) {
this.$refs.copyModal._open(data.id, data.type)
},
// 复制样品
_copySample(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopySample(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopySample(result)
}
})
},
_copyAll(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopyAll(result)
}
})
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.sampleId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
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],
this.selectData
)
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, 'sample-rel-package-item')
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
</template> </template>
<script> <script>
import Global from '../../../api/config' import Global from '../../../api/config'
import { soilTest } from '../../../api'
/** /**
* 编辑原始记录详情 * 编辑原始记录详情
...@@ -74,6 +75,7 @@ export default { ...@@ -74,6 +75,7 @@ export default {
this.$layx(this.formIdTemp, '编辑原始记录', url) this.$layx(this.formIdTemp, '编辑原始记录', url)
}, },
_saveOriginal(data) { _saveOriginal(data) {
console.log('修改的数据', data)
if (this.again) { if (this.again) {
if (data.data.msg === true) { if (data.data.msg === true) {
this._editSaveRecord(data) this._editSaveRecord(data)
...@@ -89,6 +91,15 @@ export default { ...@@ -89,6 +91,15 @@ export default {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
layx.destroyAll(this.formIdTemp) layx.destroyAll(this.formIdTemp)
}, },
_updateRecord: async function(param) {
const result = await soilTest.updateItem(param)
console.log(result)
if (result) {
this.$Message.success('保存成功')
this._cancel()
this.$emit('on-result-change')
}
},
// 保存后解析项目的检测值 // 保存后解析项目的检测值
_editSaveRecord(data) { _editSaveRecord(data) {
const param = { const param = {
...@@ -113,14 +124,15 @@ export default { ...@@ -113,14 +124,15 @@ export default {
param.copyMap = JSON.stringify(copyMapTemp) param.copyMap = JSON.stringify(copyMapTemp)
}) })
} }
this.$store.dispatch('EnvItem/updateFormForItem', param).then(() => { this._updateRecord(param)
if (this.$store.state.EnvItem.success) { // this.$store.dispatch('EnvItem/updateFormForItem', param).then(() => {
this.$Message.success('保存成功') // if (this.$store.state.EnvItem.success) {
// this.showModal = false; // this.$Message.success('保存成功')
this.$emit('on-result-change') // // this.showModal = false;
this._cancel() // this.$emit('on-result-change')
} // this._cancel()
}) // }
// })
} }
} }
} }
......
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="模板名称:">
<Input v-model="formObj.templateTitle" @on-enter="_formSearch" placeholder="请输入模板名称" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托单位:">
<Input v-model="formObj.cusNames" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :icon-msg="iconMsg" :getPage="getPage">
<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.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<!-- <template slot="col">-->
<!-- <vxe-table-column-->
<!-- :width="190"-->
<!-- title="操作"-->
<!-- align="center"-->
<!-- fixed="right">-->
<!-- <template slot-scope="scope">-->
<!-- <VXEIconList :msg="(scope.row.hasInputItem===1) ? iconMsg : iconMsgDisable"-->
<!-- @on-result-change="_iconClick" :rowData="scope.row"></VXEIconList>-->
<!-- </template>-->
<!-- </vxe-table-column>-->
<!-- </template>-->
</PTVXETable>
</Col>
</Row>
<ItemOriginalRecordEdit ref="recordEditModal"></ItemOriginalRecordEdit>
<ItemView ref="itemViewModal"></ItemView>
</div>
</template>
<script>
/**
* 原始记录查看
*/
import Global from '../../../api/config'
import { soilTest } from '../../../api'
import ItemOriginalRecordEdit from './OriginalRecordEdit'
import ItemView from './ItemView'
export default {
components: {
ItemOriginalRecordEdit,
ItemView
},
data() {
return {
currentComponent: '',
getPage: {},
btn: [
{
type: '',
id: '',
name: '纠正填写时间',
componentName: 'EditDateModal'
},
{ type: '', id: '', name: '设置填写人乙' },
{ type: 'error', id: '', name: '删除' }
],
selectIds: [],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{
type: 'ios-book',
id: '',
name: '查看原始记录'
},
{
type: 'ios-list',
id: '',
name: '查看试验项目'
}
// {
// type: 'erlenmeyer-flask',
// id: '',
// name: '查看样品',
// componentName: 'SampleView'
// },
// {
// type: 'document-text',
// id: '',
// name: '查看检测项目',
// componentName: 'ItemView'
// },
// { type: 'cloud', id: '', name: '附件', componentName: 'FileManage' },
// { type: 'trash-a', id: '', name: '删除' },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'ElnFormRecord'
// }
],
iconMsgDisable: [
{ type: 'md-create', id: '', name: '编辑', disabled: true },
{
type: '',
id: '',
name: '查看原始记录',
componentName: 'OriginalItemView'
},
{
type: 'ios-list',
id: '',
name: '查看试验项目'
}
// {
// type: 'document-text',
// id: '',
// name: '查看检测项目',
// componentName: 'ItemView'
// },
// { type: 'cloud', id: '', name: '附件', componentName: 'FileManage' },
// { type: 'trash-a', id: '', name: '删除', disabled: true },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'ElnFormRecord'
// }
],
pageColumns: [
{ title: '模板名称', key: 'title' },
{ title: '委托编号', key: 'entrustCode' },
{ title: '填写人', key: 'uname' },
{ title: '创建时间', key: 'ctime', dateTime: true }
],
formObj: {
entrustId: '',
batchNos: '',
sampleNums: '',
templateTitle: '',
fillInTimeBegin: '',
fillInTimeEnd: '',
cusNames: '',
codes: '',
itemNames: '',
testAccordings: ''
},
searchOpen: false
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_componentResult(data) {
switch (this.currentComponent) {
case 'EditDateModal':
this._updateDate(data)
break
default:
this._page()
}
},
_updateDate(date) {
this.$store
.dispatch('PrintForm/updateTimeBatch', {
ids: this.selectIds.join(','),
fillInTime: date
})
.then(() => {
if (this.$store.state.PrintForm.success) {
this._page()
this.$Message.success('更新成功!')
}
})
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '纠正填写时间':
this._editWriteTime()
break
case '设置填写人乙':
this._setAnotherTester()
break
case '删除':
this._batchDelete()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 设置填写人乙
_setAnotherTester() {
if (this.selectIds.length === 0) {
this.$msgTip('warning')
} else {
this.$refs.testerModal._open(this.selectIds)
}
},
_editWriteTime() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('填写时间')
}
},
_dateChange(data) {
this.formObj.fillInTimeBegin = data[0]
this.formObj.fillInTimeEnd = data[1]
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this.$refs.recordEditModal._openWithType(
data.originalRecordId,
'ENVTESTMAKEEDIT'
)
break
case '查看原始记录':
this._recordView(data.originalRecordId)
break
case '查看试验项目':
this._itemView(data.id)
break
case '查看检测项目':
this.$refs.refModal._open(data)
break
case '查看样品':
this.$refs.refModal._open(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'originalId')
break
case '删除':
this._deleteByIds([data.id])
break
case '操作记录':
this.$refs.refModal._open(data.id)
break
}
})
},
// 查看试验项目
_itemView(id) {
this.$refs.itemViewModal._open(id)
},
// 查看原始记录
_recordView(originalRecordId) {
// layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
Global.recordURL +
'/print/v1/form/' +
originalRecordId +
'?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
_open(entrustId) {
this.formObj.entrustId = entrustId
this._page()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.EnvItem.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.recordPage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 批量删除原始记录
_batchDelete() {
if (this.selectIds.length > 0) {
const content = '确定删除这' + this.selectIds.length + '条数据?'
this._deleteByIds(this.selectIds, content)
} else {
this.$msgTip('warning')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('EnvItem/deleteOriRecord', ids).then(() => {
if (this.$store.state.EnvItem.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
}
}
}
</script>
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<el-tab-pane label="按样品录入" name="waitScan"> <el-tab-pane label="按样品录入" name="waitScan">
<WaitScan ref="waitScanModal"></WaitScan> <WaitScan ref="waitScanModal"></WaitScan>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="查看原始记录" name="viewRecord">
<OriginalRecordView ref="recordModal"></OriginalRecordView>
</el-tab-pane>
</el-tabs> </el-tabs>
<!-- <keep-alive>--> <!-- <keep-alive>-->
<!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;--> <!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;-->
...@@ -23,11 +26,13 @@ ...@@ -23,11 +26,13 @@
<script> <script>
import WaitReceive from './item-tabs/ItemTabs' import WaitReceive from './item-tabs/ItemTabs'
import WaitScan from './sample-tabs/SampleTabs' import WaitScan from './sample-tabs/SampleTabs'
import OriginalRecordView from './OriginalRecordView'
export default { export default {
components: { components: {
WaitReceive, WaitReceive,
WaitScan WaitScan,
OriginalRecordView
}, },
data() { data() {
return { return {
...@@ -69,8 +74,9 @@ export default { ...@@ -69,8 +74,9 @@ export default {
this.$refs.alreadyIssuedModal._open(this.contractId, this.type) this.$refs.alreadyIssuedModal._open(this.contractId, this.type)
}, },
_changeTabs(tab, event) { _changeTabs(tab, event) {
if (tab.name === 'alreadyIssued') { if (tab.name === 'viewRecord') {
// this._issuedPage() // this._issuedPage()
this.$refs.recordModal._open(this.entrustId)
} else if (tab.name === 'waitReceive') { } else if (tab.name === 'waitReceive') {
// this._waitPage() // this._waitPage()
this.$refs.waitScanModal._clearTable() this.$refs.waitScanModal._clearTable()
......
...@@ -80,6 +80,7 @@ export default { ...@@ -80,6 +80,7 @@ export default {
title: '', title: '',
businessTypeList: 0 businessTypeList: 0
}, },
entrustId: '',
selectData: [], selectData: [],
itemIds: [], itemIds: [],
footerList: [ footerList: [
...@@ -139,8 +140,9 @@ export default { ...@@ -139,8 +140,9 @@ export default {
_hideLoading() { _hideLoading() {
this.$refs.footerModal._hideLoading() this.$refs.footerModal._hideLoading()
}, },
_open(ids) { _open(ids, entrustId) {
this.formObj = this.$resetFields(this.formObj) this.formObj = this.$resetFields(this.formObj)
this.entrustId = entrustId
this._classTree() this._classTree()
this.showModal = true this.showModal = true
this.itemIds = ids this.itemIds = ids
...@@ -221,9 +223,9 @@ export default { ...@@ -221,9 +223,9 @@ export default {
const result = await soilTest.checkLimit(param) const result = await soilTest.checkLimit(param)
console.log(result) console.log(result)
}, },
_createOriginalRecord: async function() { _createOriginalRecord() {
const result = await soilTest.searchItem({ ids: this.itemIds.join(',') }) // const result = await soilTest.searchItem({ ids: this.itemIds.join(',') })
console.log(result) // console.log(result)
this.showModal = false this.showModal = false
const url = const url =
Global.recordURL + '/print/v1/eln/template_YT_' + this.selectData[0].id Global.recordURL + '/print/v1/eln/template_YT_' + this.selectData[0].id
...@@ -331,6 +333,7 @@ export default { ...@@ -331,6 +333,7 @@ export default {
} }
console.log('保存的数据', tempData) console.log('保存的数据', tempData)
if (tempData.formId !== undefined) { if (tempData.formId !== undefined) {
tempData.entrustId = this.entrustId
this._save(tempData) this._save(tempData)
} }
// this.$store // this.$store
......
...@@ -93,7 +93,6 @@ export default { ...@@ -93,7 +93,6 @@ export default {
name: '管理样品' name: '管理样品'
}, },
{ type: 'md-cloud', id: '', name: '附件' }, { type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
...@@ -109,12 +108,12 @@ export default { ...@@ -109,12 +108,12 @@ export default {
{ title: '水深(米)', key: 'waterDepth', width: 120 }, { title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 }, { title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true }, { title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 }, // { title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 }, // { title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true }, { title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 }, { title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true }, // { title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 }, // { title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 } { title: '检验类别', key: 'testType', width: 120 }
], ],
searchOpen: false, searchOpen: false,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false"> <Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:"> <Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input> <Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
...@@ -49,7 +49,9 @@ export default { ...@@ -49,7 +49,9 @@ export default {
data() { data() {
return { return {
currentComponent: '', currentComponent: '',
formObj: {}, formObj: {
name: undefined
},
tableName: 'food-task-assign-item-left', tableName: 'food-task-assign-item-left',
// 用户自己选中的列 // 用户自己选中的列
userColumns: [], userColumns: [],
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false"> <Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:"> <Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入检测项目" clearable></Input> <Input @on-enter="_formSearch" name="name" placeholder="请输入检测项目" clearable></Input>
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button> <Button @click="_formSearch" type="primary">搜索</Button>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight" <PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :icon-msg="iconMsg" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data> @on-result-change="_tableResultChange" :getPage="getPage" :icon-msg="iconMsg" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column <vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns" v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key" :key="item.key"
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson> <AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord> <SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>
<OriginalRecordEdit ref="editModal"></OriginalRecordEdit> <OriginalRecordEdit ref="editModal"></OriginalRecordEdit>
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
</div> </div>
</template> </template>
<script> <script>
...@@ -57,8 +58,14 @@ import { soilTest } from '../../../../api' ...@@ -57,8 +58,14 @@ import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson' import AssignPerson from '../../../../components/user-info-single/AssignPerson'
import SelectOriTempRecord from '../SelectOriTempRecord' import SelectOriTempRecord from '../SelectOriTempRecord'
import OriginalRecordEdit from '../OriginalRecordEdit' import OriginalRecordEdit from '../OriginalRecordEdit'
import IndexManage from '../IndexManage'
export default { export default {
components: { AssignPerson, SelectOriTempRecord, OriginalRecordEdit }, components: {
AssignPerson,
SelectOriTempRecord,
OriginalRecordEdit,
IndexManage
},
data() { data() {
return { return {
// 定义表格名称----英文 // 定义表格名称----英文
...@@ -104,7 +111,10 @@ export default { ...@@ -104,7 +111,10 @@ export default {
}, },
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' } { type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
], ],
iconMsg: [{ type: 'md-create', id: '', name: '编辑原始记录' }], iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
{ type: 'md-apps', id: '', name: '查看指标' }
],
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '试验项目', key: 'name', width: 120, fixed: 'left' }, { title: '试验项目', key: 'name', width: 120, fixed: 'left' },
...@@ -114,6 +124,7 @@ export default { ...@@ -114,6 +124,7 @@ export default {
{ title: '是否填写原始记录', key: 'recorded', width: 180 }, { title: '是否填写原始记录', key: 'recorded', width: 180 },
{ title: '大类', key: 'mainType', width: 140 }, { title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 }, { title: '小类', key: 'smallType', width: 140 },
{ title: '原始记录是否填写', key: 'recorded', width: 140 },
{ title: '检测方法', key: 'testMethod', width: 260 }, { title: '检测方法', key: 'testMethod', width: 260 },
{ title: '检测依据', key: 'testBasis', width: 140 }, { title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 } { title: '检测科室', key: 'groupName', width: 150 }
...@@ -149,18 +160,40 @@ export default { ...@@ -149,18 +160,40 @@ export default {
_iconClick(res, data, currentComponent) { _iconClick(res, data, currentComponent) {
this.$nextTick(() => { this.$nextTick(() => {
switch (res) { switch (res) {
case '编辑原始记录': case '查看原始记录':
this._recordEdit(data) console.log(data)
this._viewRecord('1309434759937146882')
break
case '查看指标':
this._indexManage(data)
break break
} }
}) })
}, },
_recordEdit(data) { _indexManage(data) {
console.log(data) this.$refs.indexModal._open(data)
// this.$refs.editModal._openWithType( },
// data.originalRecordId, _viewRecord(originalRecordId) {
// 'ENVTESTAUDITEDIT' // layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
// ) // eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
Global.recordURL +
'/print/v1/form/' +
originalRecordId +
'?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
}, },
// 获取column // 获取column
_getColumn() { _getColumn() {
...@@ -325,7 +358,7 @@ export default { ...@@ -325,7 +358,7 @@ export default {
this.$message.warning('请至少选择一条数据') this.$message.warning('请至少选择一条数据')
} else { } else {
console.log('打开填写原始记录界面') console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds) this.$refs.recordModal._open(this.selectIds, this.entrustId)
} }
}, },
_allotByPerson() { _allotByPerson() {
...@@ -389,6 +422,8 @@ export default { ...@@ -389,6 +422,8 @@ export default {
// saveName.push(this.leftSelectData[i].name) // saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod) // saveMethod.push(this.leftSelectData[i].testMethod)
// } // }
// const data = this.$serialize('task-assign-item-right')
// console.log(data)
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId this.formObj.entrustId = this.entrustId
this.formObj.name = this.leftSelectData.name this.formObj.name = this.leftSelectData.name
......
...@@ -306,8 +306,9 @@ export default { ...@@ -306,8 +306,9 @@ export default {
this.$refs.refModal._open(tempData, 'planDate') this.$refs.refModal._open(tempData, 'planDate')
} }
}, },
_open(data) { _open(id, data) {
this.getPage.records = [] this.getPage.records = []
console.log(id)
this.sampleIds = data this.sampleIds = data
if (data.length === 0) { if (data.length === 0) {
this.$set(this.getPage, 'records', []) this.$set(this.getPage, 'records', [])
...@@ -338,7 +339,7 @@ export default { ...@@ -338,7 +339,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())
this.formObj.sampleIds = this.sampleIds this.formObj.sampleIds = this.sampleIds
const result = await soilTest.pageAllot(this.$serializeForm(this.formObj)) const result = await soilTest.pageTest(this.$serializeForm(this.formObj))
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll() this.$refs.pageTable._checkAll()
......
...@@ -23,16 +23,19 @@ export default { ...@@ -23,16 +23,19 @@ export default {
ItemRightList ItemRightList
}, },
data() { data() {
return {} return {
id: ''
}
}, },
methods: { methods: {
_leftResult(data) { _leftResult(data) {
this.$refs.SamplerightModal._open(data) this.$refs.SamplerightModal._open(this.id, data)
}, },
_rightResult() { _rightResult() {
this.$refs.SampleleftModal._page() this.$refs.SampleleftModal._page()
}, },
_open(id) { _open(id) {
this.id = id
this.$refs.SampleleftModal._open(id) this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn() // this.$refs.rightModal._getColumn()
}, },
......
...@@ -95,7 +95,6 @@ export default { ...@@ -95,7 +95,6 @@ export default {
name: '管理样品' name: '管理样品'
}, },
{ type: 'md-cloud', id: '', name: '附件' }, { type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
......
...@@ -86,7 +86,6 @@ export default { ...@@ -86,7 +86,6 @@ export default {
name: '编辑' name: '编辑'
}, },
{ type: 'md-cloud', id: '', name: '附件' }, { type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{ {
type: 'ios-clock', type: 'ios-clock',
id: '', id: '',
......
...@@ -483,10 +483,15 @@ Vue.prototype.$resetFields = function(formObj) { ...@@ -483,10 +483,15 @@ Vue.prototype.$resetFields = function(formObj) {
} }
return formObj return formObj
} }
Vue.prototype.$layx = function(id, title, url, option) {
// eslint-disable-next-line no-undef
layx.iframe(id, title, url, option || { width: '100%', height: '100%' })
}
/** /**
*搜索条件清空缓存处理方式(form表单 查询) *搜索条件清空缓存处理方式(form表单 查询)
* *
*/ */
Vue.prototype.$serializeForm = function(formObj) { Vue.prototype.$serializeForm = function(formObj) {
const newFormObj = {} const newFormObj = {}
for (const key in formObj) { for (const key in formObj) {
......
...@@ -15,6 +15,14 @@ import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeI ...@@ -15,6 +15,14 @@ import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeI
import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex' import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex'
import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex' import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex'
import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex' import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex'
import CheckIndex from '../pages/soil-test-manage/test-data-check/CheckIndex'
import AuditIndex from '../pages/soil-test-manage/test-data-audit/AuditIndex'
import ReportMakeIndex from '../pages/soil-report-manage/report-make/ReportMakeIndex'
import failItem from '../pages/soil-statistics/failItem'
import yearDeclara from '../pages/soil-statistics/yearDeclara'
import MeterCustomerEntrust from '../pages/soil-statistics/customer-entrust/MeterCustomerEntrust'
import MeterPersonalTask from '../pages/soil-statistics/personal-task/MeterPersonalTask'
import MeterAnnualEntrust from '../pages/soil-statistics/annual-entrust/MeterAnnualEntrust'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -87,6 +95,27 @@ export default [ ...@@ -87,6 +95,27 @@ export default [
path: 'do_test', path: 'do_test',
component: TestInputIndex, component: TestInputIndex,
meta: { title: '试样检测' } meta: { title: '试样检测' }
},
{
path: 'check',
component: CheckIndex,
meta: { title: '数据复核' }
},
{
path: 'audit',
component: AuditIndex,
meta: { title: '数据审核' }
}
]
},
{
path: 'report',
component: Blank,
children: [
{
path: 'make_report',
component: ReportMakeIndex,
meta: { title: '报告编制' }
} }
] ]
}, },
...@@ -105,5 +134,36 @@ export default [ ...@@ -105,5 +134,36 @@ export default [
meta: { title: '试验项目' } meta: { title: '试验项目' }
} }
] ]
},
{
path: 'statistics',
component: Blank,
children: [
{
path: 'fail_item_statistics',
component: failItem,
meta: { title: '不合格项目查询' }
},
{
path: 'year_declara_count',
component: yearDeclara,
meta: { title: '年度报检量统计' }
},
{
path: 'customer_entrust',
component: MeterCustomerEntrust,
meta: { title: '客户委托量统计' }
},
{
path: 'annual_entrust',
component: MeterAnnualEntrust,
meta: { title: '年度委托量统计' }
},
{
path: 'personal_task',
component: MeterPersonalTask,
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