Browse Source

数据采集-数据采集增加 修改功能 并对数据的各种状态调整操作的显示

Sanmu8 1 year ago
parent
commit
8793a6a31b
1 changed files with 49 additions and 33 deletions
  1. 49 33
      src/views/GATHER/index.vue

+ 49 - 33
src/views/GATHER/index.vue

@@ -199,7 +199,7 @@
           >
             <el-button
               style="margin: 0 2px"
-              v-if="scope.row.reportStatus == 0"
+              v-if="scope.row.reportStatus == 0 && scope.row.collStatus == 1"
               size="mini"
               slot="reference"
               type="text"
@@ -213,7 +213,7 @@
           >
             <el-button
               style="margin: 0 2px"
-              v-if="scope.row.reportStatus == 0"
+              v-if="scope.row.reportStatus == 0 && scope.row.collStatus == 1"
               size="mini"
               type="text"
               slot="reference"
@@ -225,9 +225,22 @@
             v-if="scope.row.collStatus == 1"
             size="mini"
             type="text"
-            @click="handleDetail(scope.row)"
+            @click="handleDetail(scope.row, 0)"
             >查看</el-button
           >
+
+          <el-button
+            style="margin: 0 2px"
+            v-if="
+              scope.row.collStatus == 1 &&
+              scope.row.reportStatus == 0 &&
+              scope.row.approveStatus == 0
+            "
+            size="mini"
+            type="text"
+            @click="handleDetail(scope.row, 1)"
+            >修改</el-button
+          >
         </template>
       </el-table-column>
     </el-table>
@@ -306,7 +319,7 @@
       </div>
     </el-dialog>
 
-    <!-- 添加或修改数据采集对话框 -->
+    <!-- 录入数据采集对话框 -->
     <el-dialog
       center
       :title="title"
@@ -383,13 +396,13 @@
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="submitForm('add')">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
         <!-- <el-button @click="cancel">取 消</el-button> -->
       </div>
     </el-dialog>
 
-    <!-- 查看 -->
+    <!-- 查看或修改 -->
     <el-dialog
       center
       :title="title"
@@ -422,7 +435,7 @@
               <!-- :prop="listItem.normfeeId" -->
               <!-- :rules="rules.listItem.normfeeId" -->
               <el-input
-                disabled
+                :disabled="!edit"
                 v-model="listItem.collCalue"
                 :placeholder="'请输入' + listItem.normfeeName"
               ></el-input>
@@ -461,13 +474,16 @@
           <!-- :prop="listItem.normfeeId" -->
           <!-- :rules="rules.listItem.normfeeId" -->
           <el-input
-            disabled
+            :disabled="!edit"
             v-model="listItem.collCalue"
             :placeholder="'请输入' + listItem.normfeeName"
           ></el-input>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm('edit')" v-if="edit"
+          >确 定</el-button
+        >
         <el-button type="primary" @click="cancel">返 回</el-button>
       </div>
     </el-dialog>
@@ -495,6 +511,7 @@ export default {
   name: "GATHER",
   data() {
     return {
+      edit: Boolean, //false 查看  true修改
       tabList: [],
       feeLists: [],
       activeName: "",
@@ -601,9 +618,7 @@ export default {
       let formData = new FormData();
       formData.append("file", file);
       formData.append("type", this.uploadForm.type);
-      upload(formData).then((res) => {
-
-      });
+      upload(formData).then((res) => {});
     },
     //下载模板
     handleDownload() {
@@ -672,7 +687,7 @@ export default {
       this.uploadForm = {
         type: "",
       };
-      this.fileList = []
+      this.fileList = [];
       this.resetForm("form");
     },
     /** 搜索按钮操作 */
@@ -698,7 +713,7 @@ export default {
       this.openDetail = true;
       this.title = "添加数据采集";
     },
-    /** 修改按钮操作 */
+    /** 录入按钮操作 */
     handleUpdate(row) {
       // this.reset();
       this.tabList = [];
@@ -751,7 +766,13 @@ export default {
       });
     },
     /** 查看按钮操作 */
-    handleDetail(row) {
+    handleDetail(row, type) {
+      //false 查看  true修改
+      if (type == 0) {
+        this.edit = false;
+      } else if (type == 1) {
+        this.edit = true;
+      }
       // this.reset();
       this.tabList = [];
       this.form = [];
@@ -803,7 +824,7 @@ export default {
       });
     },
     /** 提交按钮 */
-    submitForm() {
+    submitForm(type) {
       for (const i in this.form.feeLists) {
         if (
           this.form.feeLists[i].collCalue == "" ||
@@ -819,25 +840,20 @@ export default {
           });
         }
       }
-      addGATHER(this.form).then((response) => {
-        this.$modal.msgSuccess("新增成功");
-        this.open = false;
-        this.getList();
-      });
 
-      // this.$refs["form"].validate((valid) => {
-      //   if (valid) {
-      //     if (this.form.id != null) {
-      //       updateGATHER(this.form).then((response) => {
-      //         this.$modal.msgSuccess("修改成功");
-      //         this.open = false;
-      //         this.getList();
-      //       });
-      //     } else {
-
-      //     }
-      //   }
-      // });
+      if (type == "add") {
+        addGATHER(this.form).then((response) => {
+          this.$modal.msgSuccess("录入成功");
+          this.open = false;
+          this.getList();
+        });
+      } else if (type == "edit") {
+        updateGATHER(this.form).then((response) => {
+          this.$modal.msgSuccess("修改成功");
+          this.openDetail = false;
+          this.getList();
+        });
+      }
     },
     /** 删除按钮操作 */
     handleDelete(row) {