Commit 2014bb03 by honghong

修改对接字段

parent 76b61129
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
<el-form-item label="城市" prop="cityId"> :model="queryParams"
<el-input ref="queryForm"
v-model="queryParams.cityId" size="small"
placeholder="请输入城市" :inline="true"
clearable v-show="showSearch"
@keyup.enter.native="handleQuery" label-width="68px"
/> >
</el-form-item>
<el-form-item label="位置" prop="site"> <el-form-item label="位置" prop="site">
<el-input <el-select v-model="queryParams.site" placeholder="请选择">
v-model="queryParams.site" <el-option
placeholder="请输入位置" v-for="item in placeOptions"
clearable :key="item.value"
@keyup.enter.native="handleQuery" :label="item.label"
/> :value="item.value"
</el-form-item> >
<el-form-item label="描述" prop="descr"> </el-option>
<el-input </el-select>
v-model="queryParams.descr"
placeholder="请输入描述"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="图片" prop="imgUrl">
<el-input
v-model="queryParams.imgUrl"
placeholder="请输入图片"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="链接" prop="linkUrl">
<el-input
v-model="queryParams.linkUrl"
placeholder="请输入链接"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-refresh"
size="mini"
@click="handleQuery"
>刷新</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -56,18 +39,8 @@ ...@@ -56,18 +39,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['accompany:carousel:add']" v-hasPermi="['accompany:carousel:add']"
>新增</el-button> >新增</el-button
</el-col> >
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['accompany:carousel:edit']"
>修改</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -78,31 +51,52 @@ ...@@ -78,31 +51,52 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['accompany:carousel:remove']" v-hasPermi="['accompany:carousel:remove']"
>删除</el-button> >删除</el-button
</el-col> >
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['accompany:carousel:export']"
>导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="carouselList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="carouselList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" v-if="true"/> <el-table-column label="ID" align="center" prop="id" />
<el-table-column label="城市" align="center" prop="cityId" />
<el-table-column label="位置" align="center" prop="site" />
<el-table-column label="描述" align="center" prop="descr" /> <el-table-column label="描述" align="center" prop="descr" />
<el-table-column label="图片" align="center" prop="imgUrl" /> <el-table-column label="位置" align="center" prop="site" />
<el-table-column label="城市" align="center" prop="cityId" />
<el-table-column label="图片" align="center" prop="imgUrl">
<template slot-scope="{ row }">
<el-image
style="width: 30px; height: 30px"
:src="row.imgUrl"
:preview-src-list="[row.imgUrl]"
>
</el-image>
</template>
</el-table-column>
<el-table-column label="链接" align="center" prop="linkUrl" /> <el-table-column label="链接" align="center" prop="linkUrl" />
<el-table-column label="状态;0-禁用,1-启用" align="center" prop="status" /> <!-- 状态;0-禁用,1-启用 -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
>
</el-switch>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -110,20 +104,22 @@ ...@@ -110,20 +104,22 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['accompany:carousel:edit']" v-hasPermi="['accompany:carousel:edit']"
>修改</el-button> >编辑</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['accompany:carousel:remove']" v-hasPermi="['accompany:carousel:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -133,34 +129,80 @@ ...@@ -133,34 +129,80 @@
<!-- 添加或修改轮播图对话框 --> <!-- 添加或修改轮播图对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="城市" prop="cityId">
<el-input v-model="form.cityId" placeholder="请输入城市" />
</el-form-item>
<el-form-item label="位置" prop="site"> <el-form-item label="位置" prop="site">
<el-input v-model="form.site" placeholder="请输入位置" /> <!-- <el-input v-model="form.site" placeholder="请输入位置" /> -->
<el-select v-model="form.site" placeholder="请选择">
<el-option
v-for="item in placeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="城市" prop="cityId">
<el-select v-model="form.cityId" placeholder="请选择">
<el-option
v-for="item in cityList"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-input v-model="form.cityId" placeholder="请输入城市" /> -->
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="descr"> <el-form-item label="描述" prop="descr">
<el-input v-model="form.descr" placeholder="请输入描述" /> <el-input
type="textarea"
autosize
v-model="form.descr"
placeholder="请输入描述"
/>
</el-form-item> </el-form-item>
<el-form-item label="图片" prop="imgUrl"> <el-form-item label="图片" prop="imgUrl">
<el-input v-model="form.imgUrl" type="textarea" placeholder="请输入内容" /> <!-- <el-input
v-model="form.imgUrl"
type="textarea"
placeholder="请输入内容"
/> -->
<imageUpload v-model="form.imgUrl" :limit="1"></imageUpload>
</el-form-item> </el-form-item>
<el-form-item label="链接" prop="linkUrl"> <el-form-item label="链接" prop="linkUrl">
<el-input v-model="form.linkUrl" type="textarea" placeholder="请输入内容" /> <el-input placeholder="请输入内容" v-model="form.linkUrl">
<!-- <template slot="prepend">Http://</template> -->
<template slot="prepend">
<i class="el-icon-link"></i>
</template>
</el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio v-model="form.status" label="0">禁用</el-radio>
<el-radio v-model="form.status" label="1">启用</el-radio>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> <el-button :loading="buttonLoading" type="primary" @click="submitForm"
>提 交</el-button
>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listCarousel, getCarousel, delCarousel, addCarousel, updateCarousel } from "@/api/operation/carousel"; import {
listCarousel,
getCarousel,
delCarousel,
addCarousel,
updateCarousel,
} from "@/api/operation/carousel";
export default { export default {
name: "Carousel", name: "Carousel",
data() { data() {
return { return {
...@@ -198,8 +240,27 @@ ...@@ -198,8 +240,27 @@
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {},
} placeOptions: [
{
value: "首页",
label: "首页",
},
{
value: "商城首页",
label: "商城首页",
},
],
cityList: [
{
value: "1",
label: "北京",
},
{
value: "2",
label: "上海",
},
],
}; };
}, },
created() { created() {
...@@ -209,7 +270,7 @@ ...@@ -209,7 +270,7 @@
/** 查询轮播图列表 */ /** 查询轮播图列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listCarousel(this.queryParams).then(response => { listCarousel(this.queryParams).then((response) => {
this.carouselList = response.rows; this.carouselList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -234,7 +295,8 @@ ...@@ -234,7 +295,8 @@
createTime: undefined, createTime: undefined,
updateBy: undefined, updateBy: undefined,
updateTime: undefined, updateTime: undefined,
delFlag: undefined delFlag: undefined,
status: "1",
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -250,9 +312,9 @@ ...@@ -250,9 +312,9 @@
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
...@@ -264,8 +326,8 @@ ...@@ -264,8 +326,8 @@
handleUpdate(row) { handleUpdate(row) {
this.loading = true; this.loading = true;
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getCarousel(id).then(response => { getCarousel(id).then((response) => {
this.loading = false; this.loading = false;
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
...@@ -274,23 +336,27 @@ ...@@ -274,23 +336,27 @@
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.buttonLoading = true; this.buttonLoading = true;
if (this.form.id != null) { if (this.form.id != null) {
updateCarousel(this.form).then(response => { updateCarousel(this.form)
.then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} else { } else {
addCarousel(this.form).then(response => { addCarousel(this.form)
.then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} }
...@@ -300,25 +366,22 @@ ...@@ -300,25 +366,22 @@
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除轮播图编号为"' + ids + '"的数据项?').then(() => { this.$modal
.confirm('是否确认删除轮播图编号为"' + ids + '"的数据项?')
.then(() => {
this.loading = true; this.loading = true;
return delCarousel(ids); return delCarousel(ids);
}).then(() => { })
.then(() => {
this.loading = false; this.loading = false;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { })
}).finally(() => { .catch(() => {})
.finally(() => {
this.loading = false; this.loading = false;
}); });
}, },
/** 导出按钮操作 */ },
handleExport() { };
this.download('accompany/carousel/export', { </script>
...this.queryParams
}, `carousel_${new Date().getTime()}.xlsx`)
}
}
};
</script>
\ No newline at end of file
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
<el-form-item label="提供医院" prop="hospitals"> :model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<!-- <el-form-item label="提供医院" prop="hospitals">
<el-input <el-input
v-model="queryParams.hospitals" v-model="queryParams.hospitals"
placeholder="请输入提供医院" placeholder="请输入提供医院"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="业务名称" prop="name"> <el-form-item label="业务名称" prop="name">
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.name"
...@@ -18,12 +25,20 @@ ...@@ -18,12 +25,20 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="primary" type="primary"
...@@ -67,14 +82,55 @@ ...@@ -67,14 +82,55 @@
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row> -->
<el-table v-loading="loading" :data="businessList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="businessList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" v-if="true"/> <el-table-column label="ID" align="center" prop="id" />
<el-table-column label="提供医院" align="center" prop="hospitals" /> <el-table-column label="提供医院" align="center" prop="hospitals" />
<el-table-column label="业务名称" align="center" prop="name" /> <el-table-column label="业务名称" align="center" prop="name" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="服务" align="center" prop="name">
<template slot-scope="{ row }">
<el-button type="text" @click="toogleExpand(row)">查看服务</el-button>
</template>
</el-table-column>
<el-table-column type="expand" width="1">
<template slot-scope="props">
<el-form label-position="left" inline class="demo-table-expand">
<el-form-item label="商品名称">
<span>{{ props.row.name }}</span>
</el-form-item>
<el-form-item label="所属店铺">
<span>{{ props.row.shop }}</span>
</el-form-item>
<el-form-item label="商品 ID">
<span>{{ props.row.id }}</span>
</el-form-item>
<el-form-item label="店铺 ID">
<span>{{ props.row.shopId }}</span>
</el-form-item>
<el-form-item label="商品分类">
<span>{{ props.row.category }}</span>
</el-form-item>
<el-form-item label="店铺地址">
<span>{{ props.row.address }}</span>
</el-form-item>
<el-form-item label="商品描述">
<span>{{ props.row.desc }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="name" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -82,20 +138,22 @@ ...@@ -82,20 +138,22 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:business:edit']" v-hasPermi="['system:business:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:business:remove']" v-hasPermi="['system:business:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -106,24 +164,36 @@ ...@@ -106,24 +164,36 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="提供医院" prop="hospitals"> <el-form-item label="提供医院" prop="hospitals">
<el-input v-model="form.hospitals" type="textarea" placeholder="请输入内容" /> <el-input
v-model="form.hospitals"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item> </el-form-item>
<el-form-item label="业务名称" prop="name"> <el-form-item label="业务名称" prop="name">
<el-input v-model="form.name" placeholder="请输入业务名称" /> <el-input v-model="form.name" placeholder="请输入业务名称" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> <el-button :loading="buttonLoading" type="primary" @click="submitForm"
>确 定</el-button
>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listBusiness, getBusiness, delBusiness, addBusiness, updateBusiness } from "@/api/operation/business"; import {
listBusiness,
getBusiness,
delBusiness,
addBusiness,
updateBusiness,
} from "@/api/operation/business";
export default { export default {
name: "Business", name: "Business",
data() { data() {
return { return {
...@@ -157,8 +227,7 @@ ...@@ -157,8 +227,7 @@
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {},
}
}; };
}, },
created() { created() {
...@@ -168,12 +237,21 @@ ...@@ -168,12 +237,21 @@
/** 查询业务列表 */ /** 查询业务列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listBusiness(this.queryParams).then(response => { listBusiness(this.queryParams).then((response) => {
this.businessList = response.rows; this.businessList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
toogleExpand(row) {
let $table = this.$refs.table;
this.tableData.map((item) => {
if (row.id != item.id) {
$table.toggleRowExpansion(item, false);
}
});
$table.toggleRowExpansion(row);
},
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
...@@ -189,7 +267,7 @@ ...@@ -189,7 +267,7 @@
createTime: undefined, createTime: undefined,
updateBy: undefined, updateBy: undefined,
updateTime: undefined, updateTime: undefined,
delFlag: undefined delFlag: undefined,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -205,9 +283,9 @@ ...@@ -205,9 +283,9 @@
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
...@@ -219,8 +297,8 @@ ...@@ -219,8 +297,8 @@
handleUpdate(row) { handleUpdate(row) {
this.loading = true; this.loading = true;
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getBusiness(id).then(response => { getBusiness(id).then((response) => {
this.loading = false; this.loading = false;
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
...@@ -229,23 +307,27 @@ ...@@ -229,23 +307,27 @@
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.buttonLoading = true; this.buttonLoading = true;
if (this.form.id != null) { if (this.form.id != null) {
updateBusiness(this.form).then(response => { updateBusiness(this.form)
.then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} else { } else {
addBusiness(this.form).then(response => { addBusiness(this.form)
.then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} }
...@@ -255,25 +337,32 @@ ...@@ -255,25 +337,32 @@
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除业务编号为"' + ids + '"的数据项?').then(() => { this.$modal
.confirm('是否确认删除业务编号为"' + ids + '"的数据项?')
.then(() => {
this.loading = true; this.loading = true;
return delBusiness(ids); return delBusiness(ids);
}).then(() => { })
.then(() => {
this.loading = false; this.loading = false;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { })
}).finally(() => { .catch(() => {})
.finally(() => {
this.loading = false; this.loading = false;
}); });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/business/export', { this.download(
...this.queryParams "system/business/export",
}, `business_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
}; `business_${new Date().getTime()}.xlsx`
</script> );
},
\ No newline at end of file },
};
</script>
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
<el-form-item label="城市" prop="cityId"> :model="queryParams"
<el-input ref="queryForm"
v-model="queryParams.cityId" size="small"
placeholder="请输入城市" :inline="true"
clearable v-show="showSearch"
@keyup.enter.native="handleQuery" label-width="68px"
/> >
</el-form-item>
<el-form-item label="内容" prop="info">
<el-input
v-model="queryParams.info"
placeholder="请输入内容"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="位置" prop="site"> <el-form-item label="位置" prop="site">
<el-input <el-select v-model="queryParams.site" placeholder="请选择">
v-model="queryParams.site" <el-option
placeholder="请输入位置" v-for="item in placeOptions"
clearable :key="item.value"
@keyup.enter.native="handleQuery" :label="item.label"
/> :value="item.value"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -40,9 +42,10 @@ ...@@ -40,9 +42,10 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:notice:add']" v-hasPermi="['system:notice:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
...@@ -51,8 +54,9 @@ ...@@ -51,8 +54,9 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >修改</el-button
</el-col> >
</el-col> -->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
...@@ -62,9 +66,10 @@ ...@@ -62,9 +66,10 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
plain plain
...@@ -72,18 +77,30 @@ ...@@ -72,18 +77,30 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:notice:export']" v-hasPermi="['system:notice:export']"
>导出</el-button> >导出</el-button
</el-col> >
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-col> -->
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="noticeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" v-if="true"/> <el-table-column label="ID" align="center" prop="id" />
<el-table-column label="城市" align="center" prop="cityId" /> <el-table-column label="城市" align="center" prop="cityId" />
<el-table-column label="内容" align="center" prop="info" /> <el-table-column label="内容" align="center" prop="info" />
<el-table-column label="位置" align="center" prop="site" /> <el-table-column label="位置" align="center" prop="site" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -91,20 +108,22 @@ ...@@ -91,20 +108,22 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:notice:edit']" v-hasPermi="['system:notice:edit']"
>修改</el-button> >编辑</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:notice:remove']" v-hasPermi="['system:notice:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -114,28 +133,57 @@ ...@@ -114,28 +133,57 @@
<!-- 添加或修改公告对话框 --> <!-- 添加或修改公告对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="城市" prop="cityId">
<el-input v-model="form.cityId" placeholder="请输入城市" />
</el-form-item>
<el-form-item label="内容" prop="info"> <el-form-item label="内容" prop="info">
<el-input v-model="form.info" type="textarea" placeholder="请输入内容" /> <el-input
autosize
v-model="form.info"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
<el-form-item label="城市" prop="cityId">
<el-select v-model="form.cityId" placeholder="请输入城市">
<el-option
v-for="item in placeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="位置" prop="site"> <el-form-item label="位置" prop="site">
<el-input v-model="form.site" placeholder="请输入位置" /> <el-select v-model="form.site" placeholder="请输入位置">
<el-option
v-for="item in placeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> <el-button :loading="buttonLoading" type="primary" @click="submitForm"
>提 交</el-button
>
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/operation/notice"; import {
listNotice,
getNotice,
delNotice,
addNotice,
updateNotice,
} from "@/api/operation/notice";
export default { export default {
name: "Notice", name: "Notice",
data() { data() {
return { return {
...@@ -170,8 +218,27 @@ ...@@ -170,8 +218,27 @@
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {},
} placeOptions: [
{
value: "首页公告",
label: "首页公告",
},
{
value: "代办挂号公告",
label: "代办挂号公告",
},
],
cityList: [
{
value: "1",
label: "北京",
},
{
value: "2",
label: "上海",
},
],
}; };
}, },
created() { created() {
...@@ -181,7 +248,7 @@ ...@@ -181,7 +248,7 @@
/** 查询公告列表 */ /** 查询公告列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listNotice(this.queryParams).then(response => { listNotice(this.queryParams).then((response) => {
this.noticeList = response.rows; this.noticeList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -202,7 +269,7 @@ ...@@ -202,7 +269,7 @@
createBy: undefined, createBy: undefined,
createTime: undefined, createTime: undefined,
updateBy: undefined, updateBy: undefined,
updateTime: undefined updateTime: undefined,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -218,9 +285,9 @@ ...@@ -218,9 +285,9 @@
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map((item) => item.id);
this.single = selection.length!==1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
...@@ -232,8 +299,8 @@ ...@@ -232,8 +299,8 @@
handleUpdate(row) { handleUpdate(row) {
this.loading = true; this.loading = true;
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getNotice(id).then(response => { getNotice(id).then((response) => {
this.loading = false; this.loading = false;
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
...@@ -242,23 +309,27 @@ ...@@ -242,23 +309,27 @@
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
this.buttonLoading = true; this.buttonLoading = true;
if (this.form.id != null) { if (this.form.id != null) {
updateNotice(this.form).then(response => { updateNotice(this.form)
.then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} else { } else {
addNotice(this.form).then(response => { addNotice(this.form)
.then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}).finally(() => { })
.finally(() => {
this.buttonLoading = false; this.buttonLoading = false;
}); });
} }
...@@ -268,25 +339,32 @@ ...@@ -268,25 +339,32 @@
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除公告编号为"' + ids + '"的数据项?').then(() => { this.$modal
.confirm('是否确认删除公告编号为"' + ids + '"的数据项?')
.then(() => {
this.loading = true; this.loading = true;
return delNotice(ids); return delNotice(ids);
}).then(() => { })
.then(() => {
this.loading = false; this.loading = false;
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { })
}).finally(() => { .catch(() => {})
.finally(() => {
this.loading = false; this.loading = false;
}); });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/notice/export', { this.download(
...this.queryParams "system/notice/export",
}, `notice_${new Date().getTime()}.xlsx`) {
} ...this.queryParams,
} },
}; `notice_${new Date().getTime()}.xlsx`
</script> );
},
\ No newline at end of file },
};
</script>
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