Prechádzať zdrojové kódy

企微多侧边栏配置页面代码

cgp 1 týždeň pred
rodič
commit
f83c3ec182

+ 53 - 0
src/api/qw/qwAppMiniProgramRelation.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询应用-小程序关系列表
+export function listQwAppMiniProgramRelation(query) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询应用-小程序关系详细
+export function getQwAppMiniProgramRelation(id) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation/' + id,
+    method: 'get'
+  })
+}
+
+// 新增应用-小程序关系
+export function addQwAppMiniProgramRelation(data) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改应用-小程序关系
+export function updateQwAppMiniProgramRelation(data) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除应用-小程序关系
+export function delQwAppMiniProgramRelation(id) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出应用-小程序关系
+export function exportQwAppMiniProgramRelation(query) {
+  return request({
+    url: '/qw/qwAppMiniProgramRelation/export',
+    method: 'get',
+    params: query
+  })
+}

+ 348 - 0
src/views/qw/qwAppMiniProgramRelation/index.vue

@@ -0,0 +1,348 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="小程序" prop="miniAppName">
+        <el-input
+          v-model="queryParams.miniAppName"
+          placeholder="请输入小程序名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="应用id" prop="agentId">
+        <el-input
+          v-model="queryParams.agentId"
+          placeholder="请输入应用id"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="corpId" prop="corpId">
+        <el-input
+          v-model="queryParams.corpId"
+          placeholder="请输入企业corpId"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="企业名称" prop="corpName">
+        <el-input
+          v-model="queryParams.corpName"
+          placeholder="请输入企业名称"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </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="['qw:qwAppMiniProgramRelation:add']"
+        >新增</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="['qw:qwAppMiniProgramRelation:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qw:qwAppMiniProgramRelation:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['qw:qwAppMiniProgramRelation:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table border v-loading="loading" :data="qwAppMiniProgramRelationList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="主键id" align="center" prop="id" />
+      <el-table-column label="小程序id" align="center" prop="miniAppId" />
+      <el-table-column label="小程序名称" align="center" prop="miniAppName" />
+      <el-table-column label="应用id" align="center" prop="agentId" />
+      <el-table-column label="企业CorpId" align="center" prop="corpId" />
+      <el-table-column label="服务商应用的Secret" align="center" prop="openSecret" />
+      <el-table-column label="企业名称" align="center" prop="corpName" />
+      <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="['qw:qwAppMiniProgramRelation:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['qw:qwAppMiniProgramRelation: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"
+    />
+
+    <!-- 添加或修改应用-小程序关系对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="140px">
+        <el-form-item label="小程序id" prop="miniAppId">
+          <el-input v-model="form.miniAppId" placeholder="请输入小程序id" />
+        </el-form-item>
+        <el-form-item label="小程序名称" prop="miniAppName">
+          <el-input v-model="form.miniAppName" placeholder="请输入小程序名称" />
+        </el-form-item>
+        <el-form-item label="应用id" prop="agentId">
+          <el-input v-model="form.agentId" placeholder="请输入应用id" />
+        </el-form-item>
+        <el-form-item label="企业Corpid" prop="corpId">
+          <el-input v-model="form.corpId" placeholder="请输入企业Corpid" />
+        </el-form-item>
+        <el-form-item label="服务商应用的Secret" prop="openSecret">
+          <el-input v-model="form.openSecret" placeholder="请输入服务商应用的Secret" />
+        </el-form-item>
+        <el-form-item label="企业名称" prop="corpName">
+          <el-input v-model="form.corpName" 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 { listQwAppMiniProgramRelation, getQwAppMiniProgramRelation, delQwAppMiniProgramRelation, addQwAppMiniProgramRelation, updateQwAppMiniProgramRelation, exportQwAppMiniProgramRelation } from "@/api/qw/qwAppMiniProgramRelation";
+
+export default {
+  name: "QwAppMiniProgramRelation",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 应用-小程序关系表格数据
+      qwAppMiniProgramRelationList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        miniAppId: null,
+        miniAppName: null,
+        agentId: null,
+        corpId: null,
+        openSecret: null,
+        corpName: null,
+        status: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        miniAppId: [
+          { required: true, message: "小程序id不能为空", trigger: "blur" }
+        ],
+        agentId: [
+          { required: true, message: "应用id不能为空", trigger: "blur" }
+        ],
+        corpName: [
+          { required: true, message: "企业名称不能为空", trigger: "blur" }
+        ],
+        status: [
+          { required: true, message: "状态: 1-启用, 0-禁用不能为空", trigger: "blur" }
+        ],
+        createTime: [
+          { required: true, message: "创建时间不能为空", trigger: "blur" }
+        ],
+        updateTime: [
+          { required: true, message: "更新时间不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询应用-小程序关系列表 */
+    getList() {
+      this.loading = true;
+      listQwAppMiniProgramRelation(this.queryParams).then(response => {
+        this.qwAppMiniProgramRelationList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        miniAppId: null,
+        miniAppName: null,
+        agentId: null,
+        corpId: null,
+        openSecret: null,
+        corpName: null,
+        status: 0,
+        createBy: null,
+        updateBy: 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.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加应用-小程序关系";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getQwAppMiniProgramRelation(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改应用-小程序关系";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateQwAppMiniProgramRelation(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addQwAppMiniProgramRelation(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除应用-小程序关系编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delQwAppMiniProgramRelation(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有应用-小程序关系数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.exportLoading = true;
+          return exportQwAppMiniProgramRelation(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+          this.exportLoading = false;
+        }).catch(() => {});
+    }
+  }
+};
+</script>