Commit a31a7b3e by lichengming

修改了开土制备导入检测项目

parent 7232dc6f
...@@ -143,5 +143,14 @@ export default { ...@@ -143,5 +143,14 @@ export default {
.post('soil/v1/sample/scan_take_sample?sampleCode=' + data) .post('soil/v1/sample/scan_take_sample?sampleCode=' + data)
.then(res => res), .then(res => res),
pageLocationSample: data => pageLocationSample: data =>
http.post('soil/v1/sample/page_location_sample', data).then(res => res) http.post('soil/v1/sample/page_location_sample', data).then(res => res),
importExperiments: data =>
http
.post(
'soil/v1/experiment/import_experiments?aptitudeIds=' +
data.aptitudeIds +
'&ids=' +
data.ids
)
.then(res => res)
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange"> :get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
</el-select> </el-select>
<span v-if="!showOption">{{ scope.row[item.key]===0? '否':'是' }}</span> <span v-if="!showOption">{{ scope.row[item.key]===0? '否':'是' }}</span>
</div> </div>
<span v-else-if="item.status">{{scope.row[item.key]}}</span> <span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.judged"> <div v-else-if="item.judged">
{{ scope.row[item.key]===0? '否':'是' }} {{ scope.row[item.key]===0? '否':'是' }}
</div> </div>
...@@ -105,28 +105,36 @@ ...@@ -105,28 +105,36 @@
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" /> <modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div> </div>
</Modal> </Modal>
<ImportItem ref="itemImport" @on-result-change="_page"></ImportItem>
</div> </div>
</template> </template>
<script> <script>
import http from '../../api/http' import http from '../../api/http'
import { soilEntrust } from '../../api' import { soilEntrust } from '../../api'
import ImportItem from './sample-preparation/ImportItem'
export default { export default {
components: {}, components: { ImportItem },
data() { data() {
return { return {
formId: 'SoilSampleItemManage', formId: 'SoilSampleItemManage',
currentComponent: '', currentComponent: '',
btn: [], btn: [
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }], {
type: 'success',
id: '',
name: '导入检测项目'
}
],
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
sampleId: '', // 样品id sampleId: '', // 样品id
showModal: false, showModal: false,
modalTitle: '管理检测项目', modalTitle: '管理检测项目',
selectIds: [], selectIds: [],
selectData: [],
itemId: '', itemId: '',
index: '', index: '',
showOption: true, showOption: true,
searchOpen: true, searchOpen: true,
selectData: {},
getPage: {}, getPage: {},
currentRow: '', currentRow: '',
currentIndex: '', currentIndex: '',
...@@ -142,7 +150,7 @@ export default { ...@@ -142,7 +150,7 @@ export default {
{ title: '小类', key: 'smallType' }, { title: '小类', key: 'smallType' },
{ title: '检测依据', key: 'testBasis', width: 180 }, { title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 }, { title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 } { title: '状态', key: 'status', width: 180, status: true }
], ],
subOptions: [ subOptions: [
{ {
...@@ -381,7 +389,6 @@ export default { ...@@ -381,7 +389,6 @@ export default {
this._copy(data) this._copy(data)
break break
case '删除': case '删除':
console.log(index)
this._deleteById(data.id) this._deleteById(data.id)
break break
case '导出样品委托协议': case '导出样品委托协议':
...@@ -425,9 +432,9 @@ export default { ...@@ -425,9 +432,9 @@ export default {
this.selectIds = selectIds this.selectIds = selectIds
this.selectData = data this.selectData = data
break break
// case 'iconClick': case 'iconClick':
// this._iconClick(data.name, data.rowData, data.componentName) this._iconClick(data.name, data.rowData, data.componentName)
// break break
case 'page': case 'page':
this._page() this._page()
break break
...@@ -480,7 +487,7 @@ export default { ...@@ -480,7 +487,7 @@ export default {
}, },
_deleteOk: async function(ids) { _deleteOk: async function(ids) {
const result = await soilEntrust.deleteById(ids) const result = await soilEntrust.experimentDeleteById(ids)
if (result) { if (result) {
this._resultChange('删除成功! ') this._resultChange('删除成功! ')
} }
...@@ -588,15 +595,7 @@ export default { ...@@ -588,15 +595,7 @@ export default {
}, },
// 导入检测项目 // 导入检测项目
_importItem() { _importItem() {
if (this.selectIds.length === 0) { this.$refs.itemImport._open(this.sampleId)
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(
this.selectIds,
this.selectData[0],
this.selectData
)
}
}, },
// 导入检测项目包 // 导入检测项目包
_importItemPackage() { _importItemPackage() {
......
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="副样管理" name="wait">
<SampleBackupsManage ref="waitTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="副样查询" name="query">
<SampleBackupsQuery ref="queryTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import SampleBackupsManage from './tab/SampleduplicateManage'
import SampleBackupsQuery from './tab/SampleduplicateQuery'
export default {
components: {
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this.$refs.waitTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this.$refs.waitTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.queryTabs._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModalHandleApply" :mask-closable="false" width="500">
<p slot="header">处理申请</p>
<div>
<Form ref="formObj" :id="formId" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form-item label="申请日期:" prop="applyHandleTime" style="width:100%">
<Date-picker v-model="formObj.applyHandleTime" :editable="false" name="applyHandleTime"
type="date" placeholder="请选择申请日期" style="width: 100%;"
></Date-picker>
</Form-item>
<Form-item label="申请人:" prop="applyHandler" style="width:100%">
<Input v-model="formObj.applyHandler" @click.native="_selectPerson()" name="applyHandler" readonly></Input>
</Form-item>
<Form-item label="处理方式:" style="width:100%">
<el-select v-model="formObj.handleWay" name="handleWay" placeholder="请选择"
size="small"
style="width:100%"
clearable>
<el-option
v-for="item in handleWayList"
:key="item.name"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</Form-item>
<Form-item label="处理原因" prop="applyRemark" style="width:100%">
<Input :rows="3" v-model="formObj.applyRemark" placeholder="请输入处理原因" type="textarea" name="applyRemark"/>
</Form-item>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
</div>
</template>
<script>
import Global from '../../../api/config'
import AssignPerson from '../../../components/user-info-single/assignPerson'
import { soilSample } from '../../../api'
export default {
components: { AssignPerson },
data() {
return {
lengthLimitList: [{ key: 'handleQuantity', title: '样品处理数量' }],
ids: [], // 委托ids
showModalHandleApply: false,
formObj: {
id: '',
applyHandleTime: new Date(),
applyHandler: '',
applyHandlerId: '',
handleBatch: '',
retentionTime: '',
applyRemark: '',
lmsEquipFiles: [],
handleWay: '',
handleQuantity: '',
sampleUnit: ''
},
applyId: 0,
ruleValidate: {},
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '提交', type: 'primary' }
],
visible: false,
fileAction: Global.baseURL + '/food/v1/sample_handle_apply/uploadFile',
fileData: {
id: 0,
name: ''
},
formId: '',
handleWayList: [
{
name: '到期处置'
},
{
name: '立即处置'
}
],
imgSrc: ''
}
},
mounted() {
// this._dicSearch()
this._getDisposeWay()
},
methods: {
_getDisposeWay: async function() {
const result = await soilSample.getDictList('土工处理方式')
if (result) {
this.handleWayList = result
}
},
_selectPerson() {
this.$refs.personModal._openGoup('申请人', 'itemTree')
},
_assignBackData(data) {
this.formObj.applyHandler = data.realname
this.formObj.applyHandlerId = data.id
},
// 从字典中查询类别
_dicSearch() {
this.$store.dispatch('LmsBaseDict/getItem', '样品处理方式').then(() => {
const result = this.$store.state.LmsBaseDict.item
this.handleWayList = result
})
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '提交':
this._ok()
break
}
},
_open(data) {
this.ids = []
this.applyId = 0
this.fileData.id = 0
this.formObj = this.$resetFields(this.formObj)
// this._getRetention(data)
// this._getSampleBatch(data)
this.$refs.footerModal._hideLoading()
this.ids = data
this.formObj.lmsEquipFiles = []
this.showModalHandleApply = true
this.formObj.applyHandler = Global.getUserInfo().realname
this.formObj.applyHandlerId = Global.getUserInfo().id
this.formId = 'handleApplyEditForm' + this.$randomCode()
this.formObj.applyHandleTime = new Date()
},
_getSampleBatch(data) {
this.formObj.handleBatch = data.length
},
// 计算存储期限
_getRetention(data) {
const handleQuantityList = []
const sampleUnitList = []
let lastTime = ''
const ids = []
for (let i = 0; i < data.length; i++) {
ids.push(data[i].id)
// 样品处理数量和单位
handleQuantityList.push(data[i].handleQuantity)
sampleUnitList.push(data[i].sampleUnit)
if (lastTime === '') {
lastTime = data[i].endDate
} else if (lastTime !== '' && lastTime < data[i].endDate) {
lastTime = data[i].endDate
}
}
this.ids = ids
this.formObj.retentionTime = this.$dateformat(lastTime, 'yyyy-mm-dd')
// 若勾选的样品处理数量、单位一样则显示
// 通过for循环来判断数组的每一元素(若有不重复的,则返回false)
this.formObj.handleQuantity =
this.$duplicates(handleQuantityList) && handleQuantityList.length > 0
? handleQuantityList[0]
: ''
this.formObj.sampleUnit =
this.$duplicates(sampleUnitList) && sampleUnitList.length > 0
? sampleUnitList[0]
: ''
},
// 附件
_handleView(data) {
const filePath = data.filePath
const index1 = filePath.lastIndexOf('.')
const index2 = filePath.length
const suffix = filePath.substring(index1 + 1, index2) // 后缀名
if (
suffix.toLowerCase() === 'png' ||
suffix.toLowerCase() === 'jpg' ||
suffix.toLowerCase() === 'jpeg'
) {
this.visible = true
this.imgSrc =
Global.baseURL +
'/food/v1/sample_handle_apply_attachment/view' +
'?id=' +
data.id +
'&objectKey=' +
data.filePath
} else {
this.$Message.warning({
content: '非图片文件无法查看,请下载查看',
duration: 3
})
this.visible = false
}
},
// 下载文件
_downloadFile(file) {
this.$Modal.confirm({
title: '提示',
content: '确定要下载?',
onOk: () => {
const url =
Global.baseURL +
'/food/v1/sample_handle_apply/downLoadFile?id=' +
file.id
window.open(url)
}
})
},
_handleSuccess(response, file, fileList) {
if (response.success) {
this.fileData.id = response.data.applyId
this.applyId = response.data.applyId
this.$Message.success('上传成功!')
this.formObj.lmsEquipFiles.push(response.data)
} else {
this.$Message.error('上传失败!')
}
},
_handleBeforeUpload(file) {},
// 删除文件
_handleRemove(file) {
this.$Modal.confirm({
title: '提示',
content: '确定删除文件?',
onOk: () => {
const fileList = this.formObj.lmsEquipFiles
this.$store
.dispatch('FoodSampleHandleApplyAttachment/deleteByIds', file.id)
.then(() => {
if (this.$store.state.FoodSampleHandleApplyAttachment.success) {
this.formObj.lmsEquipFiles.splice(fileList.indexOf(file), 1)
this.$Message.success('删除成功!')
}
})
}
})
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
this.$refs.footerModal._hideLoading()
const data = this.$serialize(this.formId)
data.applyHandlerId = this.formObj.applyHandlerId
data.ids = this.ids.join(',')
this._submitDispose(data)
// data.handleBatch = this.formObj.handleBatch
// data.id = this.applyId
// data.handleWay = this.formObj.handleWay
// data.applyHandler = this.formObj.applyHandler
// data.handleQuantity = this.formObj.handleQuantity
// // let returnData = {ids: this.ids, obj: data};
// this.$extend(data, { backupIds: this.ids.join(',') })
// if (this.$lengthLimitVal(this.lengthLimitList, data) === false) {
// this._hideLoading()
// return
// }
// this.$store
// .dispatch('FoodSampleHandleApply/handleApplySubmit', data)
// .then(() => {
// if (this.$store.state.FoodSampleHandleApply.success) {
// this._cancel()
// this.$Message.success('提交成功')
// this.$emit('on-result-change')
// } else {
// this.$refs.footerModal._hideLoading()
// }
// })
} else {
this.$Message.error('表单验证失败!')
this.$refs.footerModal._hideLoading()
}
})
},
_submitDispose: async function(data) {
const result = await soilSample.surplusApplyHandle(data)
if (result) {
this._resultChange('提交成功')
}
},
_resultChange(msg) {
this.$Message.success(msg)
this.showModalHandleApply = false
this.$emit('on-result-change')
},
_cancel() {
this.showModalHandleApply = false
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<style scoped>
.file-upload-list {
display: inline-block;
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
border: 1px solid transparent;
border-radius: 4px;
overflow: hidden;
background: #fff;
position: relative;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
margin-right: 4px;
}
.file-upload-list i {
color: #fff;
font-size: 20px;
cursor: pointer;
margin: 0 2px;
}
.file-upload-list-cover {
display: none;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.6);
}
.file-upload-list:hover .file-upload-list-cover {
display: block;
}
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托编号:">
<Input @on-enter="_formSearch" v-model="formObj.entrustCode" name="entrustCode" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="试样编号:">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" name="sampleCode" 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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!--样品数量-->
<!-- 表格 -->
<Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.key==='keepContainer'">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else>
<el-select v-model="scope.row.keepContainer" clearable style="width:100%" size="small">
<el-option v-for="item in containerList" :value="item.name" :key="item.name">{{ item.name }}
</el-option>
</el-select>
</div>
</div>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<vxe-table-column
slot="col"
:width="80"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="editIndex===scope.rowIndex?iconMsgSave:iconMsg" @on-result-change="_iconClick" :rowData="scope.row" :rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
</div>
<SampleParpareApply ref="applyModal" @on-result-change="_page"></SampleParpareApply>
<Operation ref="recordModal"></Operation>
</div>
</template>
<script>
import SampleParpareApply from '../SurplusduplicateApply'
// eslint-disable-next-line no-unused-vars
import http from '../../../../api/http'
import { soilSample } from '../../../../api'
import Operation from '../../../../components/operation/Operation'
export default {
components: {
SampleParpareApply,
Operation
},
data() {
return {
currentComponent: '',
searchOpen: false,
formObj: {},
selectData: [],
selectIds: [],
indexList: [],
selectSampleIds: [],
getPage: {},
btn: [
{
type: 'primary',
id: '',
name: '申请处理'
},
{
type: 'primary',
id: '',
name: '完成处理'
}
// { type: '', id: '', name: '填写存放信息' },
// { type: '', id: '', name: '申请处理' },
// { type: '', id: '', name: '导出' },
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' }, // food-sample-prepare-edit
{ type: 'ios-clock', id: '', name: '操作日志' }
],
iconMsgSave: [{ type: 'ios-checkmark', id: '', name: '保存' }],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 150 },
{ title: '状态', key: 'status', status: true, width: 100 },
{ title: '包装类型', key: 'samplePack', width: 100 },
{ title: '保存容器', key: 'keepContainer', width: 150 },
{ title: '制备数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 70 },
{ title: '制备人', key: 'preparer', width: 130 },
{ title: '制备时间', key: 'prepareDate', date: true, width: 130 }
// { title: '备注', key: 'remark', width: 130 }
/* {title: '处置方式', key: 'handleMethod', width: 120,}, */
],
conditionList: [],
locList: [],
containerList: [],
currentIndex: -1,
editIndex: -1,
endDateBegin: '',
endDateEnd: '',
contList: [
{ key: 'backupCount', name: '今日新增数量', value: 0 },
{
key: 'backupCountOver',
name: '超期数量',
value: 0,
color: 'red-color'
},
{
key: 'backupCountWarn',
name: '预警数量',
value: 0,
color: 'warning-color'
}
],
// 只看预警和超期样品
warnAndOver: 0,
sampleHandleValue: '',
issueDateBegin: '',
issueDateEnd: '',
isEligible: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 255)
} else {
return this.$tableHeight('', 220)
}
},
colorComputed() {
return function(date) {
if (this.$warningValue(date) < 0) {
return '#eb6877' // 红色
} else if (
this.$warningValue(date) >= 0 &&
this.$warningValue(date) <= this.sampleHandleValue
) {
return '#f90' // 橙色
}
}
}
},
mounted() {
this.$refs.pageTable._showLoading()
// 样品存储期限预警
// this.sampleHandleValue = Number(localStorage.getItem('sampleHandleValue'))
// this._getLocList()
// this._getConditionList()
// this._getBackUpCount()
this._getContainerList()
},
methods: {
// 签发日期
_issueDateChange(date) {
this.issueDateBegin = date[0]
this.issueDateEnd = date[1]
},
// 重新请求page以及备样数量
_relPage() {
this._page()
// this._getBackUpCount()
},
_getContainerList: async function() {
const result = await soilSample.getDictList('保存容器')
if (result) {
this.containerList = result
}
},
// 查询卡片备样数量
_getBackUpCount() {
this.$store.dispatch('FoodSampleBackup/backUpCount').then(() => {
const result = this.$store.state.FoodSampleBackup.model
const length = this.contList.length
for (let i = 0; i < length; i++) {
this.$set(this.contList[i], 'value', result[this.contList[i].key])
}
})
},
// 选择时间
_endDateChange(data) {
this.getPage.records[this.currentIndex].endDate = data
},
// 查询-接收日期
_dateChange(data) {
this.endDateBegin = data[0]
this.endDateEnd = data[1]
},
_save() {
this.$nextTick(function() {
const tempData = {
keepContainer: this.getPage.records[this.currentIndex].keepContainer
}
this._saveOk({
id: this.getPage.records[this.currentIndex].id,
obj: tempData
})
})
},
_saveOk: async function(data) {
console.log(data)
const result = await soilSample.editPrepare(data)
if (result) {
this.$Message.success('编辑成功')
}
},
_iconClick(res, data, componentName, index) {
this.currentIndex = index
switch (res) {
case '操作日志':
this._record(data.id)
break
case '编辑':
this.editIndex = index
break
case '保存':
console.log('保存')
// if (data.endDate !== '') {
// // 非空情况下格式化赋值,如果不判断会格式化为当天的日期
// this._endDateChange(this.$dateformat(data.endDate, 'yyyy-mm-dd'))
// }
this._save()
this.editIndex = -1
break
}
},
_record(id) {
this.$refs.recordModal._openSurplus(id)
},
_locChange(msg, data) {
switch (msg) {
case 'select':
this.getPage.records[this.currentIndex].backupPlace = data.backupPlace
break
case 'query':
this.getPage.records[this.currentIndex].backupPlace = data.backupPlace
this._getLocList(data.backupPlace)
break
case 'focus':
this._getLocList()
break
}
},
_getLocList(data) {
const obj = {}
if (data) {
obj.backupPlace = data
}
this.$store.dispatch('FoodSampleBackup/getPositionList', obj).then(() => {
this.locList = this.$store.state.FoodSampleBackup.list
})
},
_getConditionList() {
this.$store.dispatch('LmsBaseDict/getItem', '保存方式').then(() => {
this.conditionList = this.$store.state.LmsBaseDict.item
})
},
_exportReceiveRecord() {
// 导出备样记录
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条数据!')
} else {
const obj = {
param: 'ids',
ids: this.selectIds,
url: ''
}
this.$store
.dispatch('ReportExport/getById', 'food-sample-prepare-record-export')
.then(() => {
const result = this.$store.state.ReportExport.model
obj.url = result
this.$exportByQuery(obj)
})
}
},
// 操作的序号
_handleIndex(data) {
this.currentIndex = data.rowIndex
},
_btnClick(msg) {
switch (msg) {
case '申请处理':
this._applyDispose()
break
case '完成处理':
this._handleApply()
break
case '制备':
this._preMethod()
break
case '无需制备':
this._noPreMethod()
break
case '扫码制备':
this._scanPreMethod()
break
case '填写存放信息':
this._batchEdit()
break
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
} else {
this._export()
}
break
case '导出备样记录':
this._exportReceiveRecord()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
},
_applyDispose() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.applyModal._open(this.selectIds)
}
},
_handleApply() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
console.log(this.selectData)
const errorIds = []
for (let i = 0; i < this.selectIds.length; i++) {
if (this.selectData[i].status.display !== '处理审批通过') {
errorIds.push(this.selectData[i].index + 1)
}
}
if (errorIds.length === 0) {
this.$Modal.confirm({
title: '提示',
content: '确定处理这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this._handleOk(this.selectIds.join(','))
}
})
} else {
this.$Message.warning('第 ' + errorIds + ' 条数据的审批未通过')
}
}
},
_handleOk: async function() {
const result = await soilSample.surplusHandleOk(this.selectIds.join(','))
if (result) {
this._resultChange('提交成功')
}
},
// 制备
_preMethod() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.preModal._open(this.selectSampleIds)
}
},
// 无需制备
_noPreMethod() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.noPreModal._open(this.selectSampleIds)
}
},
_scanPreMethod() {
this.$refs.scanPreModal._open()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage.records = []
this.getPage = {
total: this.$store.state.LmsFoodSamplePrepare.page.total,
pages: this.$store.state.LmsFoodSamplePrepare.page.pages,
current: this.$store.state.LmsFoodSamplePrepare.page.current,
size: this.$store.state.LmsFoodSamplePrepare.page.size,
records: []
}
const tableList = this.$store.state.LmsFoodSamplePrepare.page.records
for (let i = 0; i < tableList.length; i++) {
this.getPage.records.push({
sampleId:
tableList[i].sampleId !== undefined
? tableList[i].sampleId
: '',
sampleSn:
tableList[i].sampleSn !== undefined
? tableList[i].sampleSn
: '',
sampleName:
tableList[i].sampleName !== undefined
? tableList[i].sampleName
: '',
backupPlace:
tableList[i].backupPlace !== undefined
? tableList[i].backupPlace
: '',
cname: tableList[i].cname !== undefined ? tableList[i].cname : '',
storageCondition:
tableList[i].storageCondition !== undefined
? tableList[i].storageCondition
: '',
quantity:
tableList[i].quantity !== undefined
? tableList[i].quantity
: '',
sampleQuantity:
tableList[i].sampleQuantity !== undefined
? tableList[i].sampleQuantity
: '',
handleQuantity:
tableList[i].handleQuantity !== undefined
? tableList[i].handleQuantity
: '',
sampleUnit:
tableList[i].sampleUnit !== undefined
? tableList[i].sampleUnit
: '',
endDate:
tableList[i].endDate !== undefined
? new Date(tableList[i].endDate)
: '',
handleMethod:
tableList[i].handleMethod !== undefined
? tableList[i].handleMethod
: '',
id: tableList[i].id !== undefined ? tableList[i].id : '',
contractName:
tableList[i].contractName !== undefined
? tableList[i].contractName
: '',
code: tableList[i].code !== undefined ? tableList[i].code : '',
contractSn:
tableList[i].contractSn !== undefined
? tableList[i].contractSn
: '',
progress:
tableList[i].progress !== undefined
? tableList[i].progress
: '',
type: tableList[i].type !== undefined ? tableList[i].type : '',
issueDate:
tableList[i].issueDate !== undefined
? tableList[i].issueDate
: '',
sampleRemark:
tableList[i].sampleRemark !== undefined
? tableList[i].sampleRemark
: '',
contractRemark:
tableList[i].contractRemark !== undefined
? tableList[i].contractRemark
: '',
isEligible:
tableList[i].isEligible !== undefined
? tableList[i].isEligible
: '',
remark:
tableList[i].remark !== undefined ? tableList[i].remark : '',
contractId:
tableList[i].contractId !== undefined
? tableList[i].contractId
: ''
})
}
this.selectIds = []
this.selectData = []
this.selectSampleIds = []
break
case 'selectData':
this.selectData = data
this.selectIds = []
this.selectSampleIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
this.selectSampleIds.push(data[i].sampleId)
}
break
case 'changeSize':
this._page()
break
}
},
allSelect(data) {
this.indexList = []
for (let i = 0; i < data.length; i++) {
this.indexList.push(data[i])
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
// this._getBackUpCount()
},
_page: async function() {
this.editIndex = -1
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilSample.pageSurplus(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_batchEdit() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.editModal._open(this.selectData)
}
},
_handle() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.applyModal._open(this.selectData)
}
},
// 委托详情
_detailModal(data) {
// 查看
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 样品详情
_sampleDetailModal(data) {
if (data.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
})
}
},
/** *********************************导出-begin*********************************************/
_export() {
let result = []
if (this.selectData.length === 0) {
// 导出全部数据
this.$store
.dispatch('LmsFoodSamplePrepare/page', this._searchParams())
.then(() => {
result = this.$store.state.LmsFoodSamplePrepare.page.records
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'samplePreManage',
'备样记录',
this.pageColumns,
result
)
}
})
})
} else {
// 只导出选中的数据
result = this.selectData
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'samplePreManage',
'备样记录',
this.pageColumns,
result
)
}
})
}
},
// 参数
_searchParams() {
const data = this.$serialize('search-form')
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</script>
<style scoped>
/******副样、备样卡片********/
.reimbursement-item {
flex: 1;
border-radius: 5px;
border: 1px solid #e8e8e8;
padding-bottom: 10px;
}
.reimbursement-item + .reimbursement-item {
margin-left: 20px;
}
.reimbursement-item p {
text-align: center;
margin: 0;
}
.reimbursement-item > p:first-child {
font-size: 22px;
line-height: 40px;
}
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-query" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="试样编号:">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" name="sampleCode" 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" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<vxe-table-column
slot="col"
:width="80"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="editIndex===scope.rowIndex?iconMsgSave:iconMsg" @on-result-change="_iconClick" :rowData="scope.row" :rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
</div>
<Operation ref="recordModal"></Operation>
</div>
</template>
<script>
import { soilSample } from '../../../../api'
import Operation from '../../../../components/operation/Operation'
export default {
components: { Operation },
data() {
return {
currentComponent: '',
selectIds: [],
formObj: {
client: '',
entrustCode: '',
sampleCode: ''
},
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
btn: [
// { type: '', id: '', name: '导出' },
],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 150 },
{ title: '状态', key: 'status', status: true, width: 100 },
{ title: '包装类型', key: 'samplePack', width: 100 },
{ title: '保存容器', key: 'keepContainer', width: 100 },
{ title: '制备数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 70 },
{ title: '制备人', key: 'preparer', width: 130 },
{ title: '制备时间', key: 'prepareDate', date: true, width: 130 }
],
searchOpen: false,
getPage: {},
selectData: [],
endDateBegin: '',
endDateEnd: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 255)
} else {
return this.$tableHeight('', 220)
}
}
},
methods: {
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilSample.pageSurplusHis(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.getPage = this.$store.state.FoodSampleBackup.page
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'changeSize':
this._page()
break
// default :
// this._page();
}
},
_iconClick(res, data, componentName, index) {
this.currentIndex = index
switch (res) {
case '操作日志':
this._record(data.id)
break
default:
this._page()
}
},
_record(id) {
this.$refs.recordModal._openSurplus(id)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_dateChange(data) {
this.endDateBegin = data[0]
this.endDateEnd = data[1]
},
_btnClick(msg) {
switch (msg) {
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
} else {
this._export()
}
break
case '导出样品贮存表':
this._exportSampleStore()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_exportSampleStore() {
const obj = {
param: 'ids',
ids: this.selectIds,
url: '',
queryObj: this.$serialize('search-form-query')
}
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-handle-already-export-sample-store'
)
.then(() => {
const result = this.$store.state.ReportExport.model
obj.url = result
this.$exportByQuery(obj)
})
},
// 样品详情
_sampleDetailModal(data) {
if (data.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
})
}
},
/** *********************************导出-begin*********************************************/
_export() {
let result = []
if (this.selectData.length === 0) {
// 导出全部数据
this.$store
.dispatch('FoodSampleBackup/perSampleQuery', this._searchParams())
.then(() => {
result = this.$store.state.FoodSampleBackup.page.records
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'perSampleQuery',
'样品处理',
this.pageColumns,
result
)
}
})
})
} else {
// 只导出选中的数据
result = this.selectData
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'perSampleQuery',
'样品处理',
this.pageColumns,
result
)
}
})
}
},
// 参数
_searchParams() {
const data = this.$serialize('search-form-query')
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</script>
<!--资质项目列表-->
<template>
<div>
<div>
<Form :label-width="65" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="检测项目:" class="search-item">
<Input v-model="formObj.name" @on-enter="_search" placeholder="请输入检测项目" clearable />
</Form-item>
<Form-item>
<Button @click="_search" type="primary">搜索</Button>
</Form-item>
</Form>
</div>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.judge">{{scope.row[item.key] === 0 ?'否':'是'}}</div>
<div v-else-if="item.key==='testBasis'">
{{(scope.row.testBasis?scope.row.testBasis:' ')+(scope.row.testBasisName?scope.row.testBasisName:'')}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
export default {
components: {},
data() {
return {
getPage: {},
formObj: {
name: undefined,
testBasis: undefined,
aptitude: undefined
},
tableHeight: document.documentElement.clientHeight - 285,
pageColumns: [
{ title: '检测项目', key: 'name', width: 100 },
{ title: '检测依据', key: 'testBasis', width: 260 },
// {title: '检测依据名称', key: 'testBasisName', width: 330},
{ title: '检测方法', key: 'testMethod', width: 130 },
{ title: '检测科室', key: 'groupName', width: 140 },
{ title: '资质', key: 'aptitude', width: 130 },
{ title: '检出限类别', key: 'detectionType', width: 130 },
{ title: '检出限', key: 'detectionLimit', width: 130 },
{ title: '单位', key: 'unit', width: 130 }
],
formId: '',
itemList: [],
testBasisList: []
}
},
methods: {
_open() {
this.formObj = this.$resetFields(this.formObj)
this._page()
},
// 获取检测项目
_getItemList(data) {
const obj = {}
if (data) {
obj.name = data
}
this.$store.dispatch('FoodAptitudeItem/getTestItem', obj).then(() => {
this.itemList = this.$store.state.FoodAptitudeItem.list
})
},
// 检测项目结果
_testItemChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.name = data
this._getItemList()
break
case 'query':
this.formObj.name = data
this._getItemList(data)
break
case 'focus':
this._getItemList()
break
case 'enter':
this._search()
break
}
},
_getTestBasisList(data) {
const obj = { classify: 1, page: 1, rows: 20 }
if (data) {
obj.name = data.stdNum
}
this.$store.dispatch('StandardInfo/pageListByName', obj).then(() => {
this.testBasisList = this.$store.state.StandardInfo.page.records
})
},
_testBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.testBasis = data.stdNum
this._getTestBasisList()
break
case 'query':
this.formObj.testBasis = data.stdNum
this._getTestBasisList(data)
break
case 'focus':
this._getTestBasisList()
break
case 'enter':
this._search()
break
}
},
_page: async function() {
const result = await soilAptitude.page(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_clearSelection() {
this.$refs.pageTable._clearSelection()
},
_search() {
this.$refs.pageTable._pageChange(1)
},
_reset() {
this.formObj = this.$resetFields(this.formObj)
},
_tableResultChange(msg, data, checked) {
switch (msg) {
case 'page':
this._page()
break
case 'selectAll':
this.$emit('on-result-change', 'selectAll', data)
break
case 'selectData':
this.$emit('on-result-change', 'selectData', data)
break
case 'dbSelect':
this.$emit('on-result-change', 'dbClick', data)
break
case 'changeSize':
this._page()
break
}
}
}
}
</script>
<!--Collapse关联框 单个导入项目-->
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="100" class="zIndex-1200 full-screen modal-header-none">
<div>
<Collapse :right-title="'已选的检测项目 (共'+getPage.records.length+'条)'" @on-result-change="_optionResult"
:left-width="18"
left-title="资质项目">
<template #left>
<AptitudeItem ref="leftModal" @on-result-change="_leftResult"></AptitudeItem>
</template>
<template #right>
<PTVXETable ref="pageTable" :tableHeight="tableHeight" :getPage="getPage"
@on-result-change="_rightResult" select-data hide-page>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
v-for="item in pageColumns" :key="item.key">
<template slot-scope="scope">
<div v-if="item.key==='scened'">{{scope.row[item.key]?'':scope.row[item.key]===0?'否':'是'}}</div>
<div v-else-if="item.key==='testBasis'">
{{(scope.row.testBasis?scope.row.testBasis:' ')+
(scope.row.testBasisName?scope.row.testBasisName:'')}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</template>
</Collapse>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
import Collapse from '../../../components/base/Collapse'
import { soilSample } from '../../../api'
import AptitudeItem from './AptitudeItem'
/* 普通样品导入检测项目(一种是直接走接口保存,另一种是返回已选中的数据),专用于除了【质控】之外的导入检测项目 */
export default {
components: {
Collapse,
// AddItem,
AptitudeItem
},
props: {
isRepeat: null // 只有模拟样品才能导入重复的检测项目
},
data() {
return {
pageColumns: [
{ title: '检测项目', key: 'name', width: 100 },
{ title: '检测依据', key: 'testBasis', width: 260 },
// {title: '检测依据名称', key: 'testBasisName', width: 180,},
{ title: '检测方法', key: 'testMethod', width: 130 },
{ title: '检测科室', key: 'groupName', width: 140 }
],
footerList: [
{ name: '取消', type: '' },
{ name: '确定', type: 'primary' }
],
selectData: [],
showModal: false,
addIds: [],
sampleId: '',
delData: [],
getPage: {
records: []
},
isEditModal: false,
isReceive: false, // 用于区别是样品接收中导入检测项目还是普通样品中导入检测项目
tableHeight: document.documentElement.clientHeight - 240
}
},
methods: {
_open(sampleId) {
this.showModal = true
this.isReceive = false
this.sampleId = sampleId
this.selectData = []
this.addIds = []
this.delData = []
this.getPage.records = []
this.$refs.leftModal._open()
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_ok: async function() {
const result = await soilSample.importExperiments({
aptitudeIds: this.addIds,
ids: this.sampleId
})
if (result) {
this.showModal = false
this.$Message.success('导入成功')
this.$emit('on-result-change')
}
},
_cancel() {
this.showModal = false
this.$refs.footerModal._hideLoading()
},
// 样品接收中用的导入检测项目(给一个样品导入检测项目)
_openReceive() {
this.isReceive = true
this.selectData = []
this.addIds = []
this.delData = []
// this.getPage = [];
this.getPage.records = []
this.$refs.leftModal._open()
},
_optionResult(name) {
switch (name) {
case '添加':
this._add()
break
case '删除':
this._deleteSelected()
break
}
},
// 未关联方法返回的数据
_leftResult(msg, data, checked) {
switch (msg) {
case 'selectAll':
this.selectData = data
break
case 'selectData':
this.selectData = data
// if (data.checked) {
// this.selectData.push(data)
// const set = new Set([...this.selectData])
// this.selectData = [...set]
// console.log('选择的数据', this.selectData)
// } else {
// const index = this.selectData.indexOf(data)
// this.selectData.splice(index, 1)
// }
break
case 'dbClick':
this.selectData = [data]
this._add()
break
case 'search':
this.selectData = []
break
}
},
// 已关联方法返回的数据
_rightResult(msg, data) {
switch (msg) {
case 'selectData':
this.delData = data
break
}
},
// 添加关联方法
_add() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
for (let i = 0; i < this.selectData.length; i++) {
if (this.isRepeat) {
// 表示模拟样品,可导入重复的项目
this.getPage.records.push(this.selectData[i])
this.addIds.push(this.selectData[i].id)
} else {
// 普通样品,不能导入重复的项目
// eslint-disable-next-line no-lonely-if
if (
!this.getPage.records.find(
item => item.name === this.selectData[i].name
)
) {
this.getPage.records.push(this.selectData[i])
this.addIds.push(this.selectData[i].id)
}
}
}
// 勾选之后两侧都需要手动清空,否则会出现另一侧也勾选的问题
this.$refs.leftModal._clearSelection()
this.$refs.pageTable._clearSelection()
this.selectData = []
}
},
_deleteSelected() {
if (this.delData.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(
this.delData,
'确定删除 ' + this.delData.length + ' 条记录?'
)
}
},
_deleteByIds(row, content) {
for (let i = 0; i < row.length; i++) {
const dataIndex = this.getPage.records.indexOf(row[i])
this.getPage.records.splice(dataIndex, 1)
const idIndex = this.addIds.indexOf(row[i].id)
this.addIds.splice(idIndex, 1)
}
// 勾选之后两侧都需要手动清空,否则会出现另一侧也勾选的问题
this.$refs.leftModal._clearSelection()
this.$refs.pageTable._clearSelection()
// 手动清空删除的数据
this.delData = []
}
}
}
</script>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</Form-item> </Form-item>
<Form-item label="制备人:"> <Form-item label="制备人:">
<el-select :value="formObj.preparer" @change="selUser" style="width:100%" size="small"> <el-select :value="formObj.preparer" @change="selUser" style="width:100%" size="small">
<el-option v-for="item in backupUserList" :value="item.id" :label="item.realname" :key="item.realname">{{ item.realname }} <el-option v-for="(item,index) in backupUserList" :value="item.id" :label="item.realname" :key="index">{{ item.realname }}
</el-option> </el-option>
</el-select> </el-select>
</Form-item> </Form-item>
......
...@@ -13,6 +13,7 @@ import AddressManage from '../pages/soil-sample-manage/sample-address/AddressMan ...@@ -13,6 +13,7 @@ import AddressManage from '../pages/soil-sample-manage/sample-address/AddressMan
import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex' import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex'
import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeIndex' import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeIndex'
import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex' import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex'
import DuplicateManage from '../pages/soil-sample-manage/duplicate-manage/SampleduplicateIndex'
import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex' import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex'
import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex' import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex'
import CheckIndex from '../pages/soil-test-manage/test-data-check/CheckIndex' import CheckIndex from '../pages/soil-test-manage/test-data-check/CheckIndex'
...@@ -83,6 +84,11 @@ export default [ ...@@ -83,6 +84,11 @@ export default [
meta: { title: '余样管理' } meta: { title: '余样管理' }
}, },
{ {
path: 'copy',
component: DuplicateManage,
meta: { title: '副样管理' }
},
{
path: 'dispose', path: 'dispose',
component: SampleDisposeIndex, component: SampleDisposeIndex,
meta: { title: '样品处理' } meta: { title: '样品处理' }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment