|
@@ -0,0 +1,377 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="商户名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入商户名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商业板块" prop="district">
|
|
|
+ <el-select v-model="queryParams.district" placeholder="请选择商业板块" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.che_district"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="楼栋" prop="building">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.building"
|
|
|
+ placeholder="请输入楼栋"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="楼层" prop="floor">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.floor"
|
|
|
+ placeholder="请输入楼层"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="使用状态" prop="status">
|
|
|
+ <el-select v-model="queryParams.status" placeholder="请选择使用状态" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.vacant_status"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <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>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['community:shop:add']"
|
|
|
+ >新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-upload"
|
|
|
+ size="mini"
|
|
|
+ @click="handleImport"
|
|
|
+ v-hasPermi="['community:shop:import']"
|
|
|
+ >导入</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="el-icon-download"
|
|
|
+ size="mini"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['community:shop:export']"
|
|
|
+ >导出</el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="shopList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="商业板块" align="center" prop="district">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.che_district" :value="scope.row.district"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="楼栋" align="center" prop="building" />
|
|
|
+ <el-table-column label="楼层" align="center" prop="floor" />
|
|
|
+ <el-table-column label="店铺号" align="center" prop="number" />
|
|
|
+ <el-table-column label="使用状态" align="center" prop="status">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.vacant_status" :value="scope.row.status"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="商户名称" align="center" prop="name" />
|
|
|
+ <el-table-column label="业态" align="center" prop="category">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.establishment_category" :value="scope.row.category"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="面积" align="center" prop="area" />
|
|
|
+ <el-table-column label="经营方式" align="center" prop="businessModel">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <dict-tag :options="dict.type.business_model" :value="scope.row.businessModel"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="联系人" align="center" prop="contact" />
|
|
|
+ <el-table-column label="电话号码" align="center" prop="phone" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['community:shop:edit']"
|
|
|
+ >修改</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['community:shop:remove']"
|
|
|
+ >删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改shop对话框 -->
|
|
|
+ <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-item label="商业板块" prop="district">
|
|
|
+ <el-select v-model="form.district" placeholder="请选择商业板块">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.che_district"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+:value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="楼栋" prop="building">
|
|
|
+ <el-input v-model="form.building" placeholder="请输入楼栋" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="楼层" prop="floor">
|
|
|
+ <el-input v-model="form.floor" placeholder="请输入楼层" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="店铺号" prop="number">
|
|
|
+ <el-input v-model="form.number" placeholder="请输入店铺号" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="使用状态" prop="status">
|
|
|
+ <el-select v-model="form.status" placeholder="请选择使用状态">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.vacant_status"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+:value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="商户名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入商户名称" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="业态" prop="category">
|
|
|
+ <el-select v-model="form.category" placeholder="请选择业态">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.establishment_category"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+:value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="面积" prop="area">
|
|
|
+ <el-input v-model="form.area" placeholder="请输入面积" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="经营方式" prop="businessModel">
|
|
|
+ <el-select v-model="form.businessModel" placeholder="请选择经营方式">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dict.type.business_model"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+:value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="联系人" prop="contact">
|
|
|
+ <el-input v-model="form.contact" placeholder="请输入联系人" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="电话号码" prop="phone">
|
|
|
+ <el-input v-model="form.phone" placeholder="请输入电话号码" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" placeholder="请输入备注" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listShop, getShop, delShop, addShop, updateShop } from "@/api/community/shop";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "Shop",
|
|
|
+ dicts: ['establishment_category', 'vacant_status', 'che_district', 'business_model'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // shop表格数据
|
|
|
+ shopList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ district: null,
|
|
|
+ building: null,
|
|
|
+ floor: null,
|
|
|
+ status: null,
|
|
|
+ name: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ district: [
|
|
|
+ { required: true, message: "商业板块不能为空", trigger: "change" }
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询shop列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listShop(this.queryParams).then(response => {
|
|
|
+ this.shopList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ shopId: null,
|
|
|
+ district: null,
|
|
|
+ building: null,
|
|
|
+ floor: null,
|
|
|
+ number: null,
|
|
|
+ status: null,
|
|
|
+ name: null,
|
|
|
+ category: null,
|
|
|
+ area: null,
|
|
|
+ businessModel: null,
|
|
|
+ contact: null,
|
|
|
+ phone: null,
|
|
|
+ createTime: null,
|
|
|
+ updateTime: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.shopId)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加shop";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const shopId = row.shopId || this.ids
|
|
|
+ getShop(shopId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改shop";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.shopId != null) {
|
|
|
+ updateShop(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addShop(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const shopIds = row.shopId || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除shop编号为"' + shopIds + '"的数据项?').then(function() {
|
|
|
+ return delShop(shopIds);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('community/shop/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `shop_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|