Ben Lin
2024-10-10 cf2389121671bc8d09f32175acae80b074e21fc3
一些更改
已修改5个文件
已添加2个文件
315 ■■■■ 文件已修改
src/api/tigerapi/model/mesModel.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/system.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/prodRoute.ts 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/qrhis.ts 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/user.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/system/lowcode/composition/CarGridNav.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/wms/createqrcode/index.vue 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
}
src/api/tigerapi/system.ts
@@ -289,7 +289,7 @@
 * @param {T} data
 * @param {string} parentField çˆ¶å­—段名
 * @param {string} idField å”¯ä¸€key字段名
 * @param {string} pid_val çˆ¶id值
 * @param {string} pid çˆ¶id值
 * @return {*}
 */
export function convertToTree<T>(data: T[], parentField: string, idField: string, pid?: string) {
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 () => {
          // ä¸»åŠ¨ç™»å‡ºï¼Œä¸å¸¦redirect地址
          // await this.logout(true);
        },
      });
    },
  },
});
// Need to be used outside the setup
export function useProdRouteWithOut() {
  return useProdRouteStore(store);
}
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
  },
});
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';
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 {*}
   */
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 {