Explorar el Código

医健宝-医健宝流量充值,权限

chenguo hace 4 días
padre
commit
1e4a75e1b1

+ 9 - 1
src/api/his/patient.js

@@ -9,6 +9,14 @@ export function listPatient(query) {
   })
 }
 
+export function listPatientList(query) {
+  return request({
+    url: '/his/patient/userList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询病人详细
 export function getPatient(patientId) {
   return request({
@@ -57,4 +65,4 @@ export function exportPatient(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 29 - 6
src/views/company/companyTraffic/index.vue

@@ -53,7 +53,7 @@
 
       <el-table-column label="公司名称" align="center" prop="companyName" :show-overflow-tooltip="true" />
 
-      <el-table-column label="流量余额(KB)" align="center" prop="balance" />
+      <el-table-column label="流量余额" align="center" prop="balance" :formatter="formatBalance"/>
 
 <!--      <el-table-column label="操作人员" align="center" prop="createBy" />
 
@@ -68,7 +68,7 @@
           <el-button
             size="mini"
             type="text"
-            icon="el-icon-view"
+            icon="el-icon-money"
             @click="handleRechargeCompany(scope.row)"
             v-hasPermi="['company:traffic:charge']"
           >充值</el-button>
@@ -89,7 +89,7 @@
     <el-dialog :title="rechargeTitle" :visible.sync="rechargeOpen" width="500px" append-to-body :before-close="resetOption">
       <el-form ref="rechargeForm" :model="rechargeForm" :rules="rechargeRules" label-width="100px">
 
-        <el-form-item label="公司ID" prop="companyId">
+        <el-form-item label="公司ID" prop="companyId" v-show="!isCompanyRecharge">
           <el-select
             v-model="rechargeForm.companyId"
             filterable
@@ -101,7 +101,6 @@
             style="width: 220px"
             clearable
             size="small"
-            :disabled="isCompanyRecharge"
           >
             <el-option
               v-for="item in companyOptions"
@@ -124,7 +123,7 @@
             v-model="rechargeForm.chargeAmount"
             :min="1"
             :max="999999999"
-            placeholder="请输入充值金额(KB)"
+            placeholder="请输入充值金额()"
             controls-position="right"
             style="width: 100%"
           />
@@ -218,8 +217,9 @@ export default {
   methods: {
     resetForm,
     resetOption(){
-      this.companyOptions = [];
       this.rechargeOpen = false;
+      this.companyOptions = [];
+      this.rechargeForm = {};
     },
     /** 查询流量记录列表 */
     getList() {
@@ -256,9 +256,29 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
+      this.rechargeForm = {};
       this.handleQuery();
     },
 
+    formatBalance(row){
+      //对流量值进行判断,换算成GB或TB
+      if(!row.balance){
+        return "0KB";
+      }
+      if(row.balance < 1024){
+        return row.balance + "KB";
+      }
+      else if(row.balance < 1024 * 1024){
+        return (row.balance / 1024).toFixed(2) + "MB";
+      }
+      else if(row.balance < 1024 * 1024 * 1024){
+        return (row.balance / (1024 * 1024)).toFixed(2) + "GB";
+      }
+      else{
+        return (row.balance / (1024 * 1024 * 1024)).toFixed(2) + "TB";
+      }
+    },
+
     /** 多选框选中数据 */
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
@@ -270,6 +290,7 @@ export default {
     handleRecharge() {
       this.rechargeTitle = "流量充值";
       this.resetForm("rechargeForm");
+      this.rechargeForm = {};
       this.companyOptions = [];
       this.isCompanyRecharge = false;
       this.rechargeForm.operationType = 1; // 默认充值
@@ -278,6 +299,7 @@ export default {
     handleRechargeCompany(row) {
       this.rechargeTitle = "流量充值";
       this.resetForm("rechargeForm");
+      this.rechargeForm = {};
       this.companyOptions = [];
       this.isCompanyRecharge = true;
       this.rechargeForm.companyId = row.companyId;
@@ -314,6 +336,7 @@ export default {
     cancelRecharge() {
       this.rechargeOpen = false;
       this.resetForm("rechargeForm");
+      this.rechargeForm = {};
     }
   }
 };

+ 11 - 3
src/views/components/his/userPatietDetails.vue

@@ -170,7 +170,15 @@
 </template>
 
 <script>
-import { listPatient, getPatient, delPatient, addPatient, updatePatient, exportPatient } from "@/api/his/patient";
+import {
+  listPatient,
+  getPatient,
+  delPatient,
+  addPatient,
+  updatePatient,
+  exportPatient,
+  listPatientList
+} from '@/api/his/patient'
 import {getUserList} from "@/api/his/doctor";
 export default {
   name: "Patient",
@@ -297,7 +305,7 @@ export default {
     /** 查询病人列表 */
     getList() {
       this.loading = true;
-      listPatient(this.queryParams).then(response => {
+      listPatientList(this.queryParams).then(response => {
         this.patientList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -306,7 +314,7 @@ export default {
     getPatList(id){
       this.loading = true;
       this.queryParams.userId=id;
-      listPatient(this.queryParams).then(response => {
+      listPatientList(this.queryParams).then(response => {
         this.patientList = response.rows;
         this.total = response.total;
         this.loading = false;

+ 46 - 0
src/views/index.vue

@@ -229,6 +229,24 @@
         </div>
 
         <div class="action-group">
+          <!-- 选择部门 -->
+          <el-select v-model="deptId" placeholder="请选择部门" size="small" @change="handleDeptChange" style="width: 100px">
+            <el-option
+              v-for="company in deptOptions"
+              :key="company.deptId"
+              :label="company.deptName"
+              :value="company.deptId"
+            />
+          </el-select>
+          <!-- 选择销售公司 -->
+          <el-select  v-model="companyId" placeholder="请选择销售公司" size="small" clearable @change="handleCompanyChange" style="width: 180px" >
+            <el-option
+              v-for="company in companyOptions"
+              :key="company.companyId"
+              :label="company.companyName"
+              :value="company.companyId"
+            />
+          </el-select>
           <el-radio-group v-model="userTypeText" @change="handleUserType">
             <el-radio-button label="会员"></el-radio-button>
             <el-radio-button label="企微"></el-radio-button>
@@ -523,6 +541,8 @@ import {
   watchCourseTopTen, watchEndPlayTrend
 } from "@/api/statistics/statistics";
 import dayjs from 'dayjs';
+import { listDept } from '@/api/system/dept'
+import { listCompany } from '@/api/his/company'
 
 
 const viewCharOption = {
@@ -857,6 +877,11 @@ export default {
   components: {CountTo},
   data() {
     return {
+      deptOptions:[],
+      deptId:this.$store.state.user.deptId,
+      companyInitOptions:[],
+      companyOptions:[],
+      companyId:null,
       percentage: 0,
       // 预测message
       remainMessage: '',
@@ -957,8 +982,29 @@ export default {
   },
   created() {
     this.refresh();
+    listDept().then(res => {
+      this.deptOptions = res.data;
+    });
+    listCompany().then(res => {
+      this.companyIntiOptions = res.rows;
+      this.companyOptions = this.companyIntiOptions.filter(item => item.deptId === this.deptId);
+    });
   },
   methods: {
+    //首页统计选择部门、销售公司
+    handleDeptChange(){
+        this.companyOptions = this.companyIntiOptions.filter(item => item.deptId === this.deptId);
+        this.companyId = null;
+        this.refresh();
+    },
+    handleCompanyChange(){
+      if(this.companyId){
+        this.deptId = this.companyOptions.filter(item => item.companyId === this.companyId)[0].deptId;
+        this.refresh();
+      }else{
+        this.refresh();
+      }
+    },
     handleUserType(){
       if(this.userTypeText === '会员'){
         this.userType = 1