Sfoglia il codice sorgente

批量绑定小程序

yjwang 7 ore fa
parent
commit
9f31cc6033
4 ha cambiato i file con 76 aggiunte e 1 eliminazioni
  1. 2 0
      public/index.html
  2. 9 0
      src/api/his/company.js
  3. 59 1
      src/views/his/company/index.vue
  4. 6 0
      vue.config.js

+ 2 - 0
public/index.html

@@ -7,6 +7,8 @@
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
     <!-- <title><%= webpackConfig.name %></title> -->
+    <!-- 添加版本号防止缓存 -->
+    <meta name="version" content="<%= new Date().getTime() %>">
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
     <!-- <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=UZQBZ-SYQL3-LYF3K-Y7FAL-N3656-2DBJ4"></script> -->
 	  <style>

+ 9 - 0
src/api/his/company.js

@@ -55,6 +55,15 @@ export function updateCompany(data) {
   })
 }
 
+// 批量修改企业主备小程序
+export function batchUpdateMiniApp(data) {
+  return request({
+    url: '/company/company/batchUpdateMiniApp',
+    method: 'post',
+    data: data
+  })
+}
+
 // 删除诊所管理
 export function delCompany(companyId) {
   return request({

+ 59 - 1
src/views/his/company/index.vue

@@ -112,6 +112,17 @@
         >导出
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="multiple"
+          @click="batchDialogVisible = true"
+          v-hasPermi="['his:company:edit']"
+        >批量修改</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -613,6 +624,25 @@
         <el-button @click="revenue.open=false">取 消</el-button>
       </div>
     </el-dialog>
+    <!-- 批量修改对话框 -->
+    <el-dialog title="批量修改主/备小程序" :visible.sync="batchDialogVisible" width="400px" append-to-body>
+      <el-form label-width="100px">
+        <el-form-item label="主小程序">
+          <el-select v-model="batchMaster" placeholder="请选择小程序" clearable filterable size="small" style="width:100%">
+            <el-option v-for="item in miniAppList" :key="item.appId" :label="item.appName" :value="item.appId" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="备用小程序">
+          <el-select v-model="batchBackup" placeholder="请选择小程序" clearable filterable size="small" style="width:100%">
+            <el-option v-for="item in miniAppList" :key="item.appId" :label="item.appName" :value="item.appId" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer">
+        <el-button @click="batchDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="batchLoading" @click="submitBatchUpdate">确定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -623,6 +653,7 @@ import {
   delCompany,
   addCompany,
   updateCompany,
+  batchUpdateMiniApp,
   recharge,
   deduct,
   exportCompany,
@@ -809,7 +840,12 @@ export default {
       },
       maAppList: [],
       miniAppList: [],
-      customAppList: []
+      customAppList: [],
+      // 批量修改相关
+      batchDialogVisible: false,
+      batchMaster: null,
+      batchBackup: null,
+      batchLoading: false,
     }
   },
   created() {
@@ -840,6 +876,7 @@ export default {
     docList().then(response => {
       this.doctor = response.rows
     })
+    this.getAppList();
   },
   methods: {
     // 添加分账账户
@@ -1204,6 +1241,27 @@ export default {
         }
       }).catch(() => {
       });
+    },
+    // 批量修改提交
+    submitBatchUpdate() {
+      if (!this.batchMaster && !this.batchBackup) {
+        this.$message.warning('请至少选择主小程序或备用小程序')
+        return
+      }
+      this.batchLoading = true
+      const data = {
+        ids: this.ids
+      }
+      if (this.batchMaster) data.miniAppMaster = [this.batchMaster]
+      if (this.batchBackup) data.miniAppServer = [this.batchBackup]
+      batchUpdateMiniApp(data).then(res => {
+        this.batchLoading = false
+        this.$message.success(res.msg || '批量修改成功')
+        this.batchDialogVisible = false
+        this.getList()
+      }).catch(() => {
+        this.batchLoading = false
+      })
     }
   }
 }

+ 6 - 0
vue.config.js

@@ -62,6 +62,12 @@ module.exports = {
     config.plugins.delete('preload') // TODO: need test
     config.plugins.delete('prefetch') // TODO: need test
 
+    // 给 index.html 添加版本号参数,防止缓存
+    config.plugin('html').tap(args => {
+      args[0].hash = true
+      return args
+    })
+
     // set svg-sprite-loader
     config.module
       .rule('svg')