Commit e5542eb4 by lichengming

修改了余样管理

parent f35d37bb
...@@ -132,5 +132,8 @@ export default { ...@@ -132,5 +132,8 @@ export default {
http.post('res/v1/dict/dict_query?type=' + data).then(res => res), http.post('res/v1/dict/dict_query?type=' + data).then(res => res),
editBackup: data => editBackup: data =>
http.put('soil/v1/sample_backup/' + data.id, data.obj).then(res => res), http.put('soil/v1/sample_backup/' + data.id, data.obj).then(res => res),
// 余样编辑
editPrepare: data =>
http.put('soil/v1/prepare/' + data.id, data.obj).then(res => res),
getUserList: data => http.post('/base/v1/user/page').then(res => res) getUserList: data => http.post('/base/v1/user/page').then(res => res)
} }
...@@ -39,31 +39,15 @@ ...@@ -39,31 +39,15 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span> <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-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.key==='quantity'" @click.stop="_handleIndex(scope)"> <div v-else-if="item.key==='keepContainer'">
<div v-if="editIndex!==scope.rowIndex">
{{scope.row[item.key]}}
</div>
<div v-else>
<el-input v-model="scope.row.quantity" clearable></el-input>
</div>
</div>
<div v-else-if="item.key==='conditions'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div> <div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else> <div v-else>
<el-select v-model="scope.row.conditionList" clearable style="width:100%" size="small"> <el-select v-model="scope.row.keepContainer" clearable style="width:100%" size="small">
<el-option v-for="item in conditionList" :value="item.name" :key="item.name">{{ item.name }} <el-option v-for="item in containerList" :value="item.name" :key="item.name">{{ item.name }}
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
<div v-else-if="item.key==='backupLocation'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">
{{scope.row[item.key]}}
</div>
<div v-else>
<el-input v-model="scope.row.backupLocation" clearable></el-input>
</div>
</div>
<span v-else>{{scope.row[item.key]}}</span> <span v-else>{{scope.row[item.key]}}</span>
</template> </template>
</vxe-table-column> </vxe-table-column>
...@@ -151,7 +135,7 @@ export default { ...@@ -151,7 +135,7 @@ export default {
{ title: '试样编号', key: 'sampleCode', width: 150 }, { title: '试样编号', key: 'sampleCode', width: 150 },
{ title: '状态', key: 'status', status: true, width: 100 }, { title: '状态', key: 'status', status: true, width: 100 },
{ title: '包装类型', key: 'samplePack', width: 100 }, { title: '包装类型', key: 'samplePack', width: 100 },
{ title: '保存容器', key: 'keepContainer', width: 100 }, { title: '保存容器', key: 'keepContainer', width: 150 },
{ title: '制备数量', key: 'quantity', width: 100 }, { title: '制备数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 70 }, { title: '单位', key: 'unit', width: 70 },
{ title: '制备人', key: 'preparer', width: 130 }, { title: '制备人', key: 'preparer', width: 130 },
...@@ -161,6 +145,7 @@ export default { ...@@ -161,6 +145,7 @@ export default {
], ],
conditionList: [], conditionList: [],
locList: [], locList: [],
containerList: [],
currentIndex: -1, currentIndex: -1,
editIndex: -1, editIndex: -1,
endDateBegin: '', endDateBegin: '',
...@@ -216,6 +201,7 @@ export default { ...@@ -216,6 +201,7 @@ export default {
// this._getLocList() // this._getLocList()
// this._getConditionList() // this._getConditionList()
// this._getBackUpCount() // this._getBackUpCount()
this._getContainerList()
}, },
methods: { methods: {
// 签发日期 // 签发日期
...@@ -228,6 +214,12 @@ export default { ...@@ -228,6 +214,12 @@ export default {
this._page() this._page()
// this._getBackUpCount() // this._getBackUpCount()
}, },
_getContainerList: async function() {
const result = await soilSample.getDictList('保存容器')
if (result) {
this.containerList = result
}
},
// 查询卡片备样数量 // 查询卡片备样数量
_getBackUpCount() { _getBackUpCount() {
this.$store.dispatch('FoodSampleBackup/backUpCount').then(() => { this.$store.dispatch('FoodSampleBackup/backUpCount').then(() => {
...@@ -249,23 +241,22 @@ export default { ...@@ -249,23 +241,22 @@ export default {
}, },
_save() { _save() {
this.$nextTick(function() { this.$nextTick(function() {
const data = { const tempData = {
ids: this.getPage.records[this.currentIndex].id, keepContainer: this.getPage.records[this.currentIndex].keepContainer
backupPlace: this.getPage.records[this.currentIndex].backupPlace,
storageCondition: this.getPage.records[this.currentIndex]
.storageCondition,
endDate: this.getPage.records[this.currentIndex].endDate,
handleQuantity: this.getPage.records[this.currentIndex].handleQuantity
} }
this.$store.dispatch('FoodSampleBackup/batchEdit', data).then(() => { this._saveOk({
if (this.$store.state.FoodSampleBackup.success) { id: this.getPage.records[this.currentIndex].id,
} else { obj: tempData
this.$msgTip('error', '保存失败!')
}
this._relPage()
}) })
}) })
}, },
_saveOk: async function(data) {
console.log(data)
const result = await soilSample.editPrepare(data)
if (result) {
this.$Message.success('编辑成功')
}
},
_iconClick(res, data, componentName, index) { _iconClick(res, data, componentName, index) {
this.currentIndex = index this.currentIndex = index
switch (res) { switch (res) {
...@@ -281,7 +272,7 @@ export default { ...@@ -281,7 +272,7 @@ export default {
// // 非空情况下格式化赋值,如果不判断会格式化为当天的日期 // // 非空情况下格式化赋值,如果不判断会格式化为当天的日期
// this._endDateChange(this.$dateformat(data.endDate, 'yyyy-mm-dd')) // this._endDateChange(this.$dateformat(data.endDate, 'yyyy-mm-dd'))
// } // }
// this._save() this._save()
this.editIndex = -1 this.editIndex = -1
break break
} }
......
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