<template>
|
<el-dialog
|
custom-class="sy-modal"
|
|
title="载具选择"
|
width="700px"
|
append-to-body
|
:before-close="close"
|
>
|
<div class="sy-default-choose-table-modal-content" v-loading="loading">
|
<search-bar @search="onSearch" @reset="onReset">
|
<el-form :inline="true" class="search-form">
|
<el-form-item label="载具编号">
|
<el-input placeholder="请输入..." clearable class="default-form-width" v-model.trim="query.salverCode"></el-input>
|
</el-form-item>
|
</el-form>
|
</search-bar>
|
|
<el-table :data="list" border stripe>
|
<el-table-column width="80" label="序号" fixed align="center">
|
<template #default="scope">{{(queried.page-1)*queried.pageSize+(scope.$index+1)}}</template>
|
</el-table-column>
|
<el-table-column prop="SalverCode" label="载具编号" />
|
<el-table-column prop="CreateTime" label="创建时间" width="160" />
|
<el-table-column label="操作" width="90" fixed="right" align="center">
|
<template #default="scope">
|
<el-button type="primary" size="small" @click="onSelect(scope.row)">选 择</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<div class="pagination-row">
|
<el-pagination :pager-count="5" layout="prev, pager, next, jumper" :total="total" @current-change="onPageList" />
|
</div>
|
|
</div>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="onClose">取 消</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</template>
|
|
<script>
|
import SearchBar from '@/components/SearchBar.vue'
|
const defaultQuery = {
|
salverCode:'',
|
salverCode_FilterMode:'1'
|
}
|
export default {
|
name:'archivesOfCarriersChooseModalCompontent',
|
components:{SearchBar},
|
emits:['submitCallback','update:visible'],
|
props:{
|
visible:{
|
type:Boolean,
|
default:false
|
}
|
},
|
data(){
|
return {
|
loading:false,
|
selectList:{
|
series:[],
|
types:[]
|
},
|
list:[],
|
total:100,
|
query:{...defaultQuery},
|
queried:{...this.$config.pagination}
|
}
|
},
|
watch:{
|
visible(newVal,oldVal){
|
if (newVal!==oldVal) {
|
if (newVal) {
|
this.initModal();
|
}
|
}
|
}
|
},
|
methods:{
|
initModal(){
|
this.reset();
|
},
|
close(){
|
this.$emit('update:visible',false)
|
},
|
onClose(){
|
this.close();
|
},
|
onSelect(row){
|
this.$emit('submitCallback',row)
|
this.close();
|
},
|
/* 搜索按钮 */
|
onSearch(){
|
this.newList()
|
},
|
/* 重置按钮 */
|
onReset(){
|
this.reset();
|
},
|
reset(needLoading=true,callback){
|
this.query = {...defaultQuery}
|
this.newList(needLoading,callback)
|
},
|
/* 翻页功能 */
|
onPageList(page){
|
this.queried.page = page;
|
this.getList();
|
},
|
/* 表格刷新至首页 */
|
newList(needLoading=true,callback){
|
this.queried = {...this.query,...this.$config.pagination}
|
this.getList(callback,needLoading)
|
},
|
/* 更新数据表 */
|
getList(callback,needLoading=true){
|
if (needLoading) {
|
this.loading = true;
|
}
|
this.$api.post('Get',this.queried,{block:'baseSalver'}).then((d)=>{
|
this.total = d.total;
|
this.list = d.list.map((currentItem)=>{
|
currentItem.CreateTime = this.$utils.project.parseTimeStr(currentItem.CreateTime)
|
return currentItem
|
})
|
if (needLoading) {
|
this.loading = false;
|
}
|
callback && callback(true)
|
}).catch((err)=>{
|
if (needLoading) {
|
this.loading = false;
|
}
|
callback && callback(false)
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
</style>
|