Browse Source

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

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

+ 34 - 2
src/views/HelloView.vue

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