| 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
 | | <template> |  |   <GlobalWindow width="600px" :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm"> |  |     <el-form :model="form" ref="form" :rules="rules"> |  |   |  |       <el-form-item label="项目名称" prop="name"> |  |         <el-input v-model="form.name" placeholder="请输入名称" v-trim /> |  |       </el-form-item> |  |       <el-form-item label="所属地区" prop="areaId"> |  |         <el-cascader v-model="form.areaIdT" :props="{ |  |           label: 'name', |  |           value: 'id', |  |           children: 'childList' |  |         }" :options="treeList" @change="handleChange"></el-cascader> |  |       </el-form-item> |  |       <el-form-item label="详细地址" prop="addr"> |  |         <el-input v-model="form.addr" placeholder="请输入详细地址" /> |  |       </el-form-item> |  |       <el-form-item label="项目简介" prop="remark"> |  |         <el-input type="textarea" :rows="4" v-model="form.remark" placeholder="请输入" /> |  |       </el-form-item> |  |     </el-form> |  |   </GlobalWindow> |  | </template> |  |   |  | <script> |  | import BaseOpera from '@/components/base/BaseOpera' |  | import GlobalWindow from '@/components/common/GlobalWindow' |  | import { getCityTree } from '@/api/system/common' |  | import { detailById } from '@/api/project/ywProject' |  | export default { |  |   name: 'OperaYwProjectWindow', |  |   extends: BaseOpera, |  |   components: { GlobalWindow }, |  |   data() { |  |     return { |  |       // 表单数据 |  |       form: { |  |         id: '', |  |         creator: '', |  |         createDate: '', |  |         editor: '', |  |         editDate: '', |  |         isdeleted: '', |  |         name: '', |  |         remark: '', |  |         status: '', |  |         sortnum: '', |  |         imgurl: '', |  |         areaIdT: '', |  |         cityId: '', |  |         areaId: '', |  |         provinceId: '', |  |         addr: '' |  |       }, |  |       // 验证规则 |  |       rules: { |  |         name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }] |  |       }, |  |       projectList: [], |  |       treeList: [] |  |     } |  |   }, |  |   created() { |  |     this.config({ |  |       api: '/project/ywProject', |  |       'field.id': 'id' |  |     }) |  |   }, |  |   methods: { |  |     open(title, target) { |  |       this.title = title |  |       this.visible = true |  |       this.initData() |  |       if (target == null) { |  |         this.$nextTick(() => { |  |           this.form = { |  |             id: '', |  |             creator: '', |  |             createDate: '', |  |             editor: '', |  |             editDate: '', |  |             isdeleted: '', |  |             name: '', |  |             remark: '', |  |             status: '', |  |             sortnum: '', |  |             imgurl: '', |  |             areaIdT: '', |  |             cityId: '', |  |             areaId: '', |  |             provinceId: '', |  |             addr: '' |  |           } |  |           this.$refs.form.resetFields() |  |         }) |  |       } |  |       this.$nextTick(() => { |  |         for (const key in this.form) { |  |           this.form[key] = target[key] |  |         } |  |         this.$set(this.form, 'areaIdT', [target.provinceId, target.cityId, target.areaId,]) |  |         // console.log(this.form) |  |       }) |  |   |  |   |  |   |  |     }, |  |     handleChange(e) { |  |       if (e && e.length > 0) { |  |         if (e.length == 3) { |  |           this.$set(this.form, 'areaId', e[2]) |  |         } else if (e.length == 2) { |  |           this.$set(this.form, 'areaId', e[1]) |  |         } else { |  |           this.$set(this.form, 'areaId', e[0]) |  |         } |  |       } |  |     }, |  |     getDetail(id) { |  |       detailById(id).then(res => { |  |         this.form = res |  |       }) |  |     }, |  |     initData() { |  |       getCityTree({ |  |         "type": 0 |  |       }).then(res => { |  |         this.treeList = res |  |       }) |  |     } |  |   } |  | } |  | </script> | 
 |