Parcourir la source

Merge branch 'develop' of http://git.kdan.cc:8865/Server_Service/pdf_tech_front_end into develop

lisiyan il y a 2 ans
Parent
commit
2407cfbd74

+ 1 - 1
src/components/sideMenu.vue

@@ -100,7 +100,7 @@ export default {
         </el-menu-item>
       </el-menu>
     </div>
-    <div @click="logout()" class="w-full h-40px bg-[#F6F7F9] flex items-center cursor-pointer"><Logout class="ml-27px" /><span class="ml-11px font-bold">Log out</span></div>
+    <div @click="logout()" class="w-full h-40px bg-[#F6F7F9] flex items-center cursor-pointer"><Logout class="ml-27px" /><span class="ml-11px text-14px text-[#232A40] font-bold">Log out</span></div>
   </div>
 </template>
 

+ 32 - 10
src/views/Dashboard.vue

@@ -22,7 +22,11 @@ export default {
       },
       dataFilterProductSelect: '',
       dataFilterPlanSelect: '',
-      chartData: {},
+      chartData: {
+        date: [],
+        assignedLicensesYData: [],
+        activatedLicenseYData: []
+      },
       chartSelectValue: '',   
       teamData: {
         totalTeam: null,
@@ -78,8 +82,23 @@ export default {
     },
     // 获取图表数据
     getChartStatistics (type) {
+      if (this.chartSelectValue !== '') {
+        type = this.chartSelectValue
+      }
       get('http://81.68.234.235:8032/pdf-tech/vppDashboard/getChartStatistics/' + type).then((res) => {
-        console.log(res)
+        if (res.data.code === 200) {
+          this.chartData.date = []
+          this.chartData.assignedLicensesYData = []
+          this.chartData.activatedLicenseYData = []
+          res.data.result.forEach((item) => {
+            this.chartData.date.push(item.date)
+            this.chartData.assignedLicensesYData.push(item.licences.assignedLicenses)
+            this.chartData.activatedLicenseYData.push(item.licences.activatedLicense)
+          })
+          this.drawLine()
+        } else {
+          this.$message.error(res.data.msg)
+        }
       })
     },
     // 获取团队数据
@@ -107,7 +126,12 @@ export default {
     },
     // 绘制Echarts图表
     drawLine () {
-      var myChart = echarts.init(this.$refs.chart)
+      let myChart = echarts.getInstanceByDom(
+        this.$refs.chart
+      )
+      if (myChart == null) {
+        myChart = echarts.init(this.$refs.chart)
+      }
       myChart.setOption({
         color: ['#1460F3', '#FFAE49'],
         tooltip: {
@@ -131,7 +155,7 @@ export default {
         xAxis: {
           type: 'category',
           boundaryGap: false,
-          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+          data: this.chartData.date,
           axisPointer: {
             type: 'line',
             lineStyle: {
@@ -169,8 +193,7 @@ export default {
           {
             name: 'Assigned Licenses',
             type: 'line',
-            stack: 'Total',
-            data: [120, 132, 101, 134, 90, 230, 210],
+            data: this.chartData.assignedLicensesYData,
             lineStyle: {
               width: 3
             },
@@ -187,8 +210,7 @@ export default {
           {
             name: 'Activated Licenses',
             type: 'line',
-            stack: 'Total',
-            data: [220, 182, 191, 234, 290, 330, 310],
+            data: this.chartData.activatedLicenseYData,
             lineStyle: {
               width: 3
             },
@@ -203,7 +225,7 @@ export default {
             }
           }
         ]
-      })
+      }, true)
       window.onresize = function () {
         myChart.resize()
       }
@@ -303,7 +325,7 @@ export default {
             <option value="3">Last 30 Days</option>
             <option value="4">This Month</option>
           </select>
-          <div @click="getChartStatistics(chartSelectValue)" class="w-70px h-28px border-[#1460F3] border-1px rounded-4px px-10px py-4px text-14px leading-20px text-[#1460F3] cursor-pointer">Confirm</div>
+          <div @click="getChartStatistics()" class="w-70px h-28px border-[#1460F3] border-1px rounded-4px px-10px py-4px text-14px leading-20px text-[#1460F3] cursor-pointer">Confirm</div>
         </div>
         <div></div>
       </div>

+ 22 - 8
src/views/TeamManagement/ManageTeam.vue

@@ -1,23 +1,28 @@
 <script setup>
-import { onMounted, ref } from "vue"
+import { onMounted, ref, getCurrentInstance } from "vue"
 import Search from '@/components/icon/search.vue'
 import Warning from '@/components/icon/warning.vue'
-import { get } from '../../../utils/request'
+import { get, _delete } from '../../../utils/request'
 
+const { proxy } = getCurrentInstance()
 const tableData = ref([])
 const currentPage = ref(1)
 const pageSize = ref(5)
 const total = ref(0)
 const search = ref('')
 const dialogVisible = ref(false)
-const teamName = ref('')
 const teamId = ref('')
 const teamFilterSelect = ref('')
+const deleteTeamName = ref('')
+const deleteTeamId = ref('')
+const deleteTeamIndex = ref('')
 
 //打开对话框
 const handleClick = (index, val) => {
   console.log(index, val)
-  teamName.value = val.name
+  deleteTeamName.value = val.name
+  deleteTeamId.value = val.id
+  deleteTeamIndex.value = index
   dialogVisible.value = true
 }
 
@@ -55,9 +60,18 @@ function exportManageTeamList() {
   })
 }
 // 删除
-function handleDelete(index, row) {
-  this.tableData.splice(index, 1)
-  dialogVisible.value = false
+function handleDelete() {
+  _delete('http://81.68.234.235:8032/pdf-tech/vppTeam/deleteTeam', {
+    teamId: deleteTeamId.value
+  }).then((res) => {
+    if (res.data.code === 200) {
+      proxy.$message('Delete Success')
+      proxy.tableData.splice(deleteTeamIndex.value, 1)
+    } else (
+      proxy.$message.error(res.data.msg)
+    )
+    dialogVisible.value = false
+  })
 }
 
 onMounted(() => {
@@ -160,7 +174,7 @@ onMounted(() => {
       <Warning class="inline-block" />
       <div class="mt-16px text-16px leading-24px text-[#232A40]">
         <p>Sure Delete Team?</p>
-        <p>Team Name: <span class="font-bold">{{ teamName }}</span></p>
+        <p>Team Name: <span class="font-bold">{{ deleteTeamName }}</span></p>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="dialogVisible = false">No</el-button>

+ 22 - 16
src/views/TeamManagement/ManageTeamOperate.vue

@@ -1,5 +1,5 @@
 <script>
-import { post, put, _delete } from '../../../utils/request'
+import { post, put } from '../../../utils/request'
 
 export default {
   data () {
@@ -15,7 +15,7 @@ export default {
       },
       flag: '',
       adminOptions: [{
-        value: '1',
+        value: 1,
         label: 'HTML'
       }, {
         value: '2',
@@ -25,7 +25,7 @@ export default {
         label: 'JavaScript'
       }],
       projectOptions: [{
-        value: '1',
+        value: 1,
         label: 'HTML'
       }, {
         value: '2',
@@ -61,11 +61,17 @@ export default {
     }
     this.flag = rowData.flag
     if (rowData.flag === 'edit') {
+      if (rowData.teamId) {
+        this.formData.teamId = rowData.teamId
+      }
       if (rowData.teamName) {
         this.formData.teamName = rowData.teamName
       }
-      if (rowData.licenseNumber) {
-        this.formData.productList[0].licenseNumber = rowData.licenseNumber
+      if (rowData.teamDescription) {
+        this.formData.teamDescription = rowData.teamDescription
+      }
+      if (rowData.licenseAmount) {
+        this.formData.productList[0].licenseNumber = rowData.licenseAmount
       }
     }
     console.log(rowData)
@@ -110,21 +116,21 @@ export default {
     // 创建团队
     createTeam () {
       post('http://81.68.234.235:8032/pdf-tech/vppTeam/createTeam', this.formData).then((res) => {
-        console.log(res)
+        if (res.data.code === 200) {
+          this.$message('Change Success')
+        } else (
+          this.$message.error(res.data.msg)
+        )
       })
     },
     // 编辑团队
     editTeam () {
       put('http://81.68.234.235:8032/pdf-tech/vppTeam/editTeam', this.formData).then((res) => {
-        console.log(res)
-      })
-    },
-    // 删除团队
-    deleteTeam () {
-      _delete('http://81.68.234.235:8032/pdf-tech/vppTeam/deleteTeam', {
-        teamId: ''
-      }).then((res) => {
-        console.log(res)
+        if (res.data.code === 200) {
+          this.$message('Change Success')
+        } else (
+          this.$message.error(res.data.msg)
+        )
       })
     }
   },
@@ -158,7 +164,7 @@ export default {
             filterable
             allow-create
             default-first-option
-            placeholder="请选择文章标签"
+            placeholder=""
             class="w-600px">
             <el-option
               v-for="item in adminOptions"