Browse Source

增项申请-添加申请时对选择的公司进行判断

baichengfei 5 years ago
parent
commit
5176f7899a

+ 109 - 85
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/basislist.vue

@@ -18,7 +18,7 @@
             <el-button v-if="IsCompanyUser == 0" type="primary" size="mini"
                        style="margin-left:10px; margin-top: -4px;" @click="addappend">添加</el-button>
             <el-button v-if="IsCompanyUser == 1" type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
-              @click="addappendcom">添加
+              @click="addAppendCom">添加
             </el-button>
           </span>
           <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
@@ -201,7 +201,7 @@
         </el-form>
         <span style="float: right;margin-top:-10px;">
           <el-button size="small" @click="addshow = false">取 消</el-button>
-          <el-button type="primary" size="small" @click="addappendcom">确 定</el-button>
+          <el-button type="primary" size="small" @click="addAppendCom">确 定</el-button>
         </span>
         <br>
       </el-dialog>
@@ -213,8 +213,8 @@
 <script>
   import {
     mapGetters
-  } from 'vuex';
-  import WfHistory from '@/components/workflow/wfhistory.vue'
+  } from 'vuex'
+import WfHistory from '@/components/workflow/wfhistory.vue'
   import api from '@/api/oilsupplier/supplierappend'
   import page401 from '@/components/error/401.vue'
 
@@ -230,25 +230,25 @@
     },
     name: 'oilsuppliercertappend',
 
-    data() {
+    data () {
       return {
         addshow: false,
         historyVisible: false,
-        dialogVisible: false, //高级查询
-        //列表数据
+        dialogVisible: false, // 高级查询
+        // 列表数据
         entityList: [],
-        //分页参数
+        // 分页参数
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
-        //列表排序
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
         },
-        //查询起始时间(一月前开始)
+        // 查询起始时间(一月前开始)
         CreateOn: '',
-        //查询项
+        // 查询项
         searchFormReset: {},
         searchForm: {
           Id: '',
@@ -257,7 +257,7 @@
           ApplyDate: '',
           RecUnitId: '',
           RecUnitName: '',
-          AppendType: '02', //增项类别(1 物资类,2 基建类,3 服务类)
+          AppendType: '02', // 增项类别(1 物资类,2 基建类,3 服务类)
           DenyReason: '',
           AuditDate: '',
           Status: '',
@@ -268,16 +268,16 @@
           CreateBy: '',
           ModifiedOn: '',
           ModifiedUserId: '',
-          ModifiedBy: '',
+          ModifiedBy: ''
         },
-        //工作流
+        // 工作流
         entrydetail: {
           process: 'oil_append_apply',
           business: '',
           instance: ''
         },
-        //修改
-        optionsList: [], //服务类层级选择列表
+        // 修改
+        optionsList: [], // 服务类层级选择列表
         orgtreeprops: {
           value: 'id',
           label: 'Name',
@@ -293,19 +293,19 @@
           SupplierName: '',
           SupplierId: '',
           SupplierCertId: 0,
-          RecUnitFlag: '', //推荐单位的级联Id标记
-          RecUnitId: '', //推荐单位编码
-          RecUnitName: '', //推荐单位名称
-          AppendType: '', //增项类别(01 物资类,02 基建类,03 服务类)
-          Remark: '', //备注
-        },
+          RecUnitFlag: '', // 推荐单位的级联Id标记
+          RecUnitId: '', // 推荐单位编码
+          RecUnitName: '', // 推荐单位名称
+          AppendType: '', // 增项类别(01 物资类,02 基建类,03 服务类)
+          Remark: '' // 备注
+        }
       }
     },
-    created() {
+    created () {
       this.IsCompanyUser = this.authUser.Profile.IsCompanyUser
-      //查询条件初始值备份
+      // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
-      //查询列表
+      // 查询列表
       this.initData()
       this.getSupplierList()
     },
@@ -322,13 +322,13 @@
         this.appendformData.SupplierCertId = parseInt(obj.SupplierCertId)
         this.appendformData.SupplierName = obj.SupplierName
       },
-      initData() {
-        //分页及列表条件
+      initData () {
+        // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
           _size: this.size,
           Order: this.Column.Order,
-          Prop: this.Column.Prop,
+          Prop: this.Column.Prop
         }
         let myCreateOn = []
         // 解析时间
@@ -339,9 +339,9 @@
           myCreateOn.push(this.formatDateTime(this.CreateOn[0]))
           myCreateOn.push(this.formatDateTime(this.CreateOn[1]))
         }
-        //查询条件
+        // 查询条件
         Object.assign(params, this.searchForm)
-        //访问接口
+        // 访问接口
         api.getList(myCreateOn.join(','), params, this.$axios).then(res => {
           this.entityList = res.data.items
           this.currentItemCount = res.data.currentItemCount
@@ -350,34 +350,58 @@
         })
       },
 
-      addappendcom() {
+      addAppendCom () {
         let _this = this
-        _this.$confirm("确定添加增项申请, 是否继续?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
+        _this.$confirm('确定添加增项申请, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
-            _this.addshow = false
             _this.appendformData.AppendType = '02'
             _this.appendformData.SupplierId = parseInt(_this.appendformData.SupplierId)
+            if (!_this.appendformData.SupplierId) {
+              _this.appendformData.SupplierId = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+              return
+            }
+            let tempSupplierName = false
+            tempSupplierName = _this.supplierList.find((item) => {
+              if (item.SupplierName === _this.appendformData.SupplierName) {
+                return true
+              }// 筛选出匹配数据
+            })
+            if (!tempSupplierName) {
+              _this.appendformData.SupplierId = ''
+              _this.appendformData.SupplierName = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+            }
             _this.$axios.post('/suppliercertappend/addappend/', _this.appendformData)
               .then(res => {
                 if (res.data.code === 0) {
-                  //this.entityList = res.data.item
+                  // this.entityList = res.data.item
                   let AppendId = res.data.info
                   this.$router.push({
                     path: `/oilsupplier/supplierappend/2/basisdataopera`,
                     query: {
                       Id: AppendId,
-                      editFlag: 1 //编辑标记: 1 修改,0 不修改
+                      editFlag: 1 // 编辑标记: 1 修改,0 不修改
                     }
                   })
                   _this.$message({
                     type: 'success',
-                    message: res.data.message,
+                    message: res.data.message
                   })
+                  _this.addshow = false
                 } else {
+                  _this.appendformData.SupplierId = ''
+                  _this.appendformData.Remark = ''
                   _this.$message({
                     type: 'warning',
                     message: res.data.message
@@ -385,21 +409,23 @@
                 }
               })
               .catch(err => {
+                _this.appendformData.SupplierId = ''
+                _this.appendformData.Remark = ''
                 console.error(err)
               })
           })
-          .catch(() => {});
+          .catch(() => {})
       },
 
-      getSupplierList() {
+      getSupplierList () {
         let _this = this
         _this.supplierList = []
         let params = {
-          SuppTypeCode: '02',
+          SuppTypeCode: '02'
         }
         _this.$axios.get('/suppliercertappend/getsupplier', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.supplierList = res.data
             if (_this.supplierList) {
@@ -418,8 +444,8 @@
           })
       },
 
-      //获取服务类层级列表
-      getTechTreeList() {
+      // 获取服务类层级列表
+      getTechTreeList () {
         let _this = this
         this.$axios.get('technologyservice/businesslist', {})
           .then(res => {
@@ -430,8 +456,8 @@
           })
       },
 
-      //编辑
-      editData(row) {
+      // 编辑
+      editData (row) {
         let _this = this
         _this.$router.push({
           path: `/oilsupplier/supplierappend/2/basisdataopera`,
@@ -443,14 +469,14 @@
         })
       },
 
-      //删除
-      deleteData(Id) {
+      // 删除
+      deleteData (Id) {
         let _this = this
         _this.$confirm('此操作将彻底删除该数据, 是否继续?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          })
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
             api.deleteEntity(Id, _this.$axios)
               .then(res => {
@@ -473,7 +499,7 @@
           .catch(() => {})
       },
 
-      searchCommand(command) {
+      searchCommand (command) {
         if (command == 'search') {
           this.dialogVisible = true
         } else if (command == 'clear') {
@@ -481,30 +507,29 @@
         }
       },
 
-      getvalues(val) {
+      getvalues (val) {
         this.entrydetail.business = val.Id
         this.entrydetail.instance = val.WorkFlowId
         this.historyVisible = true
       },
 
-      MoreCmdClick(cmd) {
+      MoreCmdClick (cmd) {
         if (cmd.Command == 'History') {
           this.getvalues(cmd.row)
-
         } else if (cmd.Command == 'Delete') {
           this.deleteData(cmd.row)
         }
       },
 
-      GetCommand(cmdType, row) {
+      GetCommand (cmdType, row) {
         let cmd = {}
         cmd.Command = cmdType
         cmd.row = row
         return cmd
       },
 
-      //列表排序功能
-      orderby(column) {
+      // 列表排序功能
+      orderby (column) {
         if (column.order == 'ascending') {
           this.Column.Order = 'asc'
         } else if (column.order == 'descending') {
@@ -513,29 +538,29 @@
         this.Column.Prop = column.prop
         this.initData()
       },
-      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.initData()
       },
-      handleSearch() {
-        this.currentPage = 1;
-        this.dialogVisible = false;
-        this.initData();
+      handleSearch () {
+        this.currentPage = 1
+        this.dialogVisible = false
+        this.initData()
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.initData()
       },
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.initData()
       },
 
-      //判断增项类别,(1 物资类,2 基建类,3 服务类)
-      checkAppendType(val) {
+      // 判断增项类别,(1 物资类,2 基建类,3 服务类)
+      checkAppendType (val) {
         if (val == '01') {
           return '物资类'
         } else if (val == '02') {
@@ -559,7 +584,7 @@
           return '招标准入'
         }
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -574,20 +599,19 @@
         }
       },
 
-      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
       }
     }
   }
-
 </script>
 
 <style lang="scss">

+ 69 - 67
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/goodslist.vue

@@ -17,7 +17,7 @@
             <el-button v-if="IsCompanyUser == 0" type="primary" size="mini"
                        style="margin-left:10px; margin-top: -4px;" @click="addappend">添加</el-button>
             <el-button v-if="IsCompanyUser == 1" type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
-              @click="addappendcom">添加
+              @click="addAppendCom">添加
             </el-button>
           </span>
           <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
@@ -179,9 +179,9 @@
         <el-form label-width="90px" :model="appendformData" ref="EntityFormref" :rules="rules">
           <el-row>
             <el-col :span="24">
-              <el-form-item label="企业名称" prop="SupplierId" required>
+              <el-form-item label="企业名称" prop="SupplierId">
                 <el-select ref="suppselect" :disabled="IsCompanyUser == 1" filterable v-model="appendformData.SupplierId"
-                           @change="getInfo" placeholder="请选择供应商公司" style="width: 100%" required>
+                           @change="getInfo" placeholder="请选择供应商公司" style="width: 100%">
                   <el-option v-for="item in supplierList" :key="item.SupplierId" :label="item.SupplierName"
                              :value="item.SupplierId">
                   </el-option>
@@ -200,7 +200,7 @@
         </el-form>
         <span style="float: right;margin-top:-10px;">
           <el-button size="small" @click="addshow = false">取 消</el-button>
-          <el-button type="primary" size="small" @click="addappendcom">确 定</el-button>
+          <el-button type="primary" size="small" @click="addAppendCom">确 定</el-button>
         </span>
         <br>
       </el-dialog>
@@ -346,84 +346,86 @@ import WfHistory from '@/components/workflow/wfhistory.vue'
       },
       // ==============================================
       addappend () {
+        console.log('二级单位点击添加')
         this.addshow = true
       },
       getInfo (vId) { // 这个vId也就是value值
+        console.log('修改选择的公司', vId)
         let obj = {}
         obj = this.supplierList.find((item) => {
           return item.SupplierId === vId // 筛选出匹配数据
         })
+        console.log('修改选择的公司获取的对象obj', obj)
         // this.appendformData.SupplierId = parseInt(obj.SupplierId)
         this.appendformData.SupplierCertId = parseInt(obj.SupplierCertId)
         this.appendformData.SupplierName = obj.SupplierName
       },
 
-      addappendcom () {
-        if (!this.appendformData.SupplierId) {
-          this.$refs['EntityFormref'].validate((valid) => {
-            if (valid) {
-              // if (!this.appendformData.SupplierId) {
-              //   this.$message({
-              //     type: 'warning',
-              //     message: '请选择供应商公司'
-              //   })
-              //   return
-              // }
-              console.log('222222')
-              let _this = this
-              _this.$confirm('确定添加增项申请, 是否继续?', '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
+      addAppendCom () {
+        let _this = this
+        _this.$confirm('确定添加增项申请, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            _this.appendformData.AppendType = '01'
+            _this.appendformData.SupplierId = parseInt(_this.appendformData.SupplierId)
+            if (!_this.appendformData.SupplierId) {
+              _this.appendformData.SupplierId = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+              return
+            }
+            let tempSupplierName = false
+            tempSupplierName = _this.supplierList.find((item) => {
+              if (item.SupplierName === _this.appendformData.SupplierName) {
+                return true
+              }// 筛选出匹配数据
+            })
+            if (!tempSupplierName) {
+              _this.appendformData.SupplierId = ''
+              _this.appendformData.SupplierName = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
               })
-                .then(() => {
-                  _this.addshow = false
-                  _this.appendformData.AppendType = '01'
-                  _this.appendformData.SupplierId = parseInt(_this.appendformData.SupplierId)
-                  console.log(_this.appendformData, '数据')
-                  // if (!_this.appendformData.SupplierId) {
-                  //   _this.$message({
-                  //     type: 'warning',
-                  //     message: '请选择供应商公司'
-                  //   })
-                  //   return
-                  // }
-                  _this.$axios.post('/suppliercertappend/addappend/', _this.appendformData)
-                    .then(res => {
-                      if (res.data.code === 0) {
-                        // this.entityList = res.data.item
-                        let AppendId = res.data.info
-                        this.$router.push({
-                          path: `/oilsupplier/supplierappend/1/goodsdataopera`,
-                          query: {
-                            Id: AppendId,
-                            editFlag: 1 // 编辑标记: 1 修改,0 不修改
-                          }
-                        })
-                        _this.$message({
-                          type: 'success',
-                          message: res.data.message
-                        })
-                      } else {
-                        _this.$message({
-                          type: 'warning',
-                          message: res.data.message
-                        })
-                      }
-                    })
-                    .catch(err => {
-                      console.error(err)
-                    })
-                })
-                .catch(() => {})
-              console.log(valid, '345')
-            } else {
-              this.appendformData.SupplierId = ''
-              console.log('111111')
-              return false
             }
+            _this.$axios.post('/suppliercertappend/addappend/', _this.appendformData)
+              .then(res => {
+                if (res.data.code === 0) {
+                  // this.entityList = res.data.item
+                  let AppendId = res.data.info
+                  this.$router.push({
+                    path: `/oilsupplier/supplierappend/1/goodsdataopera`,
+                    query: {
+                      Id: AppendId,
+                      editFlag: 1 // 编辑标记: 1 修改,0 不修改
+                    }
+                  })
+                  _this.$message({
+                    type: 'success',
+                    message: res.data.message
+                  })
+                  _this.addshow = false
+                } else {
+                  _this.appendformData.SupplierId = ''
+                  _this.appendformData.Remark = ''
+                  _this.$message({
+                    type: 'warning',
+                    message: res.data.message
+                  })
+                }
+              })
+              .catch(err => {
+                _this.appendformData.SupplierId = ''
+                _this.appendformData.Remark = ''
+                console.error(err)
+              })
           })
-        }
+          .catch(() => {})
       },
 
       getSupplierList () {

+ 30 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/techlist.vue

@@ -18,7 +18,7 @@
             <el-button v-if="IsCompanyUser == 0" type="primary" size="mini"
                        style="margin-left:10px; margin-top: -4px;" @click="addappend">添加</el-button>
             <el-button v-if="IsCompanyUser == 1" type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
-              @click="addappendcom">添加
+              @click="addAppendCom">添加
             </el-button>
           </span>
           <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
@@ -203,7 +203,7 @@
         </el-form>
         <span style="float: right;margin-top:-10px;">
           <el-button size="small" @click="addshow = false">取 消</el-button>
-          <el-button type="primary" size="small" @click="addappendcom">确 定</el-button>
+          <el-button type="primary" size="small" @click="addAppendCom">确 定</el-button>
         </span>
         <br>
       </el-dialog>
@@ -353,7 +353,7 @@ import WfHistory from '@/components/workflow/wfhistory.vue'
         })
       },
 
-      addappendcom () {
+      addAppendCom () {
         let _this = this
         _this.$confirm('确定添加增项申请, 是否继续?', '提示', {
           confirmButtonText: '确定',
@@ -361,9 +361,30 @@ import WfHistory from '@/components/workflow/wfhistory.vue'
           type: 'warning'
         })
           .then(() => {
-            _this.addshow = false
             _this.appendformData.AppendType = '03'
             _this.appendformData.SupplierId = parseInt(_this.appendformData.SupplierId)
+            if (!_this.appendformData.SupplierId) {
+              _this.appendformData.SupplierId = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+              return
+            }
+            let tempSupplierName = false
+            tempSupplierName = _this.supplierList.find((item) => {
+              if (item.SupplierName === _this.appendformData.SupplierName) {
+                return true
+              }// 筛选出匹配数据
+            })
+            if (!tempSupplierName) {
+              _this.appendformData.SupplierId = ''
+              _this.appendformData.SupplierName = ''
+              _this.$message({
+                type: 'warning',
+                message: '请选择供应商公司'
+              })
+            }
             _this.$axios.post('/suppliercertappend/addappend/', _this.appendformData)
               .then(res => {
                 if (res.data.code === 0) {
@@ -381,7 +402,10 @@ import WfHistory from '@/components/workflow/wfhistory.vue'
                     type: 'success',
                     message: res.data.message
                   })
+                  _this.addshow = false
                 } else {
+                  _this.appendformData.SupplierId = ''
+                  _this.appendformData.Remark = ''
                   _this.$message({
                     type: 'warning',
                     message: res.data.message
@@ -389,6 +413,8 @@ import WfHistory from '@/components/workflow/wfhistory.vue'
                 }
               })
               .catch(err => {
+                _this.appendformData.SupplierId = ''
+                _this.appendformData.Remark = ''
                 console.error(err)
               })
           })