Parcourir la source

feat: 欢迎页面添加文字;工具详情页面物料列表接口联调

mnisting il y a 5 mois
Parent
commit
fe80f94951
4 fichiers modifiés avec 104 ajouts et 26 suppressions
  1. 26 0
      src/api/index.js
  2. 33 19
      src/views/DetailView.vue
  3. 34 2
      src/views/HelloView.vue
  4. 11 5
      src/views/HomeView.vue

+ 26 - 0
src/api/index.js

@@ -25,3 +25,29 @@ export function detailList(data) {
     data: data
   })
 }
+
+// 常用工具计数
+export function setCommonTool(query) {
+  return request({
+    url: '/tool/basis/reception/commonTool/update',
+    method: 'post',
+    params: query
+  })
+}
+
+// 常用工具列表
+export function getCommonTool() {
+  return request({
+    url: '/tool/basis/reception/commonTool/list',
+    method: 'post'
+  })
+}
+
+// 查询物料列表
+export function getwlList(query) {
+  return request({
+    url: '/tool/basis/reception/materialList',
+    method: 'get',
+    params: query
+  })
+}

+ 33 - 19
src/views/DetailView.vue

@@ -91,7 +91,7 @@
               </div>
             </template> -->
 
-            <div class="my-8" v-if="wlList.length > 0">
+            <div class="my-8">
               <!-- 搜索表单 -->
               <el-form :model="queryParams" ref="searchFormRef" :inline="true" v-show="showSearch">
                 <el-form-item label="物料编码" prop="materialNo">
@@ -128,7 +128,6 @@
                     <div class="flex items-center justify-center">
                       <div>{{ scope.row.materialNo }}</div>
                       <van-icon
-                        v-show="selectWlCode"
                         name="description-o"
                         class="text-[#004EA2] description-o ml-1 cursor-pointer"
                         @click="codeCopy(scope.row.materialNo)"
@@ -143,11 +142,12 @@
                 <el-pagination
                   class="float-right"
                   v-if="total > 0"
+                  background
                   :current-page="pageNum"
                   :page-size="20"
                   :pager-count="5"
                   layout="prev, pager, next"
-                  :total="1000"
+                  :total="total"
                   @current-change="handleCurrentChange"
                 />
               </div>
@@ -186,7 +186,7 @@ import { ref } from 'vue'
 import { useRoute, useRouter } from 'vue-router'
 import { detailList } from '@/api/index.js'
 import Clipboard from 'clipboard'
-import { listTools } from '@/api/index.js'
+import { listTools, getwlList } from '@/api/index.js'
 import { ElMessage } from 'element-plus'
 
 const router = useRouter()
@@ -195,9 +195,9 @@ const queryId = ref(route.query.id)
 const queryToolName = ref(route.query.toolName)
 
 const wlList = ref([])
-const wlSelectId = ref(0)
-const selectWlCode = ref('')
-const selectMaterialName = ref('')
+// const wlSelectId = ref(0)
+// const selectWlCode = ref('')
+// const selectMaterialName = ref('')
 const sytList = ref([])
 const fileList = ref([])
 const detailImg = ref(0)
@@ -213,18 +213,27 @@ const queryParams = ref({
 })
 const showSearch = ref(false)
 const pageNum = ref(1)
-const total = ref(10)
+const total = ref(0)
+
+const getWlList = (params) => {
+  getwlList({ basisId: queryId.value, ...params }).then((res) => {
+    // console.log(res)
+    wlList.value = res.rows
+    total.value = res.total
+  })
+}
 
 const init = () => {
+  // 查详情
   detailList({ id: queryId.value }).then((res) => {
     const toolDetails = res.data.toolDetails || []
-    wlList.value = toolDetails.filter((item) => item.informationType === 'wl')
-    // console.log(wlList.value)
-    if (wlList.value.length > 0) {
-      selectWlCode.value = wlList.value[0].materialNo
-      selectMaterialName.value = wlList.value[0].materialName
-      wlSelectId.value = wlList.value[0].id
-    }
+    // wlList.value = toolDetails.filter((item) => item.informationType === 'wl')
+    // // console.log(wlList.value)
+    // if (wlList.value.length > 0) {
+    //   // selectWlCode.value = wlList.value[0].materialNo
+    //   // selectMaterialName.value = wlList.value[0].materialName
+    //   wlSelectId.value = wlList.value[0].id
+    // }
     sytList.value = toolDetails.filter((item) => item.informationType === 'syt')
     if (sytList.value.length > 0) {
       detailImg.value = sytList.value[0].id
@@ -244,8 +253,12 @@ const init = () => {
   }).then((res) => {
     typeOptions1Ref.value = res.rows
   })
+
+  // 查物料详情的
+  getWlList({ pageNum: 1, pageSize: 5 })
 }
 init()
+
 const changeImg = ({ id, filePath }) => {
   detailImg.value = id
   sytPath.value = filePath
@@ -302,20 +315,21 @@ const handleQuery = () => {
     pageNum: pageNum.value,
     pageSize: 5
   }
-  console.log('搜索物料', params)
-  // getList(params)
+  // console.log('搜索物料', params)
+  getWlList(params)
 }
 const searchFormRef = ref(null)
 // 重置
 const resetQuery = () => {
-  searchFormRef.value.resetForm('searchFormRef')
+  searchFormRef.value.resetFields()
   handleQuery()
 }
 
 // 切换分页
 const handleCurrentChange = (val) => {
-  console.log(val)
+  // console.log(val)
   pageNum.value = val
+  handleQuery()
 }
 
 // 显示搜索框

+ 34 - 2
src/views/HelloView.vue

@@ -1,15 +1,47 @@
 <template>
   <div
-    class="w-full h-screen bg-white font-['PingFang-SC'] bg-[url('/src/assets/images/login-background.png')] overflow-hidden"
+    class="w-full h-screen bg-white bg-[url('/src/assets/images/login-background.png')] overflow-hidden"
   >
-    <div class="fixed left-1/2 top-1/2 bgTools -translate-x-1/2 -translate-y-1/2">
+    <div class="fixed left-1/2 md:left-1/4 top-1/4 md:top-1/2 -translate-x-1/2 -translate-y-1/2">
       <bgTools />
     </div>
+    <div class="fixed top-1/2 left-1/2 md:top-1/4 text-center -translate-x-1/2 md:translate-x-0">
+      <div :style="{ transform: `scale(${scaleVal})` }">
+        <div
+          class="italic text-[30px] md:text-[60px] font-black text-[#0d74db] mb-40 tracking-widest"
+          style="text-shadow: 2px 2px 5px rgb(0, 30, 95)"
+        >
+          欢迎使用数字化图鉴系统
+        </div>
+        <van-button type="primary" @click="goToHome">进入首页 ⋙</van-button>
+      </div>
+    </div>
   </div>
 </template>
 
 <script setup name="HelloView">
+import { ref, watch } from 'vue'
 import bgTools from './components/bgTools.vue'
+import { useRouter } from 'vue-router'
+import { useWindowSize } from '@vueuse/core'
+
+const router = useRouter()
+
+const goToHome = () => {
+  router.push('/home')
+}
+
+const { width } = useWindowSize()
+const scaleVal = ref(1)
+watch(
+  width,
+  (value) => {
+    scaleVal.value = value / 1900 < 0.8 ? 1 : value / 1900
+  },
+  {
+    immediate: true
+  }
+)
 </script>
 
 <style lang="scss" scoped></style>

+ 11 - 5
src/views/HomeView.vue

@@ -34,9 +34,9 @@
               class="ml-2 mb-2 font-semibold md:ml-4 md:cursor-pointer md:hover:text-[#004EA2]"
               v-for="tool in hotToolsRef"
               :key="tool.id"
-              @click="handleKeySearch(tool.name)"
+              @click="handleKeySearch(tool.toolName)"
             >
-              {{ tool.name }}
+              {{ tool.toolName }}
             </div>
           </div>
         </div>
@@ -149,8 +149,8 @@
 import { ref, computed } from 'vue'
 import useAppStore from '@/stores/app.js'
 import { getFillNums } from '@/utils'
-import { hotToolsList } from './mock'
-import { listTools } from '@/api/index.js'
+// import { hotToolsList } from './mock'
+import { listTools, setCommonTool, getCommonTool } from '@/api/index.js'
 import { useRoute, useRouter } from 'vue-router'
 
 const devPath = import.meta.env.VITE_APP_BASE_API
@@ -167,7 +167,7 @@ const searchValueRef = ref('')
 const pageNum = ref(1)
 const pageSize = ref(20)
 // 热门工具列表
-const hotToolsRef = ref(hotToolsList)
+const hotToolsRef = ref([])
 
 const type1ValueRef = ref('1')
 const type2ValueRef = ref('')
@@ -223,6 +223,10 @@ const init = () => {
     typeOptions2Ref.value = res.rows
   })
   onLoad(route.query.id)
+  // 常用工具列表
+  getCommonTool().then((res) => {
+    hotToolsRef.value = res.data.data
+  })
 }
 init()
 
@@ -234,6 +238,8 @@ const resetList = () => {
 // 搜索
 const handleSearch = () => {
   onLoad()
+  // 每次搜索时存一下搜索内容的次数,方便后台统计常用工具
+  searchValueRef.value && setCommonTool({ toolName: searchValueRef.value })
 }
 // 点击热门关键字搜索
 const handleKeySearch = (toolName) => {