Commit c110dddc by lichengming

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

parent b2f7a5d3
......@@ -19,6 +19,10 @@ export default {
http.post('soil/v1/receive_location/', data).then(res => res),
locationDeleteById: data =>
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 =>
http.put('soil/v1/receive_location/' + data.id, data.obj).then(res => res),
// 试验室领样操作
......
......@@ -191,13 +191,11 @@ export default {
},
// 获取数据
_page: async function() {
// this.$refs.pageTable._page('search-form', 'StandardInfo/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.locationPage(
this.$serializeForm(this.formObj)
)
if (result) {
console.log(result)
this.$refs.pageTable._hideLoading()
this.getPage = result
}
......@@ -244,7 +242,6 @@ export default {
switch (msg) {
case 'page':
this._page()
// this.getPage = this.$store.state.StandardInfo.page
break
case 'selectIds':
this.selectIds = data
......
......@@ -9,13 +9,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>
......@@ -23,12 +23,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" select-data @on-result-change="_tableResultChange">
<PTVXETableHeight ref="pageTable" :rows="500" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -37,10 +37,7 @@
: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)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.status">
<div v-if="item.status">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.date">
......@@ -62,7 +59,7 @@
</div>
</template>
<script>
import { soilEntrust, soilSample } from '../../../api'
import { soilSample } from '../../../api'
export default {
components: {},
data() {
......@@ -74,8 +71,14 @@ export default {
type: 'success',
id: 'ZBC',
name: '打印标签'
},
{
type: 'error',
id: '',
name: '批量删除'
}
],
iconMsg: [{ type: 'md-trash', id: '', name: '删除' }],
itemList: [],
indexList: [],
footerList: [
......@@ -118,15 +121,6 @@ export default {
}
},
methods: {
_inputChange: async function(info) {
const result = await soilEntrust.sampleEdit({
id: info.id,
describeDetail: info.describeDetail
})
if (result) {
this._resultChange('修改成功')
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
......@@ -153,10 +147,7 @@ export default {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '删除':
case '批量删除':
this._deleteSelected()
break
case 'search':
......@@ -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) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理检测项目':
this._itemManage(data.id)
break
case '编辑':
this._editModal(true, data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
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) {
const selectIds = []
switch (msg) {
......@@ -219,7 +177,6 @@ export default {
this.selectData = data
break
case 'allSelect':
console.log('123465798', data)
this.allSelect(data)
break
case 'iconClick':
......@@ -250,6 +207,7 @@ export default {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.pageLocationSample(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
......@@ -278,37 +236,21 @@ export default {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(data) {},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
} else {
// 添加
this.$refs.refModal._open('', this.entrustId)
_deleteOk: async function(ids) {
const result = await soilSample.removeSampleFromLocation(ids.join(','))
if (result) {
this.$Message.success('成功移除')
this._page()
}
// 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() {
this._page()
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
......
......@@ -64,10 +64,15 @@ import SoilSampleItemManageEdit from './SoilSampleItemManageEdit'
import SoilEntrustItemNum from './SoilItemNum'
export default {
components: {
// eslint-disable-next-line vue/no-unused-components
Operation,
// eslint-disable-next-line vue/no-unused-components
SamplePreparationEdit,
// eslint-disable-next-line vue/no-unused-components
SoilSampleManage,
// eslint-disable-next-line vue/no-unused-components
SoilSampleItemManageEdit,
// eslint-disable-next-line vue/no-unused-components
SoilEntrustItemNum
},
data() {
......
......@@ -50,6 +50,7 @@
</div>
</div>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component :is="currentComponent" ref="refModal" @on-result-change="_componentResult"></component>
</keep-alive>
</div>
......
......@@ -7,6 +7,7 @@
<el-tab-pane label="历史记录" name="his"></el-tab-pane>
</el-tabs>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent"></component>
</keep-alive>
</div>
......@@ -18,6 +19,7 @@ import MeterSendEntrust from './SamplePreparation'
import MeterSendEntrustHis from './SamplePreparationHis'
export default {
name: 'MeterSendEntrustIndex',
// eslint-disable-next-line vue/no-unused-components
components: { MeterSendEntrust, MeterSendEntrustHis },
data() {
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