Bladeren bron

feat:“首页数据统计可以按月统计,添加56种花型”

soobin 1 jaar geleden
bovenliggende
commit
2ccf22110c

+ 15 - 3
src/assets/language/en.json

@@ -9,7 +9,16 @@
     "yesterday": "Yesterday",
     "thisWeek": "Week",
     "thisMonth": "Month",
-    "other": "Other"
+    "other": "Other",
+    "timeType": "Select statistical type",
+    "monthDate": "Statistical date",
+    "monthStartDate": "Start date",
+    "monthEndDate": "End date",
+    "nextStep": "Next",
+    "dayType": "Daily statistics",
+    "monthType": "Monthly statistics",
+    "monthTip1": "The time span cannot exceed six months",
+    "monthTip2": "The end time cannot be later than the start time"
   },
   "typeSelectList": {
     "thisMerchant": "This Merchant",
@@ -242,6 +251,9 @@
     "addGroup": "Add Group",
     "setAlarm": "Set alarm",
     "equipmentName": "Machine name",
+    "lockCondition": "Lock condition",
+    "lockState": "Unavailable, locked",
+    "unLockState": "Normal use, unlocked machine",
     "equipmentNameTips": "No name has been set",
     "selectDevice": "Select Machine",
     "selectTime": "Select time",
@@ -444,8 +456,8 @@
     "lastRefreshTime": "Recent refresh time",
     "machineUniqueCode": "Machine Code",
     "furnaceHeadTemperature": "Furnace head temperature",
-    "stirringTemperature": "Stirring temperature",
-    "cornGeneratorTemperature": "Corn generator temperature",
+    "stirringTemperature": "Temperature two",
+    "cornGeneratorTemperature": "Temperature one",
     "cupQuantity": "Cup quantity",
     "numberOneTm": "NO.1000",
     "candyGeneratorTm": "Generator temperature",

+ 12 - 3
src/assets/language/ja.json

@@ -9,7 +9,16 @@
         "yesterday": "昨日",
         "thisWeek": "今週",
         "thisMonth": "今月",
-        "other": "その他"
+        "other": "その他",
+        "timeType": "統計タイプを選択します",
+        "monthDate": "日付を集計します",
+        "monthStartDate": "開始日です",
+        "monthEndDate": "終了期日",
+        "nextStep": "次のステップです",
+        "dayType": "日毎に集計する",
+        "monthType": "月ごとに集計します",
+        "monthTip1": "期間は半年以内です",
+        "monthTip2": "終了時間が開始時間より小さくなってはいけません"
     },
     "typeSelectList": {
         "thisMerchant": "この店舗",
@@ -450,8 +459,8 @@
         "furnaceHeadTemperature": "釜の温度",
         "temperatureInCabinet": "内部温度",
         "humidityInCabinet": "内部湿度",
-        "stirringTemperature": "撹拌温度",
-        "cornGeneratorTemperature": "コーンジェネレータ温度",
+        "stirringTemperature": "温度2です",
+        "cornGeneratorTemperature": "温度1です",
         "cupQuantity": "カップの残量",
         "numberOneTm": "NO.1000",
         "candyGeneratorTm": "ジェネレーター温度",

+ 13 - 4
src/assets/language/zh.json

@@ -9,7 +9,16 @@
     "yesterday": "昨日",
     "thisWeek": "本周",
     "thisMonth": "本月",
-    "other": "其他"
+    "other": "其他",
+    "timeType": "选择统计类型",
+    "monthDate": "统计日期",
+    "monthStartDate": "开始日期",
+    "monthEndDate": "结束日期",
+    "nextStep": "下一步",
+    "dayType": "按日统计",
+    "monthType": "按月统计",
+    "monthTip1": "时间跨度不能超过半年",
+    "monthTip2": "结束时间不能小于开始时间"
   },
   "typeSelectList": {
     "thisMerchant": "本商户",
@@ -450,9 +459,9 @@
     "furnaceHeadTemperature": "炉头温度",
     "temperatureInCabinet": "柜内温度",
     "humidityInCabinet": "柜内湿度",
-    "stirringTemperature": "搅拌温度",
-    "cornGeneratorTemperature": "玉米发生器温度",
-    "cupQuantity": "杯子剩余量",
+    "stirringTemperature": "温度",
+    "cornGeneratorTemperature": "温度",
+    "cupQuantity": "杯子量",
     "numberOneTm": "NO.1000",
     "candyGeneratorTm": "发生器温度",
     "outsideTm": "柜外温度",

BIN
src/assets/order/spunSugar/goods/A71.png


BIN
src/assets/order/spunSugar/goods/A72.png


BIN
src/assets/order/spunSugar/goods/A73.png


BIN
src/assets/order/spunSugar/goods/A74.png


BIN
src/assets/order/spunSugar/goods/A75.png


BIN
src/assets/order/spunSugar/goods/A76.png


BIN
src/assets/order/spunSugar/goods/A77.png


BIN
src/assets/order/spunSugar/goods/A78.png


BIN
src/assets/order/spunSugar/goods/A79.png


BIN
src/assets/order/spunSugar/goods/A80.png


BIN
src/assets/order/spunSugar/goods/A81.png


BIN
src/assets/order/spunSugar/goods/A82.png


BIN
src/assets/order/spunSugar/goods/A83.png


BIN
src/assets/order/spunSugar/goods/A84.png


+ 131 - 15
src/components/dateSelectList/index.vue

@@ -17,6 +17,21 @@
         <!-- 日期选择 -->
         <van-calendar color="#4d6add" v-model:show="calendarShow" type="range" :show-confirm="false"
           :allow-same-day="true" :min-date="minDate" @confirm="calendarConfirm" />
+        <!-- 选择统计类型 -->
+        <van-popup v-model:show="timeTypeShow" position="bottom">
+          <van-picker :title="$t('dateSelectList.timeType')" :columns="timeTypeList" @confirm="timeTypeConfirm"
+            @cancel="timeTypeCancel" />
+        </van-popup>
+        <!-- 按月统计 -->
+        <van-popup v-model:show="monthDateShow" position="bottom">
+          <van-picker-group :title="$t('dateSelectList.monthDate')"
+            :tabs="[$t('dateSelectList.monthStartDate'), $t('dateSelectList.monthEndDate')]"
+            :next-step-text="$t('dateSelectList.nextStep')" @confirm="monthDateConfirm" @cancel="monthDateCancel"
+            position="bottom">
+            <van-date-picker v-model="monthStartDate" :min-date="minDate" :columns-type="monthDateType" />
+            <van-date-picker v-model="monthEndDate" :min-date="minDate" :columns-type="monthDateType" />
+          </van-picker-group>
+        </van-popup>
       </div>
     </div>
   </div>
@@ -26,26 +41,34 @@
 import { ref } from "vue";
 import dateUtil from "@/utils/dateUtil";
 import { getLoginUser } from "@/common/js/utils";
+import { showToast } from "vant";
+import { useI18n } from 'vue-i18n';
+
 
 export default {
   name: "dateSelectList",
   components: {},
   setup(props, { emit }) {
     const minDate = new Date(2018, 1, 1);
+    const { t } = useI18n();
     const user = getLoginUser();
     // 时间类型
     const timeType = ref("0");
+    // 统计类型
+    const chartType = ref("0");
     // 时间类型切换
     const timeChange = (data) => {
       timeType.value = data;
       // 当时时间类型切换为其他时间弹出日期控件
-      (data === "4") ? calendarShow.value = true : outputDate();
+      // (data === "4") ? calendarShow.value = true : outputDate();
+      (data === "4") ? timeTypeShow.value = true : outputDate();
     };
     let calendarDate = [];
     const calendarShow = ref(false);
     // 其他时间日期组件确认返回
     const calendarConfirm = (data) => {
       calendarShow.value = false;
+      console.log(data);
       calendarDate = data;
       outputDate();
     };
@@ -114,30 +137,123 @@ export default {
       }
       // 其他时间
       if (timeType.value === "4") {
-        const firstday = Date.parse(calendarDate[0]);
-        const lastday = Date.parse(calendarDate[1]);
-        const diffDate = Math.abs(firstday - lastday);
-        const totalDays = Math.floor(diffDate / (1000 * 3600 * 24));
-        if (totalDays === 0) {
-          params.chartType = "day";
-        } else if (dateUtil.isSameWeek(calendarDate[0], calendarDate[1])) {
-          params.chartType = "week";
+
+        // const diffDate = Math.abs(firstday - lastday);
+        // const totalDays = Math.floor(diffDate / (1000 * 3600 * 24));
+        // if (totalDays === 0) {
+        //   params.chartType = "day";
+        // } else if (dateUtil.isSameWeek(calendarDate[0], calendarDate[1])) {
+        //   params.chartType = "week";
+        // } else {
+        //   params.chartType = "month";
+        // }
+        let startTime = null;
+        let endTime = null;
+        if (chartType.value == '1') {
+          // 按日统计
+          const firstday = Date.parse(calendarDate[0]);
+          const lastday = Date.parse(calendarDate[1]);
+          const diffDate = Math.abs(firstday - lastday);
+          const totalDays = Math.floor(diffDate / (1000 * 3600 * 24));
+          if (totalDays === 0) {
+            params.chartType = "day";
+          } else {
+            params.chartType = "month";
+          }
+          timeTypeShow.value = false;
+          startTime = calendarDate[0];
+          endTime = calendarDate[1];
+          params.startDate =
+            dateUtil.formateDate(startTime, "yyyy-MM-dd") + " 00:00:00";
+          params.endDate =
+            dateUtil.formateDate(endTime, "yyyy-MM-dd") + " 23:59:59";
         } else {
-          params.chartType = "month";
+          // 按月统计
+          params.chartType = "year";
+          startTime = new Date(monthStartDate.value[0] + '-' + monthStartDate.value[1] + '-01');
+          endTime = new Date(monthEndDate.value[0] + '-' + monthEndDate.value[1] + '-01');
+          console.log("startTime", startTime);
+          console.log("endTime", endTime);
+          endTime.setMonth(endTime.getMonth() + 1);
+          params.startDate =
+            dateUtil.formateDate(startTime, "yyyy-MM-dd") + " 00:00:00";
+          params.endDate =
+            dateUtil.formateDate(endTime, "yyyy-MM-dd") + " 00:00:00";
+          timeTypeShow.value = false;
         }
-        params.startDate =
-          dateUtil.formateDate(calendarDate[0], "yyyy-MM-dd") + " 00:00:00";
-        params.endDate =
-          dateUtil.formateDate(calendarDate[1], "yyyy-MM-dd") + " 23:59:59";
+
       }
       emit('update', params);
     };
+    // 统计类型
+    const timeTypeShow = ref(false);
+    const timeTypeList = [
+      { text: t('dateSelectList.dayType'), value: "1" },
+      { text: t('dateSelectList.monthType'), value: "2" },
+    ];
+    const timeTypeConfirm = ({ selectedOptions }) => {
+      console.log('selectedOptions[0].text', selectedOptions[0].value);
+      // 按日统计
+      chartType.value = selectedOptions[0].value;
+      if (selectedOptions[0].value == '1') {
+        calendarShow.value = true;
+      } else {
+        monthDateShow.value = true;
+      }
+
+    }
+    const timeTypeCancel = () => { timeTypeShow.value = false; }
+    // 按月统计
+    // 创建一个Date对象,表示当前时间
+    const currentDate = new Date();
+    // 获取当前时间的年份
+    const currentYear = currentDate.getFullYear();
+    // 获取当前时间的月份(注意,月份是从0开始的,所以要加1)
+    const currentMonth = currentDate.getMonth() + 1;
+    const monthDateShow = ref(false);
+    const monthStartDate = ref([currentYear, currentMonth]);
+    const monthEndDate = ref([currentYear, currentMonth]);
+    const monthDateType = ['year', 'month'];
+    const monthDateConfirm = () => {
+      console.log('monthStartDate', monthStartDate.value);
+      console.log('monthEndDate', monthEndDate.value);
+      const date1 = new Date(monthStartDate.value[0] + '-' + monthStartDate.value[1] + '-01');
+      const date2 = new Date(monthEndDate.value[0] + '-' + monthEndDate.value[1] + '-01');
+      // 将日期对象转换为毫秒数
+      const time1 = date1.getTime();
+      const time2 = date2.getTime();
+      // 计算时间跨度的绝对值
+      const timeDiff = Math.abs(time1 - time2);
+      // 计算半年的毫秒数(假设半年为 365 天的一半)
+      const halfYearInMilliseconds = 365 * 24 * 60 * 60 * 1000 / 2;
+      if (timeDiff > halfYearInMilliseconds) {
+        showToast(t('dateSelectList.monthTip1'));
+        return;
+      }
+      if (date1 > date2) {
+        showToast(t('dateSelectList.monthTip2'));
+        return;
+      }
+      monthDateShow.value = false;
+      outputDate();
+    }
+    const monthDateCancel = () => { monthDateShow.value = false; }
     return {
       minDate,
       timeType,
       timeChange,
       calendarShow,
-      calendarConfirm
+      calendarConfirm,
+      timeTypeShow,
+      timeTypeList,
+      timeTypeConfirm,
+      timeTypeCancel,
+      monthDateShow,
+      monthStartDate,
+      monthDateType,
+      monthEndDate,
+      monthDateConfirm,
+      monthDateCancel,
     };
   },
 };

+ 4 - 4
src/service/login.js

@@ -10,13 +10,13 @@ export function getSys(params) {
   return axios.get(`/SZWL-SERVER/tLogo/getLogo?${stringToUrl(params)}`);
 }
 // 微信授权 -> 获取 openid
-export function getOpenid() {
-  return axios.get('/SZWL-SERVER/wxLogin/menuOauth');
+export function getOpenid(params) {
+  return axios.get(`/SZWL-SERVER/wxLogin/newMenuOauth?${stringToUrl(params)}`);
 }
 
 // 用微信code 获取openid,再获取用户信息
-export function getUserDetailByWxCode(code) {
-  return axios.get('/SZWL-SERVER/wxLogin/getUserDetailByWxCode', { params: { code } });
+export function getUserDetailByWxCode(params) {
+  return axios.get(`/SZWL-SERVER/wxLogin/newGetUserDetailByWxCode?${stringToUrl(params)}`);
 }
 
 // 微信登录

+ 2 - 2
src/styles/device/index.less

@@ -198,8 +198,8 @@
             }
 
             .box4 {
-              width: 24px;
-              height: 20px;
+              width: 1rem;
+              height: 0.8rem;
               background: url("../../assets/device/alarm.png") 100% no-repeat;
             }
           }

+ 2 - 2
src/styles/deviceOper/index.less

@@ -37,13 +37,13 @@
                 text-align: center;
 
                 .operImg {
-                    width: 25px;
+                    width: 0.8rem;
                 }
             }
 
             .operText {
                 color: rgba(64, 77, 116, 1);
-                font-size: 11px;
+                font-size: 0.3rem;
                 text-align: center;
             }
         }

+ 7 - 6
src/views/device/deviceOper.vue

@@ -315,12 +315,13 @@ export default {
           operCheckShow.value = true;
         }; */
     const openDoorFun = () => {
-      if (device.value.machineType === '1' || device.value.equimentType === 'MG280') {
-        operType.value = 4;
-        operCheckShow.value = true;
-      } else {
-        router.push({ path: "openDoor", query: { deviceId: device.value.id } });
-      }
+      // if (device.value.machineType === '1' || device.value.equimentType === 'MG280') {
+      //   operType.value = 4;
+      //   operCheckShow.value = true;
+      // } else {
+      //   router.push({ path: "openDoor", query: { deviceId: device.value.id } });
+      // }
+      router.push({ path: "openDoor", query: { deviceId: device.value.id, machineType: device.value.machineType } });
     };
     // 日志功能
     const viewLogs = () => {

+ 5 - 5
src/views/device/index.vue

@@ -206,13 +206,13 @@
                     }}{{ $t("device.humidity") }}</van-col>
                   </van-row>
                   <van-row class="layer5 kBordBott" justify="space-between" v-if="item.machineType == '1'">
-                    <van-col class="word5" style="">{{ $t("device.stirringTemperature") }}:{{
-                      item.stirTm
-                    }}{{ $t("device.degree") }}</van-col>
                     <van-col class="word5" style="">{{ $t("device.cornGeneratorTemperature") }}:{{
-                      item.cornGeneratorTm
+                      item.cabinetHd
+                    }}{{ $t("device.degree") }}</van-col>
+                    <van-col class="word5" style="">{{ $t("device.stirringTemperature") }}:{{
+                      item.cabinetTm
                     }}{{ $t("device.degree") }}</van-col>
-                    <van-col class="word5" style="">{{ $t("device.cupQuantity") }}:{{ item.cupQuantity
+                    <van-col class="word5" style="">{{ $t("device.cupQuantity") }}:{{ item.furnaceTm
                     }}</van-col>
                   </van-row>
                   <template v-if="item.isMaterialUse === '1' && (item.machineType == '0' || item.machineType == null)">

+ 5 - 3
src/views/device/openDoor.vue

@@ -18,7 +18,7 @@
         </template>
       </van-field>
 
-      <van-field colon readonly :label="`${$t('device.inDoor')}`" label-width="40px">
+      <van-field v-if="machineType == '0' || machineType == null" colon readonly :label="`${$t('device.inDoor')}`" label-width="40px">
         <template #input>
           <div class="l-flex-RC">
             <van-switch :model-value="deviceDetal.inDoor" @update:model-value="inDoorChg" size="22" active-value="1"
@@ -45,6 +45,7 @@ export default {
   setup() {
     const route = useRoute();
     const deviceId = route.query.deviceId;
+    const machineType = route.query.machineType;
     const deviceDetal = ref({});
     const { t } = useI18n();
 
@@ -53,7 +54,6 @@ export default {
       // 加载样式
       styleUrl('deviceOper');
       getDeviceDetalFun();
-      console.log(deviceDetal.value)
     });
 
     // 获取设备列表数据
@@ -73,6 +73,7 @@ export default {
           data.data.inDoor = "0";
         }
         deviceDetal.value = data.data;
+        console.log(deviceDetal.value)
       } else {
         showFailToast(data.message);
       }
@@ -123,7 +124,8 @@ export default {
     return {
       deviceDetal,
       outDoorChg,
-      inDoorChg
+      inDoorChg,
+      machineType
     };
   },
   components: {

+ 1 - 1
src/views/login.vue

@@ -227,7 +227,7 @@ export default {
       state.isLoading = true;
       try {
         // 用户静默授权,获取 用户信息
-        const { data } = await getOpenid();
+        const {data} = await getOpenid({hostName: 'Sunzee'});
         console.log("微信登录:", data)
         if (data.code === "00000") {
           window.location.href = data.data;

+ 1 - 1
src/views/orderCenter/index.vue

@@ -33,7 +33,7 @@
             <!-- <div class="block5 flex-col"> -->
               <div class="salesDataBox flex-row">
                 <div class="dataGroup flex-col">
-                  <div class="dataGroupBox flex-row">
+                  <div class="dataGroupBox flex-row justify-center">
                     <!-- 订单中心 - 收入总额¥ -->
                     <!-- <span class="word8">&yen;</span> -->
                     <span class="currencySymbol">{{ currencySymbol }}</span>

+ 2 - 2
src/views/robotRanking.vue

@@ -640,8 +640,8 @@ export default {
               },
             ],
             grid: {
-              left: "3%",
-              right: "4%",
+              left: "5%",
+              right: "5%",
               bottom: "10%",
               containLabel: true,
             },

+ 1 - 1
src/views/wxLogin.vue

@@ -28,7 +28,7 @@ export default {
     });
     // 登录
     const loginByCode = async (code) => {
-      const { data } = await getUserDetailByWxCode(code);
+      const { data } = await getUserDetailByWxCode({code, hostName: 'Sunzee'});
       if (data.code === "00000") {
         setLocal("loginUser", JSON.stringify(data.data));
         // console.log('loginUser JSON:', JSON.stringify(data.data));