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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<template>
  <el-dialog
  class="height-auto"
  title="处理"
  :visible="value"
  width="50%"
  :modal='false'
  :show-close="false"
  :before-close="onCancel">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
      <el-form-item label="社区处理意见12">
        <el-input type="textarea" v-model="ruleForm.communitySuggestion" maxlength="200" cols="20"  rows="3" show-word-limit></el-input>
      </el-form-item>
 
      <el-form-item label="承办记录">
        <el-input type="textarea" v-model="ruleForm.undertakeRecord" maxlength="200" cols="20"  rows="3" show-word-limit></el-input>
      </el-form-item>
 
      <el-form-item label="领导意见">
        <el-input type="textarea" v-model="ruleForm.leaderSuggestion" maxlength="200" cols="20"  rows="3" show-word-limit></el-input>
      </el-form-item>
 
      
      <el-form-item label="街道安全管理人员意见">
        <el-input type="textarea" v-model="ruleForm.streetSuggestion" maxlength="200" cols="20"  rows="3" show-word-limit></el-input>
      </el-form-item>
 
      <el-form-item label="风险等级">
        <el-radio-group v-model="ruleForm.danglevel">
          <el-radio             
              v-for="item in riskRadio"
            :key="item.value"
            :label="item.value"
          >{{item.label}}</el-radio>
        </el-radio-group>
      </el-form-item>
 
      <el-form-item label="指派人员">
        <div v-for="(text,index) in list" :key="index">
          <el-select
            class="custom-width-select"
            size="small"
            v-model="ruleForm.assignPerson[index]"
          >
            <el-option
              v-for="item in configpatrolPerson"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
        <el-button type="primary" size="small" plain  @click="add">增加</el-button>
      </el-form-item>
 
    </el-form>
 
    <span slot="footer" class="dialog-footer">
      <el-button @click="onCancel">取 消</el-button>
      <el-button type="primary" @click="onOk('ruleForm')" >确 定</el-button>
    </span>
</el-dialog>
</template>
 
<script>
export default {
  props: {
    value: {type: Boolean},
    item: { type: Object}
  },
 
  data() {
    return {
      ruleForm: {
        communitySuggestion:"",
        undertakeRecord:"",
        leaderSuggestion:"",
        streetSuggestion:"",
        assignPerson:[],
        danglevel:"4",
      },
      oneId:[],
      list:[{"oneId":''}],
      configpatrolPerson:[], //指派人员
      riskRadio:[
        {
          value:"4",
          label:"蓝色预警"
        }, 
          {
          value:"3",
          label:"黄色预警"
        }, 
          {
          value:"2",
          label:"橙色预警"
        }, 
          {
          value:"1",
          label:"红色预警"
        }, 
      ],
      rules: {
        communitySuggestion: [
          { required: true, message: '请输入社区处理意见', trigger: 'blur' },
        ],
        assignPerson: [
          { required: true, message: '请选择指派人员', trigger: 'change' }
        ],
      },
      communityId:'',//社区Id 
      dangerReportId:'',//隐患报告id
    }
  },
 
  watch: {
    item (val) {
      if (val) {
        console.log(val.id)
        this.communityId = val.communityId;
        this.dangerReportId = val.id;
      }
    }
  },
 
  mounted() {
    //获取选择人员
    this.choosePerson()
  },
 
  methods: {
    /**选择人员 */
    choosePerson() {
      this.$api.post('patrolRecord/getTotlePerson', {param:""}, e => {
        this.choosePersonData = e;
        let newPerson = e.map(d=> {
          return {
            label : d.name,
            value : d.id,
          }      
        });
        this.configpatrolPerson = newPerson;
        console.log(this.configpatrolLeader)
      })
      
    },
 
    /**增加人员 */
    add() {
      this.list.push({"oneId": ''});
    
    },
    /** 取消 */
    onCancel () {
      this.$emit('change', false);
    },
 
    /** 确认 */
    onOk(formName) {
      console.log(this.dangerReportId)
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let parmas = {
                assignPerson: this.ruleForm.assignPerson.toString(),
              communityId: +this.communityId,
              communitySuggestion: this.ruleForm.communitySuggestion,
              dangerReportId: this.dangerReportId,
              leaderSuggestion:  this.ruleForm.leaderSuggestion,
              streetSuggestion: this.ruleForm.streetSuggestion,
              undertakeRecord:  this.ruleForm.undertakeRecord,
              dangerLevel:+this.ruleForm.danglevel
          }
 
          this.$api.post("patrolRecord/handleDangerReport", parmas, 
            e => {
              demo.toast("处理成功");
              this.$emit('success');
              this.onCancel();
            },
            err=> {
              demo.toast(err.msg)
            }
          )
        } else {
          // demo.toast("验证不通过")
          return false;
        }
      });
      // let parmas = {
    
      // };
      
      // this.okLoading = true;
      // this.$api.post("dyn/type/edit", parmas, 
      //   e => {
      //     demo.toast("编辑成功");
      //     this.$emit('success');
      //     this.onCancel();
      //   },
      //   err=> {
      //     demo.toast(err.msg)
      //   }
      // )
      // this.okLoading = false;
    }
 
  }
 
}
</script>
 
<style lang="less" scoped>
/deep/.el-dialog {
  height: 750px;
  overflow: auto;
}
.custom-width-select {
  width: 150px;
}
</style>