|
@@ -8,12 +8,27 @@
|
8
|
8
|
<div style="width:50%">
|
9
|
9
|
<el-input
|
10
|
10
|
placeholder="请输入规格名"
|
11
|
|
- v-model="postData.goodsSpec"
|
|
11
|
+ v-model="postData.SpecName"
|
12
|
12
|
clearable>
|
13
|
13
|
</el-input>
|
14
|
14
|
</div>
|
15
|
15
|
</div>
|
16
|
16
|
</li>
|
|
17
|
+ <li class="flex-h">
|
|
18
|
+ <span>选择案场:</span>
|
|
19
|
+ <div class="flex-item">
|
|
20
|
+ <div style="width:50%">
|
|
21
|
+ <el-select v-model="CaseId" placeholder="请选择">
|
|
22
|
+ <el-option
|
|
23
|
+ v-for="item in cases"
|
|
24
|
+ :key="item.CaseId"
|
|
25
|
+ :label="item.CaseName"
|
|
26
|
+ :value="item.CaseId">
|
|
27
|
+ </el-option>
|
|
28
|
+ </el-select>
|
|
29
|
+ </div>
|
|
30
|
+ </div>
|
|
31
|
+ </li>
|
17
|
32
|
<li style="text-align:center">
|
18
|
33
|
<el-button type="primary" size="mini" @click="submit">保存</el-button>
|
19
|
34
|
<el-button type="danger" size="mini" @click="cancel">取消</el-button>
|
|
@@ -24,22 +39,53 @@
|
24
|
39
|
</template>
|
25
|
40
|
|
26
|
41
|
<script>
|
|
42
|
+import { mapState } from 'vuex'
|
|
43
|
+
|
27
|
44
|
export default {
|
28
|
45
|
name: '',
|
29
|
46
|
data () {
|
30
|
47
|
return {
|
31
|
48
|
postData: {
|
32
|
|
- goodsSpec: ''
|
|
49
|
+ SpecId: '', // 规格id(新增传空值)
|
|
50
|
+ SpecName: '', // 规格名称
|
|
51
|
+ Status: '', // 状态(无状态可传空值)
|
|
52
|
+ OrgId: '', // 机构id
|
|
53
|
+ CaseId: '', // 案场id
|
|
54
|
+ }
|
|
55
|
+ }
|
|
56
|
+ },
|
|
57
|
+ computed: {
|
|
58
|
+ ...mapState({
|
|
59
|
+ cases: x => x.app.cases,
|
|
60
|
+ OrgId: x => x.app.user.OrgId,
|
|
61
|
+ }),
|
|
62
|
+ CaseId: {
|
|
63
|
+ get () {
|
|
64
|
+ return this.postData.CaseId === '' ? (((this.cases || []).filter(x => x.IsBelong === 1))[0] || {}).CaseId || '' : this.postData.CaseId
|
|
65
|
+ },
|
|
66
|
+ set (val) {
|
|
67
|
+ this.postData.CaseId = val
|
33
|
68
|
}
|
34
|
69
|
}
|
35
|
70
|
},
|
36
|
71
|
components: {},
|
37
|
72
|
methods: {
|
38
|
|
- submit () {
|
39
|
|
- console.log(this.postData)
|
|
73
|
+ submit () { // 提交数据
|
|
74
|
+ this.postData.OrgId = this.OrgId
|
|
75
|
+ if (this.postData.CaseId === '') this.postData.CaseId = this.CaseId
|
|
76
|
+ this.$ajax(this.$api.system.addGoodsSpec.url, {
|
|
77
|
+ method: this.$api.system.addGoodsSpec.method,
|
|
78
|
+ data: this.postData
|
|
79
|
+ }).then(res => {
|
|
80
|
+ this.$message({
|
|
81
|
+ type: 'success',
|
|
82
|
+ message: '操作成功'
|
|
83
|
+ })
|
|
84
|
+ this.$router.push({ name: 'goodsSpecManager' })
|
|
85
|
+ })
|
40
|
86
|
},
|
41
|
87
|
cancel () {
|
42
|
|
- this.$router.go(-1)
|
|
88
|
+ this.$router.push({ name: 'goodsSpecManager' })
|
43
|
89
|
}
|
44
|
90
|
},
|
45
|
91
|
mounted () { }
|