|
@@ -1,5 +1,43 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
|
+ <el-form ref="miniAppConfigForm" :model="miniAppConfigForm" :inline="true" label-width="100px" class="mini-app-config-form">
|
|
|
|
|
+ <el-form-item label="主要小程序">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="miniAppConfigForm.mainMiniAppId"
|
|
|
|
|
+ placeholder="请选择主要小程序"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 220px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in companyMiniAppList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.appid || item.appId"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="备用小程序">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="miniAppConfigForm.backupMiniAppId"
|
|
|
|
|
+ placeholder="请选择备用小程序"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 220px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in companyMiniAppList"
|
|
|
|
|
+ :key="'backup-' + item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.appid || item.appId"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button type="primary" size="mini" :loading="miniAppSaving" @click="onSubmitMiniApp">保存</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
<el-form-item label="名称" prop="name">
|
|
<el-form-item label="名称" prop="name">
|
|
|
<el-input
|
|
<el-input
|
|
@@ -26,73 +64,10 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<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="['course:playSourceConfig: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="['course:playSourceConfig: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="['course:playSourceConfig:remove']"
|
|
|
|
|
- >删除</el-button>
|
|
|
|
|
- </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-dialog title="开关配置" :visible.sync="switchDialogVisible" width="500px" class="switch-dialog">
|
|
|
|
|
- <el-form :model="switchForm" label-width="100px">
|
|
|
|
|
- <el-form-item label="AppId">
|
|
|
|
|
- <el-input v-model="switchForm.appId" :disabled="true"></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="开关状态">
|
|
|
|
|
- <el-switch
|
|
|
|
|
- v-model="switchForm.switchStatus"
|
|
|
|
|
- active-text="开启"
|
|
|
|
|
- inactive-text="关闭"
|
|
|
|
|
- active-value="001"
|
|
|
|
|
- inactive-value="002">
|
|
|
|
|
- </el-switch>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="配置信息" v-if="switchForm.configInfo">
|
|
|
|
|
- <el-input
|
|
|
|
|
- type="textarea"
|
|
|
|
|
- :rows="4"
|
|
|
|
|
- v-model="switchForm.configInfo"
|
|
|
|
|
- :disabled="true">
|
|
|
|
|
- </el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
|
- <el-button @click="switchDialogVisible = false">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="submitSwitchConfig">确 定</el-button>
|
|
|
|
|
- </span>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
-
|
|
|
|
|
- <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" border>
|
|
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
|
|
+ <el-table v-loading="loading" :data="list" border>
|
|
|
<el-table-column label="ID" align="center" prop="id" />
|
|
<el-table-column label="ID" align="center" prop="id" />
|
|
|
<el-table-column label="名称" align="center" prop="name" />
|
|
<el-table-column label="名称" align="center" prop="name" />
|
|
|
<el-table-column label="图标" align="center" prop="img">
|
|
<el-table-column label="图标" align="center" prop="img">
|
|
@@ -112,33 +87,34 @@
|
|
|
<el-table-column label="msgDataFormat" align="center" prop="msgDataFormat" />
|
|
<el-table-column label="msgDataFormat" align="center" prop="msgDataFormat" />
|
|
|
<el-table-column label="类型" align="center" prop="type">
|
|
<el-table-column label="类型" align="center" prop="type">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <dict-tag :options="typesOptions" :value="scope.row.type"/>
|
|
|
|
|
|
|
+ <dict-tag :options="typesOptions" :value="scope.row.type"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="互医/商城小程序" align="center" prop="isMall" width="80px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-tag v-for="(item, index) in isMallOptions" v-if="scope.row.isMall==item.dictValue" :key="index">{{item.dictLabel}}</el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="状态" align="center" prop="status" width="100px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-tag
|
|
|
|
|
+ :type="scope.row.status === 0 ? 'success' : scope.row.status === 1 ? 'warning' : 'danger'"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ getStatusLabel(scope.row.status) }}
|
|
|
|
|
+ </el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
|
|
<el-table-column label="修改时间" align="center" prop="updateTime" />
|
|
<el-table-column label="修改时间" align="center" prop="updateTime" />
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
<el-button
|
|
|
|
|
+ v-if="canModify"
|
|
|
size="mini"
|
|
size="mini"
|
|
|
type="text"
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
@click="handleUpdate(scope.row)"
|
|
|
- v-hasPermi="['course:playSourceConfig:edit']"
|
|
|
|
|
>修改</el-button>
|
|
>修改</el-button>
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="text"
|
|
|
|
|
- icon="el-icon-delete"
|
|
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
|
|
- v-hasPermi="['course:playSourceConfig:remove']"
|
|
|
|
|
- >删除</el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="text"
|
|
|
|
|
- icon="el-icon-setting"
|
|
|
|
|
- @click="handleSwitchConfig(scope.row)"
|
|
|
|
|
- >是否展示销售</el-button>
|
|
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -151,45 +127,24 @@
|
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <!-- 添加或修改点播配置对话框 -->
|
|
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
|
|
|
|
- <el-form-item label="名称" prop="name">
|
|
|
|
|
- <el-input v-model="form.name" placeholder="请输入名称" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="图标" prop="img">
|
|
|
|
|
- <image-upload v-model="form.img" :file-type='["png", "jpg", "jpeg"]' :limit="1"/>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="类型" prop="type">
|
|
|
|
|
|
|
+ <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="status">
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-model="form.type"
|
|
|
|
|
- placeholder="请选择类型">
|
|
|
|
|
|
|
+ v-model="form.status"
|
|
|
|
|
+ placeholder="请选择状态"
|
|
|
|
|
+ style="width: 220px"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ >
|
|
|
<el-option
|
|
<el-option
|
|
|
- v-for="item in typesOptions"
|
|
|
|
|
- :key="item.dictValue"
|
|
|
|
|
- :label="item.dictLabel"
|
|
|
|
|
- :value="item.dictValue"/>
|
|
|
|
|
|
|
+ v-for="item in statusOptions"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item label="原始id" prop="originalId">
|
|
|
|
|
- <el-input v-model="form.originalId" placeholder="请输入原始id" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="appid" prop="appid">
|
|
|
|
|
- <el-input v-model="form.appid" placeholder="请输入appid" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="secret" prop="secret">
|
|
|
|
|
- <el-input v-model="form.secret" placeholder="请输入secret" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="token" prop="token">
|
|
|
|
|
- <el-input v-model="form.token" placeholder="请输入token" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="aesKey" prop="aesKey">
|
|
|
|
|
- <el-input v-model="form.aesKey" placeholder="请输入aesKey" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="msgDataFormat" prop="msgDataFormat">
|
|
|
|
|
- <el-input v-model="form.msgDataFormat" placeholder="请输入msgDataFormat" />
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
-
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
@@ -201,17 +156,21 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import {list, get, update, add, del, updateIsTownOn} from '@/api/course/coursePlaySourceConfig'
|
|
|
|
|
|
|
+import { list, get, update } from '@/api/course/coursePlaySourceConfig'
|
|
|
|
|
+import { getCompanyMiniAppList, updateMiniAppMasterServer } from '@/api/company/companyConfig'
|
|
|
|
|
+import { resetForm } from '@/utils/common'
|
|
|
|
|
+import { checkPermi } from '@/utils/permission'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'CoursePlaySourceConfig',
|
|
name: 'CoursePlaySourceConfig',
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- switchDialogVisible: false,
|
|
|
|
|
- switchForm: {
|
|
|
|
|
- appId: '',
|
|
|
|
|
- switchStatus: '001',
|
|
|
|
|
|
|
+ miniAppConfigForm: {
|
|
|
|
|
+ mainMiniAppId: null,
|
|
|
|
|
+ backupMiniAppId: null
|
|
|
},
|
|
},
|
|
|
|
|
+ companyMiniAppList: [],
|
|
|
|
|
+ miniAppSaving: false,
|
|
|
queryParams: {
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
@@ -219,208 +178,179 @@ export default {
|
|
|
appid: null
|
|
appid: null
|
|
|
},
|
|
},
|
|
|
showSearch: true,
|
|
showSearch: true,
|
|
|
- single: true,
|
|
|
|
|
- multiple: true,
|
|
|
|
|
- ids: [],
|
|
|
|
|
loading: false,
|
|
loading: false,
|
|
|
list: [],
|
|
list: [],
|
|
|
total: 0,
|
|
total: 0,
|
|
|
typesOptions: [],
|
|
typesOptions: [],
|
|
|
|
|
+ statusOptions: [
|
|
|
|
|
+ { label: '正常', value: 0 },
|
|
|
|
|
+ { label: '半封禁', value: 1 },
|
|
|
|
|
+ { label: '封禁', value: 2 }
|
|
|
|
|
+ ],
|
|
|
|
|
+ isMallOptions: [
|
|
|
|
|
+ { dictLabel: '是', dictValue: 1 },
|
|
|
|
|
+ { dictLabel: '否', dictValue: 0 }
|
|
|
|
|
+ ],
|
|
|
title: null,
|
|
title: null,
|
|
|
open: false,
|
|
open: false,
|
|
|
form: {},
|
|
form: {},
|
|
|
rules: {
|
|
rules: {
|
|
|
- name: [
|
|
|
|
|
- { required: true, message: "名称不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- appid: [
|
|
|
|
|
- { required: true, message: "appid不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- img: [
|
|
|
|
|
- { required: true, message: "图标不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- type: [
|
|
|
|
|
- { required: true, message: "类型不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- originalId: [
|
|
|
|
|
- { required: true, message: "原始id不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- secret: [
|
|
|
|
|
- { required: true, message: "secret不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- token: [
|
|
|
|
|
- { required: true, message: "token不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- aesKey: [
|
|
|
|
|
- { required: true, message: "aesKey不能为空", trigger: "blur" }
|
|
|
|
|
- ],
|
|
|
|
|
- msgDataFormat: [
|
|
|
|
|
- { required: true, message: "msgDataFormat不能为空", trigger: "blur" }
|
|
|
|
|
|
|
+ status: [
|
|
|
|
|
+ { required: true, message: '状态不能为空', trigger: 'change' }
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ companyId() {
|
|
|
|
|
+ return this.$store.state.user.user && this.$store.state.user.user.companyId
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 查询详情需 query,保存需 edit */
|
|
|
|
|
+ canModify() {
|
|
|
|
|
+ return checkPermi(['course:playSourceConfig:query']) &&
|
|
|
|
|
+ checkPermi(['course:playSourceConfig:edit'])
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
created() {
|
|
created() {
|
|
|
- this.getDicts("play_source_type").then(response => {
|
|
|
|
|
- this.typesOptions = response.data.map(item => {
|
|
|
|
|
- return {
|
|
|
|
|
|
|
+ this.getDicts('play_source_type').then(response => {
|
|
|
|
|
+ this.typesOptions = response.data.map(item => ({
|
|
|
...item,
|
|
...item,
|
|
|
- listClass: 'primary'}
|
|
|
|
|
- })
|
|
|
|
|
- });
|
|
|
|
|
- this.getList();
|
|
|
|
|
|
|
+ listClass: 'primary'
|
|
|
|
|
+ }))
|
|
|
|
|
+ })
|
|
|
|
|
+ this.loadMiniAppMasterServer()
|
|
|
|
|
+ this.getList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- // 处理开关配置
|
|
|
|
|
- handleSwitchConfig(row) {
|
|
|
|
|
- this.switchForm.appId = row.appid;
|
|
|
|
|
- this.switchForm.switchStatus = "001"; // 默认关闭状态
|
|
|
|
|
-
|
|
|
|
|
- // 调用接口获取开关状态
|
|
|
|
|
- this.getSwitchConfig(row.appid);
|
|
|
|
|
- this.switchDialogVisible = true;
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- // 获取开关配置
|
|
|
|
|
- getSwitchConfig(appId) {
|
|
|
|
|
- const params = {
|
|
|
|
|
- appId: this.switchForm.appId
|
|
|
|
|
- };
|
|
|
|
|
- updateIsTownOn(params).then(response=>{
|
|
|
|
|
- if (response.code === 200) {
|
|
|
|
|
- if ( response.date){
|
|
|
|
|
- this.switchForm.switchStatus = response.date;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ resetForm,
|
|
|
|
|
+ loadMiniAppMasterServer() {
|
|
|
|
|
+ getCompanyMiniAppList().then(res => {
|
|
|
|
|
+ this.companyMiniAppList = res.data || []
|
|
|
|
|
+ const current = res.current
|
|
|
|
|
+ if (current) {
|
|
|
|
|
+ this.miniAppConfigForm.mainMiniAppId = current.mainMiniAppId ?? null
|
|
|
|
|
+ this.miniAppConfigForm.backupMiniAppId = current.backupMiniAppId ?? null
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.error('获取配置失败: ' + response.msg);
|
|
|
|
|
|
|
+ this.miniAppConfigForm.mainMiniAppId = null
|
|
|
|
|
+ this.miniAppConfigForm.backupMiniAppId = null
|
|
|
}
|
|
}
|
|
|
- }).catch(error => {
|
|
|
|
|
- this.$message.error('请求失败: ' + error.message);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.companyMiniAppList = []
|
|
|
|
|
+ this.miniAppConfigForm.mainMiniAppId = null
|
|
|
|
|
+ this.miniAppConfigForm.backupMiniAppId = null
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
- // 提交开关配置
|
|
|
|
|
- submitSwitchConfig() {
|
|
|
|
|
- const params = {
|
|
|
|
|
- appId: this.switchForm.appId,
|
|
|
|
|
- bock: this.switchForm.switchStatus
|
|
|
|
|
- };
|
|
|
|
|
- updateIsTownOn(params).then(response=>{
|
|
|
|
|
|
|
+ onSubmitMiniApp() {
|
|
|
|
|
+ const miniAppMaster = this.miniAppConfigForm.mainMiniAppId
|
|
|
|
|
+ ? [this.miniAppConfigForm.mainMiniAppId]
|
|
|
|
|
+ : []
|
|
|
|
|
+ const miniAppServer = this.miniAppConfigForm.backupMiniAppId
|
|
|
|
|
+ ? [this.miniAppConfigForm.backupMiniAppId]
|
|
|
|
|
+ : []
|
|
|
|
|
+ this.miniAppSaving = true
|
|
|
|
|
+ updateMiniAppMasterServer({ miniAppMaster, miniAppServer }).then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
- this.$message.success('配置更新成功');
|
|
|
|
|
- this.switchDialogVisible = false;
|
|
|
|
|
|
|
+ this.msgSuccess('保存成功')
|
|
|
|
|
+ this.loadMiniAppMasterServer()
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.error('更新失败: ' + response.msg);
|
|
|
|
|
|
|
+ this.msgError(response.msg || '保存失败')
|
|
|
}
|
|
}
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.msgError('保存失败')
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.miniAppSaving = false
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ getCompanyQueryParams() {
|
|
|
|
|
+ const companyIdNum = Number(this.companyId)
|
|
|
|
|
+ if (!Number.isFinite(companyIdNum)) {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...this.queryParams,
|
|
|
|
|
+ companyIds: [companyIdNum]
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
getList() {
|
|
getList() {
|
|
|
- this.loading = true;
|
|
|
|
|
- list(this.queryParams).then(response => {
|
|
|
|
|
- this.list = response.rows;
|
|
|
|
|
- this.total = response.total;
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const params = this.getCompanyQueryParams()
|
|
|
|
|
+ if (!params) {
|
|
|
|
|
+ this.list = []
|
|
|
|
|
+ this.total = 0
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.loading = true
|
|
|
|
|
+ list(params).then(response => {
|
|
|
|
|
+ this.list = response.rows
|
|
|
|
|
+ this.total = response.total
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
handleQuery() {
|
|
handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
|
|
- this.getList();
|
|
|
|
|
|
|
+ this.queryParams.pageNum = 1
|
|
|
|
|
+ this.getList()
|
|
|
},
|
|
},
|
|
|
resetQuery() {
|
|
resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
|
|
- this.getList();
|
|
|
|
|
- },
|
|
|
|
|
- handleAdd() {
|
|
|
|
|
- this.reset()
|
|
|
|
|
- this.open = true
|
|
|
|
|
- this.title = "添加点播配置"
|
|
|
|
|
|
|
+ this.resetForm('queryForm')
|
|
|
|
|
+ this.getList()
|
|
|
},
|
|
},
|
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
|
- this.reset()
|
|
|
|
|
- const id = row.id || this.ids
|
|
|
|
|
- get(id).then(response => {
|
|
|
|
|
|
|
+ get(row.id).then(response => {
|
|
|
this.form = {
|
|
this.form = {
|
|
|
...response.data,
|
|
...response.data,
|
|
|
- type: response.data.type.toString()
|
|
|
|
|
|
|
+ type: response.data.type != null ? response.data.type.toString() : response.data.type
|
|
|
}
|
|
}
|
|
|
this.open = true
|
|
this.open = true
|
|
|
- this.title = "修改点播配置"
|
|
|
|
|
|
|
+ this.title = '修改小程序配置'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- handleDelete(row) {
|
|
|
|
|
- const id = row.id || this.ids
|
|
|
|
|
- this.$confirm('是否确认删除点播配置编号为"' + id + '"的数据项?', "警告", {
|
|
|
|
|
- confirmButtonText: "确定",
|
|
|
|
|
- cancelButtonText: "取消",
|
|
|
|
|
- type: "warning"
|
|
|
|
|
- }).then(function() {
|
|
|
|
|
- return del(id);
|
|
|
|
|
- }).then(() => {
|
|
|
|
|
- this.getList();
|
|
|
|
|
- this.msgSuccess("删除成功");
|
|
|
|
|
- }).catch(() => {});
|
|
|
|
|
- },
|
|
|
|
|
- handleSelectionChange(selection) {
|
|
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
|
|
- this.single = selection.length!==1
|
|
|
|
|
- this.multiple = !selection.length
|
|
|
|
|
- },
|
|
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- if (this.form.id != null) {
|
|
|
|
|
- update(this.form).then(response => {
|
|
|
|
|
- const {code, msg} = response
|
|
|
|
|
- if (code !== 200) {
|
|
|
|
|
- this.msgError(msg)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.msgSuccess("修改成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- add(this.form).then(response => {
|
|
|
|
|
- const {code, msg} = response
|
|
|
|
|
- if (code !== 200) {
|
|
|
|
|
- this.msgError(msg)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.msgSuccess("新增成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
|
|
+ if (!valid) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const companyIdNum = Number(this.companyId)
|
|
|
|
|
+ if (!Number.isFinite(companyIdNum)) {
|
|
|
|
|
+ this.msgError('获取销售公司失败')
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
|
|
+ this.form.companyIds = [companyIdNum]
|
|
|
|
|
+ this.form.companyId = companyIdNum
|
|
|
|
|
+ update(this.form).then(response => {
|
|
|
|
|
+ const { code, msg } = response
|
|
|
|
|
+ if (code !== 200) {
|
|
|
|
|
+ this.msgError(msg)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.msgSuccess('修改成功')
|
|
|
|
|
+ this.open = false
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
cancel() {
|
|
cancel() {
|
|
|
- this.open = false;
|
|
|
|
|
- this.reset();
|
|
|
|
|
|
|
+ this.open = false
|
|
|
|
|
+ this.form = {}
|
|
|
|
|
+ this.resetForm('form')
|
|
|
},
|
|
},
|
|
|
- reset() {
|
|
|
|
|
- this.form = {
|
|
|
|
|
- id: null,
|
|
|
|
|
- name: null,
|
|
|
|
|
- appid: null,
|
|
|
|
|
- secret: null,
|
|
|
|
|
- img: null,
|
|
|
|
|
- originalId: null,
|
|
|
|
|
- token: 'cbnd7lJvkripVOpyTFAna6NAWCxCrvC',
|
|
|
|
|
- aesKey: 'HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E',
|
|
|
|
|
- msgDataFormat: 'JSON',
|
|
|
|
|
- type: '1'
|
|
|
|
|
|
|
+ getStatusLabel(status) {
|
|
|
|
|
+ const statusMap = {
|
|
|
|
|
+ '-1': '待审核',
|
|
|
|
|
+ '0': '正常',
|
|
|
|
|
+ '1': '半封禁',
|
|
|
|
|
+ '2': '封禁'
|
|
|
}
|
|
}
|
|
|
- this.resetForm("form");
|
|
|
|
|
|
|
+ return statusMap[status] || '未知'
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
<style scoped>
|
|
|
-
|
|
|
|
|
|
|
+.mini-app-config-form {
|
|
|
|
|
+ margin-bottom: 16px;
|
|
|
|
|
+ padding: 16px 16px 0;
|
|
|
|
|
+ background: #f5f7fa;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|