浏览代码

项目商机失败调整

qymljy 2 年之前
父节点
当前提交
a4bfc3c12c

+ 21 - 2
src/HDrpManagement/projectChange/components/defeat.vue

@@ -5,6 +5,16 @@
       <el-row :gutter="20">
         <el-form label-position="right" ref="form" :rules="rules"  inline label-width="100px" :model="form" size="small">
           <el-col :span="24">
+            <el-form-item label="失败类型" prop="defeattype">
+              <el-select v-model="form.defeattype" placeholder="请选择" style="width: 100%">
+                <el-option
+                    v-for="item in options"
+                    :key="item.value"
+                    :label="item.remarks"
+                    :value="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
             <el-form-item label="失败原因" prop="defeatreason">
               <el-input v-model="form.defeatreason" placeholder="请输入项目失败原因" style="width: 100%"></el-input>
             </el-form-item>
@@ -31,11 +41,16 @@ export default {
       formLabelWidth:'120px',
       form:{
         "sa_projectid": 4907,
-        "defeatreason":""
+        "defeatreason":"",
+        "defeattype": ""
       },
+      options:[],
       rules:{
         defeatreason:[
           { required: true, message: '请填写失败原因', trigger: 'blur' }
+        ],
+        defeattype:[
+          { required: true, message: '请选择失败类型', trigger: 'change' }
         ]
       }
     }
@@ -43,6 +58,9 @@ export default {
   methods:{
     onShow(){
       this.dialogVisible = true
+      this.$store.dispatch('optiontypeselect','defeattype').then(res=>{
+        this.options = res.data
+      })
     },
     onDefeat(){
       this.$refs.form.validate(async (valid) => {
@@ -51,7 +69,8 @@ export default {
           "id": 20230706152904,
           "content": {
             "sa_projectid": this.$route.query.id,
-            "defeatreason": this.form.defeatreason
+            "defeatreason": this.form.defeatreason,
+            "defeattype": this.form.defeattype
           }
         })
         this.tool.showMessage(res,()=>{

+ 6 - 1
src/HDrpManagement/projectChange/modules/detail.vue

@@ -376,6 +376,7 @@ export default {
 
           {label:'预计签约时间',value:this.mainData.signdate_due ? this.mainData.signdate_due : '--'},
           {label:'预计签约金额(元)',value:this.mainData.signamount_due ? this.tool.formatAmount(this.mainData.signamount_due,2) : '--'},
+          {label:'项目成交金额(元)',value:this.mainData.dealamount ? this.tool.formatAmount(this.mainData.dealamount,2) : '--'},
           {label:'赢率',value:this.mainData.winrate ? this.mainData.winrate : '--'},
           {label:'领域',value:this.mainData.tradefield ? this.mainData.tradefield : '--'},
           {label:'品牌',value:this.mainData.brandname ? this.mainData.brandname : '--'},
@@ -422,7 +423,7 @@ export default {
           {label:'报备审核时间',value:this.mainData.reportcheckdate?this.mainData.reportcheckdate:'--'},
           /*{label:'锁定状态',value:this.mainData.locked == '0' ? '锁定' : '解锁'},*/
           {label:'结束原因',value:this.mainData.endreason?this.mainData.endreason:'--'},
-          {label:'失败原因',value:this.mainData.defeatreason?this.mainData.defeatreason:'--'},
+          {label:'失败原因',value:this.mainData.defeatreason?this.mainAreaData.defeattype + ','+ this.mainData.defeatreason:'--'},
           {label:'转手次数',value:this.mainData.leader.length !== 0?this.mainData.leader[0].leadernum === 0?'0':this.mainData.leader[0].leadernum:'--'},
         ]
       }
@@ -481,6 +482,10 @@ export default {
           label:'预计签约金额(元)',
           value: this.mainData.signamount_due  ? this.tool.formatAmount(this.mainData.signamount_due,2) : '--'
         },
+        {
+          label:'项目成交金额(元)',
+          value: this.mainData.dealamount  ? this.tool.formatAmount(this.mainData.dealamount,2) : '--'
+        },
         {label:'领域',value:this.mainData.tradefield ? this.mainData.tradefield : '--'},
       ]
 

+ 51 - 2
src/HDrpManagement/projectPredictionManage/details/modules/projectList.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
-    <addProject v-if="!isDisabled" ref="addProject" :param="paramProject" class="inline-16" @add="addProject" @adds="addProjects"></addProject>
+    <addProject v-if="!isDisabled" ref="addProject" :param="paramProject" class="inline-16" @add="addProject" @adds="addProjects" @uploadData="uploadData" @onSuccess="onSuccess"></addProject>
+    <el-button @click="delProjectAll" type="primary" size="small">一键删除</el-button>
     <el-button v-if="!isDisabled" :type="items.length > 0?'primary':''" size="small" @click="delProjects" class="inline-16" :disabled="items.length === 0">删 除</el-button>
     <el-input  style="width:200px;" placeholder="搜索" :suffix-icon="projectParam.content.where.condition?projectParam.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="projectParam.content.where.condition" @keyup.native.enter="listData(projectParam.content.pageNumber = 1)" @clear="listData(projectParam.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
     </el-input>
@@ -109,6 +110,7 @@ export default {
   data(){
     return {
       dialogVisible:false,
+      total:0,
       brandid:'',
       tradefield:'',
       sa_brandid:'',
@@ -152,6 +154,7 @@ export default {
       paramProject:{
         "id": 20230705145604,
         "content": {
+          "nocache":true,
           "pageNumber": 1,
           "pageSize": 20,
           "sa_salesforecastbillid":this.id,
@@ -163,6 +166,7 @@ export default {
       paramProduct:{
         "id": 20230705145704,
         "content": {
+          "nocache":true,
           "pageNumber": 1,
           "pageSize": 20,
           "sa_salesforecastbillid":this.id,
@@ -258,6 +262,23 @@ export default {
         this.$emit('onSuccess')
       })
     },
+    /*一键全选项目*/
+    uploadData (uploadApi,data) {
+      console.log(data)
+      uploadApi.id = 20230705145104
+      uploadApi.content = {
+        "sa_salesforecastbillid": this.id, //订单ID
+        "ownertable": "sa_project",
+        "salesforecastproject": data.map(item=>{
+          return {
+            "sa_salesforecastprojectid": 0,
+              "ownerid": item.sa_projectid,
+              "discountrate": 1
+
+          }
+        })
+      }
+    },
     /*删除项目*/
     async delProject(val){
       const res = await this.$api.requested({
@@ -272,7 +293,6 @@ export default {
         this.listData()
         this.$emit('onSuccess')
       })
-
     },
     /*批量删除项目*/
     async delProjects(){
@@ -293,6 +313,34 @@ export default {
         this.listData()
       })
     },
+    /*一键删除项目*/
+    delProjectAll(){
+      this.$confirm('此操作将删除全部项目, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async() => {
+        const res = await this.$api.requested({
+          "id": 20230705145304,
+          "content": {
+            "sa_salesforecastbillid":this.id,
+            "sa_salesforecastprojectids":[],
+            "isAll":1,
+            "ownertable":"sa_project"
+          }
+        })
+        this.tool.showMessage(res,()=>{
+          this.items = []
+          this.projectParam.content.pageNumber = 1
+          this.listData()
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      });
+    },
     /*勾选的项目*/
     selectionChange(val){
       this.items = val
@@ -365,6 +413,7 @@ export default {
         this.onSuccess()
       })
     },
+
     /*删除商品*/
     async delProduct(val){
       console.log(val)

+ 174 - 0
src/components/uploadAllData/index1.vue

@@ -0,0 +1,174 @@
+<template>
+  <div>
+    <el-button type="primary" size="small" class="inline-16" @click="allProduct" v-if="type=='upload'">一 键 全 选</el-button>
+    <el-button type="primary" size="small" class="inline-16" @click="allProduct" v-else :disabled="disabled">一 键 删 除</el-button>
+    <el-dialog
+      title=""
+      :visible.sync="progressVisible"
+      :show-close="false"
+      append-to-body
+      width="500px">
+      <el-progress v-if="totalPage" :percentage="Math.floor(progress / totalPage * 100)"></el-progress>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {log} from "@antv/g2plot/lib/utils";
+
+export default {
+  name: '',
+  data() {
+    return {
+      totalPage:0,
+      progress:0,
+      progressVisible:false,
+      deleteIds:[]
+    };
+  },
+  props: {
+    dataSize: {
+      type:[Number,String],
+      default:() => 200
+    },
+    total: {
+      type:[Number,String],
+      default:() => 0
+    },
+    type: {
+      type:String,
+      default:() => 'upload'
+    },
+    idName: {
+      type: [Number,String]
+    },
+    dataType:{
+      type:[String],
+      default:() => '商品'
+    },
+    disabled:{
+      type:[]
+    }
+  },
+  computed:{
+  },
+  watch:{
+  },
+  methods: {
+    /* 一键选择所有商品 */
+    allProduct () {
+      if (this.total > this.dataSize) {
+        this.$confirm(`总共有${this.total}个${this.dataType},是否确定${this.type == 'upload' ? '提交' : '删除'}`,'提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          this.progressVisible = true
+          this.type == 'upload' ? this.totalPage = Math.ceil(this.total / this.dataSize) * 2 : this.totalPage = Math.ceil(this.total / this.dataSize)
+          let totalPage = Math.ceil(this.total / this.dataSize)
+          for (let index = 1; index <= totalPage; index++) {
+            this.pullData(index)
+          }
+        })
+      } else {
+        this.$confirm(`总共有${this.total}个${this.dataType},是否确定${this.type == 'upload' ? '提交' : '删除'}`,'提示',{
+          confirmButtonText:'确定',
+          cancelButtonText:'取消',
+          type:'warning'
+        }).then(async () => {
+          if (!this.total) return
+          
+          let pullApi = {}
+          /**
+           * 暴露出去操作 修改拉取请求  
+           * @param pullApi - 拉取数据的请求接口
+          */
+          this.$emit('handlePullApi',pullApi)
+          pullApi.content.pageNumber = 1
+          pullApi.content.pageSize = this.dataSize
+
+          const res = await this.$api.requested(pullApi)
+
+          if (this.type == 'upload') {
+            let uploadApi = {}
+            /**
+             * 暴露出去操作 修改上传请求
+             * @param1 uploadApi - 上传接口
+             * @param2 res.data - 拉取的上传数据
+             */
+            this.$emit('handleUploadApi',uploadApi,res.data)
+
+            const res2 = await this.$api.requested(uploadApi)
+            this.tool.showMessage(res2,() => {
+              this.$emit('onSuccess',res2.data)
+            })
+          } else {
+            this.deleteIds.push(...res.data.map(item => item[this.idName]))
+            this.deleteOrderProduct(this.deleteIds)
+          }
+        })
+      }
+    },
+    /* 拉取数据 */
+    async pullData (page) {
+      let pullApi = {}
+      /**
+       * 暴露出去操作 修改拉取请求  
+       * @param pullApi - 拉取数据的请求接口
+      */
+      this.$emit('handlePullApi',pullApi)
+      pullApi.content.pageNumber = page
+      pullApi.content.pageSize = this.dataSize
+      const res = await this.$api.requested(pullApi)
+      this.progress++
+      if (this.type == 'upload') {
+        this.uploadData(res.data)
+        if (this.progress >= this.totalPage) {
+          this.$emit('onSuccess')
+          this.progressVisible = false
+          this.progress = 0
+        }
+      } else {
+        this.deleteIds.push(...res.data.map(item => item[this.idName]))
+        if (this.progress >= this.totalPage) {
+          this.deleteOrderProduct(this.deleteIds)
+          this.progressVisible = false
+        }
+      }
+      
+      
+    },  
+    /* 添加数据 */
+    async uploadData (data) {
+      let uploadApi = {}
+      /**
+       * 暴露出去操作 修改上传请求
+       * @param1 uploadApi - 上传接口
+       * @param2 res.data - 拉取的上传数据
+       */
+      this.$emit('handleUploadApi',uploadApi,data)
+      const res = await this.$api.requested(uploadApi)
+      this.progress++
+      if (this.progress >= this.totalPage) {
+        this.$emit('onSuccess')
+        this.progressVisible = false
+        this.progress = 0
+      }
+    },
+    /* 删除数据 */
+    async deleteOrderProduct (row) {
+      let delApi = {}
+      this.$emit('handleDelApi',delApi,row)
+      const res = await this.$api.requested(delApi)
+      this.tool.showMessage(res,()=>{
+        this.$emit('onSuccess')
+        this.deleteIds = []
+      })
+    },
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

+ 23 - 2
src/template/prediction/addProjectTemp.vue

@@ -11,8 +11,15 @@
         >
       <div class="drawer__panel">
         <div style="margin-bottom: 20px">
-          <el-button type="primary" size="small" class="inline-16" @click="adds">批量添加</el-button>
-
+          <uploadAllData
+              :dataType="'项目'"
+              class="inline-16"
+              :total="total"
+              @handlePullApi="handlePullApi"
+              @handleUploadApi="handleUploadApi"
+              @onSuccess="onSuccess"
+          ></uploadAllData>
+          <el-button style="margin-left: -10px" type="primary" size="small" class="inline-16" @click="adds">批量添加</el-button>
           <el-input  style="width:200px;" placeholder="搜索" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
           </el-input>
         </div>
@@ -117,6 +124,20 @@ export default {
       this.param.content.pageNumber = val
       this.listData()
     },
+    /*拉取数据*/
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.param.content))
+      pullApi.id = this.param.id
+      /*pullApi.content.sa_projectid = this.$route.query.id*/
+    },
+    /*上传数据*/
+    handleUploadApi (uploadApi,data) {
+      this.$emit('uploadData',uploadApi,data)
+    },
+    onSuccess() {
+      this.dialogVisible = false
+      this.$emit('onSuccess')
+    }
   },
   created() {
     this.tablecols = this.tool.tabelCol(this.$route.name).addProject.tablecols