Browse Source

销售目标

qymljy 2 years ago
parent
commit
96f39c964a

+ 38 - 9
src/HManagement/personalTarget/target/modules/edit/components/table.vue

@@ -237,6 +237,18 @@
         </template>
       </el-table-column>
     </el-table>
+    <div  class="container normal-panel" style="text-align:right">
+      <el-pagination
+          background
+          small
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-sizes="[20, 50, 100, 200]"
+          layout="total,sizes, prev, pager, next, jumper"
+          :total="total">
+      </el-pagination>
+    </div>
   </div>
 </template>
 
@@ -245,23 +257,40 @@ export default {
   props:["year"],
   data () {
     return {
-      tableData:[]
-    }
-  },
-  methods:{
-    async queryData (year) {
-      console.log("输出")
-      console.log(year)
-      const res = await this.$api.requested({
+      tableData:[],
+      total:0,
+      currentPage:0,
+      param:{
         "id": 20220901141802,
         "content": {
           "sa_salestargetbillid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 20,
           "where":{
             "condition":""
           }
         }
-      })
+      }
+    }
+  },
+  methods:{
+    async queryData (year) {
+      console.log("输出")
+      console.log(year)
+      const res = await this.$api.requested(this.param)
       this.tableData = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
     },
     /*yearData(data){
       console.log(data)

+ 50 - 9
src/HManagement/projectTarget/target/modules/edit/components/table.vue

@@ -249,6 +249,18 @@
           width="120">
         </el-table-column>
       </el-table-column>
+<!--      <div  class="container normal-panel" style="text-align:right">
+        <el-pagination
+            background
+            small
+            @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+            :current-page="currentPage"
+            :page-sizes="[20, 50, 100, 200]"
+            layout="total,sizes, prev, pager, next, jumper"
+            :total="total">
+        </el-pagination>
+      </div>-->
 <!--       <el-table-column label="操作" fixed="right" width="100">
         <template slot-scope="scope">
           <slot name="editTarget" v-if="scope.row.hrid" :data="scope.row"></slot>
@@ -256,6 +268,18 @@
         </template>
       </el-table-column>-->
     </el-table>
+    <div  class="container normal-panel" style="text-align:right">
+      <el-pagination
+          background
+          small
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="currentPage"
+          :page-sizes="[20, 50, 100, 200]"
+          layout="total,sizes, prev, pager, next, jumper"
+          :total="total">
+      </el-pagination>
+    </div>
   </div>
 </template>
 
@@ -264,24 +288,41 @@ export default {
   props:['year'],
   data () {
     return {
-      tableData:[]
-    }
-  },
-  methods:{
-    async queryData (year) {
-      console.log(year)
-      const res = await this.$api.requested({
+      tableData:[],
+      total:0,
+      currentPage:0,
+      param:{
         "id": 20220909152802,
         "content": {
+          "pageNumber": 1,
+          "pageSize": 20,
           "sa_salestargetbillid": this.$route.query.id,
           "where":{
             "condition":""
           }
         }
-      })
-      this.tableData = res.data
+      }
     }
   },
+  methods:{
+    async queryData (year) {
+      console.log(year)
+      const res = await this.$api.requested(this.param)
+      this.tableData = res.data
+      this.total = res.total
+      this.currentPage = res.pageNumber
+    },
+    handleSizeChange(val) {
+      // console.log(`每页 ${val} 条`);
+      this.param.content.pageSize = val
+      this.listData()
+    },
+    handleCurrentChange(val) {
+      // console.log(`当前页: ${val}`);
+      this.param.content.pageNumber = val
+      this.listData()
+    },
+  },
   mounted () {
   }
 }

+ 1 - 1
src/SManagement/project_target/index.vue

@@ -8,7 +8,7 @@
         <div class="container normal-panel">
           <table1 ref="table">
             <template v-slot:detail="scope">
-              <el-button v-if="tool.checkAuth($route.name,'read') " type="text" size="small" @click="$store.dispatch('DrawerShowChange',true),$router.push({path:'/projectDetail',query:{id:scope.data.data.hrid,year:scope.data.year}})">详情</el-button>
+              <el-button v-if="tool.checkAuth($route.name,'read') " type="text" size="small" @click="$store.dispatch('changeDetailDrawer',true),$router.push({path:'/projectDetail',query:{id:scope.data.data.hrid,year:scope.data.year}})">详情</el-button>
               <el-button v-if="tool.checkAuth($route.name,'update') && scope.data.data.status === '新建' " type="text" size="small" @click="$store.dispatch('DrawerShowChange',true),$router.push({path:'/editProjectInfo',query:{id:scope.data.data.hrid,year:scope.data.year}})">编辑</el-button>
             </template>
           </table1>

+ 2 - 1
src/SManagement/project_target/modules/components/projectAdd/project.vue

@@ -9,7 +9,7 @@
       <div slot="title" style="font-size: 15px">
         添加项目
       </div>
-      <el-input placeholder="请输入搜索内容" suffix-icon="el-icon-search" @input="listData(params.content.pageNumber = 1)" v-model="params.content.where.condition" @keyup.native.enter="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" style="width:200px" size="small" class="input-with-select inline-16" clearable>
+      <el-input placeholder="请输入编号/项目名称"  suffix-icon="el-icon-search" @input="listData(params.content.pageNumber = 1)" v-model="params.content.where.condition" @keyup.native.enter="listData(params.content.pageNumber = 1)" @clear="listData(params.content.pageNumber = 1)" style="width:300px;margin-bottom: 10px" size="small" class="input-with-select inline-16" clearable>
       </el-input>
       <layout_table
           :layout="tablecols"
@@ -20,6 +20,7 @@
           :checkbox="true"
           @onRow="onRow">
       </layout_table>
+
       <div style="margin-top:16px;text-align:right">
         <el-pagination
             background

+ 81 - 15
src/SManagement/project_target/modules/detailInfo.vue

@@ -31,27 +31,51 @@
         <project_add :id="this.$route.query.id" :year="this.$route.query.year" @onSuccess="onSuccess"></project_add>
       </div>
       <tableLayout ref="list" :layout="tablecols" :data="list" :custom="true" height="300">
+<!--        <template v-slot:customcol="scope">
+          <div v-if="scope.column.columnname === 'point'">33333</div>
+          <div v-else ></div>
+        </template>-->
         <template v-slot:customcol="scope">
-          <el-input size="mini" v-if="(scope.column.columnname === 'target_l' || scope.column.columnname === 'target_h' || scope.column.columnname === 'point') && actindex === scope.column.data.rowindex" v-model="scope.column.data[scope.column.columnname]"></el-input>
+          <el-input size="mini" v-if="(scope.column.columnname === 'target_l' || scope.column.columnname === 'target_h' ) && actindex === scope.column.data.rowindex" v-model="scope.column.data[scope.column.columnname]"></el-input>
+          <div v-else-if="scope.column.columnname === 'point'">
+            <el-date-picker
+                v-if="actindex === scope.column.data.rowindex"
+                v-model="date"
+                type="month"
+                placeholder="选择月"
+                :picker-options="pickerOptions">
+            </el-date-picker>
+            <p v-else>{{scope.column.data.year + '-' + scope.column.data.point}}</p>
+          </div>
           <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
         </template>
 
         <template v-slot:opreation="scope">
-          <el-button type="text" size="mini" class="inline-16" @click="actindex = 1">编辑</el-button>
-          <project_del class="inline-16"></project_del>
+          <el-button type="text" size="mini" class="inline-16" @click="edit(scope.data)" v-if="editShow ">编辑</el-button>
+          <el-button type="text" style="color: #e09a1a" size="mini" class="inline-16" v-if="saveShow && actindex === (scope.data.index + 1)" @click="save(scope.data)">保存</el-button>
+          <project_del class="inline-16" v-if="editShow "></project_del>
         </template>
       </tableLayout>
-      <div  class="container normal-panel" style="text-align:right">
-        <el-pagination
-            background
-            small
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :current-page="currentPage"
-            :page-sizes="[20, 50, 100, 200]"
-            layout="total,sizes, prev, pager, next, jumper"
-            :total="total">
-        </el-pagination>
+      <div>
+        <div  class="container normal-panel" style="text-align:right">
+          <div style="float: left">
+            <label class="search__label">项目总数:</label>
+            {{total}}</div>
+          <div style="float: left;margin-left: 20px">
+            <label class="search__label" style="width: 160px">项目基本目标(万元):</label>{{target_l}}</div>
+          <div style="float: left;margin-left: 20px" ><label class="search__label" style="width: 160px">项目挑战目标(万元):</label>{{target_h}}</div>
+          <el-pagination
+              background
+              small
+              @size-change="handleSizeChange"
+              @current-change="handleCurrentChange"
+              :current-page="currentPage"
+              :page-sizes="[20, 50, 100, 200]"
+              layout="total,sizes, prev, pager, next, jumper"
+              :total="total">
+          </el-pagination>
+      </div>
+
       </div>
 <!--        <targetTable ref="list" class="container normal-panel">
         <template  v-slot:editTarget="scope">
@@ -76,13 +100,23 @@ export default {
   components:{detail_information,project_add,project_del},
   data(){
     return {
+      pickerOptions:{
+        disabledDate(time){
+          return (time.getMonth() +1) < (new Date().getMonth() +1)
+        }
+      },
       actindex:0,
       mainData:{},
       mainAreaData:[],
+      editShow:true,
+      saveShow:false,
       tablecols:'',
-      list:'',
+      target_l:0,
+      target_h:0,
+      list:[],
       total:0,
       currentPage:0,
+      date:'',
       params: {
         "id": 20220906104002,
         "content": {
@@ -157,6 +191,12 @@ export default {
       this.currentPage = res.pageNumber
       console.log("获取项目数据")
       console.log(this.list);
+      const total_target_l = []
+      this.list.forEach((i,index)=>{
+        /*total_target_l[index] = i.target_l*/
+        this.target_l = this.target_l + i.target_l
+        this.target_h = this.target_h + i.target_h
+      })
 
     },
     onSuccess(){
@@ -172,6 +212,32 @@ export default {
       this.params.content.pageNumber = val
       this.listData()
     },
+    edit(rowIndex){
+      console.log("输出")
+      console.log(rowIndex)
+      this.actindex = rowIndex.index + 1
+      this.date = rowIndex.year + '-' + rowIndex.point
+      this.saveShow = true
+      this.editShow = false
+    },
+    async save(row){
+      console.log("保存数据")
+      console.log(row)
+      this.saveShow = false
+      this.editShow = true
+      this.actindex = 0
+      const res = await this.$api.requested({
+        "id": 20220906112602,
+        "content": {
+          "sa_salestargetid": row.sa_salestargetid,
+          "target_l": row.target_l,
+          "target_h": row.target_h
+        },
+      })
+      this.tool.showMessage(res,()=>{
+        this.getprojectTargetList()
+      })
+    }
   },
   created() {
     this.queryMainData(this.$route.query.id)

+ 4 - 0
src/components/normal-basic-layout/normal.vue

@@ -15,6 +15,7 @@
       </div>
     </div>
     <slot name="content"></slot>
+    <drawer></drawer>
   </div>
 </template>
 
@@ -23,6 +24,9 @@ import {mapGetters} from 'vuex'
 export default {
   props:['tableName','idName','tableData','apiId','formPath','oldFormPath','options','autoQuery','detailPath','customTitle','hidePagination'],
   components:{
+
+    drawer:() =>  import('./drawerDetail/drawer'),
+
   },
   computed:{
     ...mapGetters({