63 lines
1.6 KiB
Vue
63 lines
1.6 KiB
Vue
<template>
|
|
<div>
|
|
<el-select ref="otherSelected" v-model="otherSelected" clearable @blur="$emit('input-blur', $event)">
|
|
<el-option v-for="other in otherList" :key="other.id" :label="other.name" :value="other.id" v-show="false"/>
|
|
<el-table v-loading="loading" :data="otherList" :stripe="true" :show-overflow-tooltip="true" @row-click="rowClick">
|
|
<el-table-column label="序号" align="center">
|
|
<template scope="scope">
|
|
<span>{{ scope.$index + 1 }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="180" />
|
|
<el-table-column label="价格" prop="price" :show-overflow-tooltip="true" width="180"/>
|
|
</el-table>
|
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
|
/>
|
|
</el-select>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import {getOtherPage} from "@/api/repair/other";
|
|
|
|
export default {
|
|
name: "OtherChoose",
|
|
data() {
|
|
return {
|
|
otherSelected: null,
|
|
otherList: [],
|
|
total: 0,
|
|
queryParams:{
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
},
|
|
loading: true
|
|
}
|
|
},
|
|
mounted() {
|
|
this.getPage()
|
|
},
|
|
methods: {
|
|
async getPage(){
|
|
try {
|
|
this.loading = true
|
|
const res = await getOtherPage(this.queryParams)
|
|
this.otherList = res.data.records
|
|
this.total = res.data.total
|
|
}finally {
|
|
this.loading = false
|
|
}
|
|
},
|
|
rowClick(row){
|
|
this.$emit("selected", row)
|
|
this.$refs.otherSelected.blur()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
</style>
|