Преглед изворни кода

更新点价确认单附件

ccj пре 3 година
родитељ
комит
ecb68b353e

+ 10 - 26
src/views/contractManagement/priceConfirmationSheet.vue

@@ -69,15 +69,6 @@
         <p>
           <template>{{ item.priceListNo }}</template>
         </p>
-        <div class="fujian">
-          <el-button size="small" type="primary">附件</el-button>
-          <div class="shangchuan">
-            <template>
-              <span v-if="item.enclosureTypeFlag == 0">未上传</span>
-              <span v-if="item.enclosureTypeFlag == 1">已上传</span>
-            </template>
-          </div>
-        </div>
         <div class="caozuoanniu">
           <template>
             <el-button class="find" type="primary" @click="sheetEdit(item)"
@@ -94,7 +85,7 @@
         </div>
       </div>
       <div class="center">
-        <ws-form ref="deptBudgetList" :model="deptBudgetList">
+        <ws-form ref="deptBudgetList" :model="item">
           <!--基本信息-->
           <ws-info-table>
             <ws-form-item
@@ -161,6 +152,13 @@
               </div>
             </ws-form-item>
           </ws-info-table>
+          <ws-upload
+            ref="upload"
+            :comp-id="compId"
+            :appendix-ids="item.addressUrl"
+            :editable="false"
+            accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
+          />
         </ws-form>
       </div>
     </div>
@@ -211,9 +209,9 @@ export default {
       id: '',
       size: 10,
       unitList: [],
-      addressUrls: [],
-      addressUrl: '',
       deptBudgetList: [],
+      compId: sessionStorage.getItem('ws-pf_compId'),
+      appendixIdss:[]
     }
   },
   activated() {
@@ -221,9 +219,6 @@ export default {
     this.showType = this.isShow
   },
   methods: {
-    close(index) {
-      this.addressUrls.splice(index, 1)
-    },
     // 关闭 dialog时 处理文件url 初始化upload组件
     handleClose() {
       this.dialogViewSpareMoney = false
@@ -295,17 +290,6 @@ export default {
           return false
         })
     },
-    fujian(row) {
-      if (row.addressUrl === null || row.addressUrl === '') {
-        EventBus.$emit(
-          'warning',
-          this.$t('system.noticeCircular.NoInformation')
-        )
-      } else {
-        this.accessoryTFs = true
-      }
-      this.appendixIdss = row.addressUrl.split(',')
-    },
     getUnitList() {
       selectConfirmationSheet({
         contractNo: this.$route.query.contractNo,

+ 18 - 44
src/views/contractManagement/priceConfirmationSheetAdd.vue

@@ -56,34 +56,6 @@
               size="small"
             />
           </ws-form-item>
-
-          <!--点价单附件-->
-          <ws-form-item label="点价单附件" span="1" prop="addressUrl">
-            <el-upload
-              class="upload-demo"
-              action="https://www.zthymaoyi.com/upload/admin"
-              :on-success="
-                (res, file) => {
-                  uploadSuccessHandle(res)
-                }
-              "
-              multiple
-              :limit="3"
-            >
-              <el-button size="small" type="primary">附件</el-button>
-            </el-upload>
-            <div class="shangchuan">
-              <template>
-                <span v-if="enclosureTypeFlag == 0"
-                  >未上传</span
-                >
-                <span v-if="enclosureTypeFlag == 1"
-                  >已上传</span
-                >
-              </template>
-            </div>
-          </ws-form-item>
-
           <!--品种合约及方向-->
           <ws-form-item
             label="品种合约及方向"
@@ -195,6 +167,13 @@
             />
           </ws-form-item>
         </ws-info-table>
+         <ws-upload
+          ref="upload"
+          :comp-id="compId"
+          :appendix-ids="deptBudgetList.addressUrl"
+          @onChange="onChange"
+          accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
+        />
       </ws-form>
     </div>
     <div style="text-align: right; padding: 10px" class="center">
@@ -261,14 +240,11 @@ export default {
         priceListNo: '',
         addressUrl: '',
       },
-      addressUrls: [],
       deptBudgetList: {},
+      compId: sessionStorage.getItem('ws-pf_compId'),
     }
   },
   methods: {
-    close(index) {
-      this.addressUrls.splice(index, 1)
-    },
     // 关闭 dialog时 处理文件url 初始化upload组件
     handleClose() {
       this.dialogViewSpareMoney = false
@@ -285,17 +261,16 @@ export default {
       this.$router.push({ path: 'priceConfirmationSheet',
       query: { contractNo: this.$route.query.contractNo , contractType: this.$route.query.contractType } })
     },
-
-    // 上传附件
-    uploadSuccessHandle(e) {
-      this.addressUrls.push(e.url)
-    this.enclosureTypeFlag = 1
-    },
-    onChange(files) {
-      this.fileNum = files
-      this.$refs.upload.handleSaveBill().then((res) => {
-        console.log(files)
-      })
+    onChange() {
+     this.$refs.upload
+        .handleSaveBill()
+        .then(async response => {
+          this.deptBudgetList.addressUrl = response
+        })
+        .catch(res => {
+          EventBus.$emit('error', (JSON.parse(res) || {}).message)
+          this.$refs.upload.clearFiles()
+        })
     },
     //计算成交数量(吨)
     transactionsNumberHandChange(e) {
@@ -483,7 +458,6 @@ export default {
       }
       this.deptBudgetList.contractType = this.$route.query.contractType,
       this.deptBudgetList.contractNo = this.$route.query.contractNo,
-       this.deptBudgetList.addressUrl = this.addressUrls.toString()
 
       this.priceConfirmationSheet = this.deptBudgetList
       this.$confirm(`确定提交确认单信息`, {

+ 20 - 43
src/views/contractManagement/priceConfirmationSheetEdit.vue

@@ -59,30 +59,6 @@
               size="small"
             />
           </ws-form-item>
-
-          <!--点价单附件-->
-          <ws-form-item label="点价单附件" span="1" prop="addressUrl">
-            <el-upload
-              class="upload-demo"
-              action="https://www.zthymaoyi.com/upload/admin"
-              :on-success="
-                (res, file) => {
-                  uploadSuccessHandle(res)
-                }
-              "
-              multiple
-              :limit="3"
-            >
-              <el-button size="small" type="primary">附件</el-button>
-            </el-upload>
-            <div class="shangchuan">
-              <template>
-                <span v-if="deptBudgetList.enclosureTypeFlag == 0">未上传</span>
-                <span v-if="deptBudgetList.enclosureTypeFlag == 1">已上传</span>
-              </template>
-            </div>
-          </ws-form-item>
-
           <!--品种合约及方向-->
           <ws-form-item
             label="品种合约及方向"
@@ -193,7 +169,15 @@
               size="small"
             />
           </ws-form-item>
+          
         </ws-info-table>
+        <ws-upload
+          ref="upload"
+          :comp-id="compId"
+          :appendix-ids="deptBudgetList.addressUrl"
+          @onChange="onChange"
+          accept=".jpg, .jpeg, .png, .pdf, .doc, .zip, .rar"
+        />
       </ws-form>
     </div>
     <div style="text-align: right; padding: 10px" class="center">
@@ -252,12 +236,10 @@ export default {
          contractNo: this.$route.query.contractNo,
          contractType :this.$route.query.contractType,
          id: this.$route.query.id,
-         
-           addressUrl: '',
+         addressUrl: '',
       },
-
-      addressUrls: [],
       deptBudgetList: {},
+      compId: sessionStorage.getItem('ws-pf_compId'),
     }
   },
   activated() {
@@ -267,9 +249,6 @@ export default {
     this.showType = this.isShow
   },
   methods: {
-    close(index) {
-      this.addressUrls.splice(index, 1)
-    },
     // 关闭 dialog时 处理文件url 初始化upload组件
     handleClose() {
       this.dialogViewSpareMoney = false
@@ -285,17 +264,16 @@ export default {
       query: { contractNo: this.$route.query.contractNo , contractType: this.$route.query.contractType } })
     },
 
-    // 上传附件
-    uploadSuccessHandle(e) {
-      this.addressUrls.push(e.url)
-       this.enclosureTypeFlag = 1
-      
-    },
-    onChange(files) {
-      this.fileNum = files
-      this.$refs.upload.handleSaveBill().then((res) => {
-        console.log(files)
-      })
+    onChange() {
+     this.$refs.upload
+        .handleSaveBill()
+        .then(async response => {
+          this.deptBudgetList.addressUrl = response
+        })
+        .catch(res => {
+          EventBus.$emit('error', (JSON.parse(res) || {}).message)
+          this.$refs.upload.clearFiles()
+        })
     },
     //数据回显
     loaddata() {
@@ -505,7 +483,6 @@ export default {
       }
       this.deptBudgetList.contractType = this.$route.query.contractType,
       this.deptBudgetList.contractNo = this.$route.query.contractNo,
-      this.deptBudgetList.addressUrl = this.addressUrls.toString(),
       this.priceConfirmationSheet = this.deptBudgetList
       this.$confirm(`确定提交确认单信息`, {
         cancelButtonText: '取消',