贺智杰 3 дней назад
Родитель
Сommit
8027de7cb2

+ 8 - 7
traceCodePackages/request/index.js

@@ -8,10 +8,11 @@ const storage = new Storage()
 
 const _baseUrl = import.meta.env.VITE_APP_API_BASEURL
 const subdomain = '/yylm'
+// const subdomain = ''
 
 export function downloadFile(url, data = {}) {
-    // const baseUrl = data.baseUrl || _baseUrl
-    const baseUrl = _baseUrl
+    const baseUrl = data.baseUrl || _baseUrl
+    // const baseUrl = _baseUrl
     uni.downloadFile({
         url: baseUrl + subdomain + url, //添加三九分配的子域名
         data,
@@ -46,8 +47,8 @@ export function downloadFile(url, data = {}) {
             }
         },
         fail: (err) => {
-            console.log(`${data?.path},${baseUrl + `` + url},请求头`, data);
-            console.log(`${data?.path},${baseUrl + `` + url},数据`, err);
+            console.log(`${data?.path},${baseUrl + subdomain + url},请求头`, data);
+            console.log(`${data?.path},${baseUrl + subdomain + url},数据`, err);
             uni.showToast({
                 title: '下载失败',
                 icon: 'error',
@@ -59,13 +60,13 @@ export function downloadFile(url, data = {}) {
 export default function request(url, data = {}, method = 'post') {
     const uid = (storage.getStorageSync('userInfo') || { ldap: '' }).ldap
     const d = { ...data, uid }
-    // const baseUrl = data.baseUrl || _baseUrl
-    const baseUrl = _baseUrl
+    const baseUrl = data.baseUrl || _baseUrl
+    // const baseUrl = _baseUrl
     return Request({
         url: subdomain + url, //添加三九分配的子域名
         method,
         data: JSON.stringify(d),
-        // baseUrl
+        baseUrl
     }).then(res => {
         console.log(`${data?.path},${baseUrl + subdomain + url},请求头`, d);
         console.log(`${data?.path},${baseUrl + subdomain + url},数据`, res);

+ 2 - 2
traceCodePackages/traceabilityCodeQuery/pages/detail/index.vue

@@ -57,7 +57,7 @@
           <view class="detail-line" v-if="i < data.enterpriseList.length - 1"></view>
         </view>
         <view class="detail-right">
-          <view class="detail-title detail-bold">{{ value.entName }}</view>
+          <view class="detail-title" :class="{'detail-bold': i == 0}">{{ value.entName }}</view>
           <view class="detail-desc">[{{ value.entTypeName }}]&nbsp;{{ getRegion(value) }}</view>
           <view class="detail-extra" v-if="!!value.inBoundBillsTime || !!value.outBoundBillsTime">
             <view class="detail-extra-item detail-text-red" v-if="!!value.inBoundBillsTime">
@@ -408,7 +408,7 @@ export default {
 }
 
 .detail-title {
-  font-size: 36rpx;
+  font-size: 32rpx;
   color: #333;
 }
 

+ 1 - 0
traceCodePackages/traceabilityCodeQuery/pages/index.vue

@@ -154,6 +154,7 @@ export default {
               icon: "none",
               duration: 2000,
             });
+            this.onTapHistory({ tracCode: res.result });
           }
         },
         fail: (err) => {

+ 4 - 3
traceCodePackages/traceabilityReport/pages/customerScanningRate/index.vue

@@ -28,7 +28,8 @@
       <ScanRateTable ref="scanTableVariety" title="品种扫码率" :columns="varietyColumns" tableWidth="1120rpx"
         headerFontSize="24rpx" bodyFontColor="#000" :api="`/bills/geVarietyScanRate`" tableType="variety" :params="{
           type: activeRange,
-        }" :showSummary="false" :products="products" :regions="regions" dropdownDirection="top" @dropdown-open="closeDropdown" />
+        }" :showSummary="false" :products="products" :regions="regions" dropdownDirection="top"
+        @dropdown-open="closeDropdown" />
       <!-- <view class="scan-rate-footer">
         <view class="scan-rate-footer-btn" @click="onExport">导出数据</view>
       </view> -->
@@ -121,7 +122,7 @@ export default {
       }).then(res => {
         if (res.code == 200) {
           const _data = res.data;
-          this.regions = _data;
+          this.regions = [{ regionCode: null, regionName: '全省份' }, ..._data];
         }
       })
     },
@@ -131,7 +132,7 @@ export default {
       }).then(res => {
         if (res.code == 200) {
           const _data = res.data;
-          this.products = _data;
+          this.products = [{ drugEntBaseInfoId: null, physicName: '全品种' }, ..._data];
         }
       })
     },

+ 25 - 44
traceCodePackages/traceabilityReport/pages/customerScanningRate/wigets/ScanRateTable.vue

@@ -6,11 +6,11 @@
     <view v-if="showHeader" class="section-header">
       <text class="section-title">{{ title }}</text>
       <view :style="{ display: 'flex' }">
-        <view v-if="showSelector && tableType === 'variety' && region" class="selector-wrap">
+        <view v-if="showSelector && tableType === 'variety'" class="selector-wrap">
           <view class="selector" @click.stop="toggleDropdownRegion">
             <text class="selector-text">{{
-              region?.regionName || region?.name || "-"
-              }}</text>
+              region?.regionCode ? region.regionName : "选择省"
+            }}</text>
             <text class="selector-arrow" :class="{ open: dropdownRegionOpen }"></text>
           </view>
           <view class="dropdown" v-show="dropdownRegionOpen" :style="dropdownDirection === 'top'
@@ -29,15 +29,15 @@
                   color: '#fff',
                 }
                 : {}
-                " @click.stop="selectProduct('region', p)">{{ p.regionName || p.name || p }}</view>
+                " @click.stop="selectProduct('region', p)">{{ p.regionName || p }}</view>
               <view v-if="regionList.length === 0" class="dropdown-item" style="text-align: center; color: #999;">暂无数据
               </view>
             </scroll-view>
           </view>
         </view>
-        <view v-if="showSelector && product" class="selector-wrap">
+        <view v-if="showSelector" class="selector-wrap">
           <view class="selector" @click.stop="toggleDropdown">
-            <text class="selector-text">{{ product?.physicName }}</text>
+            <text class="selector-text">{{ product?.drugEntBaseInfoId ? product.physicName : '选择品种' }}</text>
             <text class="selector-arrow" :class="{ open: dropdownOpen }"></text>
           </view>
           <view class="dropdown" v-show="dropdownOpen" :style="dropdownDirection === 'top'
@@ -53,7 +53,7 @@
             </view>
             <scroll-view scroll-y="true" class="dropdown-scroll-view" lower-threshold="80"
               @scrolltolower="loadMoreProducts">
-              <view class="dropdown-item" v-for="(p, i) in productList" :key="getUid()" :style="p.drugEntBaseInfoId === product.drugEntBaseInfoId
+              <view class="dropdown-item" v-for="(p, i) in productList" :key="getUid()" :style="p.drugEntBaseInfoId === product?.drugEntBaseInfoId
                 ? {
                   backgroundColor: '#2c69ff',
                   color: '#fff',
@@ -139,15 +139,15 @@
         </view>
       </scroll-view>
       <view v-if="loading" class="no-data" :style="{ height: 'auto', top: cellHeight }">
-          <view class="row loading-row">
-            <view class="loading-wrapper">
-              <image class="loading-icon" :src="loadingImg" />
-            </view>
+        <view class="row loading-row">
+          <view class="loading-wrapper">
+            <image class="loading-icon" :src="loadingImg" />
           </view>
         </view>
-        <view v-if="!loading && (!list || list.length === 0)" class="no-data" :style="{ top: cellHeight }">
-          <EmptyView />
-        </view>
+      </view>
+      <view v-if="!loading && (!list || list.length === 0)" class="no-data" :style="{ top: cellHeight }">
+        <EmptyView />
+      </view>
     </view>
   </view>
 </template>
@@ -314,43 +314,23 @@ export default {
       }
     },
     product(val) {
-      if (val && this.params) {
-        if (this.tableType === 'variety') {
-          if (this.region) {
-            this.resetFetch();
-          }
-        } else {
-          this.resetFetch();
-        }
-      }
+      this.resetFetch();
     },
     region: {
       handler(val) {
-        if (val && this.product && this.params) {
-          this.resetFetch();
-        }
+        this.resetFetch();
       },
       deep: true,
     },
     params: {
       handler(newVal, oldVal) {
-        if (newVal && this.product) {
-          if (this.tableType === 'variety') {
-            if (this.region) {
-              this.resetFetch();
-            }
-          } else {
-            this.resetFetch();
-          }
-        }
+        if (newVal !== oldVal && JSON.stringify(newVal) === JSON.stringify(oldVal)) return;
+        this.resetFetch();
       },
       deep: true,
     },
     products: {
       handler(newVal, oldVal) {
-        if (!this.product) {
-          this.product = this.products[0];
-        }
         if (this.dropdownOpen) {
           this.initProductList();
         }
@@ -359,9 +339,6 @@ export default {
     },
     regions: {
       handler(newVal, oldVal) {
-        if (!this.region) {
-          this.region = this.regions[0];
-        }
         if (this.dropdownRegionOpen) {
           this.initRegionList();
         }
@@ -385,7 +362,7 @@ export default {
     //     () => { }
     //   );
     // }
-    // this.fetchList();
+    this.fetchList();
   },
   methods: {
     initRegionList() {
@@ -529,8 +506,8 @@ export default {
         if (this.fetchLoading) return;
         this.fetchLoading = true;
         request(this.api, {
-          drugEntBaseInfoId: this.product?.drugEntBaseInfoId,
-          regionCode: this.region?.regionCode,
+          drugEntBaseInfoId: this.product ? (this.product?.drugEntBaseInfoId || '') : '',
+          regionCode: this.region ? (this.region?.regionCode || '') : '',
           ...(this.params || {}),
           pageNum: this.tablePage,
           pageSize: this.tablePageSize,
@@ -701,6 +678,7 @@ export default {
   width: 8rpx;
   height: 50%;
   background: #2c69ff;
+  border-radius: 10px;
 }
 
 .selector-wrap {
@@ -886,8 +864,10 @@ export default {
 
 /* hide scrollbars for H5/App while preserving scroll behavior */
 .no-scrollbar {
+  position: relative;
   -ms-overflow-style: none;
   scrollbar-width: none;
+  z-index: 2;
 }
 
 ::v-deep .no-scrollbar::-webkit-scrollbar {
@@ -935,5 +915,6 @@ export default {
   top: 76rpx;
   left: 0;
   width: 100%;
+  z-index: 1;
 }
 </style>

+ 50 - 17
traceCodePackages/traceabilityReport/pages/index.vue

@@ -1,22 +1,30 @@
 <template>
-  <view class="page" @click.stop="closeDropdowns">
+  <view v-if="hasFunction" class="page" @click.stop="closeDropdowns">
     <view class="tabs-container">
       <view class="tabs">
-        <view class="tab" :class="{ active: activeTab === 'scan' }" @click="activeTab = 'scan'">扫码率</view>
-        <view v-if="hasReportFunction" class="tab" :class="{ active: activeTab === 'export' }" @click="activeTab = 'export'">报表导出</view>
-        <view class="tab" :class="{ active: activeTab === 'blacklist' }" @click="activeTab = 'blacklist'">黑名单汇总</view>
+        <view v-if="hasScanFunction" class="tab" :class="{ active: activeTab === 'scan' }" @click="activeTab = 'scan'">
+          扫码率</view>
+        <view v-if="hasReportFunction" class="tab" :class="{ active: activeTab === 'export' }"
+          @click="activeTab = 'export'">报表导出</view>
+        <view v-if="hasBlacklistFunction" class="tab" :class="{ active: activeTab === 'blacklist' }"
+          @click="activeTab = 'blacklist'">黑名单汇总</view>
       </view>
     </view>
-    <view class="content" v-show="activeTab === 'scan'">
+    <view class="content" v-show="activeTab === 'scan' && hasScanFunction">
       <ScanningRate ref="scanRate" />
     </view>
-    <view class="content" :style="{ padding: '0', marginTop: '85rpx' }" v-show="activeTab === 'export'">
+    <view class="content" :style="{ padding: '0', marginTop: '85rpx' }"
+      v-show="activeTab === 'export' && hasReportFunction">
       <ReportExport />
     </view>
-    <view class="content" :style="{ padding: '0', marginTop: '85rpx' }" v-show="activeTab === 'blacklist'">
+    <view class="content" :style="{ padding: '0', marginTop: '85rpx' }"
+      v-show="activeTab === 'blacklist' && hasBlacklistFunction">
       <Blacklist />
     </view>
   </view>
+  <view v-else-if="!functionLoading" class="page">
+    <Empty text="您无权限访问" />
+  </view>
 </template>
 
 <script>
@@ -24,16 +32,20 @@ import LoadingImg from "../../static/images/loading.png";
 import ReportExport from "./reportExport/index.vue";
 import ScanningRate from "./customerScanningRate/index.vue";
 import Blacklist from "./blacklist/index.vue";
+import Empty from "../../wigets/empty.vue";
 import { hasFunction } from '../../utils/utils.js'
 export default {
   components: {
     ScanningRate,
     ReportExport,
     Blacklist,
+    Empty,
   },
   data() {
     return {
+      hasScanFunction: false,
       hasReportFunction: false,
+      hasBlacklistFunction: false,
       loading: true,
       LoadingImg,
       activeTab: "scan",
@@ -42,24 +54,45 @@ export default {
       filterForm: { report: "", product: "" },
       filterDropdown: { report: false, product: false },
       filterDateRange: [],
+      functionLoading: true,
     };
   },
   created() {
-    uni.showLoading({
-      title: '加载中',
-    })
-    hasFunction('trace-code-task').then(res => {
-      this.hasReportFunction = res
-      uni.hideLoading()
-    }).catch(err => {
-      this.hasReportFunction = false
-      uni.hideLoading()
-    })
+    this.getFunc()
+  },
+  computed: {
+    hasFunction() {
+      return this.hasScanFunction || this.hasReportFunction || this.hasBlacklistFunction
+    }
   },
   methods: {
     closeDropdowns() {
       this.$refs.scanRate.closeDropdown();
     },
+    async getFunc() {
+      uni.showLoading({
+        title: '加载中',
+      })
+      await hasFunction(['scan-rate-list', 'trace-code-task', 'blacklist-customers-list']).then(res => {
+        this.hasScanFunction = res[0]
+        this.hasReportFunction = res[1]
+        this.hasBlacklistFunction = res[2]
+      }).catch(err => {
+        this.hasScanFunction = false
+        this.hasReportFunction = false
+        this.hasBlacklistFunction = false
+        // uni.hideLoading()
+      })
+      if (this.hasScanFunction) {
+        this.active = 'scan'
+      } else if (this.hasReportFunction) {
+        this.activeTab = 'export'
+      } else if (this.hasBlacklistFunction) {
+        this.activeTab = 'blacklist'
+      }
+      this.functionLoading = false
+      uni.hideLoading()
+    }
   },
 };
 </script>

+ 3 - 3
traceCodePackages/traceabilityReport/pages/reportExport/index.vue

@@ -85,13 +85,13 @@
           paddingBottom: '40rpx',
         }">
           <view class="report-export-create-modal-row">
-            <text class="report-export-create-modal-label">片区</text>
+            <text class="report-export-create-modal-label">省份</text>
             <view class="report-export-create-modal-inputwrap"
               @click.stop="modalType !== 'read' && openDropdown('region')">
               <view class="report-export-create-modal-static">{{
                 form.region && form.region.regionName
                   ? form.region.regionName
-                  : "请选择片区"
+                  : "请选择省份"
               }}</view>
 
               <view class="report-export-input-arrow" v-if="modalType !== 'read'"></view>
@@ -109,7 +109,7 @@
                   </view>
                   <view v-if="!filteredOptions('region') || filteredOptions('region').length === 0"
                     class="report-export-create-modal-dropdown-item">
-                    未查找到该片区</view>
+                    未查找到该省份</view>
                 </scroll-view>
               </view>
             </view>

+ 5 - 1
traceCodePackages/utils/utils.js

@@ -72,7 +72,11 @@ export function hasFunction(key) {
     ).then((res) => {
       if (res?.data?.permissions) {
         const permissions = res.data.permissions || []
-        resolve(permissions.includes(key))
+        if(Array.isArray(key)) {
+          resolve(key.map(item => permissions.includes(item)))
+        } else {
+          resolve(permissions.includes(key))
+        }
       } else {
         reject(res)
       }