Commit c110dddc by lichengming

修改了收样位置管理删除按钮

parent b2f7a5d3
...@@ -19,6 +19,10 @@ export default { ...@@ -19,6 +19,10 @@ export default {
http.post('soil/v1/receive_location/', data).then(res => res), http.post('soil/v1/receive_location/', data).then(res => res),
locationDeleteById: data => locationDeleteById: data =>
http.delete('soil/v1/receive_location/?ids=' + data).then(res => res), http.delete('soil/v1/receive_location/?ids=' + data).then(res => res),
removeSampleFromLocation: data =>
http
.post('soil/v1/sample/remove_sample_from_location/?ids=' + data)
.then(res => res),
locationEdit: data => locationEdit: data =>
http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res), http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res),
// 试验室领样操作 // 试验室领样操作
......
...@@ -191,13 +191,11 @@ export default { ...@@ -191,13 +191,11 @@ export default {
}, },
// 获取数据 // 获取数据
_page: async function() { _page: async function() {
// this.$refs.pageTable._page('search-form', 'StandardInfo/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.locationPage( const result = await soilSample.locationPage(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
console.log(result)
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
} }
...@@ -244,7 +242,6 @@ export default { ...@@ -244,7 +242,6 @@ export default {
switch (msg) { switch (msg) {
case 'page': case 'page':
this._page() this._page()
// this.getPage = this.$store.state.StandardInfo.page
break break
case 'selectIds': case 'selectIds':
this.selectIds = data this.selectIds = data
......
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <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> <label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item"> <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>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_page"> <Button @click="_page" type="primary">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <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>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
<PTVXETableHeight ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETableHeight ref="pageTable" :rows="500" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" select-data @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"
...@@ -37,10 +37,7 @@ ...@@ -37,10 +37,7 @@
:width="item.width?item.width:200" :width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable> :fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="item.detail"> <div v-if="item.status">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.status">
{{ scope.row[item.key].display }} {{ scope.row[item.key].display }}
</div> </div>
<div v-else-if="item.date"> <div v-else-if="item.date">
...@@ -62,7 +59,7 @@ ...@@ -62,7 +59,7 @@
</div> </div>
</template> </template>
<script> <script>
import { soilEntrust, soilSample } from '../../../api' import { soilSample } from '../../../api'
export default { export default {
components: {}, components: {},
data() { data() {
...@@ -74,8 +71,14 @@ export default { ...@@ -74,8 +71,14 @@ export default {
type: 'success', type: 'success',
id: 'ZBC', id: 'ZBC',
name: '打印标签' name: '打印标签'
},
{
type: 'error',
id: '',
name: '批量删除'
} }
], ],
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
itemList: [], itemList: [],
indexList: [], indexList: [],
footerList: [ footerList: [
...@@ -118,15 +121,6 @@ export default { ...@@ -118,15 +121,6 @@ export default {
} }
}, },
methods: { methods: {
_inputChange: async function(info) {
const result = await soilEntrust.sampleEdit({
id: info.id,
describeDetail: info.describeDetail
})
if (result) {
this._resultChange('修改成功')
}
},
_handleRow(data) { _handleRow(data) {
this.currentRow = data.row this.currentRow = data.row
this.currentIndex = data.rowIndex this.currentIndex = data.rowIndex
...@@ -153,10 +147,7 @@ export default { ...@@ -153,10 +147,7 @@ export default {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
switch (msg) { switch (msg) {
case '添加': case '批量删除':
this._editModal(false)
break
case '删除':
this._deleteSelected() this._deleteSelected()
break break
case 'search': case 'search':
...@@ -165,49 +156,16 @@ export default { ...@@ -165,49 +156,16 @@ export default {
} }
}) })
}, },
_samplePre() {
if (this.selectIds.length === 0) {
this.$message.warning('至少选择一条数据')
} else {
this.$refs.preModal._open(this.selectIds.join(','))
}
},
_writeDetail(id) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const ids = id.join(',')
this.$refs.writeDetailModal._open(ids)
}
},
_iconClick(res, data, componentName, index) { _iconClick(res, data, componentName, index) {
this.currentComponent = componentName this.currentComponent = componentName
this.$nextTick(function() { this.$nextTick(function() {
switch (res) { switch (res) {
case '管理检测项目':
this._itemManage(data.id)
break
case '编辑':
this._editModal(true, data)
break
case '删除': case '删除':
console.log(index)
this._deleteById(data.id) this._deleteById(data.id)
break break
} }
}) })
}, },
_preEdit(id) {
this.$refs.preHisModal._open(id)
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_tableResultChange(msg, data) { _tableResultChange(msg, data) {
const selectIds = [] const selectIds = []
switch (msg) { switch (msg) {
...@@ -219,7 +177,6 @@ export default { ...@@ -219,7 +177,6 @@ export default {
this.selectData = data this.selectData = data
break break
case 'allSelect': case 'allSelect':
console.log('123465798', data)
this.allSelect(data) this.allSelect(data)
break break
case 'iconClick': case 'iconClick':
...@@ -250,6 +207,7 @@ export default { ...@@ -250,6 +207,7 @@ export default {
this.$refs.pageTable._pageChange(1) this.$refs.pageTable._pageChange(1)
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.pageLocationSample(this.formObj) const result = await soilSample.pageLocationSample(this.formObj)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
...@@ -278,37 +236,21 @@ export default { ...@@ -278,37 +236,21 @@ export default {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?') this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
} }
}, },
_detailModal(data) {}, _deleteOk: async function(ids) {
_editModal(edit, data) { const result = await soilSample.removeSampleFromLocation(ids.join(','))
if (edit) { if (result) {
console.log(data) this.$Message.success('成功移除')
this.$refs.sampleManageEdit._open(data) this._page()
} else {
// 添加
this.$refs.refModal._open('', this.entrustId)
} }
// const result = await drugCatalogueItem.deleteById(id)
}, },
// 添加编辑模拟样品 // 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.entrustId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.entrustId)
}
},
_search() { _search() {
this._page() this._page()
}, },
_resultChange(msg) { _resultChange(msg) {
this.$Message.success(msg) this.$Message.success(msg)
this._page() this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
} }
} }
} }
......
...@@ -64,10 +64,15 @@ import SoilSampleItemManageEdit from './SoilSampleItemManageEdit' ...@@ -64,10 +64,15 @@ import SoilSampleItemManageEdit from './SoilSampleItemManageEdit'
import SoilEntrustItemNum from './SoilItemNum' import SoilEntrustItemNum from './SoilItemNum'
export default { export default {
components: { components: {
// eslint-disable-next-line vue/no-unused-components
Operation, Operation,
// eslint-disable-next-line vue/no-unused-components
SamplePreparationEdit, SamplePreparationEdit,
// eslint-disable-next-line vue/no-unused-components
SoilSampleManage, SoilSampleManage,
// eslint-disable-next-line vue/no-unused-components
SoilSampleItemManageEdit, SoilSampleItemManageEdit,
// eslint-disable-next-line vue/no-unused-components
SoilEntrustItemNum SoilEntrustItemNum
}, },
data() { data() {
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
</div> </div>
</div> </div>
<keep-alive> <keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component :is="currentComponent" ref="refModal" @on-result-change="_componentResult"></component> <component :is="currentComponent" ref="refModal" @on-result-change="_componentResult"></component>
</keep-alive> </keep-alive>
</div> </div>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<el-tab-pane label="历史记录" name="his"></el-tab-pane> <el-tab-pane label="历史记录" name="his"></el-tab-pane>
</el-tabs> </el-tabs>
<keep-alive> <keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent"></component> <component ref="refModal" :is="currentComponent"></component>
</keep-alive> </keep-alive>
</div> </div>
...@@ -18,6 +19,7 @@ import MeterSendEntrust from './SamplePreparation' ...@@ -18,6 +19,7 @@ import MeterSendEntrust from './SamplePreparation'
import MeterSendEntrustHis from './SamplePreparationHis' import MeterSendEntrustHis from './SamplePreparationHis'
export default { export default {
name: 'MeterSendEntrustIndex', name: 'MeterSendEntrustIndex',
// eslint-disable-next-line vue/no-unused-components
components: { MeterSendEntrust, MeterSendEntrustHis }, components: { MeterSendEntrust, MeterSendEntrustHis },
data() { data() {
return { return {
......
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