liu 6 vuotta sitten
vanhempi
commit
89c382c391

+ 6
- 1
hksystem/src/views/housekeeper/edit.vue Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
 </style>
4 4
 
5 5
 <template>
6
-    <Modal v-model="editModal" :loading="loading" :closable="false">
6
+    <Modal v-model="editModal" :loading="loading" >
7 7
         <p slot="header">
8 8
             <Icon type="information-circled"></Icon>
9 9
             <span>修改</span>
@@ -39,6 +39,11 @@ export default {
39 39
         },
40 40
         editShow() {
41 41
             this.editModal = this.editShow;
42
+        },
43
+        editModal() {
44
+            if (!this.editModal) {
45
+                this.$emit("close");
46
+            }
42 47
         }
43 48
     },
44 49
     props: {

+ 8
- 6
hksystem/src/views/housekeeper/index.vue Näytä tiedosto

@@ -149,12 +149,14 @@ export default {
149 149
         },
150 150
         closeModal(row) {
151 151
             this.editShow = false;
152
-            this.products.forEach((product, i) => {
153
-                if (product.id == row.id) {
154
-                    product.price = row.price;
155
-                    this.$set(this.products, i, product);
156
-                }
157
-            });
152
+            if (row && row.id) {
153
+                this.products.forEach((product, i) => {
154
+                    if (product.id == row.id) {
155
+                        product.price = row.price;
156
+                        this.$set(this.products, i, product);
157
+                    }
158
+                });
159
+            }
158 160
         },
159 161
         back() {
160 162
             this.proShow = true;

+ 6
- 1
hksystem/src/views/matron/edit.vue Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
 </style>
4 4
 
5 5
 <template>
6
-    <Modal v-model="editModal" :loading="loading" :closable="false">
6
+    <Modal v-model="editModal" :loading="loading">
7 7
         <p slot="header">
8 8
             <Icon type="information-circled"></Icon>
9 9
             <span>修改</span>
@@ -39,6 +39,11 @@ export default {
39 39
         },
40 40
         editShow() {
41 41
             this.editModal = this.editShow;
42
+        },
43
+        editModal() {
44
+            if (!this.editModal) {
45
+                this.$emit("close");
46
+            }
42 47
         }
43 48
     },
44 49
     props: {

+ 8
- 6
hksystem/src/views/matron/index.vue Näytä tiedosto

@@ -151,12 +151,14 @@ export default {
151 151
         },
152 152
         closeModal(row) {
153 153
             this.editShow = false;
154
-            this.products.forEach((product, i) => {
155
-                if (product.id == row.id) {
156
-                    product.price = row.price;
157
-                    this.$set(this.products, i, product);
158
-                }
159
-            });
154
+            if (row && row.id) {
155
+                this.products.forEach((product, i) => {
156
+                    if (product.id == row.id) {
157
+                        product.price = row.price;
158
+                        this.$set(this.products, i, product);
159
+                    }
160
+                });
161
+            }
160 162
         },
161 163
         back() {
162 164
             this.proShow = true;

+ 64
- 0
hksystem/src/views/product-classify/add.vue Näytä tiedosto

@@ -0,0 +1,64 @@
1
+<style lang="less">
2
+
3
+</style>
4
+
5
+<template>
6
+    <Modal v-model="addModal" :loading="loading">
7
+        <p slot="header">
8
+            <Icon type="information-circled"></Icon>
9
+            <span>新增</span>
10
+        </p>
11
+        <div>
12
+            <Form ref="form" :label-width="80">
13
+                <FormItem label="分类">
14
+                    <Input v-model="classify" />
15
+                </FormItem>
16
+            </Form>
17
+        </div>
18
+        <div slot="footer">
19
+            <Button type="primary" @click="submit">确定</Button>
20
+        </div>
21
+    </Modal>
22
+</template>
23
+
24
+<script>
25
+export default {
26
+    name: 'add',
27
+    data() {
28
+        return {
29
+            classify: '',
30
+            loading: true,
31
+            addModal: false
32
+        }
33
+    },
34
+    watch: {
35
+        addShow() {
36
+            this.addModal = this.addShow;
37
+        },
38
+        addModal() {
39
+            if (!this.addModal) {
40
+                this.$emit("close");
41
+            }
42
+        }
43
+    },
44
+    props: {
45
+        products: Array,
46
+        addShow: Boolean
47
+    },
48
+    methods: {
49
+        submit() {
50
+            if (!this.classify) {
51
+                this.$emit("close", {classifys: classifys});
52
+                this.loading = false;
53
+            }
54
+            let classify = this.products.concat(this.classify);
55
+            this.axios.post("/product_classify/store", {
56
+                classify: classify.join(",") 
57
+            }).then((res) => {
58
+                this.$emit("close", {classifys: classify});
59
+                this.loading = false;
60
+            });
61
+        }
62
+    }
63
+};
64
+</script>

+ 8
- 3
hksystem/src/views/product-classify/edit.vue Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
 </style>
4 4
 
5 5
 <template>
6
-    <Modal v-model="editModal" :loading="loading" :closable="false">
6
+    <Modal v-model="editModal" :loading="loading">
7 7
         <p slot="header">
8 8
             <Icon type="information-circled"></Icon>
9 9
             <span>修改</span>
@@ -39,6 +39,11 @@ export default {
39 39
         },
40 40
         editShow() {
41 41
             this.editModal = this.editShow;
42
+        },
43
+        editModal() {
44
+            if (!this.editModal) {
45
+                this.$emit("close");
46
+            }
42 47
         }
43 48
     },
44 49
     props: {
@@ -57,11 +62,11 @@ export default {
57 62
                 editClassify.push(data.classify);
58 63
                 classifys.push(data);
59 64
             });
60
-            let classify_str = editClassify.join("");
65
+            let classify_str = editClassify.join(",");
61 66
             this.axios.post("/product_classify/store", {
62 67
                 classify: classify_str
63 68
             }).then((res) => {
64
-                this.$emit("close", {classifys: classifys});
69
+                this.$emit("close", {classifys: editClassify});
65 70
                 this.loading = false;
66 71
             });
67 72
         }

+ 14
- 3
hksystem/src/views/product-classify/index.vue Näytä tiedosto

@@ -28,15 +28,18 @@
28 28
                 </Card>
29 29
             </Col>
30 30
         </Row>
31
+        <add :addShow="addShow" :products="products" @close="closeAddModal"></add>
31 32
         <edit :editShow="editShow" :editClassify="prosHandle" :row="row" @close="closeModal"></edit>
32 33
     </div>
33 34
 </template>
34 35
 
35 36
 <script>
37
+import add from './add';
36 38
 import edit from './edit';
37 39
 export default {
38 40
     name: 'classify',
39 41
     components: {
42
+        add,
40 43
         edit
41 44
     },
42 45
     computed: {
@@ -57,6 +60,7 @@ export default {
57 60
             total: 0,
58 61
             pageSize: 20,
59 62
             proShow: true,
63
+            addShow: false,
60 64
             editShow: false,
61 65
             formContent: {},
62 66
             columns: [
@@ -114,8 +118,7 @@ export default {
114 118
     },
115 119
     methods: {
116 120
         add () {
117
-            this.proShow = false;
118
-            this.formContent = {};
121
+            this.addShow = true;
119 122
         },
120 123
         pubSuccess() {
121 124
             this.proShow = true;
@@ -134,7 +137,15 @@ export default {
134 137
         },
135 138
         closeModal(row) {
136 139
             this.editShow = false;
137
-            this.products = row.classifys;
140
+            if (row && row.classifys) {
141
+                this.products = row.classifys;
142
+            }
143
+        },
144
+        closeAddModal(row) {
145
+            this.addShow = false;
146
+            if (row && row.classifys) {
147
+                this.products = row.classifys;
148
+            }
138 149
         },
139 150
     },
140 151
     created () {

+ 6
- 1
hksystem/src/views/product-order/edit.vue Näytä tiedosto

@@ -3,7 +3,7 @@
3 3
 </style>
4 4
 
5 5
 <template>
6
-    <Modal v-model="editModal" :loading="loading" :closable="false">
6
+    <Modal v-model="editModal" :loading="loading">
7 7
         <p slot="header">
8 8
             <Icon type="information-circled"></Icon>
9 9
             <span>修改</span>
@@ -39,6 +39,11 @@ export default {
39 39
         },
40 40
         editShow() {
41 41
             this.editModal = this.editShow;
42
+        },
43
+        editModal() {
44
+            if (!this.editModal) {
45
+                this.$emit("close");
46
+            }
42 47
         }
43 48
     },
44 49
     props: {

+ 8
- 6
hksystem/src/views/product-order/index.vue Näytä tiedosto

@@ -150,12 +150,14 @@ export default {
150 150
         },
151 151
         closeModal(row) {
152 152
             this.editShow = false;
153
-            this.products.forEach((product, i) => {
154
-                if (product.id == row.id) {
155
-                    product.price = row.price;
156
-                    this.$set(this.products, i, product);
157
-                }
158
-            });
153
+            if (row && row.id) {
154
+                this.products.forEach((product, i) => {
155
+                    if (product.id == row.id) {
156
+                        product.price = row.price;
157
+                        this.$set(this.products, i, product);
158
+                    }
159
+                });
160
+            }
159 161
         },
160 162
         back() {
161 163
             this.proShow = true;

Loading…
Peruuta
Tallenna