|
@@ -3,12 +3,12 @@
|
3
|
3
|
<form class="mainForm">
|
4
|
4
|
<ul>
|
5
|
5
|
<li class="flex-h">
|
6
|
|
- <span>案场名称:</span>
|
|
6
|
+ <span>案场名称:<em>*</em></span>
|
7
|
7
|
<div class="flex-item">
|
8
|
8
|
<div style="width:50%">
|
9
|
9
|
<el-input
|
10
|
|
- placeholder="请输入内容"
|
11
|
|
- v-model="postData.name"
|
|
10
|
+ placeholder="请输入名称"
|
|
11
|
+ v-model="postData.CaseName"
|
12
|
12
|
clearable>
|
13
|
13
|
</el-input>
|
14
|
14
|
</div>
|
|
@@ -22,54 +22,62 @@
|
22
|
22
|
type="textarea"
|
23
|
23
|
:autosize="{ minRows: 3, maxRows: 5}"
|
24
|
24
|
placeholder="请填写详细地址"
|
25
|
|
- v-model="postData.address">
|
|
25
|
+ v-model="postData.CaseAddress">
|
26
|
26
|
</el-input>
|
27
|
27
|
</div>
|
28
|
28
|
</div>
|
29
|
29
|
</li>
|
30
|
30
|
<li class="flex-h">
|
31
|
|
- <span>案场头像:</span>
|
|
31
|
+ <span>案场描述:</span>
|
32
|
32
|
<div class="flex-item">
|
33
|
33
|
<div>
|
34
|
|
- <a class="formImg">
|
35
|
|
- <img src="" class="centerLabel contain" alt="">
|
36
|
|
- <i class="iconfont icon-quxiao"></i>
|
37
|
|
- </a>
|
38
|
|
- <el-button type="success" size="mini">上传图片</el-button>
|
|
34
|
+ <el-input
|
|
35
|
+ type="textarea"
|
|
36
|
+ :autosize="{ minRows: 3, maxRows: 5}"
|
|
37
|
+ placeholder="请填写详细描述"
|
|
38
|
+ v-model="postData.CaseDesc">
|
|
39
|
+ </el-input>
|
39
|
40
|
</div>
|
40
|
41
|
</div>
|
41
|
42
|
</li>
|
42
|
43
|
<li class="flex-h">
|
43
|
|
- <span>案场负责人:</span>
|
|
44
|
+ <span>案场电话:</span>
|
44
|
45
|
<div class="flex-item">
|
45
|
46
|
<div style="width:50%">
|
46
|
47
|
<el-input
|
47
|
|
- placeholder="真实姓名,可包含汉字、英文"
|
48
|
|
- v-model="postData.leaderName"
|
|
48
|
+ placeholder="限中国地区有效号码"
|
|
49
|
+ v-model="postData.CaseTel"
|
49
|
50
|
clearable>
|
50
|
51
|
</el-input>
|
51
|
52
|
</div>
|
52
|
53
|
</div>
|
53
|
54
|
</li>
|
54
|
55
|
<li class="flex-h">
|
55
|
|
- <span>负责人手机号:</span>
|
|
56
|
+ <span>案场头像:</span>
|
56
|
57
|
<div class="flex-item">
|
57
|
|
- <div style="width:50%">
|
58
|
|
- <el-input
|
59
|
|
- placeholder="限中国地区有效手机号"
|
60
|
|
- v-model="postData.leaderPhone"
|
61
|
|
- clearable>
|
62
|
|
- </el-input>
|
|
58
|
+ <div>
|
|
59
|
+ <!-- <a class="formImg">
|
|
60
|
+ <img :src="postData.CaseIcon" class="centerLabel contain" alt="">
|
|
61
|
+ <i class="iconfont icon-quxiao"></i>
|
|
62
|
+ </a> -->
|
|
63
|
+ <el-upload
|
|
64
|
+ class="avatar-uploader"
|
|
65
|
+ :action='$api.file.image.url'
|
|
66
|
+ :show-file-list="false"
|
|
67
|
+ :on-success="handleAvatarSuccess">
|
|
68
|
+ <img v-if="postData.CaseIcon" :src="postData.CaseIcon" class="avatar">
|
|
69
|
+ <i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
70
|
+ </el-upload>
|
63
|
71
|
</div>
|
64
|
72
|
</div>
|
65
|
73
|
</li>
|
66
|
74
|
<li class="flex-h">
|
67
|
|
- <span>左击地图获取经纬度:</span>
|
68
|
|
- <div class="flex-item">
|
|
75
|
+ <span>左击地图获取经纬度:<em>*</em></span>
|
|
76
|
+ <div class="flex-item" style="margin-left: 10px;">
|
69
|
77
|
<div style="width:50%">
|
70
|
78
|
<el-input
|
71
|
79
|
placeholder=""
|
72
|
|
- v-model="postData.atitudeAndLongitude"
|
|
80
|
+ v-model="postData.Coordinate"
|
73
|
81
|
clearable>
|
74
|
82
|
</el-input>
|
75
|
83
|
</div>
|
|
@@ -97,6 +105,7 @@
|
97
|
105
|
</template>
|
98
|
106
|
|
99
|
107
|
<script>
|
|
108
|
+import { mapState, mapActions } from 'vuex'
|
100
|
109
|
|
101
|
110
|
export default {
|
102
|
111
|
name: '',
|
|
@@ -104,11 +113,17 @@ export default {
|
104
|
113
|
var _self = this
|
105
|
114
|
return {
|
106
|
115
|
postData: {
|
107
|
|
- name: '', // 案场名称
|
108
|
|
- address: '', // 案场地址
|
109
|
|
- leaderName: '', // 负责人
|
110
|
|
- leaderPhone: '', // 负责人手机号
|
111
|
|
- atitudeAndLongitude: '',
|
|
116
|
+ OrgId: '', // 机构id
|
|
117
|
+ CaseId: '', // 案场id
|
|
118
|
+ CaseName: '', // 案场名称
|
|
119
|
+ CaseDesc: '', // 案场描述
|
|
120
|
+ CaseIcon: '', // 案场图标
|
|
121
|
+ CaseAddress: '', // 案场地址
|
|
122
|
+ CaseTel: '', // 案场电话
|
|
123
|
+ Coordinate: '', // 经纬度
|
|
124
|
+ Status: '', // 状态
|
|
125
|
+ CreatDate: '', // 创建日期
|
|
126
|
+ CreatUser: '', // 创建人
|
112
|
127
|
},
|
113
|
128
|
markers: [],
|
114
|
129
|
searchOption: {
|
|
@@ -118,14 +133,36 @@ export default {
|
118
|
133
|
mapCenter: [118.789509, 32.019989],
|
119
|
134
|
events: {
|
120
|
135
|
click: (e) => {
|
121
|
|
- _self.postData.atitudeAndLongitude = e.lnglat.lat + ',' + e.lnglat.lng
|
|
136
|
+ _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
|
122
|
137
|
}
|
123
|
138
|
},
|
124
|
139
|
}
|
125
|
140
|
},
|
|
141
|
+ computed: {
|
|
142
|
+ ...mapState({
|
|
143
|
+ OrgId: x => x.app.user.OrgId,
|
|
144
|
+ }),
|
|
145
|
+ },
|
|
146
|
+ created () {
|
|
147
|
+ this.getCaseInfoById()
|
|
148
|
+ },
|
126
|
149
|
components: {},
|
127
|
150
|
methods: {
|
128
|
|
- onSearchResult (pois) {
|
|
151
|
+ ...mapActions([
|
|
152
|
+ 'updateSystemInfo'
|
|
153
|
+ ]),
|
|
154
|
+ getCaseInfoById () { // 获取案场信息
|
|
155
|
+ this.$ajax(this.$api.caseManager.getCaseInfo.url, {
|
|
156
|
+ method: this.$api.caseManager.getCaseInfo.method,
|
|
157
|
+ urlData: { id: this.$route.query.id }
|
|
158
|
+ }).then(res => {
|
|
159
|
+ this.postData = res
|
|
160
|
+ })
|
|
161
|
+ },
|
|
162
|
+ handleAvatarSuccess (res, file) {
|
|
163
|
+ this.postData.CaseIcon = res.result.url
|
|
164
|
+ },
|
|
165
|
+ onSearchResult (pois) { // 搜索地图
|
129
|
166
|
let latSum = 0
|
130
|
167
|
let lngSum = 0
|
131
|
168
|
if (pois.length > 0) {
|
|
@@ -142,11 +179,37 @@ export default {
|
142
|
179
|
this.mapCenter = [center.lng, center.lat]
|
143
|
180
|
}
|
144
|
181
|
},
|
145
|
|
- submit () {
|
146
|
|
- console.log(this.postData)
|
|
182
|
+ submit () { // 提交数据
|
|
183
|
+ if (this.postData.CaseName === '') {
|
|
184
|
+ this.$message({
|
|
185
|
+ type: 'error',
|
|
186
|
+ message: '案场名称不能为空'
|
|
187
|
+ })
|
|
188
|
+ return false
|
|
189
|
+ }
|
|
190
|
+ if (this.postData.Coordinate === '') {
|
|
191
|
+ this.$message({
|
|
192
|
+ type: 'error',
|
|
193
|
+ message: '案场经纬度不能为空'
|
|
194
|
+ })
|
|
195
|
+ return false
|
|
196
|
+ }
|
|
197
|
+ this.postData.OrgId = this.OrgId
|
|
198
|
+ this.$ajax(this.$api.caseManager.addCase.url, {
|
|
199
|
+ method: this.$api.caseManager.addCase.method,
|
|
200
|
+ data: this.postData
|
|
201
|
+ }).then(res => {
|
|
202
|
+ this.$message({
|
|
203
|
+ type: 'success',
|
|
204
|
+ message: '操作成功'
|
|
205
|
+ })
|
|
206
|
+ this.updateSystemInfo().then(() => {
|
|
207
|
+ this.$router.push({ name: 'caseInfo' })
|
|
208
|
+ })
|
|
209
|
+ })
|
147
|
210
|
},
|
148
|
|
- cancel () {
|
149
|
|
- this.$router.go(-1)
|
|
211
|
+ cancel () { // 取消
|
|
212
|
+ this.$router.push({ name: 'caseInfo' })
|
150
|
213
|
}
|
151
|
214
|
}
|
152
|
215
|
}
|