hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
  <div>
    <el-form :inline="true" :model="From"  class="demo-form-inline" label-width="110px">
      <el-form-item label="办证状况">
        <el-select  placeholder="请选择" v-model="From.cultName">
          <el-option v-for="item in cultNameList" :key="item.value"
            :label="item.label" :value="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="残疾类别" >
        <el-select  placeholder="请选择" v-model="From.basicSituation">
          <el-option v-for="item in basicSituationList" :key="item.value"
            :label="item.label" :value="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="残疾等级" >
        <el-select  placeholder="请选择"  v-model="From.joinCultDate">
          <el-option v-for="item in joinCultDateList" :key="item.value"
            :label="item.label" :value="item.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="备注">
        <el-input type="textarea" v-model="From.remark"  placeholder="请输入-不超过200字"  maxlength="200" show-word-limit></el-input>
      </el-form-item>
      <el-form-item>
         <el-button type="primary" @click="onSubmitdrug('From')">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
 
<script>
export default {
  props:["selectData",'editId'],
  data() {
    return{
      From:{
        cultName:'',
        basicSituation:'',
        joinCultDate:'',
        remark:'',
        populationId:'',
        id:''
      },
      cultNameList:[],
      basicSituationList:[],
      joinCultDateList:[]
    }
  },
 
  watch: {
    selectData (val) {
      if(val) {
        this.init();
      }
    },
    editId(val) {
      this.From.populationId  =val;
    }
  },
 
  mounted() {
 
    /** populationId:获取人口ID  */
    if(this.$route.query.id) {
      this.From.populationId = this.$route.query.id;
      this.getDetails();
    }
 
  },
  methods: {
    /** 获取吸毒信息 populationId:人口id
     *  id:主键id  有id编辑 无id新增 */
    getDetails() {
         this.$api.get("population/disability/detail",{populationId:this.From.populationId},e=> {
           if(e.id) {
            this.From = e;
           }
        })
    },
    init() {
      this.cultNameList = this.selectData.certificateProcessingStatusList.map(d=> {
        return {
          label:d.value,
          value:d.id,
        }
      });
      this.basicSituationList = this.selectData.disabilityCategoryList.map(d=> {
        return {
          label:d.value,
          value:d.id,
        }
      });
      this.joinCultDateList = this.selectData.disabilityLevelList.map(d=> {
        return {
          label:d.value,
          value:+d.id,
        }
      });
    },
 
    onSubmitdrug(formName) {
      if(this.From.populationId == '') {
        return  this.$message({
            message: '请先填写完基础信息',
            type: 'warning'
          });
      }
      if( this.From.id) {
        //编辑
        this.$api.post("population/disability/edit",this.From,e=> {
          demo.toast("编辑成功")
        })
      }else {
        //新增
        this.$api.post("population/disability/add",this.From,e=> {
          demo.toast("保存成功")
        })
      }
    },
  }
}
</script>
 
<style>
 
</style>