Commit 9d31a1b6 by lichengming

修改了样品拆分子样品编辑

parent 748949a6
...@@ -314,5 +314,7 @@ export default { ...@@ -314,5 +314,7 @@ export default {
.post('soil/v1/alone_in_out_stock/get_stay_date', data) .post('soil/v1/alone_in_out_stock/get_stay_date', data)
.then(res => res), .then(res => res),
outStorageBack: data => outStorageBack: data =>
http.post('soil/v1/alone_sample/out_storage_back', data).then(res => res) http.post('soil/v1/alone_sample/out_storage_back', data).then(res => res),
editSample: data =>
http.put('soil/v1/sample/' + data.id, data.obj).then(res => res)
} }
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<DescribeDetailModal ref="writeDetailModal" @on-result-change="_page"></DescribeDetailModal> <DescribeDetailModal ref="writeDetailModal" @on-result-change="_page"></DescribeDetailModal>
<PreparationModal ref="preModal" @on-result-change="_page"></PreparationModal> <PreparationModal ref="preModal" @on-result-change="_page"></PreparationModal>
<SoilSampleSplit ref="splitModal" @on-result-change="_page"></SoilSampleSplit> <SoilSampleSplit ref="splitModal" @on-result-change="_page"></SoilSampleSplit>
<SoilSampleSplitChild ref="splitModalChild" @on-result-change="_page"></SoilSampleSplitChild>
<SelectFlowRelBtn ref="flow"/> <SelectFlowRelBtn ref="flow"/>
</div> </div>
</template> </template>
...@@ -77,13 +78,15 @@ import SoilSampleItemManage from './SoilSampleItemManage' ...@@ -77,13 +78,15 @@ import SoilSampleItemManage from './SoilSampleItemManage'
import DescribeDetailModal from './sample-preparation/DescribeDetailModal' import DescribeDetailModal from './sample-preparation/DescribeDetailModal'
import PreparationModal from './sample-preparation/Preparation' import PreparationModal from './sample-preparation/Preparation'
import SoilSampleSplit from './SoilSampleSplit' import SoilSampleSplit from './SoilSampleSplit'
import SoilSampleSplitChild from './SoilSampleSplitChild'
export default { export default {
components: { components: {
SoilSampleItemManage, SoilSampleItemManage,
DescribeDetailModal, DescribeDetailModal,
PreparationModal, PreparationModal,
SoilSampleSplit, SoilSampleSplit,
SelectFlowRelBtn SelectFlowRelBtn,
SoilSampleSplitChild
}, },
data() { data() {
return { return {
...@@ -277,7 +280,11 @@ export default { ...@@ -277,7 +280,11 @@ export default {
}, },
_sampleSplit() { _sampleSplit() {
if (this.selectData.length === 1) { if (this.selectData.length === 1) {
this.$refs.splitModal._open(this.selectData[0]) if (this.selectData[0].sampleCode.indexOf('-') === -1) {
this.$refs.splitModal._open(this.selectData[0])
} else {
this.$refs.splitModalChild._open(this.selectData[0])
}
} else { } else {
this.$Message.warning('请选择一条数据') this.$Message.warning('请选择一条数据')
} }
...@@ -366,6 +373,7 @@ export default { ...@@ -366,6 +373,7 @@ export default {
this.$refs.pageTable._pageChange(1) this.$refs.pageTable._pageChange(1)
}, },
_page: async function() { _page: async function() {
this.$forceUpdate()
this.selectData = [] this.selectData = []
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.contractId this.formObj.entrustId = this.contractId
......
<template>
<div>
<Modal v-model="showModal" v-drag width="1030" class="modal-footer-none">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<!--操作-->
<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" 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'" @click.stop="_handleRow(scope)">
<Input v-model="scope.row.sampleDepth" blur placeholder="请输入试样深度"
></Input>
</div>
<div v-else-if="item.key==='siteNo'" @click.stop="_handleRow(scope)">
<Input v-model="scope.row.siteNo" blur placeholder="请输入现场编号"
></Input>
</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: '添加'
},
{
type: 'md-remove-circle',
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)
},
_delete(data) {
this.getPage.records.splice(data.index, 1)
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '关闭':
this._cancel()
break
}
},
_cancel() {
this.showModal = false
},
_ok() {
this.showModal = false
this.$refs.footerModal._hideLoading()
},
_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._addSample(this.getPage.records[i])
}
},
_addSample: async function(data) {
const result = await soilSample.editSample({ id: data.id, obj: data })
if (result) {
// this._deleteOk(this.sampleId)
this.showModal = false
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._delete(data)
break
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
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) {
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()
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>
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