scorpio 2 anos atrás
pai
commit
ff2b555ccf

+ 25 - 0
src/api/dispatch/index.js

@@ -0,0 +1,25 @@
+import fetch from '../fetch.js'
+
+export default {
+  /**
+   * 获取调度详情
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  home(params) {
+    return fetch('/blade-project-manage-v2/project-dispatch/v2/index', params)
+  },
+  /**
+   * 新增或修改
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  saveOrUpdate(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/submit',
+      params,
+      'post',
+      'json'
+    )
+  }
+}

+ 3 - 1
src/api/index.js

@@ -10,6 +10,7 @@ import inspect from './inspect/index.js'
 import params from './params/index.js'
 import invest from './invest/index'
 import search from './search/index.js'
+import dispatch from './dispatch/index.js'
 
 export default {
   offices: ['pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'],
@@ -25,5 +26,6 @@ export default {
   inspect,
   params,
   invest,
-  search
+  search,
+  dispatch
 }

+ 0 - 1
src/layout/left.vue

@@ -71,7 +71,6 @@ export default {
     init() {
       const item = localStorage.getItem('index')
       if (item) {
-        console.log(JSON.parse(item))
         const menu = JSON.parse(item)
         this.active = menu.active
         this.subActive = menu.subActive

+ 2 - 0
src/page/login.vue

@@ -370,6 +370,8 @@ export default {
                 clearInterval(this.time)
                 setToken(res.access_token)
                 this.getInfo()
+                const menu = { active: 0, subActive: 0 }
+                localStorage.setItem('index', JSON.stringify(menu))
                 this.$router.replace('/')
               }
             })

+ 5 - 1
src/views/home/component/dash.vue

@@ -94,7 +94,11 @@
           {{ row.is_report === 1 ? '项目已上报' : '项目上报' }}
         </el-button>
         <el-button
-          v-if="!row.hasOwnProperty('report_type') || row.report_type === 1"
+          v-if="
+            !row.hasOwnProperty('report_type') ||
+            row.report_type === 1 ||
+            row.report_type === 4
+          "
           text
           type="primary"
           icon="el-icon-upload"

+ 86 - 3
src/views/home/component/dispatch.vue

@@ -10,7 +10,12 @@
           <span class="bold font-18 main-color">进度描述</span>
           <div class="flex flex-center">
             <base-button type="0" title="批量导出" icon="upload" />
-            <base-button class="ml-10" title="编辑" icon="upload" />
+            <base-button
+              class="ml-10"
+              :title="btnTitle"
+              icon="upload"
+              @click="edit"
+            />
           </div>
         </div>
         <div class="mt-20">
@@ -18,6 +23,7 @@
             v-model="progress"
             :rows="10"
             type="textarea"
+            :disabled="btnTitle === '编辑'"
             placeholder="填写项目进度信息"
           />
         </div>
@@ -61,12 +67,24 @@
           </div>
         </div>
         <div class="mt-20">
-          <el-carousel :interval="4000" type="card" height="200px">
-            <el-carousel-item v-for="item in 6" :key="item"> </el-carousel-item>
+          <el-carousel :interval="4000" type="card" height="400px">
+            <el-carousel-item v-for="(item, index) in srcList" :key="item">
+              <el-image
+                :src="item"
+                fit="cover"
+                @click="showImageView(item, index)"
+              />
+            </el-carousel-item>
           </el-carousel>
         </div>
       </div>
     </div>
+    <el-image-viewer
+      v-if="showImage"
+      :url-list="srcList"
+      :initial-index="imageIndex"
+      @close="showImage = false"
+    />
   </basic-container>
 </template>
 
@@ -87,11 +105,37 @@ export default {
       default: 0
     }
   },
+  watch: {
+    year: {
+      handler(val) {
+        if (val) {
+          this.detail()
+        }
+      },
+      immediate: false
+    },
+    month: {
+      handler(val) {
+        if (val) {
+          this.detail()
+        }
+      },
+      immediate: false
+    }
+  },
   data() {
     return {
       projectId: '',
+      btnTitle: '编辑',
+      showImage: false,
+      imageIndex: 0,
       progress: '',
       loading: false,
+      srcList: [
+        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
+        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
+        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
+      ],
       data: [
         {
           fileName: '支付情况表'
@@ -142,8 +186,47 @@ export default {
   },
   created() {
     this.projectId = this.$route.query.id
+    this.detail()
   },
   methods: {
+    detail() {
+      this.$api.dispatch
+        .home({
+          projectId: this.projectId,
+          year: this.year,
+          month: this.month
+        })
+        .then(res => {
+          if (res.code === 200) {
+            this.progress = res.data.processDescribe
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+    },
+    showImageView(res, index) {
+      this.imageIndex = index
+      this.showImage = true
+    },
+    edit() {
+      if (this.btnTitle === '保存' && this.progress.length > 0) {
+        const data = {
+          projectId: this.projectId,
+          year: this.year,
+          month: this.month,
+          processDescribe: this.progress
+        }
+        this.$api.dispatch.saveOrUpdate(data).then(res => {
+          if (res.code === 200) {
+            console.log(res)
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+        })
+      }
+      this.btnTitle = this.btnTitle === '编辑' ? '保存' : '编辑'
+    },
     rowDel(row, index, done) {
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',