Forráskód Böngészése

前端: 导入合同时选择分管的二级单位

baichengfei 5 éve
szülő
commit
3714931aa3

+ 110 - 93
src/dashoo.cn/frontend_web/src/pages/oilcontract/contract-import/index.vue

@@ -288,6 +288,17 @@
                 </el-form-item>
              </template>
            </el-table-column>
+          <el-table-column  prop="SecondUnit"  min-width="110" label="二级单位" align="center" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <el-form-item  style="margin-bottom: 0px;" :prop="'tableData.' + scope.$index + '.SecondUnit'" :rules="rules.SecondUnit">
+                <el-select filterable size="small" v-model="scope.row.SecondUnit" placeholder="请选择" style="width: 100%">
+                  <el-option v-for="item in secondUnitOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"
+                             style="width: 100%">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+          </el-table-column>
            <el-table-column  prop="ContractNo"  min-width="110" label="合同编号" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractName"  min-width="110" label="合同名称" align="center" show-overflow-tooltip></el-table-column>
            <el-table-column  prop="ContractSonClass"  min-width="110" label="合同子类" align="center" show-overflow-tooltip></el-table-column>
@@ -368,13 +379,13 @@
             switch (items) {
               case '01':
                 return '供应商'
-                break;
+                break
               case '02':
                 return '承包商'
-                break;
+                break
               case '03':
                 return '服务商'
-                break;
+                break
               default:
                 return '--'
             }
@@ -383,13 +394,13 @@
             switch (items) {
               case 1:
                 return '未履行'
-                break;
+                break
               case 2:
                 return '履行中'
-                break;
+                break
               case 3:
                 return '已完结'
-                break;
+                break
               default:
                 return '--'
             }
@@ -421,10 +432,8 @@
     name: 'oilcontract',
     data () {
       return {
-        tableLoading:false,//表格loading
-        dialogLoading:false,
-
-
+        tableLoading: false, // 表格loading
+        dialogLoading: false,
         uploadTrueClickLoading: false,
         rules: {
           name: [
@@ -432,10 +441,14 @@
           ],
           ContractClass: [
             { required: true, message: '请输入名称', trigger: 'change' }
+          ],
+          SecondUnit: [
+            { required: true, message: '请输入名称', trigger: 'change' }
           ]
         },
         ContractSelectName: '',
         options: [],
+        secondUnitOptions: [],
         SupplierNameData: [],
         dialogVisibleContract: false,
         uploadshow: false,
@@ -443,8 +456,6 @@
         importDialogVisible: false,
         importloading: false,
         showimportvisible: false,
-
-
         evaluateBoolean: false,
         deleteBoolean: false,
         // 控制删除框
@@ -764,7 +775,7 @@
     },
     created () {
       // 查询条件初始值备份
-      Object.assign(this.searchFormReset, this.searchForm);
+      Object.assign(this.searchFormReset, this.searchForm)
       // 查询列表
       this.initDatas()
       // this.getDictOptions()
@@ -772,6 +783,7 @@
       this.statusFun()
 
       this.contractSelete()
+      this.GetSecondUnitOptions()
     },
     methods: {
       timeStyle (item) {
@@ -803,19 +815,19 @@
             this.uploadTrueClickLoading = true
             this.tableDataList.tableData.map((item, index) => {
               this.tableDataList.tableData[index].IsDeal = this.tableDataList.tableData[index].IsDeal === '是' ? 1 : 0
-              this.tableDataList.tableData[index].IsForeign = this.tableDataList.tableData[index].IsForeign=='是'?1:0
-              this.tableDataList.tableData[index].IsInternal = this.tableDataList.tableData[index].IsInternal=='是'?1:0
-              this.tableDataList.tableData[index].EndDate = this.tableDataList.tableData[index].EndDate!=''&&this.tableDataList.tableData[index].EndDate!=undefined?new Date(this.tableDataList.tableData[index].EndDate):''
-              this.tableDataList.tableData[index].SignedDate = this.tableDataList.tableData[index].SignedDate!=''&&this.tableDataList.tableData[index].SignedDate!=undefined?new Date(this.tableDataList.tableData[index].SignedDate):''
-              this.tableDataList.tableData[index].SubmitDate = this.tableDataList.tableData[index].SubmitDate!=''&&this.tableDataList.tableData[index].SubmitDate!=undefined?new Date(this.tableDataList.tableData[index].SubmitDate):''
-              this.tableDataList.tableData[index].StartDate = this.tableDataList.tableData[index].StartDate!=''&&this.tableDataList.tableData[index].StartDate!=undefined?new Date(this.tableDataList.tableData[index].StartDate):''
+              this.tableDataList.tableData[index].IsForeign = this.tableDataList.tableData[index].IsForeign === '是' ? 1 : 0
+              this.tableDataList.tableData[index].IsInternal = this.tableDataList.tableData[index].IsInternal === '是' ? 1 : 0
+              this.tableDataList.tableData[index].EndDate = this.tableDataList.tableData[index].EndDate != '' && this.tableDataList.tableData[index].EndDate != undefined ? new Date(this.tableDataList.tableData[index].EndDate) : ''
+              this.tableDataList.tableData[index].SignedDate = this.tableDataList.tableData[index].SignedDate != '' && this.tableDataList.tableData[index].SignedDate != undefined ? new Date(this.tableDataList.tableData[index].SignedDate) : ''
+              this.tableDataList.tableData[index].SubmitDate = this.tableDataList.tableData[index].SubmitDate != '' && this.tableDataList.tableData[index].SubmitDate != undefined ? new Date(this.tableDataList.tableData[index].SubmitDate) : ''
+              this.tableDataList.tableData[index].StartDate = this.tableDataList.tableData[index].StartDate != '' && this.tableDataList.tableData[index].StartDate != undefined ? new Date(this.tableDataList.tableData[index].StartDate) : ''
             })
             var data = {
               Items: this.tableDataList.tableData
             }
             data = JSON.parse(JSON.stringify(data))
             api.saveImportExcel(data, this.$axios).then(res => {
-              if (res.data.code==0) {
+              if (res.data.code == 0) {
                 this.dialogVisibleContract = false
                 this.$message({type: 'success', message: String(res.data.message)})
                 this.clearSearch()
@@ -824,13 +836,14 @@
               }
               this.uploadTrueClickLoading = false
             }).catch(err => {
+              console.log(err)
               this.uploadTrueClickLoading = false
               this.$message({type: 'warning', message: '导入失败'})
             })
           } else {
             this.$message({type: 'warning', message: '请填写完整才能导入'})
           }
-        });
+        })
 
         // this.dialogVisibleContract = false
       },
@@ -847,11 +860,10 @@
           this.importloading = false
           if (res.data.code === 0) {
             this.dialogVisibleContract = true
-            for(var key in res.data.item){
-              console.log(key,res.data.item[key])
-              res.data.item[key].ContractClass =  res.data.item[key].SourceContractClass=='承揽合同'?'02':res.data.item[key].ContractClass
-              res.data.item[key].SupplierId = res.data.item[key].SupplierId==''?'':res.data.item[key].SupplierId
-
+            for (var key in res.data.item) {
+              console.log(key, res.data.item[key])
+              res.data.item[key].ContractClass = res.data.item[key].SourceContractClass == '承揽合同' ? '02' : res.data.item[key].ContractClass
+              res.data.item[key].SupplierId = res.data.item[key].SupplierId == '' ? '' : res.data.item[key].SupplierId
               this.tableDataList.tableData.push(res.data.item[key])
             }
           } else if (res.data.code === -1) {
@@ -864,17 +876,16 @@
             })
           }
         })
-
       },
-      //状态判断
+      // 状态判断
       statusFun () {
         let data = {
           percode: 'oil_contract.Review.Add'
         }
         permissionApi.permissionIsauth(data, this.$axios).then(res => {
-          console.log('权限',res.data)
-          if(res.data.code==0){
-            if(res.data.message=='有权限'){
+          console.log('权限', res.data)
+          if (res.data.code == 0) {
+            if (res.data.message == '有权限') {
               this.evaluateBoolean = true
             }
           }
@@ -885,9 +896,9 @@
           percode: 'oil_contract_Delete'
         }
         permissionApi.permissionIsauth(datas, this.$axios).then(res => {
-          console.log('权限',res.data)
-          if(res.data.code==0){
-            if(res.data.message=='有权限'){
+          console.log('权限', res.data)
+          if (res.data.code == 0) {
+            if (res.data.message == '有权限') {
               this.deleteBoolean = true
             }
           }
@@ -895,41 +906,50 @@
           console.error(err)
         })
       },
-      //跳转评价
-      onNavigateEvaluate(item){
+      // 二级单位列表
+      GetSecondUnitOptions () {
+        let _this = this
+        this.$axios.get('/register/orgloginlist').then(res => {
+          _this.secondUnitOptions = res.data.items
+        }).catch(err => {
+          console.log(err)
+        })
+      },
+      // 跳转评价
+      onNavigateEvaluate (item) {
         // <el-option label="供应商" value="01" key="01"></el-option>
         // <el-option label="承包商" value="02" key="02"></el-option>
         // <el-option label="服务商" value="03" key="03"></el-option>
         var index = String(item.ContractClass)
         var name = ''
-        switch(index){
-          case "01":
+        switch (index) {
+          case '01':
             name = 'contract-goods'
-          break;
-          case "02":
+            break
+          case '02':
             name = 'contract-basis'
-          break;
-          case "03":
+            break
+          case '03':
             name = 'contract-service'
-          break;
+            break
         }
-        console.log('跳转',item)
+        console.log('跳转', item)
         this.$router.push({
-          path:'/oilcontract/' + name + '/add/evaluate',
-          query:{
-            ContractId:item.Id,
+          path: '/oilcontract/' + name + '/add/evaluate',
+          query: {
+            ContractId: item.Id
             // type:1,
           }
         })
       },
-      initDatas() {
-        this.tableLoading = true;//表格loading
-        //分页及列表条件
+      initDatas () {
+        this.tableLoading = true// 表格loading
+        // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
           _size: this.size,
           Order: this.Column.Order,
-          Prop: this.Column.Prop,
+          Prop: this.Column.Prop
         }
         let myCreateOn = []
         // 解析时间
@@ -940,40 +960,39 @@
           myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
           myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
         }
-        //查询条件
-        console.log(1111,Object.assign(params, this.searchForm))
+        // 查询条件
         Object.assign(params, this.searchForm)
-        //访问接口
+        // 访问接口
         api.getList(myCreateOn.join(','), params, this.$axios).then(res => {
-          this.tableLoading = false;//表格loading
-          console.log('列表数据',res.data)
+          this.tableLoading = false// 表格loading
+          console.log('列表数据', res.data)
           this.entityList = res.data.items
           this.currentItemCount = res.data.currentItemCount
         }).catch(err => {
-          this.tableLoading = false;//表格loading
+          this.tableLoading = false// 表格loading
           console.error(err)
         })
       },
 
-      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') {
@@ -982,48 +1001,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,index) {
-         this.$refs['popover-' + `${index}`].doClose()
+      deleteEntity (row, index) {
+        this.$refs['popover-' + `${index}`].doClose()
         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') {
@@ -1036,22 +1054,22 @@
         }
       },
 
-      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
       },
 
       importExcel () {
         this.uploadshow = true
       },
-      beforeRemove(){
+      beforeRemove () {
         this.Excelurl = ''
         return true
       },
@@ -1091,11 +1109,10 @@
               })
             })
         }
-      },
+      }
 
     }
   }
-
 </script>
 
 <style lang="scss">