baichengfei 5 yıl önce
ebeveyn
işleme
23e6595d7c

+ 109 - 114
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-goods/_opera/evaluationlist.vue

@@ -99,7 +99,7 @@
   </div>
 </template>
 <script>
-  import { mapGetters } from 'vuex';
+  import { mapGetters } from 'vuex'
   import api from '@/api/oilcontract/contract'
   // import api from '@/api/oilcontract/contractEvaluationItems';
 
@@ -114,50 +114,50 @@
       // 评价id
       evaluateId: {
         type: null,
-        default:'',
+        default: ''
       },
       // 类型 0 二级部门创建 1 专业处创建
       category: {
         type: null,
-        default:'',
+        default: ''
       },
-      //项目类型
+      // 项目类型
       ContractClass: {
         type: null,
-        default:'',
+        default: ''
       },
-      //是否禁用
+      // 是否禁用
       disabledForm: {
         type: null,
-        default:false,
-      },
+        default: false
+      }
 
     },
-    computed:{
-      scoreFun:function(){
-        return function(type,k){
-          var num = 0;
+    computed: {
+      scoreFun: function () {
+        return function (type, k) {
+          var num = 0
           var list = this.entityListData.entityList
-          for(var index = 0 ; index < list.length ; index++){
+          for (var index = 0; index < list.length; index++) {
             var code = Number(list[index].LevelCode)
-            if(type == list[index].typeStatus&&code==2){
+            if (type == list[index].typeStatus && code == 2) {
               num = num + Number(list[index].Score)
             }
           }
-          if(this.entityListData.entityList[k].Score != String(num)){
+          if (this.entityListData.entityList[k].Score != String(num)) {
             // this.getNum = this.getNum + Number(num)
             this.entityListData.entityList[k].Score = String(num)
           }
           return num
         }
       },
-      getNumFun:function(){
-        return function(){
-          var num = 0;
+      getNumFun: function () {
+        return function () {
+          var num = 0
           var list = this.entityListData.entityList
-          for(var index = 0 ; index < list.length ; index++){
+          for (var index = 0; index < list.length; index++) {
             var code = Number(list[index].LevelCode)
-            if(list[index].LevelCode == 1){
+            if (list[index].LevelCode == 1) {
               num = num + Number(list[index].Score)
             }
           }
@@ -165,12 +165,12 @@
         }
       }
     },
-    data() {
+    data () {
       var validatePass = (rule, value, callback) => {
         var num = Number(value)
-        if (num == ''&&num != 0) {
+        if (num == '' && num != 0) {
           this.fractionBoolean = false
-          callback(new Error('请输入分值'));
+          callback(new Error('请输入分值'))
           return
         }
         // if (num > Number(this.branchNum)) {
@@ -178,44 +178,44 @@
         //   callback(new Error('不能大于规定的分值'));
         //   return
         // }
-        if ( num < 0) {
+        if (num < 0) {
           this.fractionBoolean = false
-          callback(new Error('不能为负数'));
+          callback(new Error('不能为负数'))
           return
         }
         this.fractionBoolean = true
-        callback();
-      };
+        callback()
+      }
       return {
-        fractionBoolean:true,
+        fractionBoolean: true,
         dialogVisibleCom: false,
         loading: false,
         UnitOrgOptions: [],
-        textareaValue:'',//不合格原因
-        dialogBoolean:false,
-        rules:{
+        textareaValue: '', // 不合格原因
+        dialogBoolean: false,
+        rules: {
           relation: [
             { validator: validatePass, trigger: 'blur' }
-          ],
+          ]
         },
         dialogVisible: false,
-        //列表数据
-        entityListData:{
-          entityList:[],
+        // 列表数据
+        entityListData: {
+          entityList: []
         },
 
-        //分页参数
+        // 分页参数
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
-        //列表排序
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
         },
-        //查询时间new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()
+        // 查询时间new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()
         CreateOn: [],
-        //查询项
+        // 查询项
         searchFormReset: {},
         searchForm: {
           Id: '',
@@ -229,7 +229,7 @@
           Remark: '',
           ModifiedOn: '',
           ModifiedUserId: '',
-          ModifiedBy: '',
+          ModifiedBy: ''
 
         },
         auditform: {
@@ -240,45 +240,42 @@
           AuditRemark: '',
           TypeCode: '03'
         },
-        entityListItemIndex:'',
-        standardNum:0,//标准分数
-        getNum:0,//实得总分
+        entityListItemIndex: '',
+        standardNum: 0, // 标准分数
+        getNum: 0 // 实得总分
 
       }
     },
-    created() {
-      //数据列表
+    created () {
+      // 数据列表
       // 判断是编辑状态还是新增状态
-      if(this.evaluateId==0){
-        this.initDatas();
-      }else{
-        this.editDatas();
+      if (this.evaluateId == 0) {
+        this.initDatas()
+      } else {
+        this.editDatas()
       }
-
-
-      //this.getDictOptions()
-
+      // this.getDictOptions()
     },
     methods: {
-      //初始数据
-      initDatas() {
+      // 初始数据
+      initDatas () {
         // 普通的传1,条件评价穿2
         var data = {
-          Category:1,
+          Category: 1
         }
         this.standardNum = 0
-        api.evaluationItemsOnelist(data,this.ContractClass,this.$axios).then(res => {
-          console.log('上级节点内容',res)
+        api.evaluationItemsOnelist(data, this.ContractClass, this.$axios).then(res => {
+          console.log('上级节点内容', res)
           var data = res.data.items
           var list = []
-          for(var index = 0 ; index < data.length ; index++){
+          for (var index = 0; index < data.length; index++) {
             data[index].typeStatus = index
             data[index].Score = '0'
             list.push(data[index])
 
             this.standardNum = this.standardNum + parseInt(data[index].NormalScore)
-            if(data[index].Son!=null&&data[index].Son!=undefined){
-              for(var k = 0 ; k < data[index].Son.length ; k++){
+            if (data[index].Son != null && data[index].Son != undefined) {
+              for (var k = 0; k < data[index].Son.length; k++) {
                 data[index].Son[k].typeStatus = index
                 data[index].Son[k].Score = data[index].Son[k].NormalScore
                 list.push(data[index].Son[k])
@@ -287,79 +284,79 @@
             }
           }
           this.entityListData.entityList = list
-          console.log('处理完的数据',list)
+          console.log('处理完的数据', list)
         }).catch(err => {
           console.error(err)
         })
       },
-      //编辑初始数据
-      editDatas() {
+      // 编辑初始数据
+      editDatas () {
         var data = {
-          ContentReviewId:this.evaluateId,
-          Category:this.category,
-          Type:1,
+          ContentReviewId: this.evaluateId,
+          Category: this.category,
+          Type: 1
         }
         this.standardNum = 0
-        api.contractEvaluationTree(data,this.$axios).then(res => {
-          console.log('编辑后的内容',res)
+        api.contractEvaluationTree(data, this.$axios).then(res => {
+          console.log('编辑后的内容', res)
           var data = res.data.items
           var list = []
-          for(var index = 0 ; index < data.length ; index++){
+          for (var index = 0; index < data.length; index++) {
             data[index].typeStatus = index
-            data[index].Score = data[index].Score==undefined||data[index].Score==''?'0':data[index].Score
+            data[index].Score = data[index].Score == undefined || data[index].Score == '' ? '0' : data[index].Score
             list.push(data[index])
             this.standardNum = this.standardNum + parseInt(data[index].NormalScore)
-            if(data[index].Son!=null&&data[index].Son!=undefined){
-              for(var k = 0 ; k < data[index].Son.length ; k++){
+            if (data[index].Son != null && data[index].Son != undefined) {
+              for (var k = 0; k < data[index].Son.length; k++) {
                 data[index].Son[k].typeStatus = index
-                data[index].Son[k].Score = data[index].Son[k].Score==undefined||data[index].Son[k].Score==''?'0':data[index].Son[k].Score
+                data[index].Son[k].Score = data[index].Son[k].Score == undefined || data[index].Son[k].Score == '' ? '0' : data[index].Son[k].Score
                 list.push(data[index].Son[k])
               }
             }
           }
           this.entityListData.entityList = list
-          console.log('处理完的数据',list)
+          console.log('处理完的数据', list)
         }).catch(err => {
           console.error(err)
         })
       },
       // 弹窗
-      onDialogVisible(item,index){
+      onDialogVisible (item, index) {
         console.log(item)
         this.entityListItemIndex = index
         this.textareaValue = item.Remark
         this.dialogBoolean = true
       },
-      //确认编辑内容
-      onTrueDialog(){
+      // 确认编辑内容
+      onTrueDialog () {
         this.entityListData.entityList[this.entityListItemIndex].Remark = this.textareaValue
         this.dialogBoolean = false
       },
       // 分数校验
-      onInputFen(index,fen){
+      onInputFen (index, fen) {
         this.branchNum = fen
         // this.entityListData.entityList[index].Score = fen
       },
 
-      getDictOptions() {
+      getDictOptions () {
         api.getDictList(this.$axios).then(res => {
-          //this.dictOptions.customerList = res.data.items['customerList']
-          //this.dictOptions.projectList = res.data.items['projectList']
+          // this.dictOptions.customerList = res.data.items['customerList']
+          // this.dictOptions.projectList = res.data.items['projectList']
 
         }).catch(err => {
           console.error(err)
         })
       },
 
-      searchCommand(command) {
+      searchCommand (command) {
         if (command == 'search') {
           this.dialogVisible = true
         } else if (command == 'clear') {
           this.clearSearch()
         }
       },
-      //列表排序功能
-      orderby(column) {
+      // 列表排序功能
+      orderby (column) {
         if (column.order == 'ascending') {
           this.Column.Order = 'asc'
         } else if (column.order == 'descending') {
@@ -368,48 +365,47 @@
         this.Column.Prop = column.prop
         this.initDatas()
       },
-      clearSearch() {
-        Object.assign(this.searchForm, this.searchFormReset);
-        //this.searchForm = this.searchFormReset;
+      clearSearch () {
+        Object.assign(this.searchForm, this.searchFormReset)
+        // this.searchForm = this.searchFormReset;
         this.CreateOn = ''
         this.initDatas()
       },
-      handleSearch() {
-        this.currentPage = 1;
-        this.dialogVisible = false;
-        this.initDatas();
+      handleSearch () {
+        this.currentPage = 1
+        this.dialogVisible = false
+        this.initDatas()
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.initDatas()
       },
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.initDatas()
       },
-      deleteEntity(row) {
-        row.deleteConfirmFlag = false;
+      deleteEntity (row) {
+        row.deleteConfirmFlag = false
         api.deleteEntity(row.Id, this.$axios).then(res => {
           if (res.data.code === 0) {
-            this.initDatas();
+            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) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -422,16 +418,16 @@
         }
       },
 
-      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;
+      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
       },
       orgunitChange (val) {
         let deptid = val
@@ -461,10 +457,9 @@
         }).catch(err => {
           console.error(err)
         })
-      },
+      }
     }
   }
-
 </script>
 
 <style lang="scss">