Parcourir la source

Merge remote-tracking branch 'origin/mergeBranch' into mergeBranch

qymljy il y a 3 ans
Parent
commit
64c4740ccf

+ 4 - 4
src/Form/projectStageMag/add.vue

@@ -11,7 +11,7 @@
         @close="onClose">
       <div class="drawer__panel">
         <el-row>
-          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="right" label-width="100px">
+          <el-form :model="form" :rules="rules" ref="form"  size="mini" label-position="right">
             <el-col :span="24">
               <el-form-item label="阶段名称:"  prop="stagename">
                 <el-input v-model="form.stagename" autocomplete="off" placeholder="输入阶段名称"></el-input>
@@ -27,12 +27,12 @@
                 <el-input v-model="form.remarks" autocomplete="off" placeholder="输入阶段说明"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="17">
+            <el-col :span="12" >
               <el-form-item label="请选择适用项目类型:" label-width="160px" prop="projecttype">
               </el-form-item>
             </el-col>
-            <el-col :span="6">
-              <el-form-item >
+            <el-col :span="12">
+              <el-form-item style="text-align:right">
                 <el-checkbox v-model="checked" @change="checkedChange">适用所有项目类型</el-checkbox>
               </el-form-item>
             </el-col>

+ 3 - 3
src/Form/projectStageMag/edit.vue

@@ -27,12 +27,12 @@
                 <el-input v-model="form.remarks" autocomplete="off" placeholder="输入阶段说明"></el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="17">
+            <el-col :span="12">
               <el-form-item label="请选择适用项目类型:" label-width="160px" prop="remarks">
               </el-form-item>
             </el-col>
-            <el-col :span="6">
-              <el-form-item >
+            <el-col :span="12">
+              <el-form-item style="text-align:right">
                 <el-checkbox v-model="checked" @change="checkedChange">适用所有项目类型</el-checkbox>
               </el-form-item>
             </el-col>

+ 131 - 68
src/Form/projectTask/add.vue

@@ -29,11 +29,11 @@
 
                 <div class="inline-16">
                   <el-checkbox v-model="form.onparties" :true-label="1" :false-label="0" @change="onPartiesChange">关联客户对象</el-checkbox>
-                  <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectObject"></AssociateCustomerObject>
+                  <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectFormObject"></AssociateCustomerObject>
                 </div>
                 <div class="inline-16">
                   <el-checkbox v-model="form.onstage" :true-label="1" :false-label="0" style="font-size: 14px" @change="onOnstageChange">关联项目阶段</el-checkbox>
-                  <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectStage"></AssociatedProjectPhases>
+                  <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectFormStage"></AssociatedProjectPhases>
                 </div>
               </el-form-item>
             </el-col>
@@ -150,100 +150,156 @@
         partiesType:[],
         projectStage:[],
 
-        act_projtask:null
+        act_projtask:null,
+
+        objects: new Map(),
+        stages: new Map(),
+        relateForm: []
       }
       
     },
     methods:{
+      selectFormObject(val) {
+        this.partiesType = val
+
+        this.selectObject(val);
+      },
+      selectFormStage(val) {
+        this.projectStage = val
+
+        this.selectStage(val);
+      },
       // 选择客户对象
       selectObject (val) {
-        val.length === 0?this.form.onparties = 0:""
+        // val.length === 0?this.form.onparties = 0:""
 
-        this.partiesType = val
 
-        // 表格插入数据
-        this.optionscore = val.map(e=>{
-          return {
-            partiestype:e.partiestype,
-            stagename:''
-          }
-        })
+        // // 表格插入数据
+        // this.optionscore = val.map(e=>{
+        //   return {
+        //     partiestype:e.partiestype,
+        //     stagename:''
+        //   }
+        // // })
+        // (e == 0 && val.length === 0) ? this.form.onparties = 0 : ""
+        this.objects = new Map()
+        val.forEach(v => this.objects.set(v.partiestype, v))
+        console.log('try calculate')
+        this.optionscore = this.calculate(this.optionscore)
+        this.act_projtask?this.act_projtask.projtaskmag_optionscore = this.optionscore:''
+
+        this.form.projtaskmag_options
+          .filter(task => task != this.act_projtask)
+          .map(task => { 
+            console.log(`88888 re-build optionscore for task ${task.optionname}`)
+            return task
+          })
+          .forEach(task => task.projtaskmag_optionscore = this.calculate(task.projtaskmag_optionscore))
       },
       // 选择项目阶段
       selectStage (val) {
-        // 判断是否选中数据,若无数据则自动取消勾选
-        val.length === 0?this.form.onstage = 0:""
-        this.projectStage = val
-        // 判断客户对象是否有数据,若有数据指循环插入阶段数据
-        if (this.partiesType.length > 0) {
-          let arr = []
-          val.forEach(ele => {
-            this.optionscore.forEach(opt => {
-              arr.push({
-                "sa_projtaskmag_optionscoreid":0,
-                "partiestype": opt.partiestype,
-                "stagename":ele.stagename,
-                "sa_projstagemagid": ele.sa_projstagemagid,
-                "score": 0
-              })
-            });
+
+        // (e == 0 && val.length === 0) ? this.form.onparties = 0 : ""
+        this.stages = new Map()
+        val.forEach(v => this.stages.set(v.stagename, v))
+        this.optionscore = this.calculate(this.optionscore)
+        this.act_projtask?this.act_projtask.projtaskmag_optionscore = this.optionscore:''
+
+        this.form.projtaskmag_options
+          .filter(task => task != this.act_projtask)
+          .map(task => { 
+            console.log(`88888 re-build optionscore for task ${task.optionname}`)
+            return task
+          })
+          .forEach(task => task.projtaskmag_optionscore = this.calculate(task.projtaskmag_optionscore))
+
+        
+      },
+      calculate(optionscore) {
+        var list = [];
+        if (this.stages == null || this.stages.size == 0){
+          this.objects.forEach((item, key) => {
+            list.push({
+              sa_projtaskmag_optionscoreid: 0,
+              partiestype: item.partiestype,
+              stagename : '',
+              score: optionscore ? this.getScore(optionscore, item.partiestype, '') : 0
+            })
+          })
+        } else if (this.objects == null || this.objects.size == 0) {
+          this.stages.forEach((item, key) => {
+            list.push({
+              sa_projtaskmag_optionscoreid: 0,
+              partiestype: '',
+              stagename: item.stagename,
+              sa_projstagemagid: item.sa_projstagemagid,
+              score: optionscore ? this.getScore(optionscore, '', item.stagename) : 0
+            })
           })
-          this.optionscore = this.tool.sortArr(arr,'partiestype')
         } else {
-          this.optionscore = val.map(e=>{
-            return {
-              partiestype:e.partiestype,
-              stagename:e.stagename,
-              sa_projstagemagid: ele.sa_projstagemagid,
-            }
+          this.objects.forEach((objItem, objKey) => {
+            this.stages.forEach((stageItem, stageKey) => {
+              list.push({
+                sa_projtaskmag_optionscoreid: 0,
+                partiestype: objItem.partiestype,
+                stagename: stageItem.stagename,
+                sa_projstagemagid: stageItem.sa_projstagemagid,
+                score: optionscore ? this.getScore(optionscore, objItem.partiestype, stageItem.stagename) : 0
+              })
+            })
           })
         }
-        
+        return list;
+      },
+      getScore(optionscore, partiestype, stagename) {
+        let result = optionscore.filter(item => item.partiestype == partiestype && item.stagename == stagename)
+        return result.length > 0 ? result[0].score : 0
       },
       // 勾选对象状态
       onPartiesChange(val) {
+        this.selectObject(val ? this.partiesType : [])
+
         // 取消勾选
-        if (!val) {
-          // 更新节点所有数据
-          console.log(this.projectStage)
-          this.optionscore = this.projectStage.map(e=>{
-            return {
-              partiestype:'',
-              stagename:e.stagename,
-              sa_projstagemagid: e.sa_projstagemagid,
-            }
-          })
-          this.form.projtaskmag_options = []
-          this.act_projtask = []
-        }
+        // if (!val) {
+        //   // 更新节点所有数据
+        //   console.log(this.projectStage)
+        //   this.optionscore = this.projectStage.map(e=>{
+        //     return {
+        //       partiestype:'',
+        //       stagename:e.stagename,
+        //       sa_projstagemagid: e.sa_projstagemagid,
+        //     }
+        //   })
+        // }
       },
       // 勾选阶段状态
       onOnstageChange(val) {
+        this.selectStage(val ? this.projectStage : [])
         // 取消勾选
-        if (!val) {
-          // 若有客户对象数据则改变结构
-          this.optionscore = this.partiesType.map(e=>{
-            return {
-              partiestype:e.partiestype,
-              stagename:'',
-            }
-          })
-          this.form.projtaskmag_options = []
-          this.act_projtask = []
-        }
+        // if (!val) {
+        //   // 若有客户对象数据则改变结构
+        //   this.optionscore = this.partiesType.map(e=>{
+        //     return {
+        //       partiestype:e.partiestype,
+        //       stagename:'',
+        //     }
+        //   })
+        // }
       },
 
       // 新建任务
       addOptions(){
-        this.form.projtaskmag_options.push({
+        let row = {
           "sa_projtaskmag_optionsid": 0,
           "optionname": "",
           "remarks": "",
           "score": 0,
-          "projtaskmag_optionscore": this.tool.deepClone(this.optionscore)
-        })
-        this.form.projtaskmag_options = this.tool.deepClone(this.form.projtaskmag_options)
-
+          "projtaskmag_optionscore": this.calculate(null)
+        }
+        this.form.projtaskmag_options.push(row)
+        if (!this.act_projtask) {
+          this.rowClick(row)
+        }
       },
       // 删除任务
       deleteOptions(index) {
@@ -261,9 +317,16 @@
 
         this.optionscore = row.projtaskmag_optionscore
       },
-      onSubmit () {
-        console.log(this.form)
-      }
+      async onSubmit () {
+        const res = await this.$api.requested({
+          "id": "20221128144204",
+          "content":this.form
+        })
+        this.tool.showMessage(res,()=>{
+          this.$emit('onSuccess')
+          this.drawer = false
+        })
+      },
     }
   }
 </script>

+ 347 - 0
src/Form/projectTask/edit copy.vue

@@ -0,0 +1,347 @@
+<template>
+  <div>
+    <el-button size="mini" type="primary" @click="onShow(drawer = true)">编 辑</el-button>
+    <el-drawer
+      title="我是标题"
+      :visible.sync="drawer"
+      direction="rtl"
+      append-to-body
+      size="80%">
+      <div class="drawer__panel">
+        <el-row :gutter="20">
+          <el-form :model="form" class="demo-form-inline" size="small" label-position="rigth" label-width="90px">
+            <el-col :span="20">
+              <el-form-item  style="width:100%" label="工作任务">
+                <el-input style="width:100%" v-model="form.taskname" placeholder="输入工作任务"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4">
+              <el-form-item label="排序">
+                <el-input v-model="form.sequence"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="关键任务">
+                <el-radio-group class="inline-16" v-model="form.important">
+                  <el-radio :label="1">是</el-radio>
+                  <el-radio :label="0">否</el-radio>
+                </el-radio-group>
+
+                <div class="inline-16">
+                  <el-checkbox disabled v-model="form.onparties" :true-label="1" :false-label="0" @change="onPartiesChange">关联客户对象</el-checkbox>
+                  <!-- <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectObject"></AssociateCustomerObject> -->
+                </div>
+                <div class="inline-16">
+                  <el-checkbox disabled v-model="form.onstage" :true-label="1" :false-label="0" style="font-size: 14px" @change="onOnstageChange">关联项目阶段</el-checkbox>
+                  <!-- <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectStage"></AssociatedProjectPhases> -->
+                </div>
+              </el-form-item>
+            </el-col>
+            
+          </el-form>
+        </el-row>
+        <div class="normal-margin">
+          <div class="normal-margin flex-align-center flex-between">
+            <p class="normal-title">评估项</p>
+            <!-- <el-button type="primary" size="small" @click="addOptions">添加任务</el-button> -->
+          </div>
+          <el-table
+              :data="form.projtaskmag_options"
+              style="width: 100%"
+              @row-click="rowClick"
+              :row-class-name="tableRowClassName"
+              highlight-current-row
+              border>
+            <el-table-column
+              type="index"
+              width="50">
+            </el-table-column>
+            <el-table-column
+                prop="optionname"
+                label="任务内容"
+                width="360">
+              <template slot-scope="scope">
+                <el-input v-model="scope.row.optionname" placeholder=""></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column
+                prop="remarks"
+                label="描述"
+                width="0">
+              <template slot-scope="scope">
+                <el-input v-model="scope.row.remarks" placeholder=""></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column
+                prop="score"
+                width="160"
+                label="独立项分值">
+              <template slot-scope="scope">
+                <el-input v-model="scope.row.score" placeholder=""></el-input>
+              </template>
+            </el-table-column>
+            <el-table-column
+                prop="operation"
+                width="100"
+                label="操作">
+              <template slot-scope="scope">
+                <el-button type="text" size="mini" :disabled="form.projtaskmag_options.length === 1" @click="deleteOption(scope.$index)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+        <div>
+          <p class="normal-title normal-margin">关联设置({{activeOptions}})</p>
+          <el-table
+            :data="optionscore"
+            border
+            style="width: 100%">
+            <el-table-column
+                v-if="form.onparties"
+                prop="partiestype"
+                label="客户对象"
+                >
+            </el-table-column>
+            <el-table-column
+                v-if="form.onstage"
+                prop="stagename"
+                label="项目阶段"
+                >
+            </el-table-column>
+            <el-table-column
+                prop="score"
+                label="分值">
+                <template slot-scope="scope">
+                  <el-input v-model="scope.row.score" placeholder="" @change="onScoreChange"></el-input>
+                  <!-- <input type="text" v-model="scope.row.score" @input="onScoreChange"> -->
+                </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
+        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
+      </div>
+    </el-drawer>
+  </div>
+</template>
+<script>
+  import AssociateCustomerObject from '@/HDrpManagement/projectTask/modules/AssociateCustomerObject.vue'
+  import AssociatedProjectPhases from '@/HDrpManagement/projectTask/modules/AssociatedProjectStage.vue'
+  export default {
+    components:{
+      AssociateCustomerObject,
+      AssociatedProjectPhases
+    },
+    data () {
+      return {
+        drawer:false,
+        show:true,
+        form:{
+          "sa_projtaskmagid": 0,
+          "taskname": "",
+          "sequence": 0,
+          "important": 0,
+          "onparties": 0,
+          "onstage": 0,
+          "projtaskmag_options": []
+        },
+        oldData:[],
+        oldStage:[],
+        optionscore:[],
+        optionscoreStr:'',
+        n_index:null,
+        activeOptions:null
+      }
+    },
+    methods:{
+      onShow () {
+        this.queryData()
+      },
+      async queryData () {
+        const res = await this.$api.requested({
+          "id": 20221128144104,
+          "content": {
+            "sa_projtaskmagid":this.$route.query.id
+          }
+        })
+        this.form = res.data
+      },
+      selectObject (val) {
+        this.oldData = val
+        if (val.length === 0) {
+          this.form.onparties = 0
+        } else {
+          if (this.oldStage.length > 0) {
+            let arr = []
+            this.oldData.forEach(e=>{
+              this.oldStage.forEach(vl=>{
+                arr.push({
+                  sa_projtaskmag_optionscoreid:0,
+                  partiestype:e.partiestype,
+                  stagename:vl.stagename,
+                  sa_projstagemagid:vl.sa_projstagemagid,
+                  score:0
+                })
+              })
+            })
+            this.optionscore = arr.sort()
+          } else {
+            this.optionscore = val
+          }
+        }
+      },
+      selectStage (val) {
+        this.oldStage = val
+        if (val.length === 0) {
+          this.form.onstage = 0
+        } else {
+           if (this.oldData.length > 0) {
+              let arr = []
+              this.oldData.forEach(e=>{
+                this.oldStage.forEach(vl=>{
+                  arr.push({
+                    sa_projtaskmag_optionscoreid:0,
+                    partiestype:e.partiestype,
+                    stagename:vl.stagename,
+                    sa_projstagemagid:vl.sa_projstagemagid,
+                    score:0
+                  })
+                })
+              })
+              this.optionscore = arr.sort()
+            } else {
+              this.optionscore = val
+            }
+        }
+      },
+      rowClick (row, column, event) {
+        try {
+          this.n_index = row.index
+          this.activeOptions = this.form.projtaskmag_options[this.n_index].optionname
+          this.optionscore = this.form.projtaskmag_options[row.index].projtaskmag_optionscore
+        } catch (error) {
+          
+        }
+        
+      },
+      onScoreChange (row) {
+        if (!this.activeOptions) return this.$message({
+          message:'请先点击要设置的任务行',
+          type:'error'
+        })
+        this.form.projtaskmag_options[this.n_index].projtaskmag_optionscore = this.optionscore
+      },
+      arraySpanMethod({ row, column, rowIndex, columnIndex }) {
+      // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
+      let mergeLength = 1;//需要进行横纵合并的列
+      if (columnIndex < mergeLength) {
+        let finArray = [1,1];
+        // 处理行数据
+        let cgname = Object.keys(row)[columnIndex]
+        console.log(cgname,'---')
+        // let cgname = 'value'
+        if(rowIndex === 0 || row[cgname] !== this.optionscore[rowIndex-1][cgname]){
+          let rowspan = 1;
+          //计算需要进行合并操作的行
+          for(let i=0; i<this.optionscore.length-1; i++){
+            // 只合并连续的
+            if(this.optionscore[i][cgname] === row[cgname] && this.optionscore[i+1][cgname] === row[cgname]){
+              rowspan ++;
+            }
+          }
+          finArray[0] = rowspan;
+        }else {
+          finArray[0] = 0;
+        }
+
+        // 处理列数据
+        let colkeys = Object.keys(row);
+        let cgvalue = Object.values(row)[columnIndex]
+        if(columnIndex ===0 || row[colkeys[columnIndex-1]] !== row[colkeys[columnIndex]]){
+          let colspan = 1;
+          //计算需要进行合并操作的列
+          for(let i=columnIndex; i<mergeLength; i++) {
+            // 只合并连续的
+            if (row[colkeys[i]]===cgvalue && row[colkeys[i+1]]===cgvalue && i+1<mergeLength) {
+              colspan ++;
+            }
+          }
+          finArray[1] = colspan;
+        } else {
+          finArray[1] = 0;
+        }
+        return finArray
+      }
+      },
+      refreshTable() {
+        this.show = false
+        setTimeout(() => {
+          this.show = true
+        }, 1000);
+      },
+      onPartiesChange (val) {
+        if (val === 1) {
+          let arr = []
+
+          this.$refs.onparties.drawer = true
+          this.optionscore = arr.sort()
+        } else {
+          this.oldData = []
+          const res = new Map();
+          this.optionscore = this.optionscore.filter((item) => !res.has(item['stagename']) && res.set(item['stagename'], 1));
+          this.form.projtaskmag_options.forEach(e=>{
+            e.projtaskmag_optionscore = this.optionscore
+          })
+        }
+      },
+      onOnstageChange (val) {
+        if (val === 1) {
+          this.$refs.onstage.drawer = true
+        } else {
+          this.oldStage = []
+          const res = new Map();
+          this.optionscore = this.optionscore.filter((item) => !res.has(item['partiestype']) && res.set(item['partiestype'], 1));
+          this.form.projtaskmag_options.forEach(e=>{
+            e.projtaskmag_optionscore = this.optionscore
+          })
+        }
+      },
+      tableRowClassName({row,rowIndex}) {
+        row.index = rowIndex
+      },
+      addOptions(){
+        this.form.projtaskmag_options.push({
+          "sa_projtaskmag_optionsid": 0,
+          "optionname": "",
+          "remarks": "",
+          "score": 0,
+          "projtaskmag_optionscore": {
+            "sa_projtaskmag_optionscoreid":0,
+            "partiestype": "",
+            "sa_projstagemagid": "",
+            "score": 0
+          }
+        })
+      },
+      async onSubmit () {
+        const res = await this.$api.requested({
+          "id": "20221128144204",
+          "content":this.form
+        })
+        this.tool.showMessage(res,()=>{
+          this.$emit('onSuccess')
+          this.drawer = false
+        })
+      },
+      deleteOption (index) {
+        this.form.projtaskmag_options = this.form.projtaskmag_options.filter((e,idx)=>{
+          if (index !== idx) return e
+        })
+        this.activeOptions = ''
+        console.log(this.form.projtaskmag_options)
+      }
+    }
+  }
+</script>

+ 194 - 159
src/Form/projectTask/edit.vue

@@ -2,7 +2,7 @@
   <div>
     <el-button size="mini" type="primary" @click="onShow(drawer = true)">编 辑</el-button>
     <el-drawer
-      title="我是标题"
+      title="新建阶段"
       :visible.sync="drawer"
       direction="rtl"
       append-to-body
@@ -29,11 +29,11 @@
 
                 <div class="inline-16">
                   <el-checkbox disabled v-model="form.onparties" :true-label="1" :false-label="0" @change="onPartiesChange">关联客户对象</el-checkbox>
-                  <!-- <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectObject"></AssociateCustomerObject> -->
+                  <!-- <AssociateCustomerObject ref="onparties" :data="form" class="inline-16" style="margin-left: 10px" @selectObject="selectFormObject"></AssociateCustomerObject> -->
                 </div>
                 <div class="inline-16">
                   <el-checkbox disabled v-model="form.onstage" :true-label="1" :false-label="0" style="font-size: 14px" @change="onOnstageChange">关联项目阶段</el-checkbox>
-                  <!-- <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectStage"></AssociatedProjectPhases> -->
+                  <!-- <AssociatedProjectPhases ref="onstage" :data="form" class="inline-16" style="margin-left: 10px" @selectStage="selectFormStage"></AssociatedProjectPhases> -->
                 </div>
               </el-form-item>
             </el-col>
@@ -43,13 +43,12 @@
         <div class="normal-margin">
           <div class="normal-margin flex-align-center flex-between">
             <p class="normal-title">评估项</p>
-            <!-- <el-button type="primary" size="small" @click="addOptions">添加任务</el-button> -->
+            <el-button type="primary" size="small" @click="addOptions">添加任务</el-button>
           </div>
           <el-table
               :data="form.projtaskmag_options"
               style="width: 100%"
               @row-click="rowClick"
-              :row-class-name="tableRowClassName"
               highlight-current-row
               border>
             <el-table-column
@@ -85,13 +84,13 @@
                 width="100"
                 label="操作">
               <template slot-scope="scope">
-                <el-button type="text" size="mini" :disabled="form.projtaskmag_options.length === 1" @click="deleteOption(scope.$index)">删除</el-button>
+                <el-button type="text" size="mini" :disabled="form.projtaskmag_options.length === 1" @click="deleteOptions(scope.$index)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
         </div>
-        <div>
-          <p class="normal-title normal-margin">关联设置({{activeOptions}})</p>
+        <div v-if="act_projtask">
+          <p class="normal-title normal-margin">关联设置({{act_projtask?act_projtask.optionname:""}})</p>
           <el-table
             :data="optionscore"
             border
@@ -112,8 +111,7 @@
                 prop="score"
                 label="分值">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.score" placeholder="" @change="onScoreChange"></el-input>
-                  <!-- <input type="text" v-model="scope.row.score" @input="onScoreChange"> -->
+                  <el-input v-model="scope.row.score" placeholder=""></el-input>
                 </template>
             </el-table-column>
           </el-table>
@@ -147,13 +145,18 @@
           "onstage": 0,
           "projtaskmag_options": []
         },
-        oldData:[],
-        oldStage:[],
         optionscore:[],
-        optionscoreStr:'',
-        n_index:null,
-        activeOptions:null
+
+        partiesType:[],
+        projectStage:[],
+
+        act_projtask:null,
+
+        objects: new Map(),
+        stages: new Map(),
+        relateForm: []
       }
+      
     },
     methods:{
       onShow () {
@@ -167,164 +170,203 @@
           }
         })
         this.form = res.data
-      },
-      selectObject (val) {
-        this.oldData = val
-        if (val.length === 0) {
-          this.form.onparties = 0
-        } else {
-          if (this.oldStage.length > 0) {
-            let arr = []
-            this.oldData.forEach(e=>{
-              this.oldStage.forEach(vl=>{
-                arr.push({
-                  sa_projtaskmag_optionscoreid:0,
-                  partiestype:e.partiestype,
-                  stagename:vl.stagename,
-                  sa_projstagemagid:vl.sa_projstagemagid,
-                  score:0
-                })
-              })
-            })
-            this.optionscore = arr.sort()
-          } else {
-            this.optionscore = val
-          }
-        }
-      },
-      selectStage (val) {
-        this.oldStage = val
-        if (val.length === 0) {
-          this.form.onstage = 0
-        } else {
-           if (this.oldData.length > 0) {
-              let arr = []
-              this.oldData.forEach(e=>{
-                this.oldStage.forEach(vl=>{
-                  arr.push({
-                    sa_projtaskmag_optionscoreid:0,
-                    partiestype:e.partiestype,
-                    stagename:vl.stagename,
-                    sa_projstagemagid:vl.sa_projstagemagid,
-                    score:0
-                  })
-                })
-              })
-              this.optionscore = arr.sort()
-            } else {
-              this.optionscore = val
-            }
-        }
-      },
-      rowClick (row, column, event) {
-        try {
-          this.n_index = row.index
-          this.activeOptions = this.form.projtaskmag_options[this.n_index].optionname
-          this.optionscore = this.form.projtaskmag_options[row.index].projtaskmag_optionscore
-        } catch (error) {
-          
-        }
-        
-      },
-      onScoreChange (row) {
-        if (!this.activeOptions) return this.$message({
-          message:'请先点击要设置的任务行',
-          type:'error'
+        this.form.projtaskmag_options[0].projtaskmag_optionscore.forEach(e=>{
+          this.objects.set(e.partiestype,{ partiestype: e.partiestype})
+          this.stages.set(e.stagename,{stagename: e.stagename, sa_projstagemagid: e.sa_projstagemagid}) 
+          this.partiesType.push({
+            partiestype: e.partiestype
+          })
+          this.projectStage.push({
+            stagename: e.stagename,
+            sa_projstagemagid: e.sa_projstagemagid
+          })
         })
-        this.form.projtaskmag_options[this.n_index].projtaskmag_optionscore = this.optionscore
       },
-      arraySpanMethod({ row, column, rowIndex, columnIndex }) {
-      // 合并行列产品名字相同合并(计算组长度以内的列,需要进行合并操作的列)
-      let mergeLength = 1;//需要进行横纵合并的列
-      if (columnIndex < mergeLength) {
-        let finArray = [1,1];
-        // 处理行数据
-        let cgname = Object.keys(row)[columnIndex]
-        console.log(cgname,'---')
-        // let cgname = 'value'
-        if(rowIndex === 0 || row[cgname] !== this.optionscore[rowIndex-1][cgname]){
-          let rowspan = 1;
-          //计算需要进行合并操作的行
-          for(let i=0; i<this.optionscore.length-1; i++){
-            // 只合并连续的
-            if(this.optionscore[i][cgname] === row[cgname] && this.optionscore[i+1][cgname] === row[cgname]){
-              rowspan ++;
-            }
-          }
-          finArray[0] = rowspan;
-        }else {
-          finArray[0] = 0;
-        }
+      selectFormObject(val) {
+        this.partiesType = val
 
-        // 处理列数据
-        let colkeys = Object.keys(row);
-        let cgvalue = Object.values(row)[columnIndex]
-        if(columnIndex ===0 || row[colkeys[columnIndex-1]] !== row[colkeys[columnIndex]]){
-          let colspan = 1;
-          //计算需要进行合并操作的列
-          for(let i=columnIndex; i<mergeLength; i++) {
-            // 只合并连续的
-            if (row[colkeys[i]]===cgvalue && row[colkeys[i+1]]===cgvalue && i+1<mergeLength) {
-              colspan ++;
-            }
-          }
-          finArray[1] = colspan;
-        } else {
-          finArray[1] = 0;
-        }
-        return finArray
-      }
+        this.selectObject(val);
       },
-      refreshTable() {
-        this.show = false
-        setTimeout(() => {
-          this.show = true
-        }, 1000);
+      selectFormStage(val) {
+        this.projectStage = val
+
+        this.selectStage(val);
       },
-      onPartiesChange (val) {
-        if (val === 1) {
-          let arr = []
+      // 选择客户对象
+      selectObject (val) {
+        // val.length === 0?this.form.onparties = 0:""
 
-          this.$refs.onparties.drawer = true
-          this.optionscore = arr.sort()
-        } else {
-          this.oldData = []
-          const res = new Map();
-          this.optionscore = this.optionscore.filter((item) => !res.has(item['stagename']) && res.set(item['stagename'], 1));
-          this.form.projtaskmag_options.forEach(e=>{
-            e.projtaskmag_optionscore = this.optionscore
+
+        // // 表格插入数据
+        // this.optionscore = val.map(e=>{
+        //   return {
+        //     partiestype:e.partiestype,
+        //     stagename:''
+        //   }
+        // // })
+        // (e == 0 && val.length === 0) ? this.form.onparties = 0 : ""
+        this.objects = new Map()
+        val.forEach(v => this.objects.set(v.partiestype, v))
+        console.log('try calculate')
+        this.optionscore = this.calculate(this.optionscore)
+        this.act_projtask?this.act_projtask.projtaskmag_optionscore = this.optionscore:''
+
+        this.form.projtaskmag_options
+          .filter(task => task != this.act_projtask)
+          .map(task => { 
+            console.log(`88888 re-build optionscore for task ${task.optionname}`)
+            return task
           })
-        }
+          .forEach(task => task.projtaskmag_optionscore = this.calculate(task.projtaskmag_optionscore))
       },
-      onOnstageChange (val) {
-        if (val === 1) {
-          this.$refs.onstage.drawer = true
+      // 选择项目阶段
+      selectStage (val) {
+
+        // (e == 0 && val.length === 0) ? this.form.onparties = 0 : ""
+        this.stages = new Map()
+        val.forEach(v => this.stages.set(v.stagename, v))
+        this.optionscore = this.calculate(this.optionscore)
+        this.act_projtask?this.act_projtask.projtaskmag_optionscore = this.optionscore:''
+
+        this.form.projtaskmag_options
+          .filter(task => task != this.act_projtask)
+          .map(task => { 
+            console.log(`88888 re-build optionscore for task ${task.optionname}`)
+            return task
+          })
+          .forEach(task => task.projtaskmag_optionscore = this.calculate(task.projtaskmag_optionscore))
+        // // 判断是否选中数据,若无数据则自动取消勾选
+        // val.length === 0?this.form.onstage = 0:""
+        // this.projectStage = val
+        // // 判断客户对象是否有数据,若有数据指循环插入阶段数据
+        // if (this.partiesType.length > 0) {
+        //   let arr = []
+        //   val.forEach(ele => {
+        //     this.optionscore.forEach(opt => {
+        //       arr.push({
+        //         "sa_projtaskmag_optionscoreid":0,
+        //         "partiestype": opt.partiestype,
+        //         "stagename":ele.stagename,
+        //         "sa_projstagemagid": ele.sa_projstagemagid,
+        //         "score": 0
+        //       })
+        //     });
+        //   })
+        //   this.optionscore = this.tool.sortArr(arr,'partiestype')
+        // } else {
+        //   this.optionscore = val.map(e=>{
+        //     return {
+        //       partiestype:e.partiestype,
+        //       stagename:e.stagename,
+        //       sa_projstagemagid: ele.sa_projstagemagid,
+        //     }
+        //   })
+        // }
+
+        
+      },
+      calculate(optionscore) {
+        var list = [];
+        if (this.stages == null || this.stages.size == 0){
+          this.objects.forEach((item, key) => {
+            list.push({
+              sa_projtaskmag_optionscoreid: 0,
+              partiestype: item.partiestype,
+              stagename : '',
+              score: optionscore ? this.getScore(optionscore, item.partiestype, '') : 0
+            })
+          })
+        } else if (this.objects == null || this.objects.size == 0) {
+          this.stages.forEach((item, key) => {
+            list.push({
+              sa_projtaskmag_optionscoreid: 0,
+              partiestype: '',
+              stagename: item.stagename,
+              sa_projstagemagid: item.sa_projstagemagid,
+              score: optionscore ? this.getScore(optionscore, '', item.stagename) : 0
+            })
+          })
         } else {
-          this.oldStage = []
-          const res = new Map();
-          this.optionscore = this.optionscore.filter((item) => !res.has(item['partiestype']) && res.set(item['partiestype'], 1));
-          this.form.projtaskmag_options.forEach(e=>{
-            e.projtaskmag_optionscore = this.optionscore
+          this.objects.forEach((objItem, objKey) => {
+            this.stages.forEach((stageItem, stageKey) => {
+              list.push({
+                sa_projtaskmag_optionscoreid: 0,
+                partiestype: objItem.partiestype,
+                stagename: stageItem.stagename,
+                sa_projstagemagid: stageItem.sa_projstagemagid,
+                score: optionscore ? this.getScore(optionscore, objItem.partiestype, stageItem.stagename) : 0
+              })
+            })
           })
         }
+        return list;
+      },
+      getScore(optionscore, partiestype, stagename) {
+        let result = optionscore.filter(item => item.partiestype == partiestype && item.stagename == stagename)
+        return result.length > 0 ? result[0].score : 0
+      },
+      // 勾选对象状态
+      onPartiesChange(val) {
+        this.selectObject(val ? this.partiesType : [])
+
+        // 取消勾选
+        // if (!val) {
+        //   // 更新节点所有数据
+        //   console.log(this.projectStage)
+        //   this.optionscore = this.projectStage.map(e=>{
+        //     return {
+        //       partiestype:'',
+        //       stagename:e.stagename,
+        //       sa_projstagemagid: e.sa_projstagemagid,
+        //     }
+        //   })
+        // }
       },
-      tableRowClassName({row,rowIndex}) {
-        row.index = rowIndex
+      // 勾选阶段状态
+      onOnstageChange(val) {
+        this.selectStage(val ? this.projectStage : [])
+        // 取消勾选
+        // if (!val) {
+        //   // 若有客户对象数据则改变结构
+        //   this.optionscore = this.partiesType.map(e=>{
+        //     return {
+        //       partiestype:e.partiestype,
+        //       stagename:'',
+        //     }
+        //   })
+        // }
       },
+
+      // 新建任务
       addOptions(){
-        this.form.projtaskmag_options.push({
+        let row = {
           "sa_projtaskmag_optionsid": 0,
           "optionname": "",
           "remarks": "",
           "score": 0,
-          "projtaskmag_optionscore": {
-            "sa_projtaskmag_optionscoreid":0,
-            "partiestype": "",
-            "sa_projstagemagid": "",
-            "score": 0
+          "projtaskmag_optionscore": this.calculate(null)
+        }
+        this.form.projtaskmag_options.push(row)
+        if (!this.act_projtask) {
+          this.rowClick(row)
+        }
+      },
+      // 删除任务
+      deleteOptions(index) {
+        console.log(index)
+        this.form.projtaskmag_options = this.form.projtaskmag_options.filter((e,idx)=>{
+          if (idx !== index) {
+            return e
           }
         })
       },
+      // 点击任务行
+      rowClick (row) {
+        // 记录当前选中行的行
+        this.act_projtask = row
+
+        this.optionscore = row.projtaskmag_optionscore
+      },
       async onSubmit () {
         const res = await this.$api.requested({
           "id": "20221128144204",
@@ -335,13 +377,6 @@
           this.drawer = false
         })
       },
-      deleteOption (index) {
-        this.form.projtaskmag_options = this.form.projtaskmag_options.filter((e,idx)=>{
-          if (index !== idx) return e
-        })
-        this.activeOptions = ''
-        console.log(this.form.projtaskmag_options)
-      }
     }
   }
 </script>

+ 140 - 0
src/HManagement/saleForecastCount/index.vue

@@ -0,0 +1,140 @@
+
+<template>
+    <div>
+      <basicLayout 
+        ref="basicLayout" 
+        tableName="saleForecastCountTable" 
+        idName="userid" 
+        :apiId="{query:20221209163203}"
+        :options="options">
+        <div slot="custom">
+          <div class="inline-24">
+            <label class="search__label ">时间:</label>
+            <el-date-picker
+              v-model="value1"
+              type="daterange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              value-format="yyyy-MM-dd"
+              @change="dateChange"
+              size="small">
+            </el-date-picker>
+          </div>
+          <div class="inline-24">
+            <label class="search__label ">部门:</label>
+            <el-cascader
+              size="small"
+              :options="depOptions"
+              :props="{ checkStrictly: true,children:'subdep',label:'depname',value:'departmentid' }"
+              @change="onCascaderChange"
+              :show-all-levels="false"
+              clearable>
+            </el-cascader>
+          </div>
+          <div class="inline-24">
+            <label class="search__label ">人员:</label>
+            <el-select v-model="userid" placeholder="请选择" @change="onSelectChange" size="small" clearable>
+              <el-option
+                v-for="item in hrList"
+                :key="item.userid"
+                :label="item.name"
+                :value="item.userid">
+              </el-option>
+            </el-select>
+          </div>
+        </div>
+        <template v-slot:tbList="scope">
+          <div>
+            {{scope.data.column.data[[scope.data.column.columnname]]}}
+          </div>
+        </template>
+        <template v-slot:tbOpreation="scope">
+        </template>
+      </basicLayout>
+    </div>
+  </template>
+  
+  <script>
+  /**
+   * @basicLayout 提供this.$ref['basicLayout'].listData()方法查询列表信息
+   * @param {string} formPath 新建,编辑组件所在文件夹名称,以后所有列表新增修改文件统一放入Form文件夹下面,并创建与开发应用相同的名称的子文件夹
+   * @param {string} tableName 开发端配置的表格名称
+   * @param {String} idName 数据主id名称
+   * @param {object} apiId:{query:查询的接口id,del:删除的接口id} 
+   * @param {Array} options:{label:描述,value:值} 
+   */
+  export default {
+    data () {
+      return {
+        options:[],
+        value1:[],
+        depOptions:[],
+        actDep:null,
+        hrList:[],
+        userid:'',
+      }
+    },
+    methods:{
+      dateChange (val) {
+        if (val) {
+          this.$refs.basicLayout.param.content.where.begdate = val[0]
+          this.$refs.basicLayout.param.content.where.enddate = val[1]
+        } else {
+          this.$refs.basicLayout.param.content.where.begdate = ''
+          this.$refs.basicLayout.param.content.where.enddate = ''
+        }
+       
+        this.$refs.basicLayout.listData()
+      },
+      async querydepartment () {
+        const res = await this.$api.requested({
+          "classname": "webmanage.department.department",
+          "method": "querydepartment",
+          "content": {
+            "pageSize":100
+          }
+        })
+        this.depOptions = res.data
+      },
+      async query_hrList () {
+        const res = await this.$api.requested({
+          "id":20221102090303,
+          "content": {
+            "pageNumber": 1,
+            "pageSize": 100,
+            "departmentids":this.actDep?[this.actDep]:[],
+            "containssub":1,
+            "where": {
+              "condition": ""
+            }
+          }
+        })
+        this.hrList = res.data
+      },
+      onCascaderChange (val) {
+        this.actDep = val[val.length - 1]
+        this.$refs.basicLayout.param.content.where.departmentid = this.actDep
+        this.$refs.basicLayout.listData()
+        this.query_hrList(this.userid = '')
+      },
+      onSelectChange (val) {
+        this.$refs.basicLayout.param.content.where.userid = val
+        this.$refs.basicLayout.listData()
+      }
+    },
+    mounted () {
+      this.querydepartment()
+      this.query_hrList()
+    }
+  }
+  
+  </script>
+  <style>
+  </style>
+  <style scoped>
+  .inline-24{
+    display: inline;
+    margin-right: 24;
+  }
+  </style>

+ 2 - 2
src/HManagement/salesForecastTemplate/index.vue

@@ -14,9 +14,9 @@
         path:'/salesForecastDetail'
       }">
       <div slot="custom">
-        <label class="search__label " style="margin: auto;width: 35px;">状态:</label>
+        <label class="search__label ">状态:</label>
         <el-select  class="inline-24" @change="selectChange" v-model="selectParam.status" placeholder="请选择状态" size="small" clearable>
-          <el-option v-for="(item,index) in statusData" :key="item.value" :value="item.value" :label="item.label"></el-option>
+          <el-option v-for="(item,index) in statusData" :key="index" :value="item.value" :label="item.label"></el-option>
         </el-select>
       </div>
       <template v-slot:tbList="scope">

+ 9 - 13
src/HManagement/salesForecastTemplate/modules/modelDetail.vue

@@ -21,10 +21,10 @@
       </div>
       <div slot="slot0" >
         <el-row :gutter="10"> 
-          <el-col :span="12">
+          <el-col :span="24">
             <forecastList ref="forecast" @tableRowClick="onTableClick"></forecastList>
           </el-col>
-          <el-col :span="12">
+          <el-col :span="24">
             <submitDetail ref="project"></submitDetail>
           </el-col>
         </el-row>
@@ -69,21 +69,17 @@ export default {
     },
     changeDataStructure() {
       this.mainAreaData = [
-        {
-          label:'状态',
-          value:this.mainData.status
+       {
+          label:'提报要求',
+          value:this.mainData.remarks
         },
         {
-          label:'生效时间',
-          value:this.mainData.begdate.split(' ')[0]
+          label:'提醒时间',
+          value:this.mainData.periodpointchange
         },
         {
-          label:'结束时间',
-          value:this.mainData.enddate.split(' ')[0]
-        },
-        {
-          label:'备注',
-          value:this.mainData.remark
+          label:'状态',
+          value:this.mainData.status
         },
       ]
     },

+ 3 - 22
src/SDrpManagement/QuotedPrice/components/copy/index.vue

@@ -1,27 +1,8 @@
 <template>
   <div>
-    <el-drawer
-        title="编辑报价单"
-        :visible.sync="drawer"
-        size="92%"
-        direction="rtl"
-        :show-close="false"
-        append-to-body
-        >
-      <div class="drawer__panel" style="margin-bottom: 0px">
-
-      </div>
-      <div >
-        <el-divider></el-divider>
-      </div>
-<!--      <div style="margin:10px 20px 20px 20px">
-        <quotedPriceProduct :sa_quotedpriceid="form.sa_quotedpriceid" :sa_projectid="form.sa_projectid" :quotedpricetype="form.quotedpricetype" ref="quoterPrice" @checkForm="onSubmit" @productData="productDataChange"></quotedPriceProduct>
-      </div>-->
-      <div class="fixed__btn__panel">
-        <el-button size="small" class="normal-btn-width">取 消</el-button>
-        <el-button size="small" type="warning"  class="normal-btn-width">确 定</el-button>
-      </div>
-    </el-drawer>
+    <div class="drawer__panel" style="margin-bottom: 0px">
+      123123121
+    </div>
   </div>
 </template>
 

+ 2 - 2
src/SDrpManagement/QuotedPrice/detail/components/copyTo.vue

@@ -95,8 +95,8 @@ export default {
         "id": 20221209094103,
       })
       console.log(res,"复制的内容")
-      this.$store.dispatch('changeDetailDrawer',true)
-      this.$router.push({
+      // this.$store.dispatch('changeDetailDrawer',true)
+      this.$router.replace({
         path:'/quotedPriceCopy',
         query:{
           id:res.data.sa_quotedpriceid

+ 4 - 3
src/SManagement/sales_forecast/modules/modelDetail.vue

@@ -70,10 +70,11 @@ export default {
     },
     changeDataStructure() {
       this.mainAreaData = [
-        {label:'单号',value:this.mainData.billnum},
-        {label:'预测模板',value:this.mainData.title},
         {label:'提报要求',value:this.mainData.remarks},
-        {label:'预测金额',value:this.mainData.sumamount}
+        {label:'提报类型',value:this.mainData.isrepeat == 1 ?'月度提报':'单次提报'},
+        {label:'预测金额',value:this.mainData.sumprojectamount},
+        {label:'负责人',value:this.mainData.createby},
+        {label:'状态',value:this.mainData.status},
       ]
     },
     // 监听切换数据,上一页,下一页

+ 1 - 1
src/components/normal-basic-layout/index.vue

@@ -32,7 +32,7 @@
         </div>
         <div class="flex-align-stretch" style="min-width:800px">
           <slot name="custom"></slot>
-          <el-input style="width:200px;" placeholder="搜索" suffix-icon="el-icon-search" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="clearSearch" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
+          <el-input style="width:200px;" placeholder="搜索" suffix-icon="el-icon-search" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" >
           </el-input>
         </div>
       </div>

+ 10 - 1
src/router/HManagement.js

@@ -570,7 +570,16 @@ const HManagement = [
     },
     ]
   },
-  
+  {
+    path: '/saleForecastCount',
+    name: 'saleForecastCount',
+    meta: {
+      title: '销售预测统计',
+      ast_nav: true,
+      keeproute: true
+    },
+    component: () => import(/* webpackChunkName: "about" */ '@/HManagement/saleForecastCount/index')
+  },
   {
     path: '/phonebook',
     name: 'phonebook',