scorpio 2 jaren geleden
bovenliggende
commit
af5cca2e9f
3 gewijzigde bestanden met toevoegingen van 149 en 107 verwijderingen
  1. 11 0
      src/api/dispatch/index.js
  2. 21 13
      src/views/home/component/dispatch.vue
  3. 117 94
      src/views/home/component/inspect/Inspect1.vue

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

@@ -9,6 +9,17 @@ export default {
   home(params) {
     return fetch('/blade-project-manage-v2/project-dispatch/v2/index', params)
   },
+  /**
+   * 项目调度文件
+   * @param params
+   * @returns {Promise<unknown>}
+   */
+  homeFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/project-dispatch/v2/file-index',
+      params
+    )
+  },
   /**
    * 新增或修改
    * @param params

+ 21 - 13
src/views/home/component/dispatch.vue

@@ -130,6 +130,7 @@ export default {
       showImage: false,
       imageIndex: 0,
       progress: '',
+      info: null,
       loading: false,
       srcList: [
         'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
@@ -190,19 +191,26 @@ export default {
   },
   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)
-          }
-        })
+      const data = {
+        projectId: this.projectId,
+        year: this.year,
+        month: this.month
+      }
+      this.$api.dispatch.home(data).then(res => {
+        if (res.code === 200) {
+          this.progress = res.data.processDescribe
+          this.info = res.data
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+      this.$api.dispatch.homeFile(data).then(res => {
+        if (res.code === 200) {
+          console.log(res)
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
     },
     showImageView(res, index) {
       this.imageIndex = index

+ 117 - 94
src/views/home/component/inspect/Inspect1.vue

@@ -1,24 +1,31 @@
 <template>
-  <div class='flex flex-justify-start flex-align-center flex-col'>
-    <span class='bold full-width text-left mt-20'>{{ info.dictValue }}</span>
-    <div style='width: 95%;' class='mt-20'>
+  <div class="flex flex-justify-start flex-align-center flex-col">
+    <span class="bold full-width text-left mt-20">{{ info.dictValue }}</span>
+    <div style="width: 95%" class="mt-20">
       <avue-crud
-          :option="option"
-          :data="data"
-          ref="crud"
-          v-model="form"
-          v-model:page='page'
-          :table-loading="loading"
-          :before-open="beforeOpen"
-          @current-change="currentChange"
-          @size-change="sizeChange"
-          @refresh-change="refreshChange"
-          @row-del="rowDel"
-          @row-save="rowSave"
-          @row-update="rowUpdate">
-        <template #menu="{row}">
-          <el-button v-if='row.hasReport' text type='primary' icon='el-icon-plus' @click='report(row)'>
-            {{ row.isReport === 1 ? "已上报" : "上报" }}
+        :option="option"
+        :data="data"
+        ref="crud"
+        v-model="form"
+        v-model:page="page"
+        :table-loading="loading"
+        :before-open="beforeOpen"
+        @current-change="currentChange"
+        @size-change="sizeChange"
+        @refresh-change="refreshChange"
+        @row-del="rowDel"
+        @row-save="rowSave"
+        @row-update="rowUpdate"
+      >
+        <template #menu="{ row }">
+          <el-button
+            v-if="row.hasReport"
+            text
+            type="primary"
+            icon="el-icon-plus"
+            @click="report(row)"
+          >
+            {{ row.isReport === 1 ? '已上报' : '上报' }}
           </el-button>
         </template>
       </avue-crud>
@@ -43,7 +50,7 @@ export default {
   },
   watch: {
     info: {
-      handler (val) {
+      handler(val) {
         if (val) {
           this.changeColum(val.dictKey)
         }
@@ -51,7 +58,7 @@ export default {
       immediate: true
     }
   },
-  data () {
+  data() {
     return {
       loading: false,
       form: {},
@@ -106,12 +113,12 @@ export default {
       }
     }
   },
-  created () {
+  created() {
     this.projectId = this.$route.query.id
     this.onLoad()
   },
   methods: {
-    changeColum (key) {
+    changeColum(key) {
       if (key === '1') {
         this.option = option1
       } else if (key === '2') {
@@ -124,10 +131,10 @@ export default {
         this.option = option5
       }
     },
-    add () {
+    add() {
       this.$refs.crud.rowAdd()
     },
-    report (row) {
+    report(row) {
       if (row.isReport === 1) {
         this.$message.error('该记录已经上报')
         return
@@ -148,119 +155,135 @@ export default {
         })
       })
     },
-    onLoad () {
+    onLoad() {
       const data = {
         projectId: this.projectId,
         status: this.info.dictKey
       }
       this.loading = true
-      this.$api.inspect.list(Object.assign(this.page, data)).then(res => {
-        this.data = res.data.records
-        this.page.total = res.data.total
-        if (this.data.length > 0) {
-          const hasReport = this.data[0].hasReport
-          if (!hasReport) {
-            // hasReport === false 表示未最后一级,不需要上报或者其他操作
-            const index = this.option.column.findIndex(e => e.prop === 'reportTime')
-            this.option.column[index].hide = true
+      this.$api.inspect
+        .list(Object.assign(this.page, data))
+        .then(res => {
+          this.data = res.data.records
+          this.page.total = res.data.total
+          if (this.data.length > 0) {
+            const hasReport = this.data[0].hasReport
+            if (!hasReport) {
+              // hasReport === false 表示未最后一级,不需要上报或者其他操作
+              const index = this.option.column.findIndex(
+                e => e.prop === 'reportTime'
+              )
+              this.option.column[index].hide = true
+            }
+            const sort = this.data[0].sort
+            if (sort !== 0) {
+              // sort ===0 第一级,填报内容的第一级用户
+              this.option.delBtn = false
+              this.option.editBtn = false
+              const index = this.option.column.findIndex(
+                e => e.prop === 'reportDeptName'
+              )
+              this.option.column[index].hide = false
+            } else {
+              // 第一级部门,不显示上报部门
+              const index = this.option.column.findIndex(
+                e => e.prop === 'reportDeptName'
+              )
+              this.option.column[index].hide = true
+            }
           }
-          const sort = this.data[0].sort
-          if (sort !== 0) { // sort ===0 第一级,填报内容的第一级用户
-            this.option.delBtn = false
-            this.option.editBtn = false
-            const index = this.option.column.findIndex(e => e.prop === 'reportDeptName')
-            this.option.column[index].hide = false
-          } else { // 第一级部门,不显示上报部门
-            const index = this.option.column.findIndex(e => e.prop === 'reportDeptName')
-            this.option.column[index].hide = true
-          }
-        }
-      }).finally(() => {
-        this.loading = false
-      })
+        })
+        .finally(() => {
+          this.loading = false
+        })
     },
-    beforeOpen (done, type) {
+    beforeOpen(done, type) {
       if (['view', 'edit'].includes(type)) {
-
       }
       done()
     },
-    getDetail (res) {
+    getDetail(res) {
       this.$api.inspect.detail({ id: res.id }).then(res => {
         if (res.code === 200) {
           this.form = res.data
         }
       })
     },
-    currentChange (currentPage) {
+    currentChange(currentPage) {
       console.log(currentPage)
       this.page.current = currentPage
       this.refreshChange()
     },
-    sizeChange (pageSize) {
+    sizeChange(pageSize) {
       this.page.size = pageSize
       this.refreshChange()
     },
-    refreshChange () {
+    refreshChange() {
       this.onLoad()
     },
-    rowSave (row, done, loading) {
+    rowSave(row, done, loading) {
       const data = {
         projectId: this.projectId,
         status: this.info.dictKey
       }
-      this.$api.inspect.submint(Object.assign(row, data)).then((res) => {
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
+      this.$api.inspect.submint(Object.assign(row, data)).then(
+        res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+          done(row)
+          this.onLoad()
+        },
+        error => {
+          window.console.log(error)
+          loading()
         }
-        done(row)
-        this.onLoad()
-      }, error => {
-        window.console.log(error)
-        loading()
-      })
+      )
     },
-    rowUpdate (row, index, done, loading) {
+    rowUpdate(row, index, done, loading) {
       const data = {
         projectId: this.projectId
       }
-      this.$api.inspect.update(Object.assign(row, data)).then((res) => {
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
+      this.$api.inspect.update(Object.assign(row, data)).then(
+        res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+          } else {
+            this.$message.error(res.msg)
+          }
+          done(row)
+          this.onLoad()
+        },
+        error => {
+          window.console.log(error)
+          loading()
         }
-        done(row)
-        this.onLoad()
-      }, error => {
-        window.console.log(error)
-        loading()
-      })
+      )
     },
-    rowDel (row, index, done) {
+    rowDel(row, index, done) {
       this.$confirm('确定将选择数据删除?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
-      }).then(() => {
-        return this.$api.inspect.remove({ ids: row.id })
-      }).then(() => {
-        this.$message({
-          type: 'success',
-          message: '操作成功!'
-        })
-        // 数据回调进行刷新
-        done(row)
-        this.onLoad()
-      }).catch(() => {
       })
+        .then(() => {
+          return this.$api.inspect.remove({ ids: row.id })
+        })
+        .then(() => {
+          this.$message({
+            type: 'success',
+            message: '操作成功!'
+          })
+          // 数据回调进行刷新
+          done(row)
+          this.onLoad()
+        })
+        .catch(() => {})
     }
   }
 }
 </script>
 
-<style scoped>
-
-</style>
+<style scoped></style>