Commit 07f2e653 by lichengming

修改了样品拆分,导入gds数据,库房样品管理排序

parent 7241309b
......@@ -295,5 +295,7 @@ export default {
storageSampleSubmit: data =>
http
.post('soil/v1/alone_sample/storage_sample_submit', data)
.then(res => res)
.then(res => res),
addSample: data =>
http.post('soil/v1/sample/sample_split_save', data).then(res => res)
}
<!--下载模板导入-->
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" class="zIndex-1100">
<p slot="header">{{modalTitle}}</p>
<Alert v-if="hideDownloadBtn===undefined" type="warning" show-icon>请导入GDS数据</Alert>
<Alert v-if="msg === '资质项目管理导入'" type="warning" show-icon>此按钮可实现新增、更新资质项目的功能,不可新增或更新限量信息</Alert>
<Alert v-if="msg === '导入更新'" type="warning" show-icon>此功能可更新现有的资质项目、判定依据、限量信息</Alert>
<Alert v-if="showError" type="error" show-icon style="margin-top: 10px">{{errorMessage}}</Alert>
<Alert v-if="showSuccess" type="success" show-icon style="margin-top: 10px">{{successMessage}}</Alert>
<div v-show="isLoad">
<Spin>
<Icon type="load-c" size=18 class="file-spin-icon-load"></Icon>
<div>正在导入,请稍后...</div>
</Spin>
</div>
<div slot="footer" class="btn-width">
<Button @click="_cancel">取消</Button>
<label style="margin-bottom: 0;margin-left:15px; float: right">
<Upload
:action="importUrl"
:on-success="_handelsuccess"
:before-upload="_beupload"
:on-progress="_handelprogress"
:on-format-error="_formatError"
:data="dataObj"
:with-credentials="true"
:show-upload-list="false"
>
<Button :disabled="isDisabled" type="primary">导入</Button>
</Upload>
</label>
</div>
</Modal>
</div>
</template>
<script>
/**
* 导入并下载模板
*/
// import global from '../../api/config'
import global from '../../api/config'
export default {
components: {},
props: {
hideDownloadBtn: null
},
data() {
return {
msg: '',
modalTitle: '导入检测项目信息',
showModal: false,
isLoad: false,
isDisabled: false,
showError: false,
showSuccess: false,
dataObj: {
file: ''
},
errorMessage: '',
successMessage: '',
format: ['xlsx', 'xls', 'doc', 'docx'],
importUrl: '',
downloadUrl: '',
// 500的提示语
errStr: '很抱歉!无法处理您的操作,请检查您的操作步骤或者联系系统管理员!'
}
},
methods: {
_open(data, msg) {
this.isLoad = false
this.showModal = true
this.isDisabled = false
this.showError = false
this.showSuccess = false
this.modalTitle = data.title
this.importUrl = global.baseURL + data.importUrl
this.downloadUrl = data.downloadUrl
this.msg = msg
},
_download() {
// this.$Modal.confirm({
// title: '提示',
// content: '确定要下载模板?',
// onOk: () => {
//
// }
// });
window.open(global.baseURL + this.downloadUrl, '_blank')
},
_cancel() {
this.showModal = false
},
_beupload(file) {
this.dataObj.file = file.name
},
_handelprogress(event, file, fileList) {
this.isLoad = true
this.isDisabled = true
},
_handelsuccess(response, file, fileList) {
// 上传成功
if (response.success) {
console.log('---response', response)
this.isLoad = false
this.$Message.success('导入成功!')
this.$emit('on-result-change', response.data)
this.showModal = false
this.isDisabled = false
this.showError = false
this.showSuccess = true
this.successMessage = response.msg
} else {
this.isLoad = false
this.showSuccess = false
this.isDisabled = false
this.errorMessage = response.code === '500' ? this.errStr : response.msg
this.showError = true
// this.$Message.error(response.msg);
}
},
_formatError(file) {
this.$Notice.error({
title: '文件格式不正确',
duration: 10,
desc:
'文件 ' +
file.name +
' 格式不正确,请上传格式为 .xlsx、xls、doc、docx 的文件!'
})
this.isLoad = false
}
}
}
</script>
......@@ -302,6 +302,9 @@ export default {
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
if (this.getPage.records.length > 0) {
this.getPage.records = result.records.reverse()
}
}
},
// 查询
......
......@@ -5,13 +5,13 @@
<Row>
<!--查询-->
<Col span="24">
<Form v-show="searchOpen" id="search-sample-company" :label-width="80" inline onsubmit="return false">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" />
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_page">
<Button @click="_page" type="primary">
搜索
</Button>
</Form-item>
......@@ -19,12 +19,12 @@
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" class="contHide" show-search-btn="true" @on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" is-edit select-data @on-result-change="_tableResultChange">
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" is-edit select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -66,6 +66,7 @@
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
<DescribeDetailModal ref="writeDetailModal" @on-result-change="_page"></DescribeDetailModal>
<PreparationModal ref="preModal" @on-result-change="_page"></PreparationModal>
<SoilSampleSplit ref="splitModal" @on-result-change="_page"></SoilSampleSplit>
</div>
</template>
<script>
......@@ -73,8 +74,14 @@ import { soilEntrust } from '../../api'
import SoilSampleItemManage from './SoilSampleItemManage'
import DescribeDetailModal from './sample-preparation/DescribeDetailModal'
import PreparationModal from './sample-preparation/Preparation'
import SoilSampleSplit from './SoilSampleSplit'
export default {
components: { SoilSampleItemManage, DescribeDetailModal, PreparationModal },
components: {
SoilSampleItemManage,
DescribeDetailModal,
PreparationModal,
SoilSampleSplit
},
data() {
return {
formId: 'soilSampleManage',
......@@ -94,6 +101,11 @@ export default {
type: 'success',
id: '',
name: '批量填写土质描述详情'
},
{
type: 'success',
id: '',
name: '样品拆分'
}
],
itemList: [],
......@@ -116,7 +128,7 @@ export default {
searchOpen: true,
modalTitle: '管理样品',
selectIds: [],
selectData: {},
selectData: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' },
......@@ -245,12 +257,18 @@ export default {
case '批量填写土质描述详情':
this._writeDetail(this.selectIds)
break
case '样品拆分':
this._sampleSplit()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_sampleSplit() {
this.$refs.splitModal._open(this.selectData[0], this.contractId)
},
_samplePre() {
if (this.selectIds.length === 0) {
this.$Message.warning('至少选择一条数据')
......
<template>
<div>
<Modal v-model="showModal" v-drag width="1030" class="modal-footer-none">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品编号:" class="search-item">
<Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_page" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange" :icon-msg="iconMsg" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.status">
{{ scope.row[item.key].display }}
</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==='sampleDepth' && scope.row.index > 0" @click.stop="_handleRow(scope)">
<Input v-model="scope.row.sampleDepth" blur placeholder="请输入试样深度"
></Input>
</div>
<div v-else-if="item.key==='siteNo'&& scope.row.index > 0" @click.stop="_handleRow(scope)">
<Input v-model="scope.row.siteNo" blur placeholder="请输入现场编号"
></Input>
</div>
<div v-else-if="item.key==='sampleCode'">
{{scope.row[item.key]}}{{'--'+scope.row.index}}
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilEntrust, soilSample } from '../../api'
export default {
components: {},
data() {
return {
formId: 'soilSampleManage',
currentComponent: '',
btn: [
{
type: 'success',
id: '',
name: '保存'
}
// {
// type: 'success',
// id: '',
// name: '导入检测项目包'
// },
// {
// type: 'success',
// id: '',
// name: '打印标签'
// }
],
itemList: [],
indexList: [],
sampleId: '',
currentIndex: -1,
currentRow: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '添加'
}
],
contractId: '', // 委托id
showModal: false,
searchOpen: true,
modalTitle: '样品拆分',
selectIds: [],
selectData: {},
sampleProgress: '',
getPage: {
records: []
},
pageColumns: [
{ title: '样品编号', key: 'sampleCode', width: 140 },
{ title: '试样深度', key: 'sampleDepth', width: 140 },
{ title: '现场编号', key: 'siteNo', width: 140 },
{ title: '试验项目', key: 'experimentNames', width: 140 },
{ title: '试验项目简写', key: 'experimentShortNames', width: 120 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{
title: '土质描述详情',
key: 'describeDetail',
width: 200
},
{
title: '备注',
key: 'remark',
width: 200
},
{ title: '样品包装类型', key: 'samplePack', width: 120 }
],
formObj: {},
entrustId: '',
receiveLocation: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_add(data) {
const addData = {
sampleCode: data.sampleCode,
sampleDepth: '',
siteNo: '',
experimentNames: data.experimentNames,
experimentShortNames: data.experimentShortNames,
sampleDescribe: data.sampleDescribe,
describeDetail: data.describeDetail,
remark: data.remark,
samplePack: data.samplePack
}
this.getPage.records.splice(data.index + 1, 0, addData)
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_cancel() {
this.showModal = false
},
_ok() {
this.showModal = false
this.$refs.footerModal._hideLoading()
console.log(this.getPage)
},
_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._editModal(false)
break
case '删除':
this._deleteSelected()
break
case '保存':
this._save()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_save() {
console.log(this.getPage.records)
for (let i = 0; i < this.getPage.records.length; i++) {
this.getPage.records[i].id = this.sampleId
this.getPage.records[i].sampleCode =
this.getPage.records[i].sampleCode +
'-' +
this.getPage.records[i].index
console.log(this.getPage.records[i])
this._addSample(this.getPage.records[i])
}
},
_addSample: async function(data) {
const result = await soilSample.addSample(data)
if (result) {
this.showModal = false
this._deleteOk(this.sampleId)
this.$emit('on-result-change')
}
},
_copyHisSample() {
this.$refs.refModal._open(this.contractId)
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '查看试样':
this._itemManage(data.id)
break
case '添加':
this._add(data)
break
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
}
})
},
_itemManage(data) {
this.$refs.sampleItemManage._open(data, this.receiveLocation)
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'allSelect':
this.allSelect(data)
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_open(data, id) {
console.log(id)
this.sampleId = ''
this.formObj = {}
this.sampleId = data.id
this.getPage.records = []
// this.formObj.receiveLocation = name
// this.receiveLocation = name
// this.formObj.storehouse = data.warehouse
// this.formObj.shelfCode = data.name
this.formObj.sampleCode = data.sampleCode
this.formObj.sampleDepth = data.sampleDepth
this.formObj.siteNo = data.siteNo
this.formObj.experimentNames = data.experimentNames
this.formObj.experimentShortNames = data.experimentShortNames
this.formObj.sampleDescribe = data.sampleDescribe
this.formObj.describeDetail = data.describeDetail
this.formObj.remark = data.remark
this.formObj.samplePack = data.samplePack
this.showModal = true
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._clearSelection()
// this._page()
for (let i = 0; i < data.length; i++) {
data[i]._XID = undefined
}
this.getPage.records.push(this.formObj)
console.log('123456', this.getPage.records)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
// this.formObj.entrustId = this.contractId
const result = await soilEntrust.pageSampleOfStorehouse(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteOk: async function(id) {
const result = await soilSample.sampleDeleteById(id)
if (result) {
console.log(result)
}
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
} else {
// 添加
this.$refs.refModal._open('', this.contractId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
......@@ -58,6 +58,7 @@
<CreateReport ref="createModal" @on-result-change="_certificateSelectExcelBack"></CreateReport>
<Reason ref="reasonModal" @on-result-change="_reasonResult" />
<Operation ref="Operation"></Operation>
<importModal ref="importModal"></importModal>
</div>
</template>
<script>
......@@ -73,6 +74,7 @@ import CollectManage from '../CollectManage'
import CollectFileManage from '../CollectFileManage'
import Reason from '../../../../components/base/Reason'
import Operation from '../../../../components/operation/ItemOperation'
import importModal from '../../../../components/import/GDSImport'
import CreateReport from './CreateReport'
export default {
components: {
......@@ -86,7 +88,8 @@ export default {
CollectFileManage,
Reason,
CreateReport,
Operation
Operation,
importModal
},
data() {
return {
......@@ -137,7 +140,8 @@ export default {
{ type: 'success', id: '', name: '原始记录填写' },
{ type: 'success', id: '', name: '完成提交' },
{ type: 'success', id: '', name: '设备' },
{ type: 'success', id: '', name: '退回' }
{ type: 'success', id: '', name: '退回' },
{ type: 'success', id: '', name: '导入GDS数据' }
],
iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
......@@ -425,7 +429,18 @@ export default {
case '退回':
this._goBack()
break
case '导入GDS数据':
this._import()
break
}
},
_import() {
const data = {
importUrl: '/soil/v1/experiment/upload_gds_file/',
downloadUrl: '/soil/v1/excel/template/SoilEntrustImport',
title: '导入GDS数据'
}
this.$refs.importModal._open(data, '导入GDS数据')
},
_goBack() {
// 退回
......
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