浏览代码

上报情况-c2

yuedefeng 4 年之前
父节点
当前提交
e064d1ae8d

+ 13 - 20
src/dashoo.cn/backend/api/business/oilcontract/contract/contractService.go

@@ -2,9 +2,7 @@ package contract
 
 import (
 	. "dashoo.cn/backend/api/mydb"
-	. "dashoo.cn/utils/db"
 	"github.com/go-xorm/xorm"
-	"strconv"
 )
 
 type OilContractService struct {
@@ -17,42 +15,37 @@ func GetOilContractService(xormEngine *xorm.Engine) *OilContractService {
 	return s
 }
 
-func (s *OilContractService) GetHandOnStatisticsList (queryParam HandOnStatisticsQuery, entitiesPtr HandOnStatisticsEntity) (total int64) {
-	var err error
+func (s *OilContractService) GetHandOnStatisticsList (queryParam HandOnStatisticsQuery, entitiesPtr interface{}) (total int64) {
 	if queryParam.PageIndex < 1 { queryParam.PageIndex = 1 }
 	if queryParam.ItemsPerPage < 1 { queryParam.ItemsPerPage = 10 }
-	var resultsSlice []map[string][]byte
+	// var resultsSlice []map[string][]byte
 
-	sqlCount := "SELECT COUNT(*) " +
+	/*sqlCount := "SELECT COUNT(*) " +
 		         " FROM OilContract a " +
 		         " LEFT JOIN OilContractReview b ON b.ContractId=a.Id " +
-		         " GROUP BY a.SecondUnit "
+		         " GROUP BY a.SecondUnit "*/
 
 	sql := "SELECT a.SecondUnit, COUNT(DISTINCT a.Id) AS ContractNum,  COUNT(DISTINCT b.ContractId) AS HasNum " +
 		" FROM OilContract a " +
 		" LEFT JOIN OilContractReview b ON b.ContractId=a.Id " +
-		// " WHERE year = ? " +
 		" GROUP BY a.SecondUnit "
 
-	resultsSlice, err = s.DBE.Query(sqlCount)
-	startLimit := (queryParam.PageIndex-1) * queryParam.ItemsPerPage
-	endLimit := (queryParam.PageIndex) * queryParam.ItemsPerPage
-	err = s.DBE.
-		SQL(sql, queryParam.YearNum).
-		OrderBy(queryParam.Order + " " + queryParam.Asc).
-		Limit(int(startLimit), int(endLimit)).
-		Find(entitiesPtr)
+	// resultsSlice, err = s.DBE.Query(sqlCount)
+	startLimit := int((queryParam.PageIndex-1) * queryParam.ItemsPerPage)
+	endLimit := int((queryParam.PageIndex) * queryParam.ItemsPerPage)
+	var totalCnt int64
+	totalCnt, _ = s.DBE.SQL(sql).Limit(startLimit, endLimit).FindAndCount(entitiesPtr)
 
-	LogError(err)
-	if len(resultsSlice) > 0 {
+	// LogError(err)
+	/** if len(resultsSlice) > 0 {
 		results := resultsSlice[0]
 		for _, value := range results {
 			total, err = strconv.ParseInt(string(value), 10, 64)
 			LogError(err)
 			break
 		}
-	}
-	return total
+	} */
+	return totalCnt
 
 }
 

+ 19 - 0
src/dashoo.cn/backend/api/controllers/oilcontract/contract.go

@@ -1183,3 +1183,22 @@ func (this *OilContractController) GetNeedEvaList() {
 	this.Data["json"] = &dataInfo
 	this.ServeJSON()
 }
+
+// @Title 获取上报情况列表
+// @Description
+// @Success 200 {object} ErrorInfo
+// @router /handOnList [post]
+func (this *OilContractController) GetHandOnStatisticsList() {
+	var queryParam contract.HandOnStatisticsQuery
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &queryParam)
+
+	var models []contract.HandOnStatisticsEntity
+	svc := contract.GetOilContractService(utils.DBE)
+	total := svc.GetHandOnStatisticsList(queryParam, &models)
+	var dataInfo DataInfo
+	dataInfo.Items = models
+	dataInfo.CurrentItemCount = total
+	this.Data["json"] = &dataInfo
+	this.ServeJSON()
+}

+ 8 - 1
src/dashoo.cn/frontend_web/src/api/oilcontract/contract.js

@@ -232,6 +232,13 @@ export default {
       url: '/contract/need-eva-list',
       method: 'get'
     })
+  },
+  // 上报情况
+  handOnList (params, myAxios) {
+    return myAxios({
+      url: '/contract/handOnList',
+      method: 'post',
+      data: params
+    })
   }
-
 }

+ 28 - 176
src/dashoo.cn/frontend_web/src/pages/oilcontract/report/handon-statistics.vue

@@ -15,10 +15,10 @@
         </span>
         <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
           <el-form-item label="单位名称">
-            <el-input size="mini" clearable v-model="searchForm.SupplierName" placeholder="请输入企业名称"></el-input>
+            <el-input size="mini" clearable v-model="searchForm.SecondUnit" placeholder="请输入企业名称"></el-input>
           </el-form-item>
           <el-form-item label="类型" style="width: 170px">
-            <el-select size="mini" v-model="searchForm.Evaluate" placeholder="请选择" style="width: 100px" clearable>
+            <el-select size="mini" v-model="searchForm.SupplierType" placeholder="请选择" style="width: 100px" clearable>
               <el-option label="全部" value="" key="01"></el-option>
               <el-option label="物资类" value="1" key="02"></el-option>
               <el-option label="服务类" value="2" key="03"></el-option>
@@ -48,10 +48,14 @@
       </div>
 
       <el-table id="rebateSetTable" highlight-current-row stripe size="mini" :data="entityList" border height="calc(100vh - 243px)" style="width: 100%" @sort-change="orderby" v-loading="tableLoading">
-        <el-table-column sortable show-overflow-tooltip prop="SupplierName" header-align="center" align="center" label="单位名称"></el-table-column>
-        <el-table-column sortable show-overflow-tooltip prop="Score" header-align="center" label="合同总数" width="150" align="center"></el-table-column>
-        <el-table-column sortable show-overflow-tooltip prop="Score" header-align="center" label="已上报数" width="150" align="center"></el-table-column>
-        <el-table-column sortable show-overflow-tooltip prop="Score" header-align="center" label="未上报数" width="150" align="center"></el-table-column>
+        <el-table-column sortable show-overflow-tooltip prop="SecondUnit" header-align="center" align="center" label="单位名称"></el-table-column>
+        <el-table-column sortable show-overflow-tooltip prop="ContractNum" header-align="center" label="合同总数" width="150" align="center"></el-table-column>
+        <el-table-column sortable show-overflow-tooltip prop="HasNum" header-align="center" label="已上报数" width="150" align="center"></el-table-column>
+        <el-table-column sortable show-overflow-tooltip prop="HasNum" header-align="center" label="未上报数" width="150" align="center">
+          <template slot-scope="scope">
+            {{ (scope.row.ContractNum - scope.row.HasNum) > 0 ? (scope.row.ContractNum - scope.row.HasNum) : '' }}
+          </template>
+        </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
                      :page-sizes="[50, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
@@ -60,57 +64,16 @@
   </div>
 </template>
 <script>
-  import { mapGetters } from 'vuex'
-  import api from '@/api/oilcontract/contractSumScore'
-  import permissionApi from '@/api/oilcontract/permission'
+  import api from '@/api/oilcontract/contract'
   import FileSaver from 'file-saver'
   import XLSX from 'xlsx'
 
   export default {
-    computed: {
-      ...mapGetters({
-        authUser: 'authUser'
-      }),
-      evaluateFun: function () {
-        return function (item,result) {
-          if (result === '0') {
-            return '不合格'
-          }
-          var index = Number(item)
-          switch (index) {
-            case 1:
-              return '优秀'
-              break
-            case 2:
-              return '合格'
-              break
-            case 3:
-              return '不合格'
-              break
-            default:
-              return '--'
-          }
-        }
-      },
-      evaluateBooleanFun: function () {
-        return function (item) {
-          var index = Number(item)
-          if (index > 0) {
-            return '是'
-          } else {
-            return '否'
-          }
-        }
-      }
-    },
-    name: 'oilContractReportOverAll',
-
+    name: 'handOnStatistics',
     data () {
       return {
         yearList: [],
         tableLoading: false,
-
-        tableWidth: '290px',
         dialogVisible: false,
         // 列表数据
         entityList: [],
@@ -118,43 +81,24 @@
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
+        CreateOn: [],
         // 列表排序
         Column: {
           Order: '',
           Prop: ''
         },
-        // 查询时间new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()
-        CreateOn: [],
-        // 查询项
-        searchFormReset: {},
         searchForm: {
-          Id: '',
-          SupplierId: '',
-          SupplierName: '',
-          Evaluate: '',
-          Score: '',
-          Score1: 0,
-          Score2: '',
-          Score3: '',
-          Score4: '',
-          Score5: '',
-          Score6: '',
-          Score7: '',
-          Score8: '',
-          Remark: '',
-          Year: ''
-        },
-        jurisdictionBoolean: false
+          SecondUnit: '',
+          SupplierType: '',
+          Year: '',
+          CreateOn: ''
+        }
       }
     },
     created () {
       this.getYearList()
-      // 查询条件初始值备份
-      Object.assign(this.searchFormReset, this.searchForm)
       // 查询列表
       this.initDatas()
-      // this.getDictOptions()
-      this.permissionIsauth()
     },
     methods: {
       getYearList () {
@@ -162,22 +106,6 @@
         let nowYear = now.getFullYear()
         this.yearList = [nowYear, nowYear - 1]
       },
-      // 判断权限
-      permissionIsauth () {
-        var data = {
-          percode: 'oil_contract.SumStore.Add'
-        }
-        permissionApi.permissionIsauth(data, this.$axios).then(res => {
-          if (res.data.code == 0) {
-            if (res.data.message == '有权限') {
-              this.jurisdictionBoolean = true
-            }
-          }
-          console.log('判断是否有权限', res)
-        }).catch(err => {
-          console.error(err)
-        })
-      },
       initDatas () {
         this.tableLoading = true
         // 分页及列表条件
@@ -185,25 +113,23 @@
         // <el-option label="基建类" value="02" key="02"></el-option>
         // <el-option label="技术服务" value="03" key="03"></el-option>
         let params = {
-          _currentPage: this.currentPage,
-          _size: this.size,
+          PageIndex: this.currentPage,
+          ItemsPerPage: this.size,
           Order: this.Column.Order,
-          Prop: this.Column.Prop,
-          ContractClass: '02'
+          Prop: this.Column.Prop
         }
-        let myCreateOn = []
         // 解析时间
-        if (this.CreateOn.length == 2) {
+        if (this.CreateOn.length === 2) {
           this.CreateOn[1].setHours(23)
           this.CreateOn[1].setMinutes(59)
           this.CreateOn[1].setSeconds(59)
-          myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
-          myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
+          params.StartTime = this.formatDateTime(this.CreateOn[0])
+          params.EndTime = this.formatDateTime(this.CreateOn[1])
         }
         // 查询条件
         Object.assign(params, this.searchForm)
         // 访问接口
-        api.GetComputeList(myCreateOn.join(','), params, this.$axios).then(res => {
+        api.handOnList(params, this.$axios).then(res => {
           this.tableLoading = false
           this.entityList = res.data.items
           this.currentItemCount = res.data.currentItemCount
@@ -213,40 +139,21 @@
         })
       },
 
-      getDictOptions () {
-        api.getDictList(this.$axios).then(res => {
-          // this.dictOptions.customerList = res.data.items['customerList']
-          // this.dictOptions.projectList = res.data.items['projectList']
-
-        }).catch(err => {
-          console.error(err)
-        })
-      },
-
       searchCommand (command) {
-        if (command == 'search') {
-          this.dialogVisible = true
-        } else if (command == 'clear') {
+        if (command === 'clear') {
           this.clearSearch()
         }
       },
       // 列表排序功能
       orderby (column) {
-        if (column.order == 'ascending') {
+        if (column.order === 'ascending') {
           this.Column.Order = 'asc'
-        } else if (column.order == 'descending') {
+        } else if (column.order === 'descending') {
           this.Column.Order = 'desc'
         }
         this.Column.Prop = column.prop
         this.initDatas()
       },
-      //
-      renderHeader (h, { column, $index }) {
-        console.log(2222, h, { column, $index })
-        column.minWidth = column.width
-        let _this = this
-        return h('span', [h('tableHead', column.label)])
-      },
       clearSearch () {
         Object.assign(this.searchForm, this.searchFormReset)
         // this.searchForm = this.searchFormReset;
@@ -267,38 +174,6 @@
         this.currentPage = 1
         this.initDatas()
       },
-      deleteEntity (row, index) {
-        this.$refs['popover-' + `${index}`].doClose()
-        api.deleteEntity(row.Id, this.$axios).then(res => {
-          if (res.data.code === 0) {
-            this.initDatas()
-            this.$message({
-              type: 'success',
-              message: res.data.message
-            })
-          } else {
-            this.$message({
-              type: 'warning',
-              message: res.data.message
-            })
-          }
-        }).catch(err => {
-          console.error(err)
-        })
-      },
-
-      jstimehandle (val) {
-        if (val === '') {
-          return '----'
-        } else if (val === '0001-01-01T08:00:00+08:00') {
-          return '----'
-        } else if (val === '5000-01-01T23:59:59+08:00') {
-          return '永久'
-        } else {
-          val = val.replace('T', ' ')
-          return val.substring(0, 10)
-        }
-      },
       exportExcel () {
         /* generate workbook object from table */
         let wb = XLSX.utils.table_to_book(
@@ -321,29 +196,6 @@
           if (typeof console !== 'undefined') console.log(e, wbout)
         }
         return wbout
-      },
-      formatDateTime (date) {
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? ('0' + m) : m
-        var d = date.getDate()
-        d = d < 10 ? ('0' + d) : d
-        var h = date.getHours()
-        var minute = date.getMinutes()
-        minute = minute < 10 ? ('0' + minute) : minute
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-      },
-      // 跳转评价
-      onNavigateScore (item) {
-        console.log('跳转', item)
-        this.$router.push({
-          path: '/oilcontract/contract-basis-year/' + item.SupplierId + '/operation',
-          query: {
-            year: this.searchForm.Year
-            // item: item
-            // SupplierId:item.SupplierId,
-          }
-        })
       }
     }
   }