Browse Source

Merge remote-tracking branch 'origin/master'

sakura 1 year ago
parent
commit
cf96c2865a
3 changed files with 158 additions and 110 deletions
  1. 3 6
      src/api/common.js
  2. 87 68
      src/views/GATHER/index.vue
  3. 68 36
      src/views/norm/quotaBonded.vue

+ 3 - 6
src/api/common.js

@@ -1,5 +1,6 @@
 import request from '@/utils/request'
 
+import download from '@/plugins/download'
 // 通用上传(单文件)
 export function uploadFile(data) {
   return request({
@@ -21,10 +22,6 @@ export function uploadFiles(data) {
 }
 
 // 下载
-export function downloadFiles(resource) {
-  return request({
-    url: '/common/download/resource?resource=' + encodeURI(resource),
-    method: 'get',
-    timeout: 2000000
-  })
+export function downloadFiles(data) {
+  download.resource(data);
 }

+ 87 - 68
src/views/GATHER/index.vue

@@ -238,12 +238,12 @@
         prop="approveTime"
         width="100"
       />
-      <el-table-column label="审核状态" align="center" prop="audit">
+      <el-table-column label="审核状态" align="center" prop="approveStatus">
         <template slot-scope="scope">
-          <span v-if="scope.row.audit == 0">未提交审核</span>
-          <span v-if="scope.row.audit == 1">审核中</span>
-          <span v-if="scope.row.audit == 2">审核通过</span>
-          <span v-if="scope.row.audit == 3">审核拒绝</span>
+          <span v-if="scope.row.approveStatus == 0">未提交审核</span>
+          <span v-if="scope.row.approveStatus == 1">审核中</span>
+          <span v-if="scope.row.approveStatus == 2">审核通过</span>
+          <span v-if="scope.row.approveStatus == 3">审核拒绝</span>
         </template>
       </el-table-column>
       <el-table-column
@@ -351,12 +351,13 @@
             @click="handleDetail(scope.row, 0)"
             >查看</el-button
           >
+          <!-- {{scope.row.collStatus}}--{{scope.row.approveStatus}} -->
           <el-button
             style="margin: 0 2px"
             v-if="
-              scope.row.collStatus == 1 &&
-              scope.row.audit == 0 &&
-              checkPermi(['gather:GATHER:edit'])
+              scope.row.collStatus == 1 &&         // 已采集
+              scope.row.approveStatus == 0 &&              // 未审核
+              checkPermi(['gather:GATHER:edit'])   // 编辑权限
             "
             size="mini"
             type="text"
@@ -452,32 +453,29 @@
           :label="item.normName"
           :name="item.normName"
         >
-          <el-form
-            v-for="(listItem, listIndex) in form.feeLists"
-            :key="index + listIndex + listItem.normId"
-            :rules="validatorList(listItem.normfeeName)"
-            :model="listItem"
-            :ref="'form' + listIndex"
-          >
-            <!-- :rules="rules" ref="form" -->
-            <el-form-item
-              :key="listItem.normfeeId"
-              :label="
-                listItem.normfeeName + '(' + listItem.funit_dictText + ')'
-              "
+          <template v-for="(listItem, listIndex) in form.feeLists">
+            <el-form
               v-if="listItem.normId == item.normId"
-              prop="collCalue"
-            >
-              <!-- 这里科研失败!想动态绑定校验规则的 -->
-              <!-- :prop="listItem.normfeeId" -->
-              <!-- :rules="rules.listItem.normfeeId" -->
-              <el-input
-                v-model="listItem.collCalue"
-                :placeholder="'请输入' + listItem.normfeeName"
-              ></el-input>
-            </el-form-item>
-          </el-form>
-
+              :rules="validatorList(listItem.normfeeName)"
+              :model="listItem"
+              :ref="'form' + listItem.normfeeId"
+              :key="listItem.normfeeId"
+            > <!-- :key="index + listIndex + listItem.normId" -->
+              <!-- :rules="rules" ref="form" -->
+              <el-form-item
+                :label="listItem.normfeeName + '(' + listItem.funit_dictText + ')'"
+                prop="collCalue"
+              >
+                <!-- 这里科研失败!想动态绑定校验规则的 -->
+                <!-- :prop="listItem.normfeeId" -->
+                <!-- :rules="rules.listItem.normfeeId" -->
+                <el-input
+                  v-model="listItem.collCalue"
+                  :placeholder="'请输入' + listItem.normfeeName"
+                ></el-input>
+              </el-form-item>
+            </el-form>
+          </template>
           <!-- 这里是第二种写法 -->
           <!-- <el-form :model="form" label-width="300px">
             <el-form-item
@@ -497,15 +495,13 @@
         <el-form
           v-for="(listItem, listIndex) in form.feeLists"
           :model="listItem"
-          :ref="'form' + listIndex"
+          :ref="'form' + listItem.normfeeId"
           :rules="rules"
+          :key="listItem.normfeeId"
         >
           <!-- :rules="rules" ref="form" -->
           <el-form-item
-            :key="listItem.normfeeId"
-            :label="
-              listItem.normfeeName + '(' + listItem.funit_dictText + ')'
-            "
+            :label="listItem.normfeeName + '(' + listItem.funit_dictText + ')'"
             prop="collCalue"
           >
             <!-- 这里科研失败!想动态绑定校验规则的 -->
@@ -545,31 +541,30 @@
           :label="item.normName"
           :name="item.normName"
         >
-          <el-form
-            v-for="(listItem, listIndex) in form.feeLists"
-            :model="listItem"
-            :ref="'form' + listIndex"
-            :rules="rules"
-          >
-            <!-- :rules="rules" ref="form" -->
-            <el-form-item
-              prop="collCalue"
-              :key="listItem.normfeeId"
-              :label="
-                listItem.normfeeName + '(' + listItem.funit_dictText + ')'
-              "
+          <template v-for="(listItem, listIndex) in form.feeLists">
+            <el-form
               v-if="listItem.normId == item.normId"
+              :model="listItem"
+              :ref="'form' + listItem.normfeeId"
+              :rules="rules"
+              :key="listItem.normfeeId"
             >
-              <!-- 这里科研失败!想动态绑定校验规则的 -->
-              <!-- :prop="listItem.normfeeId" -->
-              <!-- :rules="rules.listItem.normfeeId" -->
-              <el-input
-                :disabled="!edit"
-                v-model="listItem.collCalue"
-                :placeholder="'请输入' + listItem.normfeeName"
-              ></el-input>
-            </el-form-item>
-          </el-form>
+              <!-- :rules="rules" ref="form" -->
+              <el-form-item
+                prop="collCalue"
+                :label="listItem.normfeeName + '(' + listItem.funit_dictText + ')'"
+              >
+                <!-- 这里科研失败!想动态绑定校验规则的 -->
+                <!-- :prop="listItem.normfeeId" -->
+                <!-- :rules="rules.listItem.normfeeId" -->
+                <el-input
+                  :disabled="!edit"
+                  v-model="listItem.collCalue"
+                  :placeholder="'请输入' + listItem.normfeeName"
+                ></el-input>
+              </el-form-item>
+            </el-form>
+          </template>
 
           <!-- 这里是第二种写法 -->
           <!-- <el-form :model="form" label-width="150px">
@@ -587,16 +582,37 @@
         </el-tab-pane>
       </el-tabs>
 
+      <template v-else-if="this.form.type == 1">
+        <el-form
+          v-for="(listItem, listIndex) in form.feeLists"
+          :model="listItem"
+          :ref="'form' + listItem.normfeeId"
+          :rules="rules"
+          :key="listItem.normfeeId"
+        >
+          <!-- :rules="rules" ref="form" -->
+          <el-form-item
+            :label="listItem.normfeeName + '(' + listItem.funit_dictText + ')'"
+            prop="collCalue"
+          >
+            <!-- 这里科研失败!想动态绑定校验规则的 -->
+            <!-- :prop="listItem.normfeeId" -->
+            <!-- :rules="rules.listItem.normfeeId" -->
+            <el-input
+              v-model="listItem.collCalue"
+              :placeholder="'请输入' + listItem.normfeeName"
+            ></el-input>
+          </el-form-item>
+        </el-form>
+      </template>
+
+      <!--
       <el-form :model="form" v-else-if="this.form.type == 1">
-        <!-- :rules="rules" ref="form" -->
         <el-form-item
           v-for="(listItem, listIndex) in form.feeLists"
           :key="listItem.normfeeId"
           :label="listItem.normfeeName + '(' + listItem.funit_dictText + ')'"
         >
-          <!-- 这里科研失败!想动态绑定校验规则的 -->
-          <!-- :prop="listItem.normfeeId" -->
-          <!-- :rules="rules.listItem.normfeeId" -->
           <el-input
             :disabled="!edit"
             v-model="listItem.collCalue"
@@ -604,6 +620,7 @@
           ></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
@@ -738,7 +755,7 @@ export default {
       let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
       if (!reg.test(value)) {
         callback(new Error("请输入数字和正确格式的数字"));
-      } else if (value.split(".").length > 2) {
+      } else if (typeof value == 'string' && value.split(".").length > 2) {
         callback(new Error("请输入正确格式的数字")); //防止输入多个小数点
       }
       // else if (value.indexOf('.') != -1 && value.split('.')[1].length > 2) {
@@ -752,7 +769,7 @@ export default {
       let reg = /^[+]?(0|([1-9]\d*))(\.\d+)?$/g;
       if (!reg.test(value)) {
         callback(new Error("请输入正数和正确格式的数字"));
-      } else if (value.split(".").length > 2) {
+      } else if (typeof value == 'string' && value.split(".").length > 2) {
         callback(new Error("请输入正确格式的数字")); //防止输入多个小数点
       }
       // else if (value.indexOf('.') != -1 && value.split('.')[1].length > 2) {
@@ -1121,7 +1138,8 @@ export default {
       let p = [];
       p = this.form.feeLists.map((item, index) => {
         return new Promise((resolve, reject) => {
-          this.$refs["form" + index][0].validate((valid) => {
+          this.$refs["form" + item.normfeeId][0].validate((valid) => {
+          // this.$refs["form" + index].validate((valid) => {
             if (valid) {
               resolve(); //完成态
             } else {
@@ -1148,6 +1166,7 @@ export default {
         })
         .catch((err) => {
           console.log(err);
+          debugger;
           this.$message.error("请检查是否有必填项未输入!");
         });
     },

+ 68 - 36
src/views/norm/quotaBonded.vue

@@ -5,7 +5,14 @@
         <el-input v-model="queryParams.quotaName"></el-input>
       </el-form-item>
       <el-form-item label="保税区名称" prop="bondedName">
-        <el-input v-model="queryParams.bondedName"></el-input>
+        <el-select v-model="queryParams.bondedName" placeholder="请选择保税区" clearable filterable @change="selectBondedChange" style="width:100%">
+          <el-option
+            v-for="item in deptList"
+            :key="item.deptId"
+            :label="item.deptName"
+            :value="item.deptName">
+          </el-option>
+        </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
@@ -53,7 +60,7 @@
       <el-table-column label="文字说明" align="center" prop="remark" width="280"></el-table-column>
       <el-table-column label="附件" align="center" prop="fileNames" width="280">
         <template slot-scope="scope">
-          <el-link @click="download(scope.row.fileNames)">{{scope.row.fileNames}}</el-link>
+          <el-link style="text-decoration: underline;color: #36aafd" @click="download(scope.row.fileNames)">{{scope.row.fileNames}}</el-link>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" fixed="right" width="150">
@@ -231,7 +238,6 @@ export default {
     this.getDeptList()
   },
   methods: {
-
     // 获取保税区列表
     getDeptList() {
       this.loading = true;
@@ -335,10 +341,6 @@ export default {
             this.$message.error("得分必须为整数");
             return;
           }
-          if (this.form.enterType == '附件' && this.form.linkUrls == null) {
-            this.$message.error("请上传附件");
-            return;
-          }
           if (this.form.enterType == '文字说明' && this.form.remark == null) {
             this.$message.error("请录入文字说明");
             return;
@@ -352,32 +354,65 @@ export default {
             return;
           }
           if (this.form.id != null) {
-            let formData = new FormData()
-            if (this.fileList.length < 1) {
-              this.$message.error("请选择文件传输!");
-              return;
-            }
-            this.fileList.forEach((item) => {
-              formData.append("file", item.raw);
-            });
-            uploadFiles(formData).then(res=>{
-              if(res.code == 200){
-                this.form.linkUrls = res.fileNames;
-                this.form.fileNames = res.newFileNames;
-
-                updateQUOTABONDED(this.form).then(response => {
-                  this.$modal.msgSuccess("修改成功");
-                  this.open = false;
-                  this.getList();
+            if (this.form.enterType == '附件') {
+              if(this.fileList.length < 1) {
+                this.$message.error("请选择文件传输!");
+                return;
+              } else {
+                let formData = new FormData()
+                this.fileList.forEach((item) => {
+                  formData.append("file", item.raw);
                 });
+                uploadFiles(formData).then(res=>{
+                  if(res.code == 200){
+                    this.form.linkUrls = res.fileNames;
+                    this.form.fileNames = res.newFileNames;
+
+                    updateQUOTABONDED(this.form).then(response => {
+                      this.$modal.msgSuccess("修改成功");
+                      this.open = false;
+                      this.getList();
+                    });
+                  }
+                })
               }
-            })
+            } else {
+              updateQUOTABONDED(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            }
           } else {
-            addQUOTABONDED(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+            if (this.form.enterType == '附件') {
+              if(this.fileList.length < 1) {
+                this.$message.error("请选择文件传输!");
+                return;
+              } else {
+                let formData = new FormData()
+                this.fileList.forEach((item) => {
+                  formData.append("file", item.raw);
+                });
+                uploadFiles(formData).then(res=>{
+                  if(res.code == 200){
+                    this.form.linkUrls = res.fileNames;
+                    this.form.fileNames = res.newFileNames;
+
+                    addQUOTABONDED(this.form).then(response => {
+                      this.$modal.msgSuccess("新增成功");
+                      this.open = false;
+                      this.getList();
+                    });
+                  }
+                })
+              }
+            } else {
+              addQUOTABONDED(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
           }
         }
       });
@@ -406,12 +441,9 @@ export default {
       this.fileList = fileList;
     },
     download(resource) {
-      console.log("resource",resource)
-      downloadFiles(resource).then(res=>{
-        if(res.code == 200) {
-
-
-        }
+      let fileNames = resource.split(',');
+      fileNames.forEach(item => {
+         downloadFiles('/profile/upload/' +item);
       })
     }
   }