baichengfei 5 anni fa
parent
commit
c6e524a03b

+ 140 - 117
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplierappend/goodslist.vue

@@ -176,13 +176,12 @@
       </el-dialog>
 
       <el-dialog title="增项申请添加" :visible.sync="addshow" width="360px">
-        <el-form label-width="90px" :model="appendformData"ref="EntityFormref">
+        <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-select ref="suppselect" :disabled="IsCompanyUser == 1" filterable v-model="appendformData.SupplierId"
-                           :rules="[{ required: true, message: '请选择供应商公司', trigger: 'change' }]"
-                           @change="getInfo" placeholder="请选择供应商公司" style="width: 100%">
+                           @change="getInfo" placeholder="请选择供应商公司" style="width: 100%" required>
                   <el-option v-for="item in supplierList" :key="item.SupplierId" :label="item.SupplierName"
                              :value="item.SupplierId">
                   </el-option>
@@ -214,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'
 
@@ -231,25 +230,25 @@
     },
     name: 'oilsuppliercertappend',
 
-    data() {
+    data () {
       return {
         addshow: false,
         historyVisible: false,
         dialogVisible: false, // 高级查询
         // 列表数据
         entityList: [],
-        //分页参数
+        // 分页参数
         size: 10,
         currentPage: 1,
         currentItemCount: 0,
-        //列表排序
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
         },
-        //查询起始时间(一月前开始)
+        // 查询起始时间(一月前开始)
         CreateOn: '',
-        //查询项
+        // 查询项
         searchFormReset: {},
         searchForm: {
           Id: '',
@@ -258,7 +257,7 @@
           ApplyDate: '',
           RecUnitId: '',
           RecUnitName: '',
-          AppendType: '01', //增项类别(1 物资类,2 基建类,3 服务类)
+          AppendType: '01', // 增项类别(1 物资类,2 基建类,3 服务类)
           DenyReason: '',
           AuditDate: '',
           Status: '',
@@ -269,16 +268,16 @@
           CreateBy: '',
           ModifiedOn: '',
           ModifiedUserId: '',
-          ModifiedBy: '',
+          ModifiedBy: ''
         },
-        //工作流
+        // 工作流
         entrydetail: {
           process: 'oil_append_apply',
           business: '',
           instance: ''
         },
-        //修改
-        optionsList: [], //服务类层级选择列表
+        // 修改
+        optionsList: [], // 服务类层级选择列表
         orgtreeprops: {
           value: 'id',
           label: 'Name',
@@ -294,30 +293,37 @@
           SupplierName: '',
           SupplierId: '',
           SupplierCertId: 0,
-          RecUnitFlag: '', //推荐单位的级联Id标记
-          RecUnitId: '', //推荐单位编码
-          RecUnitName: '', //推荐单位名称
-          AppendType: '', //增项类别(01 物资类,02 基建类,03 服务类)
-          Remark: '', //备注
+          RecUnitFlag: '', // 推荐单位的级联Id标记
+          RecUnitId: '', // 推荐单位编码
+          RecUnitName: '', // 推荐单位名称
+          AppendType: '', // 增项类别(01 物资类,02 基建类,03 服务类)
+          Remark: '' // 备注
         },
+        rules: {
+          SupplierId: [{
+            required: true,
+            message: '请选择供应商公司',
+            trigger: 'blur'
+          }]
+        }
       }
     },
-    created() {
+    created () {
       this.IsCompanyUser = this.authUser.Profile.IsCompanyUser
-      //查询条件初始值备份
+      // 查询条件初始值备份
       Object.assign(this.searchFormReset, this.searchForm)
-      //查询列表
+      // 查询列表
       this.initData()
       this.getSupplierList()
     },
     methods: {
-      initData() {
-        //分页及列表条件
+      initData () {
+        // 分页及列表条件
         let params = {
           _currentPage: this.currentPage,
           _size: this.size,
           Order: this.Column.Order,
-          Prop: this.Column.Prop,
+          Prop: this.Column.Prop
         }
         let myCreateOn = []
         // 解析时间
@@ -328,9 +334,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
@@ -353,63 +359,82 @@
       },
 
       addappendcom () {
-        let _this = this
-        _this.$confirm("确定添加增项申请, 是否继续?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
-          .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)
+        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'
               })
+                .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
+            }
           })
-          .catch(() => {})
+        }
       },
 
-      getSupplierList() {
+      getSupplierList () {
         let _this = this
         _this.supplierList = []
         let params = {
-          SuppTypeCode: '01',
+          SuppTypeCode: '01'
         }
         _this.$axios.get('/suppliercertappend/getsupplier', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.supplierList = res.data
             if (_this.supplierList) {
@@ -428,8 +453,8 @@
           })
       },
 
-      //获取服务类层级列表
-      getTechTreeList() {
+      // 获取服务类层级列表
+      getTechTreeList () {
         let _this = this
         this.$axios.get('technologyservice/businesslist', {})
           .then(res => {
@@ -440,27 +465,27 @@
           })
       },
 
-      //编辑
-      editData(row) {
+      // 编辑
+      editData (row) {
         let _this = this
         _this.$router.push({
           path: `/oilsupplier/supplierappend/1/goodsdataopera`,
           query: {
             Id: row.Id,
-            editFlag: 1, //编辑标记: 1 修改,0 不修改
+            editFlag: 1, // 编辑标记: 1 修改,0 不修改
             sId: row.SupplierId
           }
         })
       },
 
-      //删除
-      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 => {
@@ -483,7 +508,7 @@
           .catch(() => {})
       },
 
-      searchCommand(command) {
+      searchCommand (command) {
         if (command == 'search') {
           this.dialogVisible = true
         } else if (command == 'clear') {
@@ -491,8 +516,8 @@
         }
       },
 
-      //列表排序功能
-      orderby(column) {
+      // 列表排序功能
+      orderby (column) {
         if (column.order == 'ascending') {
           this.Column.Order = 'asc'
         } else if (column.order == 'descending') {
@@ -501,51 +526,50 @@
         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()
       },
 
-      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
       },
 
-      //判断增项类别,(1 物资类,2 基建类,3 服务类)
-      checkAppendType(val) {
+      // 判断增项类别,(1 物资类,2 基建类,3 服务类)
+      checkAppendType (val) {
         if (val == '01') {
           return '物资类'
         } else if (val == '02') {
@@ -569,7 +593,7 @@
           return '招标准入'
         }
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -584,20 +608,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">