Commit 9c713d4a by wangweidong

整体优化

parent 778ffcaa
......@@ -64,24 +64,13 @@ export default {
// })
},
loadData: async function(item, callback) {
console.log('请求1市')
console.log('item')
console.log(item)
const val = item.__value
console.log('val')
console.log(val)
item.loading = true
// if (val.indexOf(',') === -1) {
if (val.length <= 1) {
// 不存在逗号
console.log('请求市')
console.log(item.valueName)
const result = await meterEntrust.getCity(item.valueName)
console.log(result)
if (result === undefined) {
alert('123')
}
// this.$store.dispatch('SysCity/getCity', item.valueName).then(() => {
const cityData = []
for (let i = 0; i < result.length; i++) {
cityData.push({
......@@ -95,11 +84,7 @@ export default {
item.children = cityData
item.loading = false
callback()
// })
} else {
// this.$store.dispatch('SysArea/getArea', item.valueName).then(() => {
// const result = this.$store.state.SysArea.list
console.log('请求区')
const result = await meterEntrust.getArea(item.valueName)
const areaData = []
for (let i = 0; i < result.length; i++) {
......@@ -112,7 +97,6 @@ export default {
item.children = areaData
item.loading = false
callback()
// })
}
},
// 省、市、区都可选
......
<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>
</div>
</template>
<script>
import { meterManage } from '../../api'
import SelectInput from './SelectInput'
export default {
components: {
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()
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
if (this.personal) {
obj.personal = this.personal
}
return obj
},
_page: async function() {
console.log(9522123)
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
// Object.assign(this.formObj, this.$refs.pageTable._searchParams())
// console.log('this.formObj', this.formObj)
const result = await meterManage.page(this.formObj)
if (result) {
console.log(55555)
console.log(result)
this.getPage = result
console.log(123456789)
console.log(this.getPage)
this.$refs.pageTable._hideLoading()
}
},
// _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">
<btn-list :msg="btn" @on-result-change="_btnClick" :showBtnNum="7" class="contHide"></btn-list>
</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="{ 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>
<ModalConfirm ref="confirmModal" @on-result-change="_confirmResult" :btnModalList="btnModalList"
content="该项目已绑定资质项目,请选择更新完善或者新增资质项目!"></ModalConfirm>
</div>
</template>
<script>
import { meterManageItem } from '../../api'
import Global from '../../api/config'
import VXESettingCol from '../../components/base/VXESettingCol'
import ModalConfirm from '../../components/base/ModalConfirm'
import SelectInput from './SelectInput'
export default {
components: {
VXESettingCol,
SelectInput,
ModalConfirm
},
data() {
return {
formObj: {
aptitudeId: [],
name: '',
code: '',
standardName: ''
},
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: {
records: []
},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '比较符', key: 'compare', width: 180, fixed: 'left' },
{ title: '限量值', key: 'limitValue', width: 140 },
{ title: '单位', key: 'unit', width: 160 },
{ title: '是否判定', key: 'judged', width: 120, editCell: true },
{ title: '备注', key: 'remark', 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)
// },
_formSearch: async function() {
// this.formObj.aptitudeId = this.leftSelectIds[i]
// Object.assign(this.formObj, this.$refs.pageTable._searchParams())
// console.log('this.formObj', this.formObj)
const result = await meterManageItem.page(this.leftSelectIds)
console.log('请求的结果', result)
if (result) {
this.getPage = result
// this.getPage.records.push(result[i])
this.$refs.pageTable._hideLoading()
console.log(result)
}
},
// 获取检测标准
_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.$refs.leftModal._open()
// 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">
<span v-for="item in optionList" v-bind:key="item.key">
<Option :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</span>
</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">
<span v-for="item in optionList" v-bind:key="item.key">
<Option :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</span>
</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很有用,不写可能渲染错-->
<div v-for="item in optionList" v-bind:key="item.key">
<Option :value="item.key" :key="item.key" v-if="compareKey!==item.key">
{{item.name}}
</Option>
</div>
</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>
......@@ -91,9 +91,9 @@ export default {
{ type: '', id: '', name: '导出' }
],
iconMsg: [
{ type: 'ios-clock', id: '', name: '编辑' },
{ type: 'ios-clock', id: '', name: '删除' },
{ type: 'ios-clock', id: '', name: '管理检测项目' }
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'md-trash', id: '', name: '删除' },
{ type: 'md-apps', id: '', name: '管理检测项目' }
],
formObj: {
basis: undefined,
......
......@@ -20,7 +20,7 @@
<Input v-model="formObj.fax" name="fax" placeholder="请输入传真"/>
</Form-item>
<Form-item label="省、市、区" prop="testedCityData" class="width-48">
<CityNameCascader :value="testedCityData" name="tested" @on-result-change="_cascaderResult">
<CityNameCascader :value="testedCityData.join(',')" name="tested" @on-result-change="_cascaderResult">
</CityNameCascader>
</Form-item>
......
<template>
<div>
<Modal v-model="showModal" width="1100" class="modal-footer-none">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="检定项目:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
select-data @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='jobOut'">
{{scope.row[item.key]===1?'是':'否'}}
</div>
<span v-else-if="item.key==='singleJudge'">
{{ scope.row[item.key]===undefined?'':scope.row[item.key].display }}
</span>
<!-- <div v-else-if="item.key==='testValue'">-->
<!-- <el-input-->
<!-- v-model="scope.row.testValue"-->
<!-- size="medium"-->
<!-- placeholder="请输入检测结果"-->
<!-- @blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"-->
<!-- />-->
<!-- </div>-->
<div v-else-if="item.key==='progress'">
{{scope.row.progress.display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
import { meterItem } from '../../api'
export default {
components: {
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
iconMsg: [
{ type: 'compose', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制', componentName: 'CopyModal' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
searchOpen: false,
modalTitle: '检测项目管理',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
{ 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.page(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>
<Modal v-model="showModal" :mask-closable="false" width="600">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="100">
<Form-item label="样品名称" prop="name">
<Input v-model="formObj.name" name="name" placeholder="请输入或选择样品名称" @on-result-change="_judgeBasisChange" />
</Form-item>
<Form-item label="检定依据" prop="verification">
<Input v-model="formObj.verification" name="verification" placeholder="请选择检定依据" />
</Form-item>
<Form-item label="型号规格" prop="spec">
<Input v-model="formObj.spec" name="spec" placeholder="请输入型号规格" />
</Form-item>
<Form-item label="出厂编号" prop="factoryNumber">
<Input v-model="formObj.factoryNumber" name="factoryNumber" placeholder="请输入出厂编号" />
</Form-item>
<Form-item label="数量" prop="quantity">
<Input v-model="formObj.quantity" name="quantity" placeholder="请选择数量" />
</Form-item>
<Form-item label="检测类型" prop="type">
<Input v-model="formObj.type" name="quantity" placeholder="请选择检测类型" />
</Form-item>
<Form-item label="备注" prop="remark">
<Input v-model="formObj.remark" :rows="3" placeholder="请输入备注" type="textarea" name="remark"/>
</Form-item>
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></ModalFooter>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑环境检测项目包
*/
import ModalFooter from '../../components/base/modalFooter'
import { meterAptitude } from '../../api'
export default {
components: {
ModalFooter
// autoComplete
},
data() {
// const validateJudgeBasis = (rule, value, callback) => {
// if (this.formObj.code === '') {
// callback(new Error('判定依据不能为空!'))
// } else if (this.formObj.stdId === '') {
// this.formObj.code = ''
// callback(new Error('请选择已维护过的判定依据!'))
// } else {
// callback()
// }
// }
return {
id: '',
modalTitle: '',
formObj: {
verification: '',
name: '',
spec: '',
factoryNumber: '',
type: '',
remark: '',
quantity: 1,
entrustId: ''
},
showModal: false,
aptitudeData: [],
ruleValidate: {
name: [{ required: true, message: '样品名称不能为空', trigger: 'blur' }]
},
footerList: [
{ name: '取消', type: '' },
{ name: '保存', type: 'primary' }
],
typeData: [],
judgeBasisData: []
}
},
methods: {
_save: async function(data) {
const result = await meterAptitude.save(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await meterAptitude.edit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_open(entrustId) {
this.formObj.entrustId = entrustId
this._getJudgeBasisList()
this.$refs.formObj.resetFields()
this.id = ''
this.modalTitle = '添加样品'
this.showModal = true
},
_typeChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.testType = data.name
break
}
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
// 添加
this._save(data)
} else {
// 编辑
this._edit({ id: this.formObj.id, obj: data })
}
// if (this.$string(this.id).isEmpty()) {
// // 添加
// this.$store.dispatch('FoodJudgeBasis/add', data).then(() => {
// this._resultChange('添加成功!')
// })
// } else {
// // 编辑
// this.$store
// .dispatch('FoodJudgeBasis/edit', { id: this.id, obj: data })
// .then(() => {
// this._resultChange('编辑成功!')
// })
// }
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_cancel() {
this.showModal = false
},
_resultChange(msg) {
this.showModal = false
this.$refs.footerModal._hideLoading()
this.$Message.success(msg)
this.$emit('on-result-change')
this.$refs.footerModal._hideLoading()
},
// 关联
_getJudgeBasisList(data) {
const obj = { classify: 0 }
if (data) {
obj.stdNum = data
}
// this.$store.dispatch('StandardInfo/list', obj).then(() => {
// this.judgeBasisData = this.$store.state.StandardInfo.list
// })
},
_judgeBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.code = data.stdNum
this.formObj.name = data.name
this.$refs.formObj.validateField('code')
break
case 'query':
this.formObj.stdId = ''
this.formObj.code = data.stdNum
this.formObj.name = ''
this._getJudgeBasisList(data.stdNum)
break
case 'focus':
this._getJudgeBasisList()
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.code = ''
this._getJudgeBasisList()
}
this.$refs.formObj.validateField('code')
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="1200" class="modal-footer-none">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品名称:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入样品名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入样品编号" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='jobOut'">
{{scope.row[item.key]===1?'是':'否'}}
</div>
<div v-else-if="item.key==='type'">
<Select v-model="scope.row.type">
<Option v-for="(item,index) in options" :key="item.name" :value="index">
{{ item.name }}
</Option>
</Select>
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
<importModal ref="importModal" @on-result-change="_page"></importModal>
<MeterSampleManageEdit ref="sampleEditModal" @on-result-change="_page"></MeterSampleManageEdit>
<MeterSampleEdit ref="meterSampleEditModal" @on-result-change="_page"></MeterSampleEdit>
</div>
</template>
<script>
import { meterSample } from '../../api'
import importModal from '../contract-tab/ContractTab'
import MeterSampleManageEdit from './MeterItemManage'
import MeterSampleEdit from './MeterSampleEdit'
export default {
components: {
MeterSampleManageEdit,
MeterSampleEdit,
importModal
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
},
data() {
return {
currentComponent: '',
searchOpen: false,
iconMsg: [
{ type: 'compose', id: '', name: '编辑' },
{ type: 'ios-flask-outline', id: '', name: '管理检测项目' },
{ type: 'trash-a', id: '', name: '删除' }
],
btn: [
{
type: 'success',
id: '',
name: '新增'
},
{
type: 'success',
id: '',
name: '导入样品'
},
{
type: 'success',
id: '',
name: '分包'
},
{
type: 'success',
id: '',
name: '取消分包'
},
{
type: 'success',
id: '',
name: '导入检测项目'
}
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
formId: 'meterReviewSampleManageFormId',
showModal: false,
modalTitle: '管理样品',
selectIds: [],
selectData: [],
getPage: {},
pageColumns: [
{ title: '样品编号', key: 'code', detail: true, width: 120 },
{ title: '样品名称', key: 'name', width: 140 },
{ title: '型号规格', key: 'spec', width: 140 },
{ title: '出厂编号', key: 'factoryNumber', width: 140 },
{ title: '是否分包', key: 'jobOut', width: 110 },
{ title: '检测类型', key: 'type', width: 140 },
{ title: '数量', key: 'quantity', width: 140 }
],
dateList: [],
formObj: {
entrustId: undefined,
name: undefined,
code: undefined,
type: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_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._subpackageCancelBtn()
break
case '新增':
this._addSample(this.formObj.entrustId)
break
case '导入样品':
this._importSample(this.formObj.entrustId)
break
case '分包':
this._subpackageSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
}
})
},
_addSample(entrustId) {
this.$refs.meterSampleEditModal._open(entrustId)
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理检测项目':
this._sampleEditModal(data)
break
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
}
})
},
_subpackageCancelBtn() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const data = {}
data.ids = this.selectIds.join(',')
this._subpackageCancel(data)
}
},
_subpackageCancel: async function(data) {
console.log(data)
const result = await meterSample.subpackageCancel(data)
if (result) {
this.$Message.success('取消成功!')
await this._page()
}
},
_sampleEditModal(data) {
this.$refs.sampleEditModal._open(data.id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj.entrustId = id
this.showModal = true
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
this.selectIds = []
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterSample.page(this.formObj)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultChange('删除成功!')
})
}
})
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(id) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
},
_editModal(edit, id) {
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(function() {
if (edit) {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
} else {
this.$refs.refModal._open('', this.contractId)
}
})
},
_editLY(id) {
// 粮油的编辑
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId
)
})
})
},
_search() {
this._page()
},
_searchParams() {
const data = this.$serialize('search-sample-govern')
return this.$extend(data, this.pageParams)
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
}
},
// 导入样品
_importSample() {
const data = {
importUrl: '/meter/v1/sample/import_' + this.formObj.entrustId,
downloadUrl: '/meter/v1/excel/template/MeterSampleImport',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.importModal._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)
}
},
_subpackage: async function(ids) {
const result = await meterSample.subpackageSample(ids)
if (result) {
this.$Message.success('分包成功!')
await this._page()
}
},
_itemDetail(id) {
this.$refs.foodItem._open(id)
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
......@@ -6,24 +6,24 @@
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<Form v-show="searchOpen" id="formId" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
<Input v-model="formObj.name" name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
<Input v-model="formObj.aptitude" name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
<Button type="primary" @click="_formSearch">搜索</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>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
</Col>
<!--表格-->
<Col span="24">
......@@ -47,15 +47,18 @@
</div>
<FileManage ref="FileManage"></FileManage>
<MeterSendOperation ref="operationModal"></MeterSendOperation>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<MeterSubcontractorEdit ref="editModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_page"></MeterSampleManage>
</div>
</template>
<script>
import { meterEntrust, meterSubcontractor } from '../../../api'
import { meterEntrust } from '../../../api'
import MeterSampleManage from '../MeterSampleManage'
import MeterSubcontractorEdit from './MeterSendTestEdit'
import MeterSendOperation from './MeterSendOperation'
export default {
components: { MeterSubcontractorEdit, MeterSendOperation },
components: { MeterSubcontractorEdit, MeterSendOperation, MeterSampleManage },
data() {
return {
currentComponent: '',
......@@ -83,7 +86,7 @@ export default {
{
type: 'ios-beaker',
id: '',
name: '资质项目'
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-remove-circle', id: '', name: '删除' },
......@@ -155,8 +158,8 @@ export default {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
case '管理样品':
this._sampleManage(data.id)
break
case '附件':
this._upload(data.id)
......@@ -170,6 +173,11 @@ export default {
}
})
},
_sampleManage(data) {
// 管理样品
this.$refs.meterSampleManageModal._open(data)
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
......@@ -239,11 +247,10 @@ export default {
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
this.$refs.editModal._open()
}
},
// 追加项目
......@@ -258,11 +265,11 @@ export default {
_getById: async function(id) {
const result = await meterEntrust.getVOById(id)
if (result) {
this.$refs.editSubcontractorModal._openEdit(result)
this.$refs.editModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await meterSubcontractor.deleteById(ids)
const result = await meterEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
......
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" name="name" placeholder="请输入实验室名称" clearable/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input v-model="formObj.aptitude" @on-enter="_formSearch" name="aptitude" placeholder="请输入资质" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" hide-checkbox>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterSubcontractorEdit ref="editSubcontractorModal" @on-result-change="_formSearch"></MeterSubcontractorEdit>
</div>
</template>
<script>
import { meterEntrust, meterSubcontractor } from '../../../api'
import MeterSubcontractorEdit from './MeterSendTestEdit'
export default {
components: { MeterSubcontractorEdit },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: 'meter-subcontractor-add-btn',
name: '添加'
}
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '编辑'
},
{
type: 'ios-clock',
id: '',
name: '资质项目'
},
{ type: 'ios-clock', id: '', name: '附件' },
{ type: 'ios-clock', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
name: undefined,
aptitude: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSubcontracter.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await meterEntrust.pageSendEntrust(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await meterSubcontractor.getById(id)
if (result) {
this.$refs.editSubcontractorModal._open(result)
}
},
_delete: async function(ids) {
const result = await meterSubcontractor.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
......@@ -6,9 +6,6 @@
<el-tab-pane label="待完成" name="wait">
<MeterSendEntrust ref="waitTabs"></MeterSendEntrust>
</el-tab-pane>
<el-tab-pane label="已完成" name="finish">
<MeterSendEntrustFinish ref="finishTabs"></MeterSendEntrustFinish>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterSendEntrustHis ref="hisTabs"></MeterSendEntrustHis>
</el-tab-pane>
......@@ -19,13 +16,11 @@
</template>
<script>
import MeterSendEntrust from './MeterSendEntrust'
import MeterSendEntrustFinish from './MeterSendEntrustFinish'
import MeterSendEntrustHis from './MeterSendEntrustHis'
export default {
name: 'MeterSendEntrustIndex',
components: {
MeterSendEntrust,
MeterSendEntrustFinish,
MeterSendEntrustHis
},
data() {
......
......@@ -3,49 +3,53 @@
<Modal v-model="showModal" :mask-closable="false" width="1250">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form id="MeterSendTestEdit" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form-item label="委托方是否第一次送检" prop="firsted" class="width-48">
<Radio-group v-model="formObj.firsted">
<Radio v-for="item in judgeType" :label="item.value" :key="item.value">{{item.name}}</Radio>
<Radio v-for="item in judgeType" :key="item.value" :label="item.value">{{item.name}}</Radio>
</Radio-group>
</Form-item>
<Form-item label="委托单位" prop="client" class="width-48">
<!-- <Input v-model="formObj.client" name="client" placeholder="请输入委托单位"/>-->
<AutoComplete :value="formObj.client" :downData="customerData" @on-result-change="_cusNameChange"
name="client" placeholder="请输入或选择委托单位"
<AutoComplete :value="formObj.client" :down-data="customerData" name="client"
placeholder="请输入或选择委托单位" @on-result-change="_cusNameChange"
></AutoComplete>
</Form-item>
<Form-item label="联系人" prop="operation.person" class="width-48">
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入委托单位"/>
<Input v-model="formObj.operation.person" name="operation.person" placeholder="请输入联系人"/>
</Form-item>
<Form-item label="联系电话" prop="operation.tel" class="width-48">
<Input v-model="formObj.operation.tel" name="operation.tel" placeholder="请输入委托单位"/>
<Input v-model="formObj.operation.tel" name="operation.tel" placeholder="请输入联系电话"/>
</Form-item>
<Form-item label="传真" prop="operation.fax" class="width-48">
<Input v-model="formObj.operation.fax" name="operation.fax" placeholder="请输入委托单位"/>
<Input v-model="formObj.operation.fax" name="operation.fax" placeholder="请输入传真"/>
</Form-item>
<Form-item label="省、市、区" prop="testedCityData" class="width-48">
<CityNameCascader :value="testedCityData" @on-result-change="_cascaderResult" name="tested">
<CityNameCascader :value="testedCityData.join(',')" name="tested" @on-result-change="_cascaderResult">
</CityNameCascader>
</Form-item>
<Form-item label="街道" prop="street" class="width-48">
<Input v-model="formObj.street" name="street" placeholder="请输入委托单位"/>
<Input v-model="formObj.street" name="street" placeholder="请输入街道"/>
</Form-item>
<Form-item label="邮编" prop="operation.postcode" class="width-48">
<Input v-model="formObj.operation.postcode" name="operation.postcode" placeholder="请输入委托单位"/>
<Input v-model="formObj.operation.postcode" name="operation.postcode" placeholder="请输入邮编"/>
</Form-item>
<Form-item label="E-mail" prop="operation.email" class="width-48">
<Input v-model="formObj.operation.email" name="operation.email" placeholder="请输入实验室名称"/>
<Input v-model="formObj.operation.email" name="operation.email" placeholder="请输入E-mail"/>
</Form-item>
<Form-item label="委托日期:" prop="edate" class="width-48">
<!-- <Input v-model="formObj.edate" name="edate" placeholder="请输入联系人"/>-->
<Date-picker @on-change="_ctimeChange" type="date" split-panels style="width:100%;"
placeholder="请选择委托日期"></Date-picker>
<Date-picker v-model="formObj.edate" type="date" split-panels style="width:100%;" placeholder="请选择委托日期"
@on-change="_ctimeChange"></Date-picker>
</Form-item>
<Form-item label="要求完成日期:" prop="odate" class="width-48">
<Date-picker v-model="formObj.odate" type="date" split-panels style="width:100%;" placeholder="请选择要求完成日期"
@on-change="_odateChange"></Date-picker>
</Form-item>
<Form-item label="合同号:" prop="contractCode" class="width-48">
<Input v-model="formObj.contractCode" name="contractCode" placeholder="请输入联系人"/>
<Input v-model="formObj.contractCode" name="contractCode" placeholder="请输入合同号"/>
</Form-item>
<Form-item label="备注:" prop="remark" style="width: 99.8%">
<Input v-model="formObj.remark" :rows="3" name="remark" type="textarea"
......@@ -55,7 +59,7 @@
<Col span="24">
<!-- <btn-list :msg="btn" :open="searchOpen" :showSearchBtn="false" @on-result-change="_btnClick"-->
<!-- class="contHide"></btn-list>-->
<Button @click="_add()" type="success">添加</Button>
<Button type="success" @click="_add()">添加</Button>
</Col>
<Col span="24">
<PTVXETable
......@@ -77,9 +81,12 @@
>
<template slot-scope="scope">
<div v-if="item.key==='name'" @click.stop="_handleRow(scope)">
<!-- <el-input v-model="scope.row.name" @click.native="_selectAptitude(scope.$index)" blur placeholder="请输入或选择样品名称"-->
<!-- ></el-input>-->
<el-input v-model="scope.row.name" @on-result-change="_judgeBasisChange" @click.native="_selectjudgeBasis(scope.$rowIndex)" blur placeholder="请输入或选择样品名称"
<el-input v-model="scope.row.name" blur placeholder="请输入或选择样品名称" @on-result-change="_judgeBasisChange" @click.native="_selectjudgeBasis(scope.$rowIndex)"
></el-input>
</div>
<div v-if="item.key==='verification'" @click.stop="_handleRow(scope)">
<el-input v-model="scope.row.verification" blur placeholder="请输入或选择检定依据"
></el-input>
</div>
<div v-if="item.key==='spec'" @click.stop="_handleRow(scope)">
......@@ -91,8 +98,6 @@
></el-input>
</div>
<div v-if="item.key==='type'" @click.stop="_handleRow(scope)">
<!--&lt;!&ndash; <el-input v-model="scope.row.type" blur placeholder="请输入或选择检测类型"&ndash;&gt;-->
<!--&lt;!&ndash; ></el-input>&ndash;&gt;-->
<Select v-model="scope.row.type">
<Option v-for="(item,index) in options" :key="item.name" :value="index">
{{ item.name }}
......@@ -100,13 +105,18 @@
</Select>
</div>
<div v-if="item.key==='quantity'" @click.stop="_handleRow(scope)">
<!-- <el-input v-model="scope.row.quantity" blur placeholder="请输入或选择数量"-->
<!-- ></el-input>-->
<el-input
v-model="scope.row.quantity"
@keydown.native="channelInputLimit"
type="number"
placeholder="请输入或选择数量"
@keydown.native="channelInputLimit"
/>
</div>
<div v-if="item.key==='remark'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.remark"
placeholder="请输入备注"
/>
</div>
</template>
......@@ -118,14 +128,14 @@
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<EditModal ref="EditModal" @on-result-change="_backData" is-change />
<EditModal ref="EditModal" is-change @on-result-change="_backData" />
</div>
</template>
<script>
/**
* 添加编辑分包商
*/
import { lmsBaseDict, meterEntrust } from '../../../api'
import { lmsBaseDict, meterEntrust, meterSample } from '../../../api'
import CityNameCascader from '../../../components/base/CityNameCascader'
import AutoComplete from '../../../components/base/AutoCompletes'
import EditModal from './EditModal'
......@@ -156,16 +166,15 @@ export default {
cityData: [],
testedCityData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [
{ type: 'ios-clock', id: '', name: '编辑' },
{ type: 'ios-clock', id: '', name: '删除' }
],
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
pageColumns: [
{ title: '样品名称', key: 'name', width: 160 },
{ title: '型号规格', key: 'spec' },
{ title: '检定依据', key: 'verification' },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '检测类型', key: 'type' },
{ title: '数量', key: 'quantity' }
{ title: '数量', key: 'quantity' },
{ title: '备注', key: 'remark' }
// {title: '限制范围或说明', key: 'limitDescription'},
],
options: [
......@@ -199,6 +208,7 @@ export default {
subArea: '',
personCondition: '',
edate: '',
odate: '',
contractCode: '',
operation: {
person: '',
......@@ -255,13 +265,6 @@ export default {
aptitudeData: []
}
},
// created() {
// this.$set(
// this.formObj,
// 'tested',
// JSON.parse(JSON.stringify(this.testedTemp))
// )
// },
methods: {
_cusNameChange(msg, data) {
// this.financeObj = {} // 清空维护发票信息的数据
......@@ -282,9 +285,7 @@ export default {
}
},
_customerMatch(data) {
// this.formObj.client = data
this._getQueryList(data)
console.log(data)
},
_cusNameQuery(query) {
this.formObj.client = query
......@@ -293,8 +294,9 @@ export default {
_ctimeChange(data) {
console.log('时间', data)
this.formObj.edate = data
// this.formObj.ctimeBegin = data[0]
// this.formObj.ctimeEnd = data[1]
},
_odateChange(data) {
this.formObj.odate = data
},
_judgeBasisChange(msg, data) {
switch (msg) {
......@@ -338,8 +340,9 @@ export default {
const data = {
name: '',
spec: '',
verification: '',
factoryNumber: '',
quantity: '',
quantity: '1',
type: ''
}
this.getPage.records.unshift(data)
......@@ -411,16 +414,28 @@ export default {
// this._editModal(true, data.id)
break
case '删除':
// this._deleteById(data.id)
console.log('点击了删除按钮')
console.log(index)
this.getPage.records.splice(index, 1)
this._deleteSample(data)
break
case '操作日志':
// this._record(data.id)
break
}
},
_deleteSample(data) {
if (data.id === undefined) {
return false
} else {
this._delete(data.id)
}
},
_delete: async function(id) {
const result = await meterSample.deleteById(id)
if (result) {
console.log(result)
}
},
_selectAptitude(data) {
console.log(data)
......@@ -461,7 +476,7 @@ export default {
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
const data = this.$serialize('MeterSendTestEdit')
Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) {
// 添加
......@@ -469,8 +484,6 @@ export default {
saveData.sampleList = this.getPage.records
this._save(saveData)
} else {
// 编辑
// this._edit({ id: this.formObj.id, obj: data })
const saveData = this.formObj
saveData.sampleList = this.getPage.records
this._edit(saveData)
......@@ -515,11 +528,11 @@ export default {
this.getPage.records = []
this.id = ''
this.formObj.aptitude = []
this.modalTitle = '分包商管理新增'
this.modalTitle = '送检委托单新增'
} else {
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '分包商管理编辑'
this.modalTitle = '送检委托单编辑'
this._showTime(formObj)
}
},
......@@ -534,8 +547,23 @@ export default {
this.id = formObj.id
this.formObj = formObj
this._showAddress(formObj)
this._showTime(formObj)
this.getPage.records = formObj.sampleList
},
_showTime(formObj) {
if (this.formObj.odate === undefined) {
this.formObj.odate = ''
} else {
this.formObj.odate = new Date(formObj.odate)
}
if (this.formObj.edate === undefined) {
this.formObj.edate = ''
} else {
this.formObj.edate = new Date(formObj.edate)
}
},
_showAddress(formObj) {
this.testedCityData = []
if (
......@@ -574,6 +602,15 @@ export default {
result[0].city,
result[0].area
]
if (result[0].province) {
this.formObj.province = result[0].province
}
if (result[0].city) {
this.formObj.city = result[0].city
}
if (result[0].area) {
this.formObj.county = result[0].area
}
}
},
_getAptitudeList: async function() {
......@@ -582,9 +619,6 @@ export default {
this.aptitudeData = result
}
},
_showTime(formObj) {
// 回显资质类型
},
_save: async function(data) {
const result = await meterEntrust.save(data)
console.log(result)
......
......@@ -47,8 +47,8 @@
</div>
<FileManage ref="FileManage"></FileManage>
<Reason ref="reasonModal" @on-result-change="_reasonResult"></Reason>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_componentResult"></MeterSampleManage>
<MeterEntrustDetail ref="meterSampleEdit" @on-result-change="_componentResult"></MeterEntrustDetail>
<MeterSampleManage ref="meterSampleManageModal" @on-result-change="_page"></MeterSampleManage>
<MeterEntrustDetail ref="meterSampleEdit" @on-result-change="_page"></MeterEntrustDetail>
<Operation ref="operation"></Operation>
</div>
</template>
......
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