Commit f35d37bb by lichengming

修改了备样管理编辑

parent 00c30bec
......@@ -131,5 +131,6 @@ export default {
getDictList: data =>
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)
http.put('soil/v1/sample_backup/' + data.id, data.obj).then(res => res),
getUserList: data => http.post('/base/v1/user/page').then(res => res)
}
......@@ -50,12 +50,21 @@
<div v-else-if="item.key==='conditions'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else>
<el-select :value="scope.row.conditions" @change="selCondi" clearable style="width:100%" size="small">
<el-select :value="scope.row.conditions" @change="selCondi" style="width:100%" size="small">
<el-option v-for="item in conditionList" :value="item.name" :key="item.name">{{ item.name }}
</el-option>
</el-select>
</div>
</div>
<div v-else-if="item.key==='backupUser'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else>
<el-select :value="scope.row.backupUser" @change="selUser" style="width:100%" size="small">
<el-option v-for="item in backupUserList" :value="item.id" :label="item.realname" :key="item.realname">{{ item.realname }}
</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]}}
......@@ -171,6 +180,7 @@ export default {
/* {title: '处置方式', key: 'handleMethod', width: 120,}, */
],
conditionList: [],
backupUserList: [],
locList: [],
currentIndex: -1,
editIndex: -1,
......@@ -226,6 +236,7 @@ export default {
// this.sampleHandleValue = Number(localStorage.getItem('sampleHandleValue'))
// this._getLocList()
this._getConditionList()
this._getUserList()
// this._getBackUpCount()
},
methods: {
......@@ -263,7 +274,10 @@ export default {
const tempData = {
quantity: this.getPage.records[this.currentIndex].quantity,
conditions: this.getPage.records[this.currentIndex].conditions,
backupLocation: this.getPage.records[this.currentIndex].backupLocation
backupLocation: this.getPage.records[this.currentIndex]
.backupLocation,
backupUser: this.getPage.records[this.currentIndex].backupUser,
backupUserId: this.getPage.records[this.currentIndex].backupUserId
}
this._saveOk({
id: this.getPage.records[this.currentIndex].id,
......@@ -311,10 +325,36 @@ export default {
break
}
},
_getUserList: async function() {
const result = await soilSample.getUserList()
if (result) {
console.log(result)
this.backupUserList = result.records
}
},
selCondi(data) {
this.$forceUpdate()
this.getPage.records[this.currentIndex].conditions = data
},
selUser(data) {
this.$forceUpdate()
if (data) {
for (let i = 0; i < this.backupUserList.length; i++) {
if (this.backupUserList[i].id === data) {
this.getPage.records[
this.currentIndex
].backupUser = this.backupUserList[i].realname
}
}
} else {
this.getPage.records[this.currentIndex].backupUser = ''
}
this.getPage.records[this.currentIndex].backupUserId = data
console.log(this.getPage.records[this.currentIndex])
// this.$forceUpdate()
// this.getPage.records[this.currentIndex].backupUser = data
// this.getPage.records[this.currentIndex].backupUser = data
},
inputChange(data) {
this.getPage.records[this.currentIndex].quantity = data
},
......
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