Commit e5542eb4 by lichengming

修改了余样管理

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