From cf2389121671bc8d09f32175acae80b074e21fc3 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 10 十月 2024 01:23:08 +0800
Subject: [PATCH] 一些更改

---
 src/store/modules/prodRoute.ts                                    |   69 +++++++++++
 src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue |    4 
 src/views/tigerprojects/wms/createqrcode/index.vue                |  177 +++++++++++++++++-----------
 src/store/modules/user.ts                                         |    9 -
 src/api/tigerapi/model/mesModel.ts                                |   15 ++
 src/api/tigerapi/system.ts                                        |    2 
 src/store/modules/qrhis.ts                                        |   39 ++++++
 7 files changed, 235 insertions(+), 80 deletions(-)

diff --git a/src/api/tigerapi/model/mesModel.ts b/src/api/tigerapi/model/mesModel.ts
index 8e9adb2..972f6a5 100644
--- a/src/api/tigerapi/model/mesModel.ts
+++ b/src/api/tigerapi/model/mesModel.ts
@@ -507,3 +507,18 @@
   prodCode: string;
   isDefault: boolean;
 }
+
+/**
+ * @description: 宸ヨ壓璺嚎鏍戝舰
+ * @return {*}
+ */
+export interface MesRotTree {
+  org: string;
+  pid: string;
+  tid: string;
+  id: string;
+  code: string;
+  name: string;
+  type: string;
+  seq: string;
+}
diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts
index 75ce889..dae8570 100644
--- a/src/api/tigerapi/system.ts
+++ b/src/api/tigerapi/system.ts
@@ -289,7 +289,7 @@
  * @param {T} data
  * @param {string} parentField 鐖跺瓧娈靛悕
  * @param {string} idField 鍞竴key瀛楁鍚�
- * @param {string} pid_val 鐖秈d鍊�
+ * @param {string} pid 鐖秈d鍊�
  * @return {*}
  */
 export function convertToTree<T>(data: T[], parentField: string, idField: string, pid?: string) {
diff --git a/src/store/modules/prodRoute.ts b/src/store/modules/prodRoute.ts
new file mode 100644
index 0000000..51da415
--- /dev/null
+++ b/src/store/modules/prodRoute.ts
@@ -0,0 +1,69 @@
+/*
+ * @Description: 浜у搧宸ヨ壓璺嚎Store
+ * @Author: Ben Lin
+ * @version:
+ * @Date: 2024-06-18 15:09:47
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-10-08 16:10:48
+ */
+import { defineStore } from 'pinia';
+import { store } from '@/store';
+import { useI18n } from '@/hooks/web/useI18n';
+import { useMessage } from '@/hooks/web/useMessage';
+import { h } from 'vue';
+import { MesRotTree } from '/@/api/tigerapi/model/mesModel';
+
+interface ProdRouteState {
+  curProdRotTree: Nullable<MesRotTree>;
+  rotList: MesRotTree[];
+}
+
+export const useProdRouteStore = defineStore({
+  id: 'app-prodrot',
+  state: (): ProdRouteState => ({
+    curProdRotTree: null,
+    rotList: [],
+  }),
+  getters: {
+    getCurProdRotTree(state): MesRotTree | null {
+      return state.curProdRotTree;
+    },
+    getRotList(state): MesRotTree[] {
+      return state.rotList;
+    },
+  },
+  actions: {
+    getRotList(roleList: MesRotTree[]) {
+      this.rotList = roleList;
+    },
+    setUserInfo(info: MesRotTree | null) {
+      this.curProdRotTree = info;
+    },
+    resetState() {
+      this.curProdRotTree = null;
+      this.rotList = [];
+    },
+    /**
+     * @description: 璁剧疆榛樿宸ヨ壓璺嚎
+     * @return {*}
+     */    
+    setDefaulRoute() {
+      const { createConfirm } = useMessage();
+      const { t } = useI18n();
+      createConfirm({
+        iconType: 'warning',
+        title: () => h('span', t('sys.app.logoutTip')),
+        content: () => h('span', t('sys.app.logoutMessage')),
+        onOk: async () => {
+          // 涓诲姩鐧诲嚭锛屼笉甯edirect鍦板潃
+          // await this.logout(true);
+        },
+      });
+    },
+  },
+});
+
+// Need to be used outside the setup
+export function useProdRouteWithOut() {
+  return useProdRouteStore(store);
+}
diff --git a/src/store/modules/qrhis.ts b/src/store/modules/qrhis.ts
new file mode 100644
index 0000000..f02ebb9
--- /dev/null
+++ b/src/store/modules/qrhis.ts
@@ -0,0 +1,39 @@
+/*
+ * @Description: 鑷畾涔変簩缁寸爜Store
+ * @Author: Ben Lin
+ * @version:
+ * @Date: 2024-06-18 15:09:47
+ * @LastEditors: Ben Lin
+ * @LastEditTime: 2024-10-09 22:27:39
+ */
+import { defineStore } from 'pinia';
+import { store } from '@/store';
+
+interface QrhisState {
+  hisData: string[];
+}
+
+export const useQrhisStore = defineStore({
+  id: 'app-Qrhis',
+  state: (): QrhisState => ({
+    hisData: [],
+  }),
+  getters: {
+    gethisData(state): string[] {
+      return state.hisData;
+    },
+  },
+  actions: {
+    sethisData(val: string[]) {
+      this.hisData = val;
+    },
+    resetState() {
+      this.hisData = [];
+    },
+  },
+  persist: {
+    key: 'HONGHU_NX__DEVELOPMENT__hisData', //瀛樺偍鍚嶇О
+    storage: sessionStorage, // 瀛樺偍鏂瑰紡
+    paths: ['hisData'], //鎸囧畾 state 涓摢浜涙暟鎹渶瑕佽鎸佷箙鍖栥�俒] 琛ㄧず涓嶆寔涔呭寲浠讳綍鐘舵�侊紝undefined 鎴� null 琛ㄧず鎸佷箙鍖栨暣涓� state
+  },
+});
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index ae3b263..d5c91f3 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -4,7 +4,7 @@
  * @version:
  * @Date: 2024-06-18 15:09:47
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-07-24 16:17:11
+ * @LastEditTime: 2024-10-07 17:01:32
  */
 import type { UserInfo } from '#/store';
 import type { ErrorMessageMode } from '#/axios';
@@ -14,14 +14,11 @@
 import { PageEnum } from '@/enums/pageEnum';
 import { ROLES_KEY, TOKEN_KEY, USER_INFO_KEY } from '@/enums/cacheEnum';
 import { getAuthCache, setAuthCache } from '@/utils/auth';
-import { GetUserInfoModel, LoginParams } from '@/api/sys/model/userModel';
-import { doLogout, getTgUserInfo, getUserInfo, loginApi } from '@/api/sys/user';
+import { GetUserInfoModel } from '@/api/sys/model/userModel';
+import { doLogout, getTgUserInfo, loginApi } from '@/api/sys/user';
 import { useI18n } from '@/hooks/web/useI18n';
 import { useMessage } from '@/hooks/web/useMessage';
 import { router } from '@/router';
-import { usePermissionStore } from '@/store/modules/permission';
-import { RouteRecordRaw } from 'vue-router';
-import { PAGE_NOT_FOUND_ROUTE } from '@/router/routes/basic';
 import { isArray } from '@/utils/is';
 import { h } from 'vue';
 import { AccountInfo } from '/@/api/tigerapi/model/systemModel';
diff --git a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
index 7183571..f3daf6c 100644
--- a/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
+++ b/src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue
@@ -4,7 +4,7 @@
  * @version: 
  * @Date: 2024-06-20 12:13:27
  * @LastEditors: Ben Lin
- * @LastEditTime: 2024-10-06 16:55:15
+ * @LastEditTime: 2024-10-07 16:52:03
 -->
 <template>
   <Card :title="GetTitle(props.configType)['navTitle']">
@@ -163,7 +163,7 @@
   function RvItemSuccess(d, u) {}
 
   /**
-   * @description:
+   * @description: 寮�鍏虫敼鍙樹簨浠�
    * @param {*} d
    * @return {*}
    */
diff --git a/src/views/tigerprojects/wms/createqrcode/index.vue b/src/views/tigerprojects/wms/createqrcode/index.vue
index d8fe0dd..fe49488 100644
--- a/src/views/tigerprojects/wms/createqrcode/index.vue
+++ b/src/views/tigerprojects/wms/createqrcode/index.vue
@@ -1,17 +1,34 @@
 <template>
- 
-  <PageWrapper title="鐢熸垚浜岀淮鐮�">
-    <div class="mb-4 pt-4" style="background-color: white; width: 99%;">
-       <BasicForm @register="register">
-      <template #search="{ field }">
-          <Button v-if="field" style="margin-left: 0;" @click="onSearch">鐢熸垚</Button>
+  <PageWrapper title="鐢熸垚浜岀淮鐮�" contentFullHeight contentClass="flex">
+    <template #headerContent>
+      <BasicForm @register="register">
+        <template #search="{ field }">
+          <Button v-if="field" style="margin-left: 0" @click="onSearch">鐢熸垚</Button>
         </template>
       </BasicForm>
+    </template>
+    <div class="w-1/4 xl:w-1/5 p-3" style="background-color: white">
+      <a-list size="small" bordered :data-source="hisData">
+        <template #renderItem="{ item }">
+          <a-list-item>
+            <a-list-item-meta description="">
+              <template #title>
+                <span @click="showQr(item)">{{ item }}</span>
+              </template>
+            </a-list-item-meta>
+          </a-list-item>
+        </template>
+        <template #header>
+          <div>鍘嗗彶璁板綍</div>
+        </template>
+        <!-- <template #footer>
+          <div>Footer</div>
+        </template> -->
+      </a-list>
     </div>
-   
-    <div class="flex flex-wrap" v-if="show">
+    <div class="w-3/4 xl:w-4/5 p-5" v-if="show">
       <!-- <CollapseContainer title="浜岀淮鐮�" class="text-center qrcode-demo-item"></CollapseContainer> -->
-      <div class="mb-4 pt-4 text-center" style="background-color: white; width: 99%;">
+      <div class="mb-4 pt-4 text-center" style="width: 99%; background-color: white">
         <QrCode
           :value="qrCodeUrl"
           :width="390"
@@ -27,85 +44,103 @@
     </div>
   </PageWrapper>
 </template>
-<script lang="ts"  setup>
-import { ref } from 'vue';
-import { QrCode } from '/@/components/Qrcode/index';
-import LogoImg from '/@/assets/images/logo.png';
-import { CollapseContainer } from '/@/components/Container/index';
-import { GetQrCode } from '/@/api/tigerapi/wms/qrcode';
-import { useMessage } from '/@/hooks/web/useMessage';
-import { PageWrapper } from '/@/components/Page';
-import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
-import { Button } from '/@/components/Button';
+<script lang="ts" setup>
+  import { onMounted, ref } from 'vue';
+  import { List, ListItem, ListItemMeta } from 'ant-design-vue';
+  import { QrCode } from '/@/components/Qrcode/index';
+  import LogoImg from '/@/assets/images/logo.png';
+  import { CollapseContainer } from '/@/components/Container/index';
+  import { GetQrCode } from '/@/api/tigerapi/wms/qrcode';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { PageWrapper } from '/@/components/Page';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+  import { Button } from '/@/components/Button';
+  import { useQrhisStore } from '/@/store/modules/qrhis';
+  import { storeToRefs } from 'pinia';
 
-const schemas: FormSchema[] = [
-  {
-    field: 'SN',
+  const AList = List;
+  const AListItem = ListItem;
+  const AListItemMeta = ListItemMeta;
+  const schemas: FormSchema[] = [
+    {
+      field: 'SN',
       component: 'Input',
       label: 'SN',
       colProps: {
         span: 8,
       },
-     
-  },{
-        field: '0',
-        component: 'Input',
-        slot: 'search',
-        colProps: {
-          span: 4,
-        },
-      }
-];
+    },
+    {
+      field: '0',
+      component: 'Input',
+      slot: 'search',
+      colProps: {
+        span: 4,
+      },
+    },
+  ];
 
-const { createMessage } = useMessage();
-const show = ref(false)
-const qrCodeUrl = ref('');
-const [
-      register,
-      { validateFields, clearValidate, getFieldsValue, resetFields, setFieldsValue },
-    ] = useForm({
+  let qrDatas:any[] = []
+  const useQrhis = useQrhisStore();
+  const { hisData } = storeToRefs(useQrhis);
+  const { createMessage } = useMessage();
+  const show = ref(false);
+  const qrCodeUrl = ref('');
+  const [register, { validateFields, clearValidate, getFieldsValue, resetFields, setFieldsValue }] =
+    useForm({
       showSubmitButton: false,
       showResetButton: false,
       labelWidth: 80,
       schemas,
-      canResize:true,
+      canResize: true,
       actionColOptions: {
         span: 12,
       },
     });
 
-function onQrcodeDone({ ctx }: any) {
-  if (ctx instanceof CanvasRenderingContext2D) {
-    // 棰濆缁樺埗
-    ctx.fillStyle = 'black';
-    ctx.font = '16px "寰蒋闆呴粦"';
-    ctx.textBaseline = 'bottom';
-    ctx.textAlign = 'center';
-    ctx.fillText('浣犲竻浣犲厛鎵�', 200, 380, 200);
+  function onQrcodeDone({ ctx }: any) {
+    if (ctx instanceof CanvasRenderingContext2D) {
+      // 棰濆缁樺埗
+      ctx.fillStyle = 'black';
+      ctx.font = '16px "寰蒋闆呴粦"';
+      ctx.textBaseline = 'bottom';
+      ctx.textAlign = 'center';
+      ctx.fillText('浣犲竻浣犲厛鎵�', 200, 380, 200);
+    }
   }
-}
-async function onSearch({ ctx }: any) {
-  var barcode=getFieldsValue();
- if(barcode.SN!=''){
-  show.value=true;
-  qrCodeUrl.value=barcode.SN;
-  // var apiAction = await GetQrCode(barcode.SN)
-  // if(apiAction.IsSuccessed){
-  //   show.value=true;
-  //   qrCodeUrl.value=apiAction.Message
-  // }
-  // else{
-  //   //show.value=false;
-  //   show.value=true;
-  //   qrCodeUrl.value=barcode.SN;
-  //   //createMessage.error('鏉$爜绯荤粺涓嶅瓨鍦�');
-  // }
- }else{
-  show.value=false;
-  createMessage.error('杈撳叆鐨勬潯鐮佷负绌�');
- }
- 
-}
+  async function onSearch({ ctx }: any) {
+    var barcode = getFieldsValue();
+    if (barcode.SN != '') {
+      show.value = true;
+      qrCodeUrl.value = barcode.SN;
+      useQrhis.gethisData.push(barcode.SN);
+      qrDatas = useQrhis.gethisData
+      useQrhis.sethisData(qrDatas);
+      // var apiAction = await GetQrCode(barcode.SN)
+      // if(apiAction.IsSuccessed){
+      //   show.value=true;
+      //   qrCodeUrl.value=apiAction.Message
+      // }
+      // else{
+      //   //show.value=false;
+      //   show.value=true;
+      //   qrCodeUrl.value=barcode.SN;
+      //   //createMessage.error('鏉$爜绯荤粺涓嶅瓨鍦�');
+      // }
+    } else {
+      show.value = false;
+      createMessage.error('杈撳叆鐨勬潯鐮佷负绌�');
+    }
+  }
+  async function showQr(code: string) {
+    if (code != '') {
+      show.value = true;
+      qrCodeUrl.value = code;
+    } else {
+      show.value = false;
+      createMessage.error('杈撳叆鐨勬潯鐮佷负绌�');
+    }
+  }
 </script>
 <style scoped>
   .qrcode-demo-item {

--
Gitblit v1.9.3