Commit 58cbfe47 by lichengming

修改了委托评审查看详情

parent dba98a21
<template>
<div>
<vxe-grid
ref="xTable"
:show-overflow="hideOverflow === undefined || hideOverflow === true?true:false"
:auto-resize="true"
:height="500"
:loading="loading"
:pager-config="
hidePage === undefined?{total:getPage.total,currentPage:getPage.current,pageSize:getPage.size,pageSizes:pageSizeOpts,background:true}:null"
:scroll-y="setOptimization === undefined?defOptimization:setOptimization"
:checkbox-config="selectConfig"
@checkbox-all="_selectAll"
@checkbox-change="_selectRowChange"
@page-change="_pageSizeChange"
:cell-class-name="_tableCellClassName"
:row-class-name="_tableRowClassName"
:edit-config="editConfig"
:row-key="true"
:tooltip-config="{enterable:true}"
size="mini"
border
resizable
stripe
show-header-overflow
>
<vxe-table-column
v-if="hideCheckbox===undefined || hideCheckbox === false"
type="checkbox"
fixed="left"
width="50"
align="center"/>
<vxe-table-column
type="seq"
fixed="left"
title="序号"
width="50"
align="center"/>
<slot></slot>
<vxe-table-column
:width="$optColWidth(iconMsg)"
v-if="$optColWidth(iconMsg)>0?true:false"
title="操作"
align="center" fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
<slot name="col"></slot>
</vxe-grid>
<!--自定义表格列-->
<div style="position: absolute;right:0;top:0;z-index:2000">
<slot name="setting"></slot>
</div>
</div>
</template>
<script>
/**
* VXE-TABLE 数据录入用(分包数据录入,检测数据录入 专用)
*/
import VXEIconList from '../base/VXEIconList'
export default {
components: { VXEIconList },
props: {
hideOverflow: null,
hidePage: null,
pageColumns: null,
// tableHeight: 500,
hideCheckbox: null,
optColWidth: null,
getPage: null,
iconMsg: null,
warnKey: null,
selectData: null,
hideElevator: null,
hideTotal: null,
hideSizer: null,
clickValue: null, // 单击返回值
noWarning: null, // 不显示警告提示
isDataTest: null, // 判断是否是数据检测
tableName: null, // 该值存在,则支持自定义表格
setOptimization: null, // 加载滚动配置项
rows: null
},
data() {
return {
formId: '',
extendsData: {},
loading: false,
pageParams: {
page: 1,
rows: this.rows !== undefined ? this.rows : this.$defRow
},
rowData: {},
checkData: [],
sampleHandleValue: '',
// 一系列配置
pageSizeOpts: [50, 100, 500, 1000],
// 默认的配置
defOptimization: this.$setOptimization(),
selectConfig: { checkField: 'checked', trigger: 'row' },
editConfig: {
trigger: 'click',
mode: 'cell',
showIcon: true,
autoClear: false,
showStatus: true
}
}
},
watch: {
// // 监听数据
'getPage.records': function(newVal, oldVal) {
this._loadData(newVal)
}
},
methods: {
_loadData(data) {
// 阻断 vue 对大数组的双向绑定,大数据性能翻倍提升
if (this.$refs.xTable) {
this.$refs.xTable.loadData(data)
}
},
// 刷新column 和刷新数据
_refreshColumn() {
this.$refs.xTable.refreshColumn()
this.$refs.xTable.syncData()
},
_pageSizeChange(row) {
switch (row.type) {
case 'size':
this.pageParams.page = 1
this.pageParams.rows = row.pageSize
this._pageParamsChange()
break
case 'current':
this._pageChange(row.currentPage)
break
}
},
_pageChange(page) {
this.pageParams.page = page
this._pageParamsChange()
},
_pageParamsChange() {
this.$emit('on-result-change', 'changeSize')
},
_searchParams() {
const data = {}
const serData = this.$serialize(this.formId)
Object.assign(data, serData, this.extendsData)
if (this.hidePage === undefined) {
return this.$extend(data, this.pageParams)
} else {
return this.$extend(data)
}
},
_page(formId, uri, extendsData) {
this.loading = true
if (this.tableName !== undefined) {
// tableName存在-----支持自定义表格
this._settingCol(formId, uri, extendsData)
} else {
this._pageTemp(formId, uri, extendsData)
}
},
_settingCol(formId, uri, extendsData) {
if (uri) {
// 为了避免uri为undefined
this.$store
.dispatch('SysTableColumn/getByTableName', this.tableName)
.then(() => {
// 查询用户下的表格数据
const userTableCode = this.$store.state.SysTableColumn.model
this.$emit(
'on-result-change',
'table-col',
this.$tableColumns(this.pageColumns, userTableCode)
)
this._pageTemp(formId, uri, extendsData)
})
}
},
// 临时
_pageTemp(formId, uri, extendsData) {
this.formId = formId
if (extendsData) {
this.extendsData = extendsData
}
this.$store.dispatch(uri, this._searchParams()).then(() => {
this.loading = false
this.$emit('on-result-change', 'page', '')
this._refreshColumn()
})
},
// 多选
_selectAll: function(data) {
this._selectRowChange(data)
},
_selectRowChange(data) {
// 可编辑单元格
if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
const selData = data.selection
this.checkData = selData
// 默认返回的是id数组
if (this.selectData === undefined) {
const idList = []
for (let i = 0; i < selData.length; i++) {
idList.push(selData[i].id)
}
this.$emit('on-result-change', 'selectIds', idList)
this.$emit('on-result-change', 'selectData', selData)
} else {
// 有selectData参数时执行
this.$emit('on-result-change', 'selectData', selData)
}
}
},
// 单元格变色
_tableCellClassName({ row, column, rowIndex, columnIndex }) {
// if (column.property === 'name' && row['progress'] && row.progress.display.indexOf('退回') !== -1) {//含有退回就变红
// return 'cell-red';
// }
if (
column.property === 'serviceType' &&
row.serviceType &&
row.serviceType.indexOf('加急') !== -1
) {
// 含有加急就变红
return 'cell-red'
}
// if (column.property === 'name' && row['name'] && row.name.indexOf('复测') !== -1) {//含有加急就变红
// return 'cell-red';
// }
},
// 整行变色
_tableRowClassName({ row, rowIndex }) {
// console.log('row==', row, rowIndex)
if (this.checkData.length !== 0) {
/* 选中的进行高亮显示 */
const index = this.checkData.indexOf(row)
if (index !== -1) {
return 'high-light-row'
}
} else {
/* 没选中的根据页面逻辑变色 */
}
},
// 操作列回调
_iconClick(name, rowData, componentName, rowIndex, obj) {
this.$emit('on-result-change', 'iconClick', {
name: name,
rowData: rowData,
componentName: componentName,
rowIndex: rowIndex,
obj: obj
})
},
// 关闭loading
_hideLoading() {
this.loading = false
},
// 打开loading
_showLoading() {
this.loading = true
},
// 清空选中checkbox状态
_clearSelection() {
this.$nextTick(function() {
this.$refs.xTable.clearCheckboxRow()
})
this.checkData = []
if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
if (this.selectData === undefined) {
this.$emit('on-result-change', 'selectIds', [])
} else {
this.$emit('on-result-change', 'selectData', [])
}
}
},
// 激活单元格编辑 row:当前行数据,field:单元格的英文名称
_activeCell(obj) {
this.$refs.xTable.setActiveCell(obj.row, obj.field)
if (obj.msg === 'left') {
// 向左返回的时候 清除滚动状态
this.$refs.xTable.clearScroll()
}
},
// 只刷新选中行的数据
_refreshRows(rowList) {
const records = this.getPage.records
for (let i = 0; i < rowList.length; i++) {
const index = records.findIndex(item => item.id === rowList[i].id)
if (index !== -1) {
this.$set(this.getPage.records, index, rowList[i])
}
}
}
}
}
</script>
<template>
<div>
<!--阿里巴巴图标-->
<div>
<div class="col-setting">
<span @click="_checkClick" style="cursor: pointer">
<i class="pt-ivu-icon pt-setting" style="color: #00a0e9;font-size: 20px"></i>
</span>
</div>
</div>
<!--阿里巴巴图标-->
<!--select-table-start-modal-->
<div>
<Modal v-model="showSelectModal" width="700" class="zIndex-1300">
<p slot="header">{{modalTitle}}</p>
<div>
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="_checkAll">{{title}}</el-checkbox>
<el-checkbox-group v-model="checkList" @change="_selectChange" style="margin-top:10px">
<el-checkbox :label="item.key" v-for="item in tableColumns" :key="item.key"
style="width:25%;margin-left: 0">{{item.title}}
</el-checkbox>
</el-checkbox-group>
</div>
<div slot="footer" class="btn-width">
<Button @click="_cancel" type="ghost" style="margin-left: 8px">取消</Button>
<Button @click="_ok" :loading="isLoading" type="primary">保存</Button>
</div>
</Modal>
</div>
<!--select-table-end-modal-->
</div>
</template>
<script>
/* VXE-TABLE 自定义表格列 */
export default {
props: {
pageColumns: null, // table 列(自己选中需要展示的)
tableName: null, // 表格的名字(英文)
userColumns: null // 用户自己选中的列 code
},
data() {
return {
// 自定义列
checkList: [],
modalTitle: '自定义列',
showSelectModal: false,
checkAll: false,
isIndeterminate: true, // 设置 indeterminate 状态,只负责样式控制
title: '',
tableColumns: [], // 从企业中获得的表格数据
isLoading: false
}
},
methods: {
_checkClick() {
this.showSelectModal = true
this.isLoading = false
// 查询该企业下表格列(根据表格名称)
this._getByNameCompany()
},
_getByNameCompany() {
this.$store
.dispatch('SysTableColumn/getByNameCompany', this.tableName)
.then(() => {
const result = this.$store.state.SysTableColumn.model
/** *********企业的表格信息与本地pageColumns比较(如果企业没有选择表格,则显示全部表格列信息)***********/
const tableColumns = []
for (let i = 0; i < this.pageColumns.length; i++) {
result.map(item => {
if (item === this.pageColumns[i].key) {
tableColumns.push(this.pageColumns[i])
}
})
}
this.tableColumns = tableColumns
/** ********************************************用户选中的数据*************************************/
// 用户没选中则勾选的是企业的表格数据
const userData =
this.userColumns.length === 0 ? this.tableColumns : this.userColumns
const checkList = []
for (let k = 0; k < userData.length; k++) {
checkList.push(userData[k].key)
}
this.checkList = checkList
/** **********************************************是否全部选中*************************************/
if (checkList.length === this.tableColumns.length) {
// 全部选中
this.checkAll = true
this.isIndeterminate = false
this.title = '全不选'
} else {
this.checkAll = false
this.isIndeterminate = true
this.title = '全选'
}
})
},
// 选中的checkbox
_selectChange(data) {
this.checkList = data
const checkedCount = data.length
this.checkAll = checkedCount === this.tableColumns.length
this.isIndeterminate =
checkedCount > 0 && checkedCount < this.tableColumns.length
if (this.checkAll) {
this.title = '全不选'
} else {
this.title = '全选'
}
},
// 全选
_checkAll(val) {
this.isIndeterminate = false
if (val) {
// 全选
const checkList = []
for (let k = 0; k < this.tableColumns.length; k++) {
checkList.push(this.tableColumns[k].key)
}
this.checkList = checkList
this.title = '全不选'
} else {
// 全不选
this.checkList = []
this.title = '全选'
}
},
// 保存
_ok() {
if (this.checkList.length === 0) {
this.$Message.warning('请至少选择一项数据!')
} else {
this.isLoading = true
const data = {
tableName: this.tableName,
codes: this.checkList
}
this.$store.dispatch('SysTableColumn/userSave', data).then(() => {
if (this.$store.state.SysTableColumn.success) {
this.$Message.success('保存成功')
this.$emit('on-result-change')
this._cancel()
this.isLoading = false
} else {
this.isLoading = false
}
})
}
},
// 取消
_cancel() {
this.showSelectModal = false
}
}
}
</script>
<style>
.col-setting {
padding: 0px 5px;
border-top: 1px solid #ebeef5;
border-right: 1px solid #ebeef5;
background: #f8f8f9;
height: 30px;
line-height: 42px;
}
</style>
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterSendOperation ref="operationModal"></MeterSendOperation>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
......@@ -256,7 +257,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
......
......@@ -47,6 +47,7 @@
</div>
<Reason ref="reasonModal" @on-result-change="_reasonResult"></Reason>
<operationModal ref="operationModal"></operationModal>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
......@@ -316,7 +317,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -46,6 +46,7 @@
</div>
</div>
<operationModal ref="operationModal"></operationModal>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
......@@ -270,7 +271,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -49,6 +49,7 @@
<CarManage ref="carEdit"></CarManage>
<InstruMentEdit ref="InstruEdit"></InstruMentEdit>
<operationModal ref="operationModal"></operationModal>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
......@@ -328,7 +329,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -45,7 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<operationModal ref="operationModal"></operationModal>
</div>
......@@ -248,7 +248,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<operationModal ref="operationModal"></operationModal>
<SelEquip ref="SelEquip" @on-result-change="_equipSelectBack"></SelEquip>
<CarManage ref="carEdit"></CarManage>
......@@ -318,7 +319,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterOutTaskAlloca ref="taskAllocaModal"></MeterOutTaskAlloca>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<MeterOutTaskOperation ref="operationModal"></MeterOutTaskOperation>
......@@ -259,7 +260,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_componentResult"></MeterSampleManage>
<MeterEntrustDetail ref="meterSampleEdit" @on-result-change="_componentResult"></MeterEntrustDetail>
<Operation ref="operation"></Operation>
......@@ -294,7 +295,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
......
......@@ -10,24 +10,24 @@
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入样品编号" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.code" @on-enter="_formSearch" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button>
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
:icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -57,12 +57,18 @@
</Row>
</div>
</Modal>
<importModal ref="importModal"></importModal>
<MeterSampleManageEdit ref="sampleEditModal"></MeterSampleManageEdit>
</div>
</template>
<script>
import { meterSample } from '../../api'
import MeterSampleManageEdit from './MeterSampleManageEdit'
import importModal from './contractTab/ContractTab'
export default {
components: {
MeterSampleManageEdit,
importModal
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
......@@ -70,6 +76,7 @@ export default {
data() {
return {
currentComponent: '',
searchOpen: 'false',
// btn: [
// {type: 'success', id: '', name: '添加', componentName: 'FoodSampleGovernEdit'},
// {id: 'food-gov-sample-batch-add', name: '批量添加', componentName: 'FoodSampleGovernBatchAdd'},
......@@ -81,7 +88,8 @@ export default {
// ],
iconMsg: [
{ type: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'ios-copy', id: '', name: '管理检测样品' },
// { type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [
......@@ -96,6 +104,11 @@ export default {
type: 'success',
id: '',
name: '取消分包'
},
{
type: 'success',
id: '',
name: '导入检测项目'
}
],
options: [
......@@ -182,6 +195,9 @@ export default {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理检测样品':
this._sampleEditModal(data)
break
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
......@@ -202,6 +218,10 @@ export default {
}
})
},
_sampleEditModal(data) {
console.log(data)
this.$refs.sampleEditModal._open(data.id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
......@@ -379,7 +399,7 @@ export default {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
this.$refs.importModal._open(this.selectIds, this.selectData[0])
}
},
_subpackageSample() {
......
<template>
<div>
<Modal v-model="showModal" width="1200" class="modal-footer-none">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" @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" style="margin-left: -10px">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='jobOut'">
{{scope.row[item.key]===1?'是':'否'}}
</div>
<span v-else-if="item.key==='singleJudge'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<div v-else-if="item.key==='testValue'">
<el-input
v-model="scope.row.testValue"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
size="medium"
placeholder="请输入检测结果"
/>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row.progress.display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
import { meterItem } from '../../api'
export default {
components: {
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
// btn: [
// {type: 'success', id: '', name: '添加', componentName: 'FoodSampleGovernEdit'},
// {id: 'food-gov-sample-batch-add', name: '批量添加', componentName: 'FoodSampleGovernBatchAdd'},
// {id: '', name: '导入样品', componentName: 'FoodImportSample'},
// {id: '', name: '导入检测项目', componentName: 'RelItem'},
// {id: '', name: '导入检测项目包', componentName: 'RelItemPackage'},
// {id: '', name: '复制历史样品检测项目', componentName: 'CopyHisItem'},
// {id: '', name: '删除'},
// ],
iconMsg: [
{ type: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [
// {
// // meter-review-entrust-pass-btn
// type: 'success',
// id: '',
// name: '完成'
// },
// // meter-review-entrust-back-btn
// {
// type: 'success',
// id: '',
// name: '填写检测值'
// },
// {
// type: 'success',
// id: '',
// name: '判定'
// }
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
searchOpen: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
// { title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '检定项目', key: 'name', width: 180 },
{ title: '比较符', key: 'compare', width: 100 },
{ title: '限量值', key: 'limitValue', width: 140 },
{ title: '检测值', key: 'testValue', width: 140 },
{ title: '单项判定', key: 'singleJudge', width: 140 },
{ title: '进度', key: 'progress', width: 110 }
],
dateList: [],
formObj: {
sampleId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '完成':
this._testEnd()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
localStorage.setItem('type', data.type)
if (data.type === 2) {
this._editLY(data.id) // 粮油的编辑页
} else {
this._editModal(true, data.id)
}
break
case '复制':
this._copy(data.id, data.type)
break
case '删除':
this._deleteById(data.id)
break
case '检测项目':
this._itemDetail(data.id)
break
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj.sampleId = id
this.showModal = true
this._page()
},
_testEnd() {
if (this.selectIds.length === 0) {
this.$Message.success('请选择完成检测的项目')
return false
}
this._testItemEnd(this.selectIds)
},
_testItemEnd: async function() {
const result = await meterItem.testEnd({
ids: this.selectIds,
sampleId: this.formObj.sampleId
})
if (result) {
await this._page()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterItem.pageTest(this.formObj)
console.log('result', result)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultChange('删除成功!')
})
}
})
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_editModal(edit, id) {
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(function() {
if (edit) {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
} else {
this.$refs.refModal._open('', this.contractId)
}
})
},
_editLY(id) {
// 粮油的编辑
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
})
},
_search() {
this._page()
},
_searchParams() {
const data = this.$serialize('search-sample-govern')
return this.$extend(data, this.pageParams)
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
}
},
_copy(sampleId, type) {
this.$refs.refModal._open(sampleId, type)
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/government/import_' + this.contractId,
downloadUrl: '/food/v1/excel/template/FoodSampleGovernment',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_subpackageSample() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选中一条样品进行分包!')
return false
} else {
for (let i = 0; i < this.selectData.length; i++) {
if (this.selectData[i].jobOut === 1) {
this.$Message.warning(
'样品编号为' +
this.selectData[i].code +
'已经分包了,请选择未分包的样品!'
)
return false
}
}
this._subpackage(this.selectIds)
}
},
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, 'batch-rel-package-item')
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_itemDetail(id) {
this.$refs.foodItem._open(id)
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
},
// 单个填写检测值
_handleTestValueEdit: async function(id, testValue) {
if (testValue !== '' && undefined !== testValue) {
const data = {}
data.itemIds = id
data.testValue = testValue
const result = await meterItem.testValue(data)
if (result) {
this.$Message.success('保存成功')
await this._page()
} else {
this.$Message.error('保存失败')
}
}
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="data-input-contract-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item-select">
<SelectInput ref="selInput1" :optionList="optionList" @on-result-change="_selInputResult1"
keyword="code" placeholder="请输入委托编号"></SelectInput>
</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">
<!--切换待认领任务-->
<template slot="processTask" v-if="$showBtn('food-data-input-contract-task')">
<div class="fr process-task" style="margin-right: 10px">
<el-checkbox v-model="personal" @change="_page" :true-label="1"
:false-label="0" size="medium">个人任务
</el-checkbox>
</div>
</template>
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns"
:table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:rows="100" is-task>
<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="_page" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<!-- <component ref="refModal" :is="currentComponent"></component>-->
</div>
</template>
<script>
import SelectInput from './SelectInput'
// import FoodContractCompanyDetail from '../../../marketManage/food-contract-company/FoodContractCompanyDetail'
// import FoodContractGovernDetail from '../../../marketManage/food-contract-govern/FoodContractGovernDetail'
export default {
components: {
// FoodContractCompanyDetail,
// FoodContractGovernDetail,
SelectInput
},
data() {
return {
currentComponent: '',
tableName: 'food-data-input-contract-left',
// 用户自己选中的列
userColumns: [],
personal: 1,
btn: [],
optionList: [
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'cname', name: '委托单位', placeholder: '请输入委托单位' },
{ key: 'name', name: '委托名称', placeholder: '请输入委托名称' },
{
key: 'reportDueDate',
name: '应出报告日期',
placeholder: '请选择应出报告日期',
date: true
}
],
getPage: {},
pageColumns: [
{ title: '委托名称', key: 'name', width: 160 },
{ title: '委托编号', key: 'code', width: 180, detail: true },
{ title: '委托单位', key: 'cname', width: 200 },
{ title: '服务类型', key: 'serviceType', width: 120 },
{ title: '应出报告日期', key: 'reportDueDate', width: 140, date: true }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
_dicSearch() {
this.$store
.dispatch('LmsBaseDict/getItem', '个人任务是否勾选')
.then(() => {
const resultData = this.$store.state.LmsBaseDict.item
if (resultData.length > 0) {
this.personal = resultData[0].name === '是' ? 1 : 0
} else {
this.personal = 1
}
this._page()
})
},
_btnClick() {},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open() {
// this._dicSearch()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
if (this.personal) {
obj.personal = this.personal
}
return obj
},
_page() {
this.$refs.pageTable._page(
'data-input-contract-left',
'FoodContract/dataInputContractLeft',
this._searchParams()
)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.$emit('on-result-change', data, this.personal)
break
case 'changeSize':
this._page()
this._clear()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_clear() {
this.selectIds = []
this.$emit('on-result-change', [])
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
this._clear()
}
// 委托详情
// _detailModal(data) {
// this.$store.dispatch('FoodContract/getById', data.id).then(() => {
// if (data.type === 1) {
// this.currentComponent = 'FoodContractGovernDetail'
// } else {
// this.currentComponent = 'FoodContractCompanyDetail'
// }
// this.$nextTick(function() {
// this.$refs.refModal._open(this.$store.state.FoodContract.model)
// })
// })
// }
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
111111
<Form id="data-input-contract-right" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item-select">
<SelectInput ref="selInput1" :optionList="optionList" :judgeList="judgeList"
@on-result-change="_selInputResult1" compare-keyword="testBasis"
keyword="name"
placeholder="请输入检测项目"></SelectInput>
</Form-item>
<Form-item class="search-item-select">
<SelectInput ref="selInput2" :optionList="optionList" :judgeList="judgeList"
@on-result-change="_selInputResult2" compare-keyword="name"
keyword="testBasis"
placeholder="请输入检测依据"></SelectInput>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<BtnList :msg="btn" @on-result-change="_btnClick" :showBtnNum="7" class="contHide"></BtnList>
</Col>
<Col span="24">
<PTVXETableData
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:table-name="tableName"
:pageColumns="pageColumns"
@on-result-change="_tableResultChange"
: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?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
:edit-render="item.editCell?{autofocus: 'input'}:null"
sortable
>
<!--可编辑模板-->
<!-- <template v-slot:edit="{ row,rowIndex }">-->
<!-- <div v-if="item.key === 'name'" :style="{color:colorComputed(row.planEndDate)}">-->
<!-- {{row.key}}-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='testValue'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.testValue" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- @keyup.enter.native="_enterSave({scope:{row:row,rowIndex:rowIndex},fieldName:item.key,msg:'enter'})" placeholder="请输入检测值"-->
<!-- size="small">-->
<!-- </el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='retestValue'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.retestValue" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- placeholder="请输入复测测值" size="small"></el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='unit'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <AutoCompletes :value="row.unit" :downData="unitList" @on-result-change="_unitChange"-->
<!-- :handleObj="{row:row,index:rowIndex}" show-key="name" placeholder="请输入或选择单位"-->
<!-- blur-->
<!-- ></AutoCompletes>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='qualified'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <Select v-model="row.qualified.value" @on-change="_saveQualified"-->
<!-- :class="[{'selected-test-red':row.qualified.value==='NOT_OK'},-->
<!-- {'selected-test-green':row.qualified.value==='OK'},-->
<!-- {'selected-test-warn':row.qualified.value==='NO_JUDGE'}]"-->
<!-- placeholder="结果判定">-->
<!-- <Option value="WAIT_SYSTEM">待判定</Option>-->
<!-- <Option value="OK">合格</Option>-->
<!-- <Option value="NOT_OK">不合格</Option>-->
<!-- <Option value="NO_JUDGE">不判定</Option>-->
<!-- </Select>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='singleConclusion'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <Select v-model="row.singleConclusion" @on-open-change="_saveSel" multiple>-->
<!-- <Option v-for="item in singleConclusionList" :value="item.name" :key="item.id">{{item.name}}-->
<!-- </Option>-->
<!-- </Select>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='testBasisFull'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <AutoCompletesTestBasis :value="row.testBasisFull" :downData="testBasisData"-->
<!-- @on-result-change="_testBasisChange" :handleObj="{row:row,index:rowIndex}"-->
<!-- placeholder="请输入或选择检测依据" focus blur-->
<!-- ></AutoCompletesTestBasis>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='testMethod'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <AutoCompletes :value="row.testMethod" :downData="testMethodData" @on-result-change="_testMethodChange"-->
<!-- :handleObj="{row:row,index:rowIndex}" show-key="testMethod" placeholder="请输入或选择检测方法" blur-->
<!-- focus-->
<!-- ></AutoCompletes>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='detectionType'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <Select v-model="row.detectionType" @on-change="_save(item.key)" placeholder="请选择检出类别" clearable>-->
<!-- <Option v-for="item in detectionTypeList" :key="item.name" :value="item.name">-->
<!-- {{item.name}}-->
<!-- </Option>-->
<!-- </Select>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='detection'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.detection" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- placeholder="请输入检出限" size="small"></el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='judgeBasis'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <AutoCompletes :value="row.judgeBasis" :downData="judgeBasisData" @on-result-change="_judgeBasisChange"-->
<!-- :handleObj="{row:row,index:rowIndex}" show-key="judgeBasis" placeholder="请输入或选择判定依据" focus-->
<!-- blur-->
<!-- ></AutoCompletes>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='judgeBasisName'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <AutoCompletes :value="row.judgeBasisName" :downData="judgeBasisNameData" @on-result-change="_judgeBasisNameChange"-->
<!-- :handleObj="{row:row,index:rowIndex}" show-key="judgeBasisName" placeholder="请输入或选择判定依据名称" focus-->
<!-- blur-->
<!-- ></AutoCompletes>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='limitDefault'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.limitDefault" @focus="_handleRow({row:row,index:rowIndex})" @change="_handleLimitDefalut"-->
<!-- placeholder="请输入限量" size="small"></el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='limitType'&&edit" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <span>-->
<!-- <el-input v-model="row.limitType" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- placeholder="请输入限量类别" style="width:70%"-->
<!-- size="small"></el-input>-->
<!-- </span>-->
<!-- <span>-->
<!-- <el-popover-->
<!-- placement="bottom"-->
<!-- width="700"-->
<!-- trigger="click">-->
<!-- <el-table :data="limitData" @row-click="_selLimit" :height="240" clas="pop-table"-->
<!-- stripe border size="small" highlight-current-row>-->
<!-- <el-table-column width="80" property="firstClass" label="大类"></el-table-column>-->
<!-- <el-table-column width="80" property="secondClass" label="亚类"></el-table-column>-->
<!-- <el-table-column width="80" property="thirdClass" label="次亚类"></el-table-column>-->
<!-- <el-table-column width="80" property="fourthClass" label="细类"></el-table-column>-->
<!-- <el-table-column width="80" property="testParameter" label="产品"></el-table-column>-->
<!-- <el-table-column width="100" property="limitDefault" label="限量"></el-table-column>-->
<!-- <el-table-column width="100" property="limitType" label="限量类别"></el-table-column>-->
<!-- <el-table-column width="100" property="unit" label="单位"></el-table-column>-->
<!-- </el-table>-->
<!-- <a slot="reference" @click.native.stop="_getLimit(row)">选择</a>-->
<!-- </el-popover>-->
<!-- </span>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='judged'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <Select v-model="row.judged" placeholder="是否判定" disabled>-->
<!-- <Option :value="0"></Option>-->
<!-- <Option :value="1"></Option>-->
<!-- </Select>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='labRemark'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.labRemark" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- placeholder="请输入说明" size="small"></el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='planEndDate'">-->
<!-- {{ row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}-->
<!-- </div>-->
<!-- <div v-else-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>-->
<!-- <div v-else-if="item.key==='progress'">{{row[item.key].display}}</div>-->
<!-- <a v-else-if="item.key==='num'" @click="_sampleDetail(row)">{{row[item.key]}}</a>-->
<!-- <div v-else-if="item.key === 'distanceWeekdays'"-->
<!-- :class="$distanceWeekdaysColor(row[item.key])" style="font-weight: bold">-->
<!-- {{row[item.key]}}-->
<!-- </div>-->
<!-- <div v-else-if="item.key === 'detectionUnit'" @click="_handleRow({row:row,index:rowIndex})">-->
<!-- <el-input v-model="row.detectionUnit" @blur="_save(item.key)" @focus="_handleRow({row:row,index:rowIndex})"-->
<!-- placeholder="请输入检出限单位" size="small"></el-input>-->
<!-- </div>-->
<!-- <div v-else-if="item.key === 'analysisDate'" @click="_handleRow({row:row,index: rowIndex})">-->
<!-- <AnalysisDate :editAnalysisDateList="row.analysisDateList"-->
<!-- :analysisDate="row.analysisDate" @on-result-change="_analysisDateResult"></AnalysisDate>-->
<!-- </div>-->
<!-- <div v-else>{{row[item.key]}}</div>-->
<!-- </template>-->
<!--只读模板-->
<template v-slot="{ row }">
<div v-if="item.key === 'name'" :style="{color:colorComputed(row.planEndDate)}">
{{row.name}}
</div>
<div v-else-if="item.key==='qualified'">
<span v-if="row.qualified.value === 'WAIT_SYSTEM'">待判定</span>
<span v-else-if="row.qualified.value === 'OK'" class="green-color">合格</span>
<span v-else-if="row.qualified.value === 'NOT_OK'" class="red-color">不合格</span>
<span v-else-if="row.qualified.value === 'NO_JUDGE'" class="warning-color">不判定</span>
</div>
<div v-else-if="item.key==='singleConclusion'">
{{row.singleConclusion.join(',')}}
</div>
<div v-else-if="item.key==='judged'">
{{row.judged === 1?'是':'否'}}
</div>
<div v-else-if="item.key==='planEndDate'">
{{ row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.date">{{row[item.key]?$dateformat(row[item.key],'yyyy-mm-dd'):''}}</div>
<div v-else-if="item.key==='progress'">{{row[item.key].display}}</div>
<a v-else-if="item.key==='num'" @click="_sampleDetail(row)">{{row[item.key]}}</a>
<div v-else-if="item.key === 'distanceWeekdays'"
:class="$distanceWeekdaysColor(row[item.key])" style="font-weight: bold">
{{row[item.key]}}
</div>
<div v-else>{{row[item.key]}}</div>
</template>
</vxe-table-column>
<template slot="col">
<vxe-table-column
:width="150"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="(scope.row.recordId) ? iconMsg : iconMsgDisable"
@on-result-change="_iconClick" :rowData="scope.row"></VXEIconList>
</template>
</vxe-table-column>
</template>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_page" :table-name="tableName"></VXESettingCol>
</PTVXETableData>
</Col>
</Row>
<!-- <component ref="refModal" :is="currentComponent" @on-result-change="_modalResult" is-change="true"></component>-->
<ModalConfirm ref="confirmModal" @on-result-change="_confirmResult" :btnModalList="btnModalList"
content="该项目已绑定资质项目,请选择更新完善或者新增资质项目!"></ModalConfirm>
<!--原始记录模板选择-->
<!-- <OriginalRecordTemplate ref="recordTemp" @on-result-change="_tempResult"></OriginalRecordTemplate>-->
<!--原始记录填写-->
<!-- <OriginalRecordWrite ref="recordWrite" @on-result-change="_page"></OriginalRecordWrite>-->
</div>
</template>
<script>
// import AutoCompletes from '../../../components/base/AutoCompletes'
import SelEquip from '../../../components/select-equip/SelEquip'
import AssignPerson from '../../../components/user-info-single/AssignPerson'
// import Forward from '../Forward'
// import Judge from '../Judge'
// import DetectionValue from '../DetectionValue'
// import FoodItemRecord from '../../../record/FoodItemRecord'
// import SpecialCharacter from '../SpecialCharacter'
import Global from '../../../api/config'
// import ImportItem from '../ImportItem'
// import AutoCompletesTestBasis from '../../../marketManage/food-item/AutoCompletesTestBasis'
// import FoodSampleCompanyDetail from '../../../marketManage/food-sample-company/FoodSampleCompanyDetail'
// import FoodSampleGovernDetail from '../../../marketManage/food-sample-govern/FoodSampleGovernDetail'
import Reason from '../../../components/base/Reason'
import VXESettingCol from '../../../components/base/VXESettingCol'
// import AddLibOutStd from '../AddLibOutStd'
// import RelevantDataQuery from '../RelevantDataQuery'
// import MaintainInfoModal from '../../../maintainInfo/MaintainInfoModal'
import ModalConfirm from '../../../components/base/ModalConfirm'
import SelectInput from './SelectInput'
// import CopyHisItem from '../copy-his-item/CopyHisItem'
// import OriginalRecordEdit from '../../original-record/OriginalRecordEdit'
// import OriginalRecordWrite from '../../original-record/OriginalRecordWrite'
// import OriginalRecordTemplate from '../../original-record/OriginalRecordTemplate'
// import ItemReset from '../ItemReset'
// import AnalysisDate from '../AnalysisDate'
// import DataInputItemBack from '../DataInputItemBack'
// import SelectTestStep from '../../../../../food/aptutudeManage/food-test-step-manage/SelectTestStep'
// import BatchRecordView from '../../original-record/BatchRecordView'
export default {
components: {
// BatchRecordView,
// SelectTestStep,
// MaintainInfoModal,
VXESettingCol,
// AutoCompletes,
// AutoCompletesTestBasis,
// Forward,
// eslint-disable-next-line vue/no-unused-components
SelEquip,
// Judge,
// DetectionValue,
// FoodItemRecord,
// eslint-disable-next-line vue/no-unused-components
AssignPerson,
// SpecialCharacter,
// ImportItem,
// FoodSampleCompanyDetail,
// FoodSampleGovernDetail,
SelectInput,
// eslint-disable-next-line vue/no-unused-components
Reason,
// AddLibOutStd,
// RelevantDataQuery,
ModalConfirm
// CopyHisItem,
// OriginalRecordTemplate,
// OriginalRecordEdit,
// OriginalRecordWrite,
// ItemReset,
// AnalysisDate,
// DataInputItemBack
},
data() {
return {
tableName: 'food-data-input-contract-right',
// 用户自己选中的列
userColumns: [],
currentComponent: '',
edit: false,
btnModalList: [
{ type: 'primary', name: '更新' },
{ type: 'primary', name: '新增' },
{ type: '', name: '取消' }
],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'qualifiedValue',
name: '结果判定',
placeholder: '请选择结果判定',
multiple: true
},
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'firstClass', name: '大类', placeholder: '请输入大类' },
{ key: 'detectType', name: '细类', placeholder: '请输入细类' },
{
key: 'sampleRemark',
name: '样品备注',
placeholder: '请输入样品备注'
},
{
key: 'planDate',
name: '计划完成时间',
placeholder: '请选择计划完成时间',
date: true
},
{
key: 'reportDueDate',
name: '应出报告日期',
placeholder: '请选择应出报告日期',
date: true
},
{
key: 'receiveDate',
name: '接收日期',
placeholder: '请选择接收日期',
date: true,
dateToMin: true
},
{ key: 'limitDefault', name: '限量', placeholder: '请输入限量' }
],
judgeList: [
{ name: '待判定', value: '0' },
{ name: '不判定', value: '5' },
{ name: '合格', value: '7' },
{ name: '不合格', value: '9' }
],
btn: [
{ type: 'primary', id: 'food-data-input-build-batch', name: '建批' },
{ type: 'primary', id: 'food-data-input-auto-judge', name: '自动判定' },
{
type: 'primary',
id: 'food-data-input-submit-check',
name: '提交至复核'
},
{
type: 'primary',
id: 'food-data-input-select-checker',
name: '选择复核人',
componentName: 'AssignPerson'
},
{ type: 'primary', id: 'food-data-input-submit', name: '提交至审核' },
{
type: 'primary',
id: 'food-data-input-select-auditor',
name: '选择审核人',
componentName: 'AssignPerson'
},
{
type: 'primary',
id: 'food-data-input-submit-report',
name: '提交至报告'
},
{ type: 'primary', id: 'food-data-input-submit-end', name: '无需报告' },
{
type: 'primary',
id: 'food-data-input-abort',
name: '终止检测',
componentName: 'Reason'
},
{ id: 'food-data-input-judge', name: '判定', componentName: 'Judge' },
{ id: '', name: '仪器', componentName: 'SelEquip' },
{ id: '', name: '批量填写', componentName: 'DetectionValue' },
{ id: 'food-data-input-edit-original-record', name: '填写原始记录' },
{
id: 'food-data-input-batch-record-views',
name: '查看合并记录',
componentName: 'BatchRecordView'
},
{ id: '', name: '导出' },
{ id: '', name: '导入', componentName: 'ImportItem' },
{
id: 'food-data-input-forward',
name: '转发',
componentName: 'Forward'
},
{ id: '', name: '特殊字符箱', componentName: 'SpecialCharacter' },
{
id: 'food-data-input-back',
name: '退回',
componentName: 'DataInputItemBack'
},
{
id: 'food-data-input-item-reset',
name: '检测项目重置',
componentName: 'ItemReset'
},
{
id: 'food-data-input-copy-his-data',
name: '复制历史数据',
componentName: 'CopyHisItem'
},
{
id: 'food-data-input-lib-out-std',
name: '填写库外检测依据',
componentName: 'AddLibOutStd'
},
{
id: 'food-data-input-save-to-lab',
name: '存到资质库',
componentName: ''
},
{ type: '', id: 'food-data-input-maintain-info', name: '信息维护' }
],
currentRow: {},
currentIndex: -1,
unitList: [],
unitListTemp: [],
testBasisData: [],
testBasisNameData: [],
judgeBasisData: [],
judgeBasisNameData: [],
limitData: [],
testMethodData: [],
singleConclusionList: [],
detectionTypeList: [],
detectionDate: '',
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180, fixed: 'left' },
{ title: '样品名称', key: 'sampleName', width: 140 },
{ title: '产品', key: 'subClass', width: 160 },
{ title: '检测值', key: 'testValue', width: 120, editCell: true },
{ title: '单位', key: 'unit', width: 120, editCell: true },
{ title: '限量', key: 'limitDefault', width: 120, editCell: true },
{ title: '限量类别', key: 'limitType', width: 160, editCell: true },
{ title: '说明', key: 'labRemark', width: 140, editCell: true },
{ title: '结果判定', key: 'qualified', width: 120, editCell: true },
{
title: '单项结论',
key: 'singleConclusion',
width: 200,
editCell: true
},
{ title: '复测值', key: 'retestValue', width: 120, editCell: true },
{ title: '是否判定', key: 'judged', width: 100 },
{ title: '委托单位', key: 'cname', width: 180 },
{ title: '委托编号', key: 'code', width: 180 },
{ title: '制单日期', key: 'ctime', width: 120, date: true },
{ title: '数据出具日期', key: 'resultDate', width: 120, date: true },
{ title: '计划完成时间', key: 'planEndDate', width: 120, date: true },
{ title: '距离收检工作日', key: 'distanceWeekdays', width: 130 },
{ title: '应出报告日期', key: 'reportDueDate', width: 120, date: true },
{ title: '检测依据', key: 'testBasisFull', width: 380, editCell: true },
{ title: '检测方法', key: 'testMethod', width: 220, editCell: true },
{ title: '检出类别', key: 'detectionType', width: 140, editCell: true },
{ title: '检出限', key: 'detection', width: 120, editCell: true },
{
title: '检出限单位',
key: 'detectionUnit',
width: 120,
editCell: true
},
{ title: '判定依据', key: 'judgeBasis', width: 160, editCell: true },
{
title: '判定依据名称',
key: 'judgeBasisName',
width: 220,
editCell: true
},
{ title: '仪器编号', key: 'equipNum', width: 200 },
{ title: '仪器名称', key: 'equipName', width: 220 },
{ title: '分析时间', key: 'analysisDate', width: 240, editCell: true },
{ title: '排序号', key: 'sortNo', width: 220 },
{ title: '类别', key: 'firstDetectClass', width: 220 },
{ title: '项目备注', key: 'remark' },
{ title: '样品备注', key: 'sampleRemark' },
{ title: '委托备注', key: 'contractRemark' }
// {title: '委托编号', key: 'code', width: 180},
// {title: '状态', key: 'progress', width: 120,},
// {title: '样品状态', key: 'sampleStatus', width: 120,},
],
iconMsg: [
{
type: 'edit',
id: 'food-data-input-original-record-edit',
name: '编辑原始记录',
componentName: 'OriginalRecordEdit'
},
{
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
{
type: 'search',
id: '',
name: '相关数据查询',
componentName: 'RelevantDataQuery'
},
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodItemRecord'
}
],
iconMsgDisable: [
{
type: 'edit',
id: 'food-data-input-original-record-edit',
name: '编辑原始记录',
componentName: 'OriginalRecordEdit',
disabled: true
},
{
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
{
type: 'search',
id: '',
name: '相关数据查询',
componentName: 'RelevantDataQuery'
},
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodItemRecord'
}
],
leftSelectIds: [],
selectIds: [],
selectData: [],
selectSampleIds: [],
personal: '',
// 检测步骤
stepId: '',
// 点击编辑时的当前的key
currentEditKey: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.detectionDate * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
// 从字典查预警期
// _dicSearch() {
// this.$store.dispatch('LmsBaseDict/getItem', '食品检测预警天数').then(() => {
// let result = this.$store.state.LmsBaseDict.item;
// if (result.length !== 0) {
// this.warningValue = result[0].name;
// console.log(this.warningValue)
// }
// });
// },
// 分析时间的回传
_analysisDateResult(msg, date, dateList) {
switch (msg) {
case 'selectDate':
this.currentRow.analysisDate = date
this.currentRow.analysisDateList = dateList
this._save('analysisDate')
break
}
},
_dicSearch() {
const data = [
'数据录入常用单位',
'允许数据录入改判定依据、检测依据',
'检测项目单项结论',
'食品检出类别',
'食品检测预警天数'
]
for (let i = 0; i < data.length; i++) {
this.$store.dispatch('LmsBaseDict/getItem', data[i]).then(() => {
const resultData = this.$store.state.LmsBaseDict.item
switch (data[i]) {
case '数据录入常用单位':
this.unitList = JSON.parse(JSON.stringify(resultData))
this.unitListTemp = JSON.parse(JSON.stringify(resultData))
break
case '允许数据录入改判定依据、检测依据':
if (resultData.length > 0) {
this.edit = resultData[0].name === '是'
} else {
this.edit = false
}
break
case '检测项目单项结论':
this.singleConclusionList = resultData
break
case '食品检出类别':
this.detectionTypeList = resultData
break
case '食品检测预警天数':
this.detectionDate = resultData[0].name
break
}
})
}
},
_saveSel(open) {
if (open === false) {
this._save('singleConclusion')
}
},
_unitChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.unit = data.name
this._save('unit')
break
case 'blur':
this._save('unit')
break
case 'query':
this.currentRow.unit = data.name
break
}
},
_modalResult(data, title) {
switch (this.currentComponent) {
case 'AssignPerson':
if (title === '分配复核人') {
this._checkerResult(data)
} else {
this._auditorResult(data)
}
break
case 'SelEquip':
this._equipResult(data)
break
case 'Reason':
if (title === '终止原因') {
// 终止原因
this._itemAbort(data)
}
break
case 'OriginalRecordTemplate':
this._tempResult(data)
break
case 'SelectTestStep':
this.stepId = data.id
this._buildEnd()
break
case 'DataInputItemBack':
this._resultChange('退回成功')
break
default:
this._page()
}
},
_resultChange(msg) {
if (this.$store.state.FoodItem.success) {
this.$Message.success(msg)
this._page()
this.selectIds = []
this.selectData = []
this.selectSampleIds = []
}
},
_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
}
},
_open(ids, personal) {
this.leftSelectIds = ids
this.personal = personal
if (ids.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectIds = []
this.selectData = []
this.selectSampleIds = []
} else {
this._formSearch()
}
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { contractIds: this.leftSelectIds.join(',') }
const obj4 = this.$refs.selInput1._qualifiedValue()
const obj5 = this.$refs.selInput2._qualifiedValue()
if (this.personal) {
obj.personal = this.personal
}
Object.assign(obj, obj1, obj2, obj3, obj4, obj5)
return obj
},
_page() {
this.$refs.pageTable._page(
'data-input-contract-right',
'FoodItem/inputSapPage',
this._searchParams()
)
},
_tableResultChange(msg, data) {
switch (msg) {
// case 'page':
// this.getPage = {
// total: this.$store.state.FoodItem.page.total,
// pages: this.$store.state.FoodItem.page.pages,
// current: this.$store.state.FoodItem.page.current,
// size: this.$store.state.FoodItem.page.size,
// records: []
// }
// let tableList = this.$store.state.FoodItem.page.records
// for (let i = 0; i < tableList.length; i++) {
// let obj = {
// aptitudeItemId:
// tableList[i].aptitudeItemId !== undefined
// ? tableList[i].aptitudeItemId
// : '',
// num: tableList[i].num !== undefined ? tableList[i].num : '',
// sortNo:
// tableList[i].sortNo !== undefined ? tableList[i].sortNo : '',
// name: tableList[i].name !== undefined ? tableList[i].name : '',
// sampleName:
// tableList[i].sampleName !== undefined
// ? tableList[i].sampleName
// : '',
// testValue:
// tableList[i].testValue !== undefined
// ? tableList[i].testValue
// : '',
// retestValue:
// tableList[i].retestValue !== undefined
// ? tableList[i].retestValue
// : '',
// unit: tableList[i].unit !== undefined ? tableList[i].unit : '',
// planEndDate:
// tableList[i].planEndDate !== undefined
// ? tableList[i].planEndDate
// : '',
// qualified:
// tableList[i].qualified !== undefined
// ? tableList[i].qualified
// : '',
// testBasis:
// tableList[i].testBasis !== undefined
// ? tableList[i].testBasis
// : '',
// testBasisId:
// tableList[i].testBasisId !== undefined
// ? tableList[i].testBasisId
// : '',
// testBasisName:
// tableList[i].testBasisName !== undefined
// ? tableList[i].testBasisName
// : '',
// testBasisFull:
// (tableList[i].testBasis ? tableList[i].testBasis : '') +
// ' ' +
// (tableList[i].testBasisName ? tableList[i].testBasisName : ''),
// testMethod:
// tableList[i].testMethod !== undefined
// ? tableList[i].testMethod
// : '',
// detection:
// tableList[i].detection !== undefined
// ? tableList[i].detection
// : '',
// detectionType:
// tableList[i].detectionType !== undefined
// ? tableList[i].detectionType
// : '',
// judgeBasis:
// tableList[i].judgeBasis !== undefined
// ? tableList[i].judgeBasis
// : '',
// judgeBasisId:
// tableList[i].judgeBasisId !== undefined
// ? tableList[i].judgeBasisId
// : '',
// judgeBasisName:
// tableList[i].judgeBasisName !== undefined
// ? tableList[i].judgeBasisName
// : '',
// limitDefault:
// tableList[i].limitDefault !== undefined
// ? tableList[i].limitDefault
// : '',
// limitType:
// tableList[i].limitType !== undefined
// ? tableList[i].limitType
// : '',
// judged:
// tableList[i].judged !== undefined ? tableList[i].judged : '',
// equipName:
// tableList[i].equipName !== undefined
// ? tableList[i].equipName
// : '',
// equipNum:
// tableList[i].equipNum !== undefined
// ? tableList[i].equipNum
// : '',
// code: tableList[i].code !== undefined ? tableList[i].code : '',
// remark:
// tableList[i].remark !== undefined ? tableList[i].remark : '',
// labRemark:
// tableList[i].labRemark !== undefined
// ? tableList[i].labRemark
// : '',
// progress:
// tableList[i].progress !== undefined
// ? tableList[i].progress
// : '',
// id: tableList[i].id !== undefined ? tableList[i].id : '',
// type: tableList[i].type !== undefined ? tableList[i].type : '',
// sampleId:
// tableList[i].sampleId !== undefined
// ? tableList[i].sampleId
// : '',
// contractId:
// tableList[i].contractId !== undefined
// ? tableList[i].contractId
// : '',
// recordId:
// tableList[i].recordId !== undefined
// ? tableList[i].recordId
// : '',
// compareSymbol:
// tableList[i].compareSymbol !== undefined
// ? tableList[i].compareSymbol
// : '',
// limitValue:
// tableList[i].limitValue !== undefined
// ? tableList[i].limitValue
// : '',
// sampleStatus:
// tableList[i].sampleStatus !== undefined
// ? tableList[i].sampleStatus
// : '',
// microbeN: tableList[i].microbeN ? tableList[i].microbeN : 0,
// microbeC: tableList[i].microbeC ? tableList[i].microbeC : 0,
// microbeM: tableList[i].microbeM ? tableList[i].microbeM : 0,
// microbeBm: tableList[i].microbeBm ? tableList[i].microbeBm : 0,
// subClass: tableList[i].subClass ? tableList[i].subClass : '',
// reportDueDate: tableList[i].reportDueDate
// ? tableList[i].reportDueDate
// : '',
// resultDate: tableList[i].resultDate
// ? tableList[i].resultDate
// : '',
// testBasisSm: tableList[i].testBasisSm
// ? tableList[i].testBasisSm
// : '',
// sampleRemark: tableList[i].sampleRemark
// ? tableList[i].sampleRemark
// : '',
// contractRemark: tableList[i].contractRemark
// ? tableList[i].contractRemark
// : '',
// cname: tableList[i].cname ? tableList[i].cname : '',
// ctime: tableList[i].ctime ? tableList[i].ctime : '',
// distanceWeekdays: tableList[i].distanceWeekdays
// ? tableList[i].distanceWeekdays
// : '',
// singleConclusion: tableList[i].singleConclusion
// ? tableList[i].singleConclusion.split(',')
// : [],
// firstDetectClass: tableList[i].firstDetectClass
// ? tableList[i].firstDetectClass
// : '',
// detectionUnit: tableList[i].detectionUnit
// ? tableList[i].detectionUnit
// : '',
// analysisDate: tableList[i].analysisDate
// ? tableList[i].analysisDate
// : ''
// }
// if (tableList[i].analysisDate !== undefined) {
// const list = tableList[i].analysisDate.split('~')
// if (list.length === 2) {
// if (list[0].split(':').length === 2) {
// obj.analysisDateList = [list[0], list[1]]
// } else {
// obj.analysisDateList = [
// list[0] + ' 00:00',
// list[1] + ' 00:00'
// ]
// }
// } else if (list[0].split(':').length === 2) {
// obj.analysisDateList = [list[0], list[0]]
// } else {
// obj.analysisDateList = [list[0] + ' 00:00', list[0] + ' 00:00']
// }
// }
// } else {
// obj.analysisDateList = []
// }
// this.getPage.records.push(obj)
// }
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
// this.selectIds = []
// this.selectData = []
// this.selectSampleIds = []
// this.stepId = ''
// break
case 'selectIds':
this.selectIds = data
break
case 'selectData':
this.selectData = data
this.selectSampleIds = data.map(({ sampleId: i }) => i)
break
// case 'iconClick':
// this._iconClick(data.name, data.rowData, data.componentName);
// break;
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
if (this.leftSelectIds.length) {
this._page()
}
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 获取检测标准
_testBasisList(data) {
const obj = {}
if (this.currentRow.name) {
obj.name = this.currentRow.name
} else {
// 没有填检测项目检测依据的下拉就为空
this.testBasisData = []
return
}
if (data) {
obj.testBasis = data
}
this.$store.dispatch('FoodAptitudeItem/getTestBasis', obj).then(() => {
this.testBasisData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测依据结果
_testBasisChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.testBasisFull =
data.testBasis + ' ' + data.testBasisName
this.currentRow.testBasis = data.testBasis
this.currentRow.testBasisId = data.stdId
this.currentRow.testBasisName = data.testBasisName
// this.currentRow.groupId = data.groupId;
// this.currentRow.groupName = data.groupName;
this.$set(this.currentRow, 'testBasisSm', '#')
this._setDetection() // 获取检出限
break
case 'query':
this.currentRow.testBasisFull = data
// 只要搜索就清空已填的值
this.currentRow.testBasisName = ''
this.currentRow.testBasisId = ''
this.currentRow.testBasis = ''
this.currentRow.testMethod = ''
this.$set(this.currentRow, 'testBasisSm', '#')
// if (this.currentRow.aptitudeItemId) {
// this.currentRow.aptitudeItemId = '';
// }
if (data === '') {
this.currentRow.testMethod = ''
}
this._testBasisList(data)
break
case 'focus':
this._testBasisList()
break
case 'blur':
// 如果没有依据,则清空
if (this.currentRow.testBasisId === '') {
this.currentRow.testBasisFull = ''
this.$set(this.currentRow, 'testBasisSm', '#')
}
this._save('testBasisFull')
}
},
// 获取检测方法
_testMethodList(testMethod) {
const obj = {}
if (this.currentRow.name && this.currentRow.testBasisId) {
obj.name = this.currentRow.name
obj.stdId = this.currentRow.testBasisId
} else {
this.testMethodData = []
return
}
if (testMethod) {
obj.testMethod = testMethod
}
this.$store.dispatch('FoodAptitudeItem/getTestMethod', obj).then(() => {
this.testMethodData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测方法结果
_testMethodChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.testMethod = data.testMethod
this.$set(this.currentRow, 'testBasisSm', '#')
this._save('testMethod')
break
case 'query':
this.currentRow.testMethod = data.testMethod
this.$set(this.currentRow, 'testBasisSm', '#')
this._testMethodList(data.testMethod)
break
case 'focus':
this._testMethodList()
break
case 'blur':
this._save('testMethod')
break
}
},
// 根据检测项目 检测依据获取检出限
_setDetection() {
const obj = {
name: this.currentRow.name,
stdId: this.currentRow.testBasisId
}
this.$store.dispatch('FoodAptitudeItem/getDetection', obj).then(() => {
const data = this.$store.state.FoodAptitudeItem.model
if (data) {
this.currentRow.detection = data.detectionLimit
this.currentRow.unit = data.unit
}
this._save('testBasisFull')
})
},
// 获取判定标准
_judgeBasisList(msg, data) {
const obj = { name: this.currentRow.name }
if (this.currentRow.testBasis) {
obj.testBasis = this.currentRow.testBasis
}
if (msg === 'judgeBasis' && data) {
obj.judgeBasis = data
} else if (msg === 'judgeBasisName' && data) {
obj.judgeBasisName = data
}
this.$store.dispatch('FoodAptitudeItem/getJudgeBasis', obj).then(() => {
if (msg === 'judgeBasis') {
this.judgeBasisData = this.$store.state.FoodAptitudeItem.list
} else if (msg === 'judgeBasisName') {
this.judgeBasisNameData = this.$store.state.FoodAptitudeItem.list
} else {
this.judgeBasisData = this.$store.state.FoodAptitudeItem.list
this.judgeBasisNameData = this.$store.state.FoodAptitudeItem.list
}
})
},
// 判定依据结果
_judgeBasisChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.judgeBasis = data.judgeBasis
this.currentRow.judgeBasisId = data.id
this.currentRow.judgeBasisName = data.judgeBasisName
this._stdSetLimit() // 查询限量并赋值保存
break
case 'query':
this.currentRow.judgeBasis = data.judgeBasis
// 手动填或者是选完修改的就清空判定id,满足可选可填
// this.currentRow.judgeBasisName = '';
this.currentRow.judgeBasisId = ''
this._judgeBasisList('judgeBasis', data.judgeBasis)
break
case 'focus':
this._judgeBasisList('judgeBasis')
break
case 'blur':
this._save('judgeBasis')
break
}
},
// 判定依据名称结果
_judgeBasisNameChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.judgeBasisName = data.judgeBasisName
this.currentRow.judgeBasisId = data.id
this.currentRow.judgeBasis = data.judgeBasis
this._stdSetLimit() // 查询限量并赋值保存
break
case 'query':
this.currentRow.judgeBasisName = data.judgeBasisName
// 手动填或者是选完修改的的就清空判定id,满足可选可填
// this.currentRow.judgeBasis = '';
this.currentRow.judgeBasisId = ''
this._judgeBasisList('judgeBasisName', data.judgeBasisName)
break
case 'focus':
this._judgeBasisList('judgeBasisName')
break
case 'blur':
this._save('judgeBasisName')
break
}
},
// 判定依据选了之后设置限量
_stdSetLimit() {
if (this.currentRow.aptitudeItemId) {
const obj = {
aptitudeItemId: this.currentRow.aptitudeItemId
}
if (this.currentRow.judgeBasisId) {
obj.judgeBasisId = this.currentRow.judgeBasisId
}
this.$store.dispatch('FoodAptitudeLimit/getLimitInfo', obj).then(() => {
const limitData = this.$store.state.FoodAptitudeLimit.limitModel
if (limitData.length) {
this.currentRow.limitDefault = limitData[0].limitDefault
this.currentRow.judged = limitData[0].judged
this.currentRow.limitType = limitData[0].limitType
this.currentRow.compareSymbol = limitData[0].compareSymbol
this.currentRow.limitValue = limitData[0].limitValue
}
this._save('judgeBasis')
})
} else {
this._save('judgeBasis')
}
},
// 根据资质和 判定依据 获取限量值
_getLimit(row) {
this.currentRow = row
const obj = {}
if (row.aptitudeItemId) {
obj.aptitudeItemId = row.aptitudeItemId
}
if (row.judgeBasisId) {
obj.judgeBasisId = row.judgeBasisId
}
this.$store.dispatch('FoodAptitudeLimit/getLimitInfo', obj).then(() => {
const list = this.$store.state.FoodAptitudeLimit.limitModel
if (list.length) {
this.limitData = list
} else {
this.limitData = []
}
})
},
// 选择限量值并保存
_selLimit(row, event, column) {
this.$set(this.currentRow, 'limitDefault', row.limitDefault)
this.$set(this.currentRow, 'limitType', row.limitType)
this.currentRow.judged = row.judged
this.currentRow.compareSymbol = row.compareSymbol
this.currentRow.limitValue = row.limitValue
this.currentRow.microbeN = row.microbedn ? row.microbedn : 0
this.currentRow.microbeC = row.microbedc ? row.microbedc : 0
this.currentRow.microbeM = row.microbedsm ? row.microbedsm : 0
this.currentRow.microbeBm = row.microbedbm ? row.microbedbm : 0
this.currentRow.calType = row.computeType ? row.computeType : 0
// this.currentRow.subClass = row.firstClass ? (row.firstClass + '/' + row.secondClass + '/' + row.thirdClass + '/' + row.fourthClass) : '';
this.currentRow.subClass = row.testParameter ? row.testParameter : ''
this._save('limitType')
// this._enterSave('', this.currentIndex);
// this._refreshRow(row.id, this.currentIndex);
},
// 操作的序号
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.index
},
// 限量值修改了 是否判定改为否 并保存
_handleLimitDefalut() {
this.currentRow.judged = 0
if (this.currentRow.qualified.value !== 'NO_JUDGE') {
this.currentRow.qualified.value = 'WAIT_SYSTEM'
}
this._save('limitDefault')
// this._saveQualified();
},
// ①保存 除结果判定(除手工判定),非特殊情况,只更新修改的key,
// ②如果有其他的参数关联修改在_refreshPage方法内单独追加该key
_save(key) {
this.currentEditKey = key
let tempBool = true
setTimeout(() => {
if (tempBool) {
this.$refs.pageTable._showLoading()
}
}, 1500)
const params = this._saveParams(key)
this.$store.dispatch('FoodItem/itemEdit', params).then(() => {
if (this.$store.state.FoodItem.success) {
tempBool = false
this.$refs.pageTable._hideLoading()
// 刷新修改的当前行的数据
this._refreshPage(params.id)
} else {
this.$Message.error('保存失败')
tempBool = false
this.$refs.pageTable._hideLoading()
}
})
},
// 只刷新某一行的特殊字段数据
_refreshPage(id) {
const params = JSON.parse(JSON.stringify(this.$refs.pageTable.pageParams))
params.id = id
this.$store.dispatch('FoodItem/inputSapPage', params).then(() => {
const resRows = this.$store.state.FoodItem.page.records[0]
const index = this.getPage.records.findIndex(item => item.id === id)
switch (this.currentEditKey) {
case 'limitType':
this.$set(this.getPage.records[index], 'judged', resRows.judged)
break
case 'testValue':
this.$set(
this.getPage.records[index],
'qualified',
resRows.qualified
)
break
case 'limitDefault':
// 限量修改后的重新赋值
this.$set(
this.getPage.records[index],
'qualified',
resRows.qualified
)
this.$set(
this.getPage.records[index],
'compareSymbol',
resRows.compareSymbol
)
this.$set(
this.getPage.records[index],
'limitValue',
resRows.limitValue
)
this.$set(this.getPage.records[index], 'microbeN', resRows.microbeN)
this.$set(this.getPage.records[index], 'microbeC', resRows.microbeC)
this.$set(this.getPage.records[index], 'microbeM', resRows.microbeM)
this.$set(
this.getPage.records[index],
'microbeBm',
resRows.microbeBm
)
this.$set(this.getPage.records[index], 'subClass', resRows.subClass)
this.$set(this.getPage.records[index], 'judged', resRows.judged)
break
case 'testBasisFull':
this.$set(
this.getPage.records[index],
'detection',
resRows.detection
)
this.$set(this.getPage.records[index], 'unit', resRows.unit)
}
})
},
_refreshRow(id, index) {
this.$store.dispatch('FoodItem/getById', id).then(() => {
const result = this.$store.state.FoodItem.model
if (result) {
this.currentRow.qualified = result.qualified
this.$refs.pageTable._hideLoading()
}
})
},
_saveParams(key) {
const obj = {}
const item = this.currentRow
switch (key) {
case 'testValue':
// 检测值
obj.testValue = item.testValue
break
case 'testBasisFull':
// 检测依据
obj.groupId = item.groupId
obj.groupName = item.groupName
obj.testBasisSm = item.testBasisSm
obj.detection = item.detection
obj.unit = item.unit
obj.testMethod = item.testMethod
if (item.testBasisId) {
obj.testBasis = item.testBasis
obj.testBasisId = item.testBasisId
obj.testBasisName = item.testBasisName
}
break
case 'testMethod':
obj.testMethod = item.testMethod
obj.testBasisSm = item.testBasisSm
break
case 'judgeBasis':
case 'judgeBasisName':
obj.judgeBasis = item.judgeBasis
obj.judgeBasisName = item.judgeBasisName
obj.limitDefault = item.limitDefault
obj.judged = item.judged
obj.limitType = item.limitType
obj.compareSymbol = item.compareSymbol
obj.limitValue = item.limitValue
if (item.judgeBasisId) {
obj.judgeBasisId = item.judgeBasisId
}
break
case 'limitDefault':
obj.qualified = item.qualified.value
obj.limitDefault = item.limitDefault
break
case 'limitType':
obj.limitDefault = item.limitDefault
obj.limitType = item.limitType
obj.judged = item.judged
obj.compareSymbol = item.compareSymbol
obj.limitValue = item.limitValue
obj.microbeN = item.microbeN
obj.microbeC = item.microbeC
obj.microbeM = item.microbeM
obj.microbeM = item.microbeM
obj.microbeBm = item.microbeBm
obj.subClass = item.subClass
break
case 'singleConclusion':
obj.singleConclusion = item.singleConclusion.join(',')
break
default:
// 其他没有特殊处理的单独修改某一个key的值
obj[key] = item[key]
break
}
const data = {
id: item.id,
obj: obj
}
return data
},
// 单独保存结果判定(手工判定)
_saveQualified() {
let tempBool = true
setTimeout(() => {
if (tempBool) {
this.$refs.pageTable._showLoading()
}
}, 1500)
const item = this.currentRow
const data = {
id: item.id,
obj: {
qualified: item.qualified.value
}
}
this.$store.dispatch('FoodItem/edit', data).then(() => {
if (this.$store.state.FoodItem.success) {
tempBool = false
this.$refs.pageTable._hideLoading()
} else {
this.$Message.error('保存失败')
tempBool = false
this.$refs.pageTable._hideLoading()
}
})
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '仪器':
// this._selectEquipment()
break
case '判定':
// this._judge()
break
case '批量填写':
// this._detectionValue()
break
case '填写原始记录':
// this._writeOriginalRecord()
break
case '查看合并记录':
// this._batchRecordView()
break
case '转发':
// this._forward()
break
case '提交至报告':
// this._submitToReport()
break
case '无需报告':
// this._submitToEnd()
break
case '终止检测':
// const ids = this.selectIds
// if (ids.length === 0) {
// this.$Message.warning('请至少选择一条数据!')
// } else {
// this.$refs.refModal._open('终止原因')
// }
break
case '提交至审核':
// this._submit()
break
case '提交至复核':
// this._submitToCheck()
break
case '导入':
// this._import()
break
case '导出':
// this._export()
break
case '特殊字符箱':
// this._special()
break
case '选择复核人':
// this._selChecker()
break
case '选择审核人':
// this._selAuditor()
break
case '自动判定':
// this._autoJudge()
break
case '建批':
// this._build()
break
case '复制历史数据':
// this._copyHisData()
break
case '退回':
// if (this.selectIds.length === 0) {
// this.$Message.warning('请至少选择一条数据')
// } else {
// this.$refs.refModal._open(this.selectIds)
// }
break
case '填写库外检测依据':
// if (this.selectIds.length === 0) {
// this.$Message.warning('请至少选择一条数据')
// } else {
// this.$refs.refModal._open(this.selectIds)
// }
break
case '存到资质库':
// this._saveToLab()
break
case '信息维护':
// this._maintainInfo()
break
case '检测项目重置':
// this._itemResetInfo()
break
}
})
},
// 查看合并记录
_batchRecordView() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_itemResetInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_build() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
// 判断是否需要弹出检测步骤界面
this.$store
.dispatch('FoodItemStep/checkItemStep', {
itemIds: this.selectIds.join(',')
})
.then(() => {
const resultStep = this.$store.state.FoodItemStep.success
// 1)如果是true,则需要执行建批操作
if (resultStep === true) {
this.stepId = ''
this._buildEnd()
} else if (resultStep === false) {
// 2)如果是false,则需要弹出选择检测步骤界面,然后绑定步骤id
this.currentComponent = 'SelectTestStep'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
})
}
},
// 建批最终的请求
_buildEnd() {
let setTimeoutMsg = ''
const objTemp = { ids: this.selectIds.join(',') }
if (this.stepId) {
// 检测步骤id
objTemp.stepId = this.stepId
}
// 首先判断是否启用sop,后台判断
this.$store.dispatch('FoodItem/waitBuildGroupGreat', objTemp).then(() => {
const result = this.$store.state.FoodItem.success
setTimeoutMsg = result
if (result === true) {
this._resultChange('建批成功')
} else if (result === false) {
// 否则弹出模板,进行选择
this.currentComponent = 'OriginalRecordTemplate'
this.$nextTick(() => {
this.$refs.refModal._open('', 'build-group')
})
}
})
setTimeout(() => {
if (setTimeoutMsg === '') {
this._sopTip()
}
}, 1000)
},
// 是否启用字典的提示(1s之内没有返回值就显示提示信息)
_sopTip() {
this.$store.dispatch('LmsBaseDict/getItem', '启用SOP').then(() => {
const resultData = this.$store.state.LmsBaseDict.item
const msg = !!(resultData.length > 0 && resultData[0].name === '是')
if (msg) {
this.$Notice.info({
title: '提示',
desc: '正在后台生成原始记录,稍候刷新即可查看。'
})
}
})
},
_copyHisData() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_saveToLab() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
let type = 0
let flag = true
for (let i = 0; i < this.selectData.length; i++) {
if (this.selectData[i].aptitudeItemId !== '') {
flag = false
}
}
if (flag) {
// 都没有资质id
type = 1
this._saveToLabOk(type)
} else {
// 都有 或 有的有 有的没有
// this.$Modal.confirm({
// title: '提示',
// content: '该项目已绑定资质项目,请选择更新完善或者新增资质项目!',
// okText: '更新',
// cancelText: '新增',
// onOk: () => {
// type = 0 //更新
// this._saveToLabOk(type)
// },
// onCancel: () => {
// type = 1
// this._saveToLabOk(type)
// }
// });
this.$refs.confirmModal._openModal()
}
}
},
_confirmResult(name) {
switch (name) {
case '更新':
this._saveToLabOk(0)
break
case '新增':
this._saveToLabOk(1)
break
}
},
_saveToLabOk(type) {
this.$store
.dispatch('FoodItem/saveToLab', {
ids: this.selectIds.join(','),
type: type
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this.$refs.confirmModal._closeModal()
}
})
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_autoJudge() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
const items = this._getBatchData()
this.$store.dispatch('FoodItem/batchUpdateItem', items).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
}
},
_getBatchData() {
const items = []
for (let i = 0; i < this.selectData.length; i++) {
const obj = {
id: this.selectData[i].id,
name: this.selectData[i].name,
testValue: this.selectData[i].testValue,
retestValue: this.selectData[i].retestValue,
unit: this.selectData[i].unit,
testMethod: this.selectData[i].testMethod,
limitDefault: this.selectData[i].limitDefault,
limitValue: this.selectData[i].limitValue,
compareSymbol: this.selectData[i].compareSymbol,
limitType: this.selectData[i].limitType,
judged: this.selectData[i].judged,
detection: this.selectData[i].detection,
labRemark: this.selectData[i].labRemark,
microbeN: this.selectData[i].microbeN
? this.selectData[i].microbeN
: 0,
microbeC: this.selectData[i].microbeC
? this.selectData[i].microbeC
: 0,
microbeM: this.selectData[i].microbeM
? this.selectData[i].microbeM
: 0,
microbeBm: this.selectData[i].microbeBm
? this.selectData[i].microbeBm
: 0,
qualified: this.selectData[i].qualified.value,
subClass: this.selectData[i].subClass
}
if (this.selectData[i].testBasisId) {
obj.testBasisId = this.selectData[i].testBasisId
obj.testBasis = this.selectData[i].testBasis
obj.testBasisName = this.selectData[i].testBasisName
}
if (this.selectData[i].judgeBasisId) {
obj.judgeBasisId = this.selectData[i].judgeBasisId
obj.judgeBasis = this.selectData[i].judgeBasis
obj.judgeBasisName = this.selectData[i].judgeBasisName
} else {
obj.judgeBasis = this.selectData[i].judgeBasis
obj.judgeBasisName = this.selectData[i].judgeBasisName
}
items.push(obj)
}
return items
},
// 填写原始记录
_writeOriginalRecord() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$store
.dispatch('FoodItem/checkCanWriteOriginal', { ids: this.selectIds })
.then(() => {
const result = this.$store.state.FoodItem.recordModel
if (result === '0') {
// 选择原始记录模板
this.currentComponent = 'OriginalRecordTemplate'
this.$nextTick(() => {
this.$refs.refModal._open()
})
} else if (result !== undefined) {
this.currentComponent = 'OriginalRecordWrite'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, result)
})
}
})
}
},
// 选完模板填写
_tempResult(data) {
if (data.msg && data.msg === 'build-group') {
// 建批保存
let setTimeoutMsg = ''
const objTemp = {
ids: this.selectIds.join(','),
templateId: data.modelId.id
}
if (this.stepId) {
objTemp.stepId = this.stepId
}
this.$store
.dispatch('FoodItem/waitBuildGroupGreat', objTemp)
.then(() => {
const result = this.$store.state.FoodItem.success
setTimeoutMsg = result
if (result) {
this._resultChange('建批成功')
}
})
setTimeout(() => {
if (setTimeoutMsg === '') {
this._sopTip()
}
}, 1000)
} else {
this.currentComponent = 'OriginalRecordWrite'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, data.modelId.id)
})
}
},
// 特殊符号工具箱
_special() {
this.$refs.refModal._open(this.selectIds)
},
// 批量选择复核人
_selChecker() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.$refs.refModal._openGoupByUserId('分配复核人', user.id)
}
},
// 选复核人结果
_checkerResult(res) {
this.$store
.dispatch('FoodItem/checkerSelect', {
ids: this.selectIds.join(','),
checkerId: res.userId,
checker: res.realname
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
},
_selAuditor() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.$refs.refModal._openGoupByUserId('分配审核人', user.id)
}
},
// 选审核人结果
_auditorResult(res) {
this.$store
.dispatch('FoodItem/inputAuditorSelect', {
ids: this.selectIds.join(','),
auditorId: res.userId,
auditor: res.realname
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
},
// 导入
_import() {
this.$refs.refModal._open()
},
// 导出
_export() {
if (
this.getPage.records === undefined ||
this.getPage.records.length === 0
) {
this.$Message.warning('暂无数据,不可导出!')
} else {
// 勾选导出勾选的,未勾选导出全部的
const obj = {
param: 'ids',
ids: this.selectIds,
url: '/food/v1/item/item_export',
queryObj: this.$serializeFormSearch(this._searchParams()),
msgContent: '确定要导出数据(最多20000条数据)?'
}
this.$exportByQuery(obj)
}
},
// 批量转发
_forward() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
// 批量提交
_submit() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定该操作?',
onOk: () => {
this.$store
.dispatch('FoodItem/inputSubmit', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('提交成功!')
this._page()
}
})
}
})
}
},
_submitToCheck() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定该操作?',
onOk: () => {
this.$store
.dispatch('FoodItem/inputSubmitToCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('提交成功!')
this._page()
}
})
}
})
}
},
// 批量提交到报告
_submitToReport() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定该操作?',
onOk: () => {
this.$store
.dispatch('FoodItem/inputSubmitToReport', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('提交成功!')
this._page()
}
})
}
})
}
},
// 批量完成
_submitToEnd() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
loading: true,
okText: '是',
cancelText: '否',
content: '数据将跳过报告编制,直接至完成,是否继续?',
onOk: () => {
this.$store
.dispatch('FoodItem/inputSubmitToEnd', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
this.$Modal.remove()
}
})
}
})
}
},
// 终止检测
_itemAbort(data) {
this.$store
.dispatch('FoodItem/itemAbort', {
ids: this.selectIds.join(','),
reason: data
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('终止成功!')
this.selectIds = []
this._page()
}
})
},
// 批量选择仪器
_selectEquipment() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open('sample-input')
}
},
// 仪器选择保存
_equipResult(res) {
const equipIds = []
for (let i = 0; i < res.length; i++) {
equipIds.push(res[i].id)
}
this.$store
.dispatch('FoodItem/selectEquip', {
ids: this.selectIds.join(','),
equipIds: equipIds.join(',')
})
.then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
},
// 批量判定
_judge() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
// 批量填写检测值
_detectionValue() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '样品附件':
this._upload(data.sampleId)
break
case '编辑原始记录':
this._originalRecordEdit(data)
break
case '操作日志':
this._record(data.id)
break
case '相关数据查询':
this.$refs.refModal._open(data.id)
break
}
})
},
// 操作日志
_record(id) {
this.$refs.refModal._open(id)
},
// 样品详情
_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
)
})
}
})
},
// 编辑原始记录
_originalRecordEdit(data) {
if (!data.recordId) {
this.$Message.warning('该检测项目暂无原始记录!')
} else {
this.$refs.refModal._open(data.recordId)
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
/** ************************检测值回车进入下一行并且保存***********************************/
_enterSave(data) {
const tempData = this._saveParams(data.fieldName)
if (tempData.obj.testValue !== '') {
// 有值则进行保存
this.$refs.pageTable._showLoading()
this.$store.dispatch('FoodItem/itemEdit', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this._refreshRowFocusNext(data, tempData.id)
} else {
this.$Message.error('保存失败')
this.$refs.pageTable._hideLoading()
}
})
} else {
// 无值则进行单纯的跳转
this._nextRow(data)
}
},
_refreshRowFocusNext(data, id) {
this.$store.dispatch('FoodItem/getById', id).then(() => {
const result = this.$store.state.FoodItem.model
if (result) {
this.currentRow.qualified = result.qualified
this.$refs.pageTable._hideLoading()
this._nextRow(data)
}
})
},
// 跳转到下一行
_nextRow(data) {
const field = data.fieldName // 当前单元格英文名称
let currentNextRow = data.scope.row // 当前行数据
const index = data.scope.rowIndex // 当前行索引
switch (data.msg) {
case 'enter':
// 回车下一行的数据
currentNextRow = this.getPage.records[index + 1]
break
}
if (currentNextRow && field) {
this.$refs.pageTable._activeCell({
row: currentNextRow,
field: field,
msg: data.msg
})
}
}
/** ************************检测值回车进入下一行并且保存***********************************/
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1200">
<TwoColumnPage>
<template slot="left">
<ContractLeftList ref="leftModal" @on-result-change="_leftResult"></ContractLeftList>
</template>
<template slot="right">
<ContractRightList ref="rightModal" @on-result-change="_rightResult"></ContractRightList>
</template>
</TwoColumnPage>
</Modal>
</div>
</template>
<script>
import TwoColumnPage from '../../../components/base/TwoColumnPage'
import ContractLeftList from './ContractLeftList'
import ContractRightList from './ContractRightList'
export default {
components: {
TwoColumnPage,
ContractLeftList,
ContractRightList
},
data() {
return {
showModal: false
}
},
methods: {
_open() {
// this.formObj.entrustId = id
this.showModal = true
// this._page()
},
_leftResult(data, personal) {
// this.$refs.rightModal._open(data, personal)
console.log(data, personal)
},
_rightResult() {
// this.$refs.leftModal._page()
}
// _open() {
// this.$refs.leftModal._open()
// }
}
}
</script>
<template>
<div>
<!--有时间组件-->
<div v-if="date === true && multiple === false" class="search-item-select-date">
<Select slot="prepend" v-model="key" @on-change="_selKeyChange" style="width:90px">
<Option v-for="item in optionList" :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</Select>
<template v-if="dateToMin">
<Date-picker :placeholder="msg" :editable="false"
@on-change="_dateChange"
type="datetimerange" format="yyyy-MM-dd HH:mm" style="width:185px;"
placement="bottom-start">
</Date-picker>
</template>
<template v-else>
<Date-picker :placeholder="msg" :editable="false" @on-change="_dateChange"
type="daterange" format="yyyy-MM-dd" style="width:185px;"
placement="bottom-start">
</Date-picker>
</template>
</div>
<!--结果判定单选组件-->
<div v-else-if="date === false && multiple === true" class="search-item-select-date">
<Select slot="prepend" v-model="key" @on-change="_selKeyChange" style="width:90px">
<Option v-for="item in optionList" :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</Select>
<el-select v-model="qualifiedValue" :placeholder="msg" size="small" clearable>
<el-option :label="item.name" :value="item.value" v-for="item in judgeList"
:key="item.value"></el-option>
</el-select>
</div>
<!--正常-->
<Input v-model="inputValue" :placeholder="msg" @on-enter="_formSearch" v-else-if="date === false && multiple === false"
style="width: 275px">
<Select slot="prepend" v-model="key" @on-change="_selKeyChange" style="width:90px">
<!--:key 渲染时key很有用,不写可能渲染错-->
<Option v-for="item in optionList" :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</Select>
</Input>
</div>
</template>
<script>
export default {
props: {
placeholder: null,
keyword: null,
optionList: null,
compareKeyword: null,
isDate: null,
judgeList: null
},
data() {
return {
formObj: {},
inputValue: '',
msg: this.placeholder, // 必须重新赋值 ,因前面不是变量
key: this.keyword, // 必须重新赋值 ,因前面不是变量
compareKey: this.compareKeyword, // 必须重新赋值 ,因前面不是变量
date: this.isDate !== undefined,
multiple: false,
qualifiedValue: '',
// 日期精确到分,动态设置日期格式不行
dateToMin: false
}
},
methods: {
_formSearch() {
if (this.inputValue) {
this.formObj[this.key] = this.inputValue
// this.$emit('on-result-change', 'search', this.formObj)
this.$emit('on-result-change', 'search')
} else {
this.formObj[this.key] = ''
// this.$emit('on-result-change', 'search', this.$serializeFormSearch(this.formObj))
this.$emit('on-result-change', 'search')
}
},
_setCompareKeyword(data) {
this.compareKey = data
},
_getFormObj() {
if (this.inputValue) {
this.formObj[this.key] = this.inputValue
} else {
this.formObj[this.key] = ''
}
return this.$serializeFormSearch(this.formObj)
},
_qualifiedValue() {
const obj = {}
if (this.qualifiedValue) {
obj.qualifiedValue = this.qualifiedValue
} else {
obj.qualifiedValue = ''
}
return this.$serializeFormSearch(obj)
},
_selKeyChange(data) {
this.$emit('on-result-change', 'keyword', this.key)
this.formObj = {}
this.inputValue = ''
const obj = this.optionList.find(item => item.key === data)
if (obj.date) {
if (obj.dateToMin !== undefined) {
this.dateToMin = true
} else {
this.dateToMin = false
}
this.date = true
this.multiple = false
this.qualifiedValue = ''
} else if (obj.multiple) {
this.multiple = true
this.date = false
} else {
this.multiple = false
this.date = false
this.qualifiedValue = ''
}
this.key = obj.key
this.msg = obj.placeholder
},
_dateChange(date) {
if (date[0]) {
this.formObj[this.key + 'Begin'] = date[0]
this.formObj[this.key + 'End'] = date[1]
} else {
this.formObj = {}
}
},
_selJudge() {}
}
}
</script>
......@@ -6,24 +6,24 @@
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
......@@ -47,6 +47,7 @@
</div>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_page"></MeterSampleManage>
<MeterEntrustDetail ref="meterSampleEdit" @on-result-change="_componentResult"></MeterEntrustDetail>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
......@@ -292,7 +293,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterPersonItemTaskManage ref="personModal"></MeterPersonItemTaskManage>
<personModal ref="personModal"></personModal>
<ListModal ref="ListModal" @on-result-change="_page"></ListModal>
......@@ -313,7 +314,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -6,24 +6,24 @@
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<SelEquip ref="SelEquip" @on-result-change="_equipSelectBack"></SelEquip>
<CarManage ref="carEdit"></CarManage>
<InstruMentEdit ref="InstruEdit"></InstruMentEdit>
......@@ -315,7 +316,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSample.getById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<MeterOutTaskAlloca ref="taskAllocaModal" @on-result-change="_page"></MeterOutTaskAlloca>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<MeterOutTaskOperation ref="operationModal"></MeterOutTaskOperation>
......@@ -259,7 +260,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<operationModal ref="operationModal"></operationModal>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
......@@ -214,7 +215,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<subSampleManage ref="subSampleManage"></subSampleManage>
<operationModal ref="operationModal"></operationModal>
</div>
......@@ -229,7 +230,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
......
......@@ -8,7 +8,7 @@
<!-- <InputNumber v-model.number="formObj.outFee" :min="0" :step="1"-->
<!-- name="outFee" style="width:100%" placeholder="">-->
<!-- </InputNumber>-->
<Input v-model="formObj.inner" readonly name="inner" @click.native="_selectStaff"></Input>
<Input v-model="formObj.inner" @click.native="_selectStaff" readonly name="inner"></Input>
</Form-item>
<Form-item label="返库时间:" prop="inStockTime">
<div class="block">
......@@ -35,7 +35,7 @@
</Modal>
<!--选择实验室-->
<EditLabSelect ref="labModal" @on-result-change="_labResult"></EditLabSelect>
<UserInfo ref="userModal" is-change @on-result-change="_userData"></UserInfo>
<UserInfo ref="userModal" @on-result-change="_userData" is-change></UserInfo>
</div>
</template>
<script>
......@@ -77,6 +77,9 @@ export default {
}
},
methods: {
_labResult(data) {
console.log(data)
},
getNowTime() {
const now = new Date()
const year = now.getFullYear() // 得到年份
......
......@@ -45,6 +45,7 @@
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<subSampleManage ref="subSampleManage"></subSampleManage>
<operationModal ref="operationModal"></operationModal>
</div>
......@@ -230,7 +231,7 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.$refs.FileManage._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
......
......@@ -8,7 +8,7 @@
<!-- <InputNumber v-model.number="formObj.outFee" :min="0" :step="1"-->
<!-- name="outFee" style="width:100%" placeholder="">-->
<!-- </InputNumber>-->
<Input v-model="formObj.outer" readonly name="outer" @click.native="_selectStaff"></Input>
<Input v-model="formObj.outer" @click.native="_selectStaff" readonly name="outer"></Input>
</Form-item>
<Form-item label="出库时间:" prop="outStockTime">
<div class="block">
......@@ -35,7 +35,7 @@
</Modal>
<!--选择实验室-->
<EditLabSelect ref="labModal" @on-result-change="_labResult"></EditLabSelect>
<UserInfo ref="userModal" is-change @on-result-change="_userData"></UserInfo>
<UserInfo ref="userModal" @on-result-change="_userData" is-change></UserInfo>
</div>
</template>
<script>
......@@ -100,6 +100,9 @@ export default {
this.formObj.outStockTime = defaultDate
// this.$set(this.searchFormField, 'date', defaultDate)
},
_labResult(data) {
console.log(data)
},
_userData(data, msg, contractTempData) {
if (msg === 'salesman') {
// 选择业务员
......
......@@ -9,8 +9,10 @@ import iconList from '../components/base/iconList'
import elementTable from '../components/table/elementTable'
import modalFooter from '../components/base/modalFooter'
import PTVXETable from '../components/table/PTVXETable'
import PTVXETableData from '../components/base/PTVXETableData'
import VXEIconList from '../components/base/VXEIconList'
import FileManage from '../components/file/file-manage/FileManage'
import VXESettingCol from '../components/base/VXESettingCol'
Vue.use(VXETable)
Vue.component('btn-list', btnList)
......@@ -18,5 +20,7 @@ Vue.component('icon-list', iconList)
Vue.component('element-table', elementTable)
Vue.component('modal-footer', modalFooter)
Vue.component('PTVXETable', PTVXETable)
Vue.component('PTVXETableData', PTVXETableData)
Vue.component('VXEIconList', VXEIconList)
Vue.component('VXESettingCol', VXESettingCol)
Vue.component('FileManage', FileManage)
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