scorpioyq 2 سال پیش
والد
کامیت
cef0cb6ab4
2فایلهای تغییر یافته به همراه120 افزوده شده و 119 حذف شده
  1. 78 77
      src/views/invest/components/years.vue
  2. 42 42
      src/views/invest/index.vue

+ 78 - 77
src/views/invest/components/years.vue

@@ -2,10 +2,10 @@
   <div class="flex flex-center flex-col">
     <div class="full-width">
       <basic-tab
-        :tabs="tabs"
-        :full="true"
-        @change="change"
-        style="width: 99%"
+          :tabs="tabs"
+          :full="true"
+          @change="change"
+          style="width: 99%"
       />
     </div>
     <div class="flex flex-center full-width mt-10">
@@ -13,35 +13,35 @@
         <div class="box" :style="`box-shadow: ` + i.box">
           <div class="flex flex-col bold font-16 padding-14">
             <div class="flex flex-justify-start flex-align-end">
-              <img :src="i.icon" />
+              <img :src="i.icon"/>
               <span class="grey-6 ml-5">{{ i.name }}</span>
               <span v-if="i.index !== 2" class="font-12 grey-6 ml-10"
-                >万元</span
+              >万元</span
               >
             </div>
             <div
-              v-if="i.index !== 2"
-              class="flex flex-align-end flex-justify-start mt-10"
+                v-if="i.index !== 2"
+                class="flex flex-align-end flex-justify-start mt-10"
             >
               <span class="grey" style="margin-left: 3px">¥</span>
               <span class="ml-5 font-24" :style="`color:` + i.color">{{
-                info[i.prop] ? info[i.prop].toLocaleString() : '0'
-              }}</span>
+                  info[i.prop] ? info[i.prop].toLocaleString() : '0'
+                }}</span>
               <el-icon
-                :size="15"
-                v-if="i.index === 0 && user.info.viewStage === 1"
-                class="ml-10 pointer"
-                @click="edit(i)"
+                  :size="15"
+                  v-if="i.index === 0 && user.info.viewStage === 1"
+                  class="ml-10 pointer"
+                  @click="edit(i)"
               >
-                <Edit />
+                <Edit/>
               </el-icon>
             </div>
             <div v-else class="flex flex-justify-start flex-center mt-10">
               <div class="progress-bar mt-10">
                 <div
-                  v-if="info[i.prop]"
-                  class="bar full-height"
-                  :style="
+                    v-if="info[i.prop]"
+                    class="bar full-height"
+                    :style="
                     `width: ` +
                     (Number.parseFloat(info[i.prop].replace('%', '')) > 100
                       ? '100%'
@@ -50,12 +50,12 @@
                 ></div>
               </div>
               <span class="ml-10 font-24 mt-10" :style="`color:` + i.color">{{
-                info[i.prop]
-              }}</span>
+                  info[i.prop]
+                }}</span>
             </div>
           </div>
           <div style="margin-top: -20px">
-            <wave :color="i.color" />
+            <wave :color="i.color"/>
           </div>
         </div>
       </div>
@@ -66,8 +66,8 @@
 <script>
 import basicTab from '@/components/basic-tab/index.vue'
 import wave from '@/views/invest/components/wave.vue'
-import { useStore } from '@/store/user.js'
-import { ElMessageBox } from 'element-plus'
+import {useStore} from '@/store/user.js'
+import {ElMessageBox} from 'element-plus'
 import index from '@/views/task/Index.vue'
 
 export default {
@@ -77,10 +77,10 @@ export default {
       return index
     }
   },
-  components: { basicTab, wave },
+  components: {basicTab, wave},
   setup() {
     const user = useStore()
-    return { user }
+    return {user}
   },
   props: {
     deptId: {
@@ -95,6 +95,7 @@ export default {
   watch: {
     deptId: {
       handler(val) {
+        console.log(val)
         this.load()
       },
       immediate: true
@@ -111,17 +112,17 @@ export default {
       times: [],
       info: {},
       tabs: [
-        { name: '总览', value: 0 },
-        { name: '一季度', value: 1 },
-        { name: '二季度', value: 2 },
-        { name: '三季度', value: 3 },
-        { name: '四季度', value: 4 }
+        {name: '总览', value: 0},
+        {name: '一季度', value: 1},
+        {name: '二季度', value: 2},
+        {name: '三季度', value: 3},
+        {name: '四季度', value: 4}
       ],
       quarter: '',
       dash: [
         {
           icon: new URL('../../../assets/svg/invest/1.svg', import.meta.url)
-            .href,
+              .href,
           name: '责任目标',
           value: 0,
           prop: 'plan_complete_amount',
@@ -129,13 +130,13 @@ export default {
           color: '#32B5F3',
           index: 0,
           background: new URL(
-            '../../../assets/svg/invest/bg1.svg',
-            import.meta.url
+              '../../../assets/svg/invest/bg1.svg',
+              import.meta.url
           ).href
         },
         {
           icon: new URL('../../../assets/svg/invest/2.svg', import.meta.url)
-            .href,
+              .href,
           name: '累计完成投资',
           value: 0,
           prop: 'total_complete_amount',
@@ -145,7 +146,7 @@ export default {
         },
         {
           icon: new URL('../../../assets/svg/invest/3.svg', import.meta.url)
-            .href,
+              .href,
           name: '投资完成比例',
           value: 0,
           prop: 'rate',
@@ -155,7 +156,7 @@ export default {
         },
         {
           icon: new URL('../../../assets/svg/invest/4.svg', import.meta.url)
-            .href,
+              .href,
           name: '计划纳统投资',
           value: 0,
           prop: 'total_investment_amount',
@@ -173,16 +174,16 @@ export default {
     load() {
       this.tabs[0].name = this.year + '年总览'
       this.$api.invest
-        .homeInvest({
-          deptId: this.deptId === null ? '' : this.deptId,
-          year: this.year === null ? '' : this.year,
-          quarter: this.quarter
-        })
-        .then(res => {
-          if (res.code === 200) {
-            this.info = res.data
-          }
-        })
+          .homeInvest({
+            deptId: this.deptId === null ? '' : this.deptId,
+            year: this.year === null ? '' : this.year,
+            quarter: this.quarter
+          })
+          .then(res => {
+            if (res.code === 200) {
+              this.info = res.data
+            }
+          })
     },
     init() {
       const year = new Date().getFullYear()
@@ -195,56 +196,56 @@ export default {
     },
     edit(item) {
       ElMessageBox.prompt(
-        '当前责任目标为' +
+          '当前责任目标为' +
           this.info[item.prop].toLocaleString() +
           '万元,请输入新的责任目标(数字,小数点)',
-        '提示',
-        {
-          confirmButtonText: '保存',
-          cancelButtonText: '取消',
-          inputPattern: /^([1-9]\d*|0)(\.\d+)?$/,
-          inputErrorMessage: '信息错误'
-        }
-      ).then(({ value }) => {
+          '提示',
+          {
+            confirmButtonText: '保存',
+            cancelButtonText: '取消',
+            inputPattern: /^([1-9]\d*|0)(\.\d+)?$/,
+            inputErrorMessage: '信息错误'
+          }
+      ).then(({value}) => {
         let data = {}
         switch (this.quarter) {
           case 0: // 年度
-            data = { number: value }
+            data = {number: value}
             break
           case 1: // 1季度
-            data = { number: value, type: 1 }
+            data = {number: value, type: 1}
             break
           case 2: // 2季度
-            data = { number: value, type: 2 }
+            data = {number: value, type: 2}
             break
           case 3: // 3季度
-            data = { number: value, type: 3 }
+            data = {number: value, type: 3}
             break
           case 4: // 4季度
-            data = { number: value, type: 4 }
+            data = {number: value, type: 4}
             break
           default:
-            data = { number: value }
+            data = {number: value}
             break
         }
         this.$api.invest
-          .savePlan(
-            Object.assign(
-              {
-                deptId: this.deptId === null ? '' : this.deptId,
-                year: this.year === null ? '' : this.year
-              },
-              data
+            .savePlan(
+                Object.assign(
+                    {
+                      deptId: this.deptId === null ? '' : this.deptId,
+                      year: this.year === null ? '' : this.year
+                    },
+                    data
+                )
             )
-          )
-          .then(res => {
-            if (res.code === 200) {
-              this.$message.success(res.msg)
-              this.info[item.prop] = value
-            } else {
-              this.$message.error(res.msg)
-            }
-          })
+            .then(res => {
+              if (res.code === 200) {
+                this.$message.success(res.msg)
+                this.info[item.prop] = value
+              } else {
+                this.$message.error(res.msg)
+              }
+            })
       })
     }
   }

+ 42 - 42
src/views/invest/index.vue

@@ -3,87 +3,87 @@
     <div class="full-width flex mt-10">
       <el-col :span="4" v-if="hasChildrenDept">
         <basic-container>
-          <left :has-children="hasChildrenDept" @change="changeDept" />
+          <left :has-children="hasChildrenDept" @change="changeDept"/>
         </basic-container>
       </el-col>
       <el-col :span="hasChildrenDept ? 20 : 24">
         <basic-container>
           <div class="flex flex-align-start">
             <el-select
-              v-model="year"
-              clearable
-              style="width: 15%"
-              @change="yearSelect"
+                v-model="year"
+                clearable
+                style="width: 15%"
+                @change="yearSelect"
             >
               <el-option
-                v-for="item in years"
-                :key="item.value"
-                :label="item.value"
-                :value="item.value"
+                  v-for="item in years"
+                  :key="item.value"
+                  :label="item.value"
+                  :value="item.value"
               />
             </el-select>
           </div>
           <div class="mt-20">
-            <years :dept-id="dept" :year="year" @change="change" />
+            <years :dept-id="dept" :year="year" @change="change"/>
           </div>
         </basic-container>
         <basic-container>
           <div class="flex">
             <div
-              class="flex-child-average full-width flex flex-col flex-justify-start"
+                class="flex-child-average full-width flex flex-col flex-justify-start"
             >
               <div class="flex flex-center flex-justify-between">
                 <span class="font-16 bold full-width text-left"
-                  >投资数据统计 单位(亿元)</span
+                >投资数据统计 单位(亿元)</span
                 >
                 <div
-                  class="flex flex-center"
-                  :class="isAverage ? 'red' : 'blue'"
+                    class="flex flex-center"
+                    :class="isAverage ? 'red' : 'blue'"
                 >
                   <el-icon>
-                    <Warning />
+                    <Warning/>
                   </el-icon>
                   <span
-                    class="full-width text-right ml-5 nowrap mr-20"
-                    v-if="isAverage"
-                    >上月未完成平均投资指标</span
+                      class="full-width text-right ml-5 nowrap mr-20"
+                      v-if="isAverage"
+                  >上月未完成平均投资指标</span
                   >
                   <span class="full-width text-right ml-5 nowrap mr-20" v-else
-                    >上月已完成平均投资指标</span
+                  >上月已完成平均投资指标</span
                   >
                 </div>
               </div>
               <div class="full-width mt-10" style="background-color: #f7fafd">
                 <chart
-                  :dept-id="dept"
-                  :quarter="yearType.value === 0 ? '' : yearType"
-                  :year="year"
-                  @avg="avg"
+                    :dept-id="dept"
+                    :quarter="yearType.value === 0 ? '' : yearType"
+                    :year="year"
+                    @avg="avg"
                 />
               </div>
 
               <span class="font-16 bold full-width text-left mt-20"
-                >项目入库统计 单位(个)</span
+              >项目入库统计 单位(个)</span
               >
               <div class="full-width mt-10" style="background-color: #f7fafd">
                 <chart2
-                  :dept-id="dept"
-                  :quarter="
+                    :dept-id="dept"
+                    :quarter="
                     yearType.value === 0 || yearType === '0' ? '' : yearType
                   "
-                  :year="year"
+                    :year="year"
                 />
               </div>
             </div>
             <div class="white-bg padding"></div>
             <div class="flex-child-average">
               <amount
-                v-if="user.info.viewStage === 1 && dept === null"
-                :type="yearType"
-                :deptId="dept"
-                :year="year"
+                  v-if="user.info.viewStage === 1 && dept === null"
+                  :type="yearType"
+                  :deptId="dept"
+                  :year="year"
               />
-              <complete v-else :type="yearType" :deptId="dept" :year="year" />
+              <complete v-else :type="yearType" :deptId="dept" :year="year"/>
             </div>
           </div>
         </basic-container>
@@ -107,14 +107,14 @@ import amount from '@/views/invest/components/amount.vue'
 import chart from '@/views/invest/components/chart.vue'
 import chart2 from '@/views/invest/components/chart2.vue'
 import complete from '@/views/invest/components/complete.vue'
-import { useStore } from '@/store/user.js'
+import {useStore} from '@/store/user.js'
 
 export default {
   name: 'index',
-  components: { BasicContainer, left, years, amount, chart, chart2, complete },
+  components: {BasicContainer, left, years, amount, chart, chart2, complete},
   setup() {
     const user = useStore()
-    return { user }
+    return {user}
   },
   data() {
     return {
@@ -158,13 +158,13 @@ export default {
   methods: {
     deptDetail() {
       this.$api.system
-        .getDeptDetail({ id: this.user.info.deptId })
-        .then(res => {
-          if (res.code === 200) {
-            this.hasChildrenDept = res.data.hasChildren
-            this.dept = res.data.id
-          }
-        })
+          .getDeptDetail({id: this.user.info.deptId})
+          .then(res => {
+            if (res.code === 200) {
+              this.hasChildrenDept = res.data.hasChildren
+              // this.dept = res.data.id
+            }
+          })
     },
     changeDept(res) {
       if (res === null) {