From 1aeff8b542a22d6c6a2efbac87704bca554afee8 Mon Sep 17 00:00:00 2001
From: Goldennfish <1981343953@qq.com>
Date: 星期二, 18 七月 2023 09:46:21 +0800
Subject: [PATCH] 提交我的信息和原材料报检页面

---
 src/views/rawMaterials/reportForInspection/index.vue |  278 +++++++++++++++++++++++++++++++++++++++
 src/store/modules/user.js                            |   10 +
 src/api/user.js                                      |    4 
 src/views/personal/myInformation/index.vue           |   69 +++++++--
 src/utils/auth.js                                    |   14 ++
 5 files changed, 350 insertions(+), 25 deletions(-)

diff --git a/src/api/user.js b/src/api/user.js
index 915b99d..4aaf85d 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -15,8 +15,8 @@
 // 鑾峰彇鐢ㄦ埛淇℃伅
 export function getInfo() {
   return request({
-    url: '/user/info',
-    method: 'get'
+    url: '/user/getUserById',
+    method: 'post'
   })
 }
 
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 2f6423f..c81f028 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,12 +1,13 @@
 import { login, logout, getInfo } from '@/api/user'
-import { getToken, setToken, removeToken } from '@/utils/auth'
+import { getToken, setToken, removeToken, getRefresh, setRefresh, removeRefresh } from '@/utils/auth'
 import { resetRouter } from '@/router'
 
 const getDefaultState = () => {
   return {
     token: getToken(),
     name: '',
-    avatar: ''
+    avatar: '',
+    refresh: getRefresh()
   }
 }
 
@@ -18,6 +19,9 @@
   },
   SET_TOKEN: (state, token) => {
     state.token = token
+  },
+  SET_REFRESH: (state, refresh) => {
+    state.refresh = refresh
   },
   SET_NAME: (state, name) => {
     state.name = name
@@ -35,7 +39,9 @@
       login({ username: username.trim(), password: password }).then(response => {
         const { data } = response
         commit('SET_TOKEN', data.token)
+        commit('SET_REFRESH', data.refresh)
         setToken(data.token)
+        setRefresh(data.refresh)
         resolve()
       }).catch(error => {
         reject(error)
diff --git a/src/utils/auth.js b/src/utils/auth.js
index 059af18..b131480 100644
--- a/src/utils/auth.js
+++ b/src/utils/auth.js
@@ -1,6 +1,7 @@
 import Cookies from 'js-cookie'
 
 const TokenKey = 'vue_admin_template_token'
+const RefreshKey = 'vue_admin_template_refresh'
 
 export function getToken() {
   return Cookies.get(TokenKey)
@@ -13,3 +14,16 @@
 export function removeToken() {
   return Cookies.remove(TokenKey)
 }
+
+export function getRefresh() {
+  return Cookies.get(RefreshKey)
+}
+
+export function setRefresh(refresh) {
+  return Cookies.set(RefreshKey, refresh)
+}
+
+export function removeRefresh() {
+  return Cookies.remove(RefreshKey)
+}
+
diff --git a/src/views/personal/myInformation/index.vue b/src/views/personal/myInformation/index.vue
index b2e640f..0813686 100644
--- a/src/views/personal/myInformation/index.vue
+++ b/src/views/personal/myInformation/index.vue
@@ -8,21 +8,32 @@
         </div>
         <div class="tips-btn">
           <span><i class="el-icon-edit" />鎿嶄綔锛�</span>
-          <el-button type="text">缂栬緫</el-button>
+          <el-button type="text" @click="dialogFormVisible = true">缂栬緫</el-button>
+          <el-dialog title="缂栬緫" :visible.sync="dialogFormVisible">
+            <el-form ref="form" :model="form" :rules="rules">
+              <el-form-item label="璐﹀彿" :label-width="formLabelWidth" prop="account">
+                <el-input v-model="form.account" autocomplete="off" />
+              </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+              <el-button @click="dialogFormVisible = false">鍙� 娑�</el-button>
+              <el-button type="primary" @click="submitForm()">纭� 瀹�</el-button>
+            </div>
+          </el-dialog>
         </div>
       </div>
       <div class="message">
-        <div class="message-item"><span><i class="el-icon-edit" />鐢ㄦ埛鍚嶏細</span>121212121212</div>
+        <div class="message-item"><span><i class="el-icon-edit" />鐢ㄦ埛鍚嶏細</span>{{infoTable.username}}</div>
         <div class="message-item">
           <span><i class="el-icon-edit" />濮撳悕锛�</span>
-          <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}"/>{{ 'jack' }}</el-tag>
+          <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />{{ infoTable.name }}</el-tag>
         </div>
         <div class="message-item">
           <span><i class="el-icon-edit" />鐢佃瘽鍙风爜锛�</span>
-          19825217196</div>
+          {{infoTable.cellPhone}}</div>
         <div class="message-item">
           <span><i class="el-icon-edit" />閭锛�</span>
-          1212112</div>
+          {{infoTable.email}}</div>
         <div class="message-item">
           <span><i class="el-icon-edit" />绛惧悕锛�</span>
           2121212121212121</div>
@@ -142,16 +153,16 @@
         </el-table-column>
       </el-table> -->
       <div class="message">
-        <div class="message-item"><span><i class="el-icon-edit" />浼佷笟绠�绉帮細</span>121212121212</div>
+        <div class="message-item"><span><i class="el-icon-edit" />浼佷笟绠�绉帮細</span>{{businessTable.businessSmallName}}</div>
         <div class="message-item">
-          <span><i class="el-icon-edit" />瀹屾暣鍚嶇О锛�</span>
+          <span><i class="el-icon-edit" />瀹屾暣鍚嶇О锛�</span>{{ businessTable.businessBigName }}
         </div>
         <div class="message-item">
           <span><i class="el-icon-edit" />鑱旂郴浜猴細</span>
-          <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}"/>{{ 'jack' }}</el-tag></div>
+          <el-tag type="primary"><i class="el-icon-info" :style="{marginRight:'4px', color:'#409EFF'}" />{{ businessTable.businessContact }}</el-tag></div>
         <div class="message-item">
           <span><i class="el-icon-edit" />鑱旂郴浜虹數璇濓細</span>
-          1212112</div>
+          {{businessTable.businessPhone}}</div>
         <div class="message-item">
           <span><i class="el-icon-edit" />鍔犲叆鐘舵�侊細</span>
           2121212121212121</div>
@@ -161,31 +172,36 @@
 </template>
 
 <script>
+import { getInfo } from '@/api/user'
+
+// axios.defaults.baseURL = process.env.VUE_APP_BASE_API
+
 export default {
   data() {
     return {
-      infoTable: [
+      infoTable:
         {
           username: 'jack',
           name: '寮犱笁',
           cellPhone: '138888888',
           email: '138888888@qq.com',
           signature: '鎴戞槸娉曞鐙傚緬'
-        }
-
-      ],
-      businessTable: [
+        },
+      businessTable:
         {
           businessSmallName: '涓ぉ',
           businessBigName: '涓ぉ绉戞妧',
           businessContact: 'jack',
           businessPhone: '1388888888',
           businessStatus: 1
-        }
-      ]
+        },
+      dialogFormVisible: false,
+      form: [],
+      formLabelWidth: 120
     }
   },
   created() {
+    this.getUserInfo()
   },
   methods: {
     clearFilter() {
@@ -195,6 +211,24 @@
     filterTag(value, row) {
       console.log(value, row)
       return row.businessStatus === value
+    },
+    submitForm() {
+      // Handle form submission here
+      // console.log(this.form);
+      // POST璇锋眰
+      this.dialogFormVisible = false
+    },
+    async getUserInfo() {
+      const res = await getInfo()
+      this.infoTable.name = res.data.uname
+      this.infoTable.username = res.data.account
+      this.infoTable.cellPhone = res.data.phone
+      this.infoTable.email = res.data.email
+      this.businessTable.businessSmallName = res.data.e_byname
+      this.businessTable.businessBigName = res.data.e_name
+      this.businessTable.businessContact = res.data.e_link_name
+      this.businessTable.businessPhone = res.data.e_phone
+      // console.log(res)
     }
   }
 }
@@ -290,9 +324,6 @@
       //   max-width: 60%;
       // }
     }
-  }
-  .my-info{
-
   }
   .my-business{
     margin-top: 28px;
diff --git a/src/views/rawMaterials/reportForInspection/index.vue b/src/views/rawMaterials/reportForInspection/index.vue
index 99c7493..e8c9abe 100644
--- a/src/views/rawMaterials/reportForInspection/index.vue
+++ b/src/views/rawMaterials/reportForInspection/index.vue
@@ -1,13 +1,287 @@
 <template>
-  <div>home</div>
+  <div class="content-main">
+    <div class="top-bar">
+      <el-form ref="form" inline="true" :model="searchData">
+        <el-form-item>
+          <el-input
+            v-model="searchData.keyword"
+            class="input-form"
+            placeholder="璇疯緭鍏ョ敵璇峰崟鍙�/妫�楠屽璞�/瀵硅薄浣嶇疆/瀵硅薄鍚嶇О"
+          >
+            <i slot="prefix" class="el-input__icon el-icon-search" />
+          </el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary">鏌ヨ</el-button>
+          <el-button type="primary" plain>閲嶇疆</el-button>
+        </el-form-item>
+        <el-dropdown>
+          <span class="retrieval">
+            楂樼骇妫�绱�<i class="el-icon-arrow-down el-icon--right" />
+          </span>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item>榛勯噾绯�</el-dropdown-item>
+            <el-dropdown-item>鐙瓙澶�</el-dropdown-item>
+            <el-dropdown-item>铻鸿洺绮�</el-dropdown-item>
+            <el-dropdown-item disabled>鍙岀毊濂�</el-dropdown-item>
+            <el-dropdown-item divided>铓典粩鐓�</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+      </el-form>
+      <el-form class="rightBtn">
+        <el-form-item class="getDataBtn">
+          <el-button type="primary" icon="el-icon-download" plain>鑾峰彇ERP鏁版嵁</el-button>
+        </el-form-item>
+        <el-form-item class="createBtn">
+          <el-button type="primary" icon="el-icon-plus">鏂板妫�楠屽崟</el-button>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div class="library-table">
+      <div class="table-header">
+        <div class="search-bar">
+          <el-radio-group v-model="radioValue">
+            <el-radio-button label="鍏ㄩ儴" />
+            <el-radio-button label="寰呮彁浜�" />
+            <el-radio-button label="宸叉彁浜�" />
+            <el-radio-button label="宸蹭綔搴�" />
+          </el-radio-group>
+        </div>
+      </div>
+      <div class="table-box">
+        <el-table
+          ref="inspectionTable"
+          :max-height="800"
+          :cell-style="{textAlign: 'center'}"
+          :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
+          :data="inspectionTable"
+          style="width: 100%"
+        >
+          <el-table-column
+            prop="applicationOrdernumber"
+            label="鐢宠鍗曞彿"
+            min-width="200"
+          />
+          <el-table-column
+            prop="typeofInspection"
+            label="妫�楠岀被鍨�"
+            min-width="200"
+          />
+          <el-table-column
+            prop="objectofInspection"
+            label="妫�楠屽璞�"
+            min-width="200"
+          />
+          <el-table-column
+            prop="palceofObject"
+            label="瀵硅薄浣嶇疆"
+            min-width="200"
+          />
+          <el-table-column
+            prop="name"
+            label="瀵硅薄鍚嶇О"
+            min-width="200"
+          />
+          <el-table-column
+            prop="date"
+            label="鐧昏鏃ユ湡"
+            min-width="200"
+          />
+          <el-table-column
+            prop="registrant"
+            label="鐧昏浜�"
+            min-width="200"
+          />
+          <el-table-column
+            prop="applicationTime"
+            label="鐢宠鏃堕棿"
+            min-width="200"
+          />
+          <el-table-column
+            label="鎿嶄綔"
+            min-width="200"
+            :fixed="true"
+          >
+            <template slot-scope="scope">
+              <el-button type="text" size="small" @click="handleClick(scope.row)">鏌ョ湅</el-button>
+              <el-button type="text" size="small">浣滃簾</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- 鍒嗛〉鍣� -->
+      <div>
+          <el-pagination
+            :current-page="currentPage"
+            :page-sizes="[100, 200, 300, 400]"
+            :page-size="pageSize"
+            layout="total, sizes, prev, pager, next, jumper"
+            :total="this.inspectionTable.length"
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+          />
+      </div>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
 export default {
-
+  data() {
+    return {
+      searchData: {
+        keyword: ''
+      },
+      inspectionTable: [{
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      },
+      {
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      },
+      {
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      },
+      {
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      },
+      {
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      },
+      {
+        applicationOrdernumber: 'QC22-09155',
+        typeofInspection: '閲囪喘鍏ュ簱',
+        objectofInspection: 'MI202207032-1',
+        palceofObject: '---',
+        name: '杩欐槸涓�鏉℃祴璇曟暟鎹�',
+        date: '2022-09-23',
+        registrant: '绠$悊鍛�',
+        applicationTime: '111'
+      }
+      ],
+      currentPage: 1,
+      total: 20, // 鎬绘潯鏁�
+      pageSize: 100, // 姣忛〉鐨勬暟鎹潯鏁�
+      radioValue: '鍏ㄩ儴'
+    }
+  },
+  methods: {
+    handleClick(row) {
+      console.log(row)
+    },
+    // 姣忛〉鏉℃暟鏀瑰彉鏃惰Е鍙� 閫夋嫨涓�椤垫樉绀哄灏戣
+    handleSizeChange(val) {
+      console.log(`姣忛〉 ${val} 鏉)
+      this.currentPage = 1
+      this.pageSize = val
+    },
+    // 褰撳墠椤垫敼鍙樻椂瑙﹀彂 璺宠浆鍏朵粬椤�
+    handleCurrentChange(val) {
+      console.log(`褰撳墠椤�: ${val}`)
+      this.currentPage = val
+    }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
+  .content-main{
+    width: 100%;
+    height: 100%;
+    display: flex;
+    flex-direction: column;
+  }
+  .top-bar{
+    margin: -25px;
+    background: #fff;
+    display: flex;
+    justify-content: space-between;
+    padding: 5px 24px 0px 24px;
+  }
+  .input-form{
+    width: 500px;
+  }
+  .retrieval{
+  float: right;
+  font-size: 14px;
+  color: rgb(0, 120, 255);
+  line-height: 40px;
+ }
+ .rightBtn {
+  display: flex;
+  justify-content: flex-end;
+}
 
+.getDataBtn, .createBtn {
+  margin-left: 10px; /* Optional: Add some space between the buttons */
+}
+.library-table{
+      background-color: #fff;
+      flex: 1;
+      max-width: 100%;
+      margin-left: 0px;
+      margin-right: 0px;
+      margin-top: 50px;
+      display: flex;
+      flex-direction: column;
+      .table-header{
+        padding: 20px;
+        display: flex;
+        justify-content: space-between;
+        .el-form-item{
+          margin-bottom: 30px !important;
+        }
+      }
+      .table-box{
+          padding: 0px 20px;
+          margin-top: 20px;
+          flex: 1;
+          background: #fff;
+          // padding: 20px 20px 10px 20px;
+          display: flex;
+          flex-direction: column;
+          .el-table {
+            flex: 1;
+          }
+          >div:nth-child(2){
+            display: flex;
+            justify-content: end;
+            margin: 10px 0;
+          }
+      }
+    }
 </style>

--
Gitblit v1.9.3