zhangqiOMG 2 gadi atpakaļ
vecāks
revīzija
d0d11bd9ae

+ 216 - 0
src/HDrpManagement/contractManage/components/importFile.vue

@@ -0,0 +1,216 @@
+<template>
+  <div>
+    <!-- 按钮类型 -->
+    <el-button type="success" size="small" @click="onShow(0)" icon="el-icon-upload">导 入</el-button>
+    <el-dialog title="文件上传" class="import-panel" :visible.sync="dialogUploadVisible" width="500px" append-to-body :close-on-click-modal="false" :show-close="false" @close="clearFiles">
+      <div slot="title"></div>
+      <div style="background:#f1f2f3" class="my-tabs" >
+        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
+          <!-- <el-tab-pane label="导入经销商线索" name="first"></el-tab-pane> -->
+          <el-tab-pane label="导入" name="second"></el-tab-pane>
+        </el-tabs>
+      </div>
+      <div style="padding:20px">
+        <el-upload
+          style="width:100%"
+          ref="my-upload"
+          class="upload-demo normal-margin"
+          :accept="accept"
+          action="#"
+          :auto-upload="false"
+          :show-file-list="false"
+          :on-change="handleChange"
+          drag
+          multiple>
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        </el-upload>
+        <div class="progress_panel" v-for="file in filelist" :key="file.uid">
+          <img v-if="file.type === 'DOC' || file.type === 'DOCX'" width="30" src="@/assets/file_icons/word.png"
+            alt="">
+          <img v-else-if="file.type === 'PDF'" width="30" src="@/assets/file_icons/PDF.png" alt="">
+          <img v-else-if="file.type === 'MP4' || file.type === 'AVI'" width="30" src="@/assets/file_icons/video.png"
+            alt="">
+          <img v-else-if="file.type === 'XLS' || file.type === 'XLSX'" width="30" src="@/assets/file_icons/excel.png"
+            alt="">
+          <img v-else-if="file.type === 'PNG' || file.type === 'JPG'|| file.type === 'JPEG'" width="30"
+            src="@/assets/file_icons/image.png" alt="">
+          <img v-else-if="file.type === 'PPT' || file.type === 'PPTX'" width="30" src="@/assets/file_icons/PPT.png"
+            alt="">
+          <img v-else width="30" src="@/assets/file_icons/unknow.png" alt="">
+          <div>
+            <p v-if="file.progress === 100" style="float:right"><span style="color:#67C23A">●</span>上传成功</p>
+            <p>{{file.raw?file.raw.name:'暂无上传文件'}}</p>
+            <el-progress :percentage="file.progress" :show-text="false"></el-progress>
+          </div>
+        </div>
+        <slot name="errorFile"></slot>
+        <p class="tips">• 为保证数据导入顺利,推荐您下载并使用<a :href="modelurl">《Excel标准模板》</a></p>
+        <p class="tips">• 文件中数据不能超过5000行</p>
+        <a :href="errorUrl" class="tips" style="color:red" v-if="errorUrl">•下载错误数据</a>
+        <div class="dialog-footer">
+          <el-button size="small" @click="cancel" class="normal-btn-width">取 消</el-button>
+          <el-button size="small" type="warning" @click="dialogUploadVisible = false" class="normal-btn-width btn-warning">确 定</el-button>
+        </div>
+      </div>
+      
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+export default {
+  /*
+    folderid:文件夹id; 必填
+    btntype:展示上传按钮的类型;
+    accept:限制上传文件类型;
+    bindData:附件上传成功后对应需要绑定的数据信息
+  */
+  props:['btntype','accept','bindData','errorUrl'],
+  data () {
+    return {
+      dialogUploadVisible: false,
+      params: {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "getFileName",
+        "content": {
+          "filename": '',
+          "filetype": '',
+          "parentid": ""//归属文件夹ID
+        }
+      },
+      file: {},
+      filelist: [],
+      CampaignList:[],
+      activeName:'last',
+      modelurl:'',
+      campaignid:'',
+      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+    }
+  },
+  mounted () {
+   
+    // this.listData()
+  },
+  methods: {
+    onShow () {
+      this.dialogUploadVisible = true
+       this.getModelUrl()
+    },
+    cancel () {
+      this.dialogUploadVisible = false
+      this.campaignid = ''
+      this.$refs['my-upload'].clearFiles()
+      this.filelist = []
+    },
+    handleChange (file, filelist) {
+      this.filelist = filelist
+      var index = file.raw.name.lastIndexOf(".");
+      var ext = file.name.substr(index + 1);
+      this.params.content.filename = file.raw.name
+      this.params.content.filetype = ext
+      this.getUploadUrl(file, ext)
+    },
+    handleClick () {
+      this.getModelUrl()
+    },
+    // 获取导入模板
+    async getModelUrl () {
+      const res = await this.$api.requested({
+       "id":20230314133304,
+        "content": {
+        }
+      })
+      this.modelurl = res.data
+      
+    },
+    // 获取华为云上传地址
+    async getUploadUrl (file, ext) {
+      this.params.content.parentid = this.folderid
+      const res = await this.$api.requested(this.params)
+      let url = res.data.uploadurl
+      let obsfilename = res.data.serialfilename
+
+      this.upoladFileToServer(url, file, ext, obsfilename)
+    },
+    // 上传到华为云
+    async upoladFileToServer (url, file, ext, obsfilename) {      
+      let THIS = this
+      let config = {
+        headers: ext === 'pdf' ? { 'Content-Type': 'application/pdf' } : { 'Content-Type': 'application/octet-stream' },
+        onUploadProgress: function (progressEvent) {
+          let percent = progressEvent.loaded / progressEvent.total * 100
+          THIS.filelist.forEach(e => {
+            if (e.uid === file.uid) {
+              THIS.$set(e, 'type', ext.toUpperCase());
+              THIS.$set(e, 'progress', percent);
+            }
+          })
+        },
+      }
+      const res = await this.$upload.hw_upload(url, file.raw, config)
+      this.createFileRecord(obsfilename)
+    },
+
+    // 上传成功以后生成附件记录
+    async createFileRecord (obsfilename) {
+      let obj = {
+         "serialfilename": obsfilename
+      }
+      obj = Object.assign({},obj,this.bindData)
+      let param = {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "uploadSuccess",
+        "content":obj
+      }
+      
+      const res = await this.$api.requested(param)
+      this.$emit('onSuccess',res.data.attachmentids[0])
+    },
+
+    clearFiles () {
+      this.$refs['my-upload'].clearFiles()
+      this.filelist = []
+      this.dialogUploadVisible = false
+      this.$emit('clearUrl')
+    },
+  }
+}
+
+</script>
+<style>
+.import-panel .el-dialog__header,.import-panel .el-dialog__body{
+  padding: 0 !important;
+}
+.upload-demo > div {
+  width: 100% !important;
+}
+.upload-demo .el-upload-dragger {
+  width: 100% !important;
+}
+</style>
+<style scoped>
+.progress_panel {
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  margin: 10px 0;
+  border-radius: 5px;
+  transition: linear 0.2s all;
+}
+.progress_panel:hover {
+  box-shadow: 0px 0px 5px #ccc;
+}
+.progress_panel > div {
+  flex: 1;
+  padding: 0 10px;
+}
+.progress_panel > div > p {
+  line-height: 30px;
+}
+.tips{
+  line-height: 30px;
+}
+</style>
+

+ 1 - 0
src/HDrpManagement/contractManage/components/productDetailList/productDetailList.vue

@@ -4,6 +4,7 @@
       <div class="flex-align-center" style="margin-bottom:10px">
         <el-input size="small" style="width:200px;margin-right:10px" v-model="params.content.where.condition" placeholder="输入搜索内容" @clear="listData(params.content.pageNumber = 1)" @keyup.native.enter="listData(params.content.pageNumber = 1)" clearable></el-input>
         <slot name="addProduct"/>
+        <slot name="export"></slot>
       </div>
       <tableLayout :layout="tablecols" :data="list" :opwidth="200" height="calc(100vh - 550px)" :width="true" :custom="true" fixedName="operation qty marketprice discountrate price countPrice" >
         <template v-slot:customcol="scope">

+ 32 - 3
src/HDrpManagement/contractManage/modules/detail.vue

@@ -27,6 +27,7 @@
         <!--项目产品明细折扣表-->
         <productBillno ref="billno" @priceChange="queryMainData" v-if="mainData.type == '项目'">
           <addProduct ref="addProduct" :data="mainData" v-if="tool.checkAuth($route.name,'productBillManage')" :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" @onSuccess="$refs.billno.listData()"/>
+          
           <template v-slot:edit="scope">
             <el-button 
               v-if="tool.checkAuth($route.name,'productBillManage')"
@@ -42,7 +43,17 @@
         </productBillno>
         <!--产品明细折扣表-->
         <productDetailList ref="productDetailList" v-if="mainData.type == '框架'" @priceChange="queryMainData">
-          <addProductDetail :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" v-if="tool.checkAuth($route.name,'productDetailManage')" @onSuccess="$refs.productDetailList.listData()"/>
+          <addProductDetail class="inline-16" :disabled="mainData.status != '新建' || !isLeader" slot="addProduct" v-if="tool.checkAuth($route.name,'productDetailManage')" @onSuccess="$refs.productDetailList.listData()"/>
+          <importFile 
+            v-if="tool.checkAuth($route.name,'exportProduct')"
+            slot="export"
+            ref="importFile" 
+            class="inline-16" 
+            :bindData="{ownertable:'sa_contract',ownerid:$route.query.id,usetype:'default'}" 
+            :errorUrl="errorUrl" 
+            @clearUrl="errorUrl = null" 
+            @onSuccess="bindImportOrder"
+          ></importFile>
           <template v-slot:edit="scope">
             <el-button 
               v-if="tool.checkAuth($route.name,'productDetailManage')"
@@ -150,6 +161,7 @@ import reverseCheck from '../components/reverseCheck'
 import revoke from "@/HDrpManagement/contractManage/components/revoke";
 import BaseInfo from '@/HDrpManagement/projectChange/modules/modules/baseInfo/baseInfo'
 import itemClass from '../components/itemClass/index.vue'
+import importFile from '../components/importFile'
 export default {
   name: "detail",
   data() {
@@ -159,7 +171,8 @@ export default {
       modelList:[],
       isLeader:false,
       detailInfo:{},
-      message:'确定删除当前条款吗?'
+      message:'确定删除当前条款吗?',
+      errorUrl:null
     }
   },
   components:{
@@ -183,7 +196,8 @@ export default {
     delTarget,
     BaseInfo,
     revoke,
-    itemClass
+    itemClass,
+    importFile,
   },
   watch: {
     mainData: {
@@ -1205,6 +1219,21 @@ export default {
                   }
 
 
+    },
+    async bindImportOrder (id) {
+      const res = await this.$api.requested({
+        "id": 20230314133404,
+        "content": {
+          "sa_contractid":this.$route.query.id,
+          "attachmentid":id
+        }
+      })
+      if (res.data !== '成功') {
+        this.errorUrl = res.data
+      }
+      this.tool.showMessage(res,() => {
+        this.$refs.productDetailList.listData()
+      })
     },
     // 监听切换数据,上一页,下一页
     pageChange (id,rowindex,tabIndex) {

+ 1 - 8
src/HDrpManagement/orderManage/details/tabs/addProduct.vue

@@ -2,14 +2,7 @@
 <div>
   <div class="flex-align-center flex-between mt-10">
     <div>
-      <el-input class="inline-16" style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>
-      <uploadAllData 
-        class="inline-16"
-        :total="total" 
-        @handlePullApi="handlePullApi"
-        @handleUploadApi="handleUploadApi"
-        @onSuccess="onSuccess"
-      ></uploadAllData>
+      <el-input class="inline-16" style="width:200px" size="small"  suffix-icon="el-icon-search" v-model="params.content.where.condition" placeholder="产品名称,编号" @keyup.enter.native="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" clearable></el-input>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 -->
     </div>
     <el-button type="primary" size="small" :disabled="tableSelectData.length === 0" @click="onConfirm">添加选中商品</el-button>
   </div>

+ 3 - 50
src/HDrpManagement/orderManage/details/tabs/productlist.vue

@@ -5,7 +5,7 @@
         <slot name="operation"></slot>
         <el-button style="margin:0 0 10px 10px" size="small" type="primary" :disabled="data.status !== '新建'" v-if="type !== 'confirmdate'" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
         <excel style="margin:0 0 10px 10px" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
-        <uploadAllData 
+        <!-- <uploadAllData 
           style="margin:0 0 10px 10px"
           :total="total" 
           @onSuccess="listData()"
@@ -13,8 +13,7 @@
           @handleDelApi="handleDelApi"
           idName="sa_orderitemsid"
           type="del"
-        ></uploadAllData>
-        <!-- <el-button type="primary" size="small" style="margin:0 0 10px 10px" @click="allProduct">一 键 删 除</el-button> -->
+        ></uploadAllData> -->
       </div>
       <p class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal" v-if="data.status === '新建'">{{checkFreefreightamount}}</p>
       <el-table
@@ -398,7 +397,7 @@ export default {
         "content": {
           "sa_orderid": 0, //订单ID
           "pageNumber": 1,
-          "pageSize": 20,
+          "pageSize": 10000,
           "where": {
             "condition": ""
           }
@@ -454,52 +453,6 @@ export default {
         "sa_orderitemsids": data
       }
     },
-    /* 一键选择所有商品 */
-    async allProduct () {
-      if (this.total > 200) {
-        this.$confirm(`总共删除${this.total}个商品,时间较长,是否继续`,'提示',{
-          confirmButtonText:'确定',
-          cancelButtonText:'取消',
-          type:'warning'
-        }).then(async () => {
-          this.progressVisible = true
-          let totalPage = Math.ceil(this.total / 200)
-          for (let index = 1; index <= totalPage; index++) {
-            this.pullData(index)
-          }
-          // this.$emit('onConfirm',res.data)
-        })
-      } else {
-        this.$confirm('是否删除所有数据?','提示',{
-          confirmButtonText:'确定',
-          cancelButtonText:'取消',
-          type:'warning'
-        }).then(async () => {
-          this.param.content.sa_orderid = this.$route.query.id
-          this.param.content.pageNumber = 1
-          this.param.content.pageSize = 200
-          const res = await this.$api.requested(this.param)
-          this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
-          this.deleteOrderProduct(this.deleteIds)
-        })
-        
-      }
-    },
-    /* 拉取数据 */
-    async pullData (page) {
-      this.param.content.sa_orderid = this.$route.query.id
-      this.param.content.pageNumber = page
-      this.param.content.pageSize = 200
-      const res = await this.$api.requested(this.param)
-      this.progress++
-      this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
-      if (this.progress >= this.totalPage) {
-        this.deleteOrderProduct(this.deleteIds)
-        this.progressVisible = false
-        this.progress = 0
-        this.param.content.pageSize = 20
-      }
-    },
     handleSizeChange(val) {
       // console.log(`每页 ${val} 条`);
       this.params.content.pageSize = val

+ 1 - 0
src/HManagement/marketing2/agent/index.vue

@@ -22,6 +22,7 @@
             :errorUrl="errorUrl" 
             @clearUrl="errorUrl = null" 
             @onSuccess="bindImportOrder"
+            v-if="tool.checkAuth($route.name,'export')"
           ></importFile>
         </div>
         <div slot="custom">

BIN
src/assets/normalProduct.jpg