shihang 6 anni fa
parent
commit
362dc75e66

+ 96 - 166
src/dashoo.cn/frontend_web/src/components/oilsupplier/businesslist.vue

@@ -32,12 +32,9 @@
         <el-row>
           <el-col :span="12" v-if="SupplierTypeCode == '01' && Title == '新增准入范围'">
             <el-form-item label="名称" prop="checkName">
-              <!-- <el-select filterable default-first-option v-model="OneCode" placeholder="请选择" style="width: 100%"
-                @change="getChild()">
-                <el-option v-for="item in oneList" :key="item.Id" :label="item.Name" :value="item.Id"></el-option>
-              </el-select> -->
-              <el-cascader ref="cascader" :options="optionsList" style="width:100%" :props="goodsProps" :show-all-levels="false" 
-                v-model="selectedOptList" @active-item-change="getChildrens" @change="getGoodsCode" placeholder="请选择分类">
+              <el-cascader ref="cascader" :options="optionsList" style="width:100%" :props="goodsProps"
+                :show-all-levels="false" v-model="selectedOptList" @active-item-change="getChildrens"
+                @change="getGoodsCode" placeholder="请选择分类">
               </el-cascader>
             </el-form-item>
           </el-col>
@@ -116,15 +113,14 @@
 
   export default {
     name: 'EquipmentList',
-    components: {
-    },
+    components: {},
     props: {
       canadd: {
         type: Boolean,
         default: false
       }
     },
-    created () {
+    created() {
       this.initData()
     },
     computed: {
@@ -132,7 +128,7 @@
         session: 'session'
       })
     },
-    data () {
+    data() {
       var CheckSelectedOption = (rule, value, callback) => {
         if (this.selectedOptList && this.selectedOptList.length < 1) {
           callback(new Error('请选择分类'))
@@ -145,8 +141,6 @@
         SupplierTypeCode: '',
         SupplierCertId: 0,
 
-        oneList: [],
-        OneCode: '',
         businessList: [],
         techList: [],
         techTreeList: [],
@@ -158,6 +152,23 @@
         selectedorg: [],
         ClassId: '',
 
+        //物资类懒加载
+        optionsList: [], //物资类层级列表
+        selectedOptList: [], //已选择的物资类列表
+        goodsProps: {
+          value: 'id',
+          label: 'Name',
+          children: 'children'
+        },
+        //物资类表单规则
+        formRules: {
+          checkName: [{
+            required: true,
+            validator: CheckSelectedOption,
+            trigger: 'blur'
+          }],
+        },
+
         Title: '',
         BusinessForm: {
           Id: '',
@@ -181,23 +192,6 @@
         Size: 10,
         CurrentItemCount: 0,
         subfileList: [], // 文档
-        //物资类懒加载
-        optionsList: [], //物资类层级列表
-        selectedOptList: [], //已选择的物资类列表
-        goodsProps: {
-          value: 'id',
-          label: 'Name',
-          children: 'children'
-        },
-        //物资类表单规则
-        formRules: {
-          checkName: [{
-            required: true,
-            validator: CheckSelectedOption,
-            trigger: 'blur'
-          }],
-        },
-        // ParentId: 0, //物资类初始父类Id值:0
         flagId: 0 //标记是否第一次点击
       }
     },
@@ -209,39 +203,39 @@
         let Id = val[0]
         if (Id != _this.flagId) { //判断是否是第一次,若不相等则为第一次
           this.$axios.get('goodsaptitudeclass/getchildlist/' + Id, {})
-          .then(res => {
-            //获取下一级所有级联数据
-            if (res.data.items) {//判断是否有数据
-              let tempList = []
-              tempList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
-              //添加到上一级对应的选项中
-              for (let i = 0; i < _this.optionsList.length; i++) {
-                if (_this.optionsList[i].id === Id) {
-                  _this.$set(_this.optionsList[i], 'children', tempList)
-                  break
+            .then(res => {
+              //获取下一级所有级联数据
+              if (res.data.items) { //判断是否有数据
+                let tempList = []
+                tempList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
+                //添加到上一级对应的选项中
+                for (let i = 0; i < _this.optionsList.length; i++) {
+                  if (_this.optionsList[i].id === Id) {
+                    _this.$set(_this.optionsList[i], 'children', tempList)
+                    break
+                  }
                 }
-              }
-            } else {
-              //修改上一级的children属性
-              for (let i = 0; i < _this.optionsList.length; i++) {
-                if (_this.optionsList[i].id === Id) {
-                  _this.$set(_this.optionsList[i], 'children', '')
-                  break
+              } else {
+                //修改上一级的children属性
+                for (let i = 0; i < _this.optionsList.length; i++) {
+                  if (_this.optionsList[i].id === Id) {
+                    _this.$set(_this.optionsList[i], 'children', '')
+                    break
+                  }
                 }
               }
-            }
-            //做标记
-            _this.flagId = Id
-          })
-          .catch(err => {
-            console.error(err)
-          })
+              //做标记
+              _this.flagId = Id
+            })
+            .catch(err => {
+              console.error(err)
+            })
         }
       },
 
       //获取分类级联Id
       getGoodsCode(item) {
-        this.getCodeById(item[item.length-1]) //根据分类Id获取Code
+        this.getCodeById(item[item.length - 1]) //根据分类Id获取Code
       },
 
       //根据分类Id获取Code
@@ -257,13 +251,13 @@
           })
       },
 
-      getvalue (SupplierId, SupplierTypeCode, certId) {
+      getvalue(SupplierId, SupplierTypeCode, certId) {
         this.SupplierId = SupplierId
         this.SupplierTypeCode = SupplierTypeCode
         this.SupplierCertId = certId
         this.initData()
       },
-      initData () {
+      initData() {
         let _this = this
         const params = {
           SupplierCertId: this.SupplierCertId,
@@ -272,24 +266,25 @@
           _size: this.size
         }
         this.$axios.get('suppliercertsub/list', {
-          params
-        })
+            params
+          })
           .then(res => {
             _this.businessList = res.data.items
-            _this.currentItemCount = res.data.currentItemCount                  
+            _this.currentItemCount = res.data.currentItemCount
+            _this.$emit('getlist')
           })
           .catch(err => {
             console.error(err)
           })
       },
-      savedata () {
+      savedata() {
         if (this.Title === '新增准入范围') {
           this.addBusiness()
         } else if (this.Title === '编辑准入范围') {
           this.editBusiness()
         }
       },
-      addBusiness () {
+      addBusiness() {
         let _this = this
         let arr = []
         arr = _this.$refs['cascader'].currentLabels
@@ -305,28 +300,28 @@
           })
         } else {
           _this.$axios.post('/suppliercertsub/addbusiness/', _this.BusinessForm)
-          .then(res => {
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message
-              })
-              _this.BusinessForm.Id = res.data.item + ''
-              _this.visible = false
-              _this.initData()
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-          })
-          .catch(err => {
-            console.error(err)
-          })
+            .then(res => {
+              if (res.data.code === 0) {
+                _this.$message({
+                  type: 'success',
+                  message: res.data.message
+                })
+                _this.BusinessForm.Id = res.data.item + ''
+                _this.visible = false
+                _this.initData()
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: res.data.message
+                })
+              }
+            })
+            .catch(err => {
+              console.error(err)
+            })
         }
       },
-      editBusiness () {
+      editBusiness() {
         let _this = this
         _this.BusinessForm.SupplierId = parseInt(_this.BusinessForm.SupplierId)
         _this.BusinessForm.SupplierCertId = parseInt(_this.BusinessForm.SupplierCertId)
@@ -351,13 +346,13 @@
             console.error(err)
           })
       },
-      deletedata (val) {
+      deletedata(val) {
         let _this = this
         _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        })
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          })
           .then(() => {
             _this.$axios.delete('suppliercertsub/businessdelete/' + val.Id, {})
               .then(function (response) {
@@ -380,8 +375,7 @@
           })
           .catch(() => {})
       },
-      showDialog () {
-        this.OneCode = ''
+      showDialog() {
         this.selectedorg = []
         this.keyword = ''
         this.seachdata()
@@ -399,7 +393,7 @@
         this.getbusiness()
         this.visible = true
       },
-      openDialog (val) {
+      openDialog(val) {
         this.Title = '编辑准入范围'
         this.BusinessForm.Id = val.Id
         this.BusinessForm.SupplierId = val.SupplierId
@@ -413,23 +407,15 @@
         this.getbusiness()
         this.visible = true
       },
-      getbusiness () {
+      getbusiness() {
         let _this = this
         if (_this.SupplierTypeCode === '01') { // 获取物资类第一级分类
           this.$axios.get('goodsaptitude/goodsparentlist', {})
             .then(res => {
               _this.optionsList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
-              _this.optionsList.forEach((item,index)=>{
+              _this.optionsList.forEach((item, index) => {
                 _this.$set(this.optionsList[index], 'children', [])
               })
-              // _this.oneList = res.data.items
-              // if (_this.Title === '编辑准入范围') {
-              //   for (var i = 0; i < _this.oneList.length; i++) {
-              //     if (_this.BusinessForm.Code === _this.oneList[i].Code) {
-              //       _this.OneCode = _this.oneList[i].Id
-              //     }
-              //   }
-              // }
             })
             .catch(err => {
               console.error(err)
@@ -441,8 +427,8 @@
             _size: this.Size
           }
           this.$axios.get('basisbuild/basiclist', {
-            params
-          })
+              params
+            })
             .then(res => {
               _this.techList = res.data.items
               _this.CurrentItemCount = res.data.currentItemCount
@@ -461,7 +447,7 @@
             })
         }
       },
-      getCode () {
+      getCode() {
         this.ClassId = this.selectedorg[this.selectedorg.length - 1]
         for (var i = 0; i < this.techList.length; i++) {
           if (this.selectedorg[this.selectedorg.length - 1] === this.techList[i].Id) {
@@ -471,94 +457,37 @@
           }
         }
       },
-      getChild () {
-        const params = {
-          ParentId: this.OneCode
-        }
-        this.$axios.get('goodsaptitude/goodschildlist', {
-          params
-        })
-          .then(res => {
-            this.techList = res.data.items
-            if (this.techList && this.techList.length > 0) {
-              this.techTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId', 'Id,Name')
-            } else {
-              this.getParentCode()
-            }
-          })
-          .catch(err => {
-            console.error(err)
-          })
-      },
-      getParentCode () {
-        this.ClassId = this.OneCode
-        for (var i = 0; i < this.oneList.length; i++) {
-          if (this.OneCode === this.oneList[i].Id) {
-            this.BusinessForm.SubClassId = this.techList[i].Id
-            this.BusinessForm.Name = this.oneList[i].Name
-            this.BusinessForm.Code = this.oneList[i].Code
-          }
-        }
-      },
-      getChooseCode (val) {
+      getChooseCode(val) {
         this.ClassId = val.Id
         this.BusinessForm.SubClassId = val.Id
         this.BusinessForm.Code = val.Code
         this.BusinessForm.Name = val.Name
         this.basicDialog = false
       },
-      nextStep () {
-        this.subfileList = this.$refs['subfileList'].subfileList
-        if (!this.businessList || this.businessList.length === 0) {
-          this.$message({
-            type: 'warning',
-            message: '请添加准入范围!'
-          })
-          return
-        }
-        if (this.subfileList && this.subfileList.length > 0) {
-          for (var i = 0; i < this.subfileList.length; i++) {
-            if (this.subfileList[i].FileType === '1' && this.subfileList[i].FileUrl === '') {
-              this.$message({
-                type: 'warning',
-                message: '请上传文件' + this.subfileList[i].NeedFileType + '!'
-              })
-              return
-            }
-          }
-          this.$emit('close')
-        } else {
-          this.$emit('close')
-        }
-      },
-
-      // subfiledialog () {
-      //   this.$refs['subfileList'].showDialog()
-      // },
 
-      handleSizeChange (value) {
+      handleSizeChange(value) {
         this.size = value
         this.currentPage = 1
         this.initData()
       },
-      handleCurrentChange (value) {
+      handleCurrentChange(value) {
         this.currentPage = value
         this.initData()
       },
-      HandleSizeChange (value) {
+      HandleSizeChange(value) {
         this.Size = value
         this.CurrentPage = 1
         this.getbusiness()
       },
-      HandleCurrentChange (value) {
+      HandleCurrentChange(value) {
         this.CurrentPage = value
         this.getbusiness()
       },
-      seachdata () {
+      seachdata() {
         this.CurrentPage = -1
         this.getbusiness()
       },
-      jstimehandle (val) {
+      jstimehandle(val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -572,6 +501,7 @@
       }
     }
   }
+
 </script>
 
 <style>

+ 6 - 4
src/dashoo.cn/frontend_web/src/pages/oilsupplier/supplier/_opera/techedit.vue

@@ -178,7 +178,7 @@
           </el-card>
         </el-tab-pane>
         <el-tab-pane label="准入范围" :disabled="!certId">
-          <business-list ref="businessList" :data.sync="businessList" :canadd="add_flat" height="360px"
+          <business-list ref="businessList" :data.sync="businessList" @getlist="getbuslist" :canadd="add_flat" height="360px"
             style="margin-top: 20px"></business-list>
         </el-tab-pane>
         <el-tab-pane label="企业资质" :disabled="!certId">
@@ -209,8 +209,7 @@
           <el-col :span="24">
             <el-form-item label="二级单位">
               <el-cascader :options="orgtreelist" :props="orgtreeprops" change-on-select :show-all-levels="false"
-                           filterable style="width: 100%" @change="auditOrgChang" v-model="secOrganize"
-                           placeholder="请选择组织">
+                filterable style="width: 100%" @change="auditOrgChang" v-model="secOrganize" placeholder="请选择组织">
               </el-cascader>
             </el-form-item>
           </el-col>
@@ -404,7 +403,7 @@
         }
       }
     },
-    mounted () {
+    mounted() {
       this.serviceId = this.$route.params.opera + ''
       if (this.$route.query.rtn) {
         this.showReturn = 0
@@ -583,6 +582,9 @@
           })
         }
       },
+      getbuslist(){
+        this.$refs['subfileList'].getvalue(this.formData.Id, this.formData.SupplierTypeCode, this.certId)
+      },
 
       getDictOptions() {
         api.getDictList(this.$axios).then(res => {