Explorar el Código

教学点分部问题

lex-xin hace 5 años
padre
commit
3fd01fd17d
Se han modificado 1 ficheros con 13 adiciones y 2 borrados
  1. 13 2
      src/views/categroyManager/insideSetting/addressManager.vue

+ 13 - 2
src/views/categroyManager/insideSetting/addressManager.vue

@@ -113,7 +113,7 @@
                       prop="cooperationOrganId"
                       label="合作单位"
                       :label-width="formLabelWidth">
-          <el-select v-model="form.cooperationOrganId">
+          <el-select v-model="form.cooperationOrganId" @change="onCooperationChange">
             <el-option v-for="item in cooperationList"
                        :key="item.value"
                        :label="item.label"
@@ -255,6 +255,7 @@ export default {
         subsidy: null, // 课酬补贴
         organId: null, // 分部编号
       },
+      selectOrganId: null, // 选中的分部编号
       rules: {
         name: [{ required: true, message: '请输入教学点名称', trigger: 'blur' }],
         source: [{ required: true, message: '请选择教学点来源', trigger: 'change' }],
@@ -292,6 +293,7 @@ export default {
         if (valid) {
           this.form.address = this.addressDetail.address
           this.form.longitudeLatitude = this.addressDetail.poi
+          this.form.organId = this.selectOrganId
           if (this.formActionTitle == 'create') {
             schoolAdd(this.form).then(res => {
               if (res.code == 200) {
@@ -349,6 +351,13 @@ export default {
         })
       }
     },
+    onCooperationChange(value) {
+      this.cooperationList.forEach(item => {
+        if(item.value == value) {
+          this.selectOrganId = item.organId
+        }
+      })
+    },
     onSearchResult (pois) { // 搜索出来的Marker
       this.markers = [] // 搜索时进行数据重置
       let latSum = 0
@@ -423,6 +432,7 @@ export default {
               res.data.forEach(r => {
                 this.cooperationList.push({
                   value: r.id,
+                  organId: r.organId,
                   label: r.name
                 })
               })
@@ -446,6 +456,7 @@ export default {
       // }
       this.teachingStatus = true
       this.formActionTitle = type
+      this.form.organId = null
       // 修改的时候赋值
       if (type == 'update') {
         this.addressDetail = {
@@ -460,7 +471,7 @@ export default {
           remark: row.remark,  // 费用
           address: row.address.split(',').join(''), // 上课地点
           subsidy: row.subsidy, // 课酬补贴
-          
+          organId: row.organId
         }
       }
     },