438 lines
19 KiB
HTML
438 lines
19 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<style>
|
|
.viewTable .el-descriptions__table {
|
|
table-layout: fixed !important;
|
|
}
|
|
|
|
.viewTable .el-descriptions-item__cell {
|
|
text-align: center !important;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<el-card shadow="never">
|
|
<div class="search">
|
|
<div class="search-item">
|
|
<div class="search-item-label">年度:</div>
|
|
<div class="search-item-option">
|
|
<el-date-picker
|
|
placeholder="选择年度"
|
|
type="year"
|
|
@change="doSearch"
|
|
style="width: 100%"
|
|
v-model="pageForm.year"
|
|
value-format="yyyy">
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
<div class="search-item">
|
|
<div class="search-item-label">关键字:</div>
|
|
<div class="search-item-option">
|
|
<el-input @keyup.enter.native="doSearch" clearable clearable
|
|
placeholder="请输入内容"
|
|
style="width: 100%"
|
|
v-model="pageForm.keywords">
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
<div class="search-query">
|
|
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
|
|
<el-card class="mt10" shadow="never">
|
|
<table-tool :app="this" label="旅行社列表">
|
|
<template #func>
|
|
<el-button @click="openImport" size="medium" type="primary">导入旅行社</el-button>
|
|
<el-button @click="openAdd" size="medium" type="primary">新建旅行社</el-button>
|
|
</template>
|
|
</table-tool>
|
|
<el-table :data="tableData" :size="tableSize">
|
|
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index"
|
|
width="80px"></el-table-column>
|
|
<el-table-column
|
|
:label="column.label"
|
|
:prop="column.prop"
|
|
:width="column.width"
|
|
:sortable="column.sortable"
|
|
align="center"
|
|
header-align="center"
|
|
show-overflow-tooltip
|
|
v-for="column in tableColumns"
|
|
>
|
|
<template scope="{row}" v-if="column.prop==='isDisabled'">
|
|
<el-switch
|
|
:active-value="false"
|
|
:inactive-value="true"
|
|
@change="(val)=>{travelAgencyStatusChange(row.id)}"
|
|
active-color="#13ce66"
|
|
inactive-color="#ff4949"
|
|
v-model="row.isDisabled">
|
|
</el-switch>
|
|
</template>
|
|
<template scope="{row:{officialWebsite}}" v-else-if="column.prop==='officialWebsite'">
|
|
<a :href="officialWebsite" class="text-primary" target="_blank">
|
|
{{officialWebsite}}
|
|
</a>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="250px">
|
|
<template scope="{row}">
|
|
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
|
|
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
|
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
|
|
<el-dialog :close-on-click-modal="false" :title="editDialogTitle" :visible.sync="editDialogVisible"
|
|
width="60%">
|
|
<el-form :model="formData" :rules="rules" label-width="120px" ref="form">
|
|
<el-row :gutter="20">
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="年度" prop="year">
|
|
<el-date-picker style="width: 100%"
|
|
type="year"
|
|
v-model="formData.year"
|
|
value-format="yyyy"></el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="编号" prop="serialNumber">
|
|
<el-input maxlength="50" v-model="formData.serialNumber"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :md="24" :sm="24" :xs="24">
|
|
<el-form-item label="旅行社名称" prop="travelAgencyName">
|
|
<el-input maxlength="50" v-model="formData.travelAgencyName"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="旅行社联系人" prop="contact">
|
|
<el-input maxlength="10" v-model="formData.contact"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="联系电话" prop="contactMobileNumber">
|
|
<el-input v-model="formData.contactMobileNumber"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="邮箱" prop="email">
|
|
<el-input maxlength="50" v-model="formData.email"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="官网" prop="officialWebsite">
|
|
<el-input maxlength="100" v-model="formData.officialWebsite"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :md="24" :sm="24" :xs="24">
|
|
<el-form-item label="备注" prop="note">
|
|
<el-input maxlength="100"
|
|
type="textarea"
|
|
v-model="formData.note"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :md="12" :sm="24" :xs="24">
|
|
<el-form-item label="是否启用" prop="isDisabled">
|
|
<el-switch
|
|
:active-value="false"
|
|
:inactive-value="true"
|
|
active-color="#13ce66"
|
|
inactive-color="#ff4949"
|
|
v-model="formData.isDisabled">
|
|
</el-switch>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :md="24" :sm="24" :xs="24">
|
|
<el-form-item label="移动端缩略图" prop="files">
|
|
<file-upload :files.sync="formData.files"
|
|
picture_card
|
|
:max="1"
|
|
:type="['jpg', 'jpeg', 'png']"
|
|
></file-upload>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
<el-row justify="end" type="flex">
|
|
<el-button @click="editDialogVisible=false">取消</el-button>
|
|
<el-button @click="doSubmit" type="primary">提交</el-button>
|
|
</el-row>
|
|
</el-dialog>
|
|
|
|
<template #view>
|
|
<el-descriptions :column="2" border class="viewTable">
|
|
<el-descriptions-item label="旅行社编号">{{viewData.serialNumber}}</el-descriptions-item>
|
|
<el-descriptions-item label="旅行社名称">{{viewData.travelAgencyName}}</el-descriptions-item>
|
|
<el-descriptions-item label="联系人">{{viewData.contact}}</el-descriptions-item>
|
|
<el-descriptions-item label="备注">{{viewData.contactMobileNumber}}</el-descriptions-item>
|
|
<el-descriptions-item label="邮箱">{{viewData.email}}</el-descriptions-item>
|
|
<el-descriptions-item label="官网">
|
|
<a :href="viewData.officialWebsite" target="_blank">
|
|
{{viewData.officialWebsite}}
|
|
<span class="text-primary">立即访问</span>
|
|
</a>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item :span="2" label="备注">{{viewData.note}}</el-descriptions-item>
|
|
</el-descriptions>
|
|
</template>
|
|
|
|
|
|
<el-dialog
|
|
title="旅行社导入"
|
|
:visible.sync="importVisible"
|
|
:close-on-click-modal="false"
|
|
width="50%"
|
|
>
|
|
<el-timeline>
|
|
<el-timeline-item timestamp="下载模板" placement="top">
|
|
<el-card>
|
|
<el-button size="medium" type=""
|
|
@click="location.href='/platform/basics/downloadTemplate?filePath=travel/TravelAgencyImport.xlsx&fileName=旅行社导入模板.xls'"
|
|
icon="el-icon-download">下载模板
|
|
</el-button>
|
|
|
|
</el-card>
|
|
</el-timeline-item>
|
|
<el-timeline-item timestamp="上传文件" placement="top">
|
|
<el-card>
|
|
<el-form>
|
|
<el-upload
|
|
name="file"
|
|
ref="upload"
|
|
:on-remove="(file, fileList) => {
|
|
importData.fileList = fileHandleRemove(file, fileList)
|
|
}"
|
|
:on-change="(file, fileList) => {
|
|
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
|
|
}"
|
|
:auto-upload="false"
|
|
:limit="1"
|
|
:file-list="importData.fileList">
|
|
<el-button size="medium" type="" icon="el-icon-upload"
|
|
style="width: 200px">选择文件
|
|
</el-button>
|
|
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
|
|
只能上传 xls/xlsx 文件
|
|
</div>
|
|
</el-upload>
|
|
</el-form>
|
|
</el-card>
|
|
</el-timeline-item>
|
|
</el-timeline>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="importVisible = false" :disabled="importLoading">取 消</el-button>
|
|
<el-button type="primary" @click="doImport" :loading="importLoading">确定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
</guava>
|
|
</div>
|
|
|
|
<script>
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
tableColumns: [
|
|
{label: '年度', prop: 'year', sortable: true},
|
|
{label: '旅行社名称', prop: 'travelAgencyName', width: '200'},
|
|
{label: '旅行社编号', prop: 'serialNumber', sortable: true},
|
|
{label: '联系人', prop: 'contact'},
|
|
{label: '联系人手机', prop: 'contactMobileNumber'},
|
|
{label: '邮箱', prop: 'email'},
|
|
{label: '官网', prop: 'officialWebsite'},
|
|
{label: '备注', prop: 'note'},
|
|
{label: '是否禁用', prop: 'isDisabled'}
|
|
],
|
|
editDialogVisible: false,
|
|
rules: {
|
|
serialNumber: [{required: true, message: '请输入编号', trigger: ['change', 'blur']}],
|
|
travelAgencyName: [{required: true, message: '请输入旅行社名称', trigger: ['change', 'blur']}],
|
|
contact: [{required: true, message: '请输入联系人姓名', trigger: ['change', 'blur']}],
|
|
contactMobileNumber: [
|
|
{required: true, message: '请输入联系人电话', trigger: 'blur',},
|
|
{
|
|
pattern: /^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/,
|
|
message: '请输入正确的联系人电话',
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
email: [
|
|
{required: false, message: '请输入邮箱地址', trigger: 'blur'},
|
|
{type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
|
|
],
|
|
officialWebsite: [
|
|
{required: false, message: '请输入官网地址', trigger: ['change', 'blur']},
|
|
{type: 'url', message: '请输入正确的官网地址', trigger: ['blur', 'change']}],
|
|
note: [{required: false, message: '请输入备注', trigger: ['change', 'blur']}],
|
|
year: [{required: true, message: '请选择年度', trigger: ['change', 'blur']}],
|
|
//files: [{required: true, message: '请上传移动端缩略图', trigger: ['change', 'blur']}],
|
|
},
|
|
viewData: {},
|
|
formData: {
|
|
id: null,
|
|
serialNumber: null,
|
|
travelAgencyName: null,
|
|
contact: null,
|
|
contactMobileNumber: null,
|
|
email: null,
|
|
officialWebsite: null,
|
|
note: null,
|
|
year: null,
|
|
isDisabled: false
|
|
},
|
|
pageForm: {
|
|
keywords: null,
|
|
year: null
|
|
},
|
|
//旅行社导入
|
|
importVisible: false,
|
|
importLoading: false,
|
|
importData: {},
|
|
}
|
|
},
|
|
computed: {
|
|
editDialogTitle() {
|
|
return this.formData.id ? '编辑旅行社' : '新增旅行社'
|
|
}
|
|
},
|
|
methods: {
|
|
openAdd() {
|
|
this.editDialogVisible = true
|
|
this.$nextTick(() => {
|
|
if (this.$refs['form']) {
|
|
this.$refs['form'].resetFields()
|
|
}
|
|
this.formData = {
|
|
id: null,
|
|
serialNumber: null,
|
|
travelAgencyName: null,
|
|
contact: null,
|
|
contactMobileNumber: null,
|
|
email: null,
|
|
officialWebsite: null,
|
|
note: null,
|
|
year: null,
|
|
isDisabled: false
|
|
}
|
|
})
|
|
},
|
|
async openEdit(row) {
|
|
const cloneData = clone(row)
|
|
cloneData.year = cloneData.year.toString()
|
|
this.formData = {...cloneData}
|
|
this.editDialogVisible = true
|
|
},
|
|
async doSubmit() {
|
|
const valid = await this.$refs['form'].validate()
|
|
if (!valid) return
|
|
const resp = await $.post(loc() + '/doSubmit', {travelAgency: JSON.stringify(this.formData)})
|
|
if (resp.code === 0) {
|
|
this.editDialogVisible = false
|
|
this.notifySuccess(resp.msg)
|
|
this.pageData()
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
async travelAgencyStatusChange(id) {
|
|
const resp = await $.post(loc() + '/openClosedTravelAgency/' + id)
|
|
if (resp.code === 0) {
|
|
this.notifySuccess(resp.msg)
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
async doDelete(id) {
|
|
const confirm = await this.$confirm('可能会导致数据不完整,您确定要删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
if (confirm !== 'confirm') return
|
|
|
|
const resp = await $.post(loc() + '/deleteTravelAgency/' + id)
|
|
if (resp.code === 0) {
|
|
this.doSearch()
|
|
this.notifySuccess(resp.msg)
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
},
|
|
|
|
async openView(row) {
|
|
this.viewData = row
|
|
this.$refs.guava.view()
|
|
},
|
|
async initPageData() {
|
|
}, /** 旅行社导入 */
|
|
openImport() {
|
|
this.importData = {
|
|
fileList: []
|
|
}
|
|
this.importVisible = true;
|
|
},
|
|
async doImport() {
|
|
if (this.importData.fileList.length === 0) {
|
|
this.notifyWarning("请选择文件!")
|
|
return
|
|
}
|
|
const data = new FormData();
|
|
|
|
this.importData.fileList.forEach((val) => {
|
|
data.append("file", val.raw, val.raw.name);
|
|
});
|
|
this.importLoading = true
|
|
|
|
const resp = await $.post(loc() + '/travelAgencyImport',data)
|
|
if (resp.code===0){
|
|
this.pageData();
|
|
this.importVisible = false
|
|
this.importLoading = false
|
|
}else {
|
|
this.notifyWarning("导入失败")
|
|
this.importLoading = false
|
|
}
|
|
},
|
|
},
|
|
async created() {
|
|
await this.initPageData()
|
|
this.pageData()
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#-->
|