XMLWAN 4 years ago
parent
commit
71efbdef00
8 changed files with 153 additions and 53 deletions
  1. 18 0
      .babelrc
  2. 9 0
      .editorconfig
  3. 5 0
      .eslintignore
  4. 29 0
      .eslintrc.js
  5. 19 0
      .gitignore
  6. 10 0
      .postcssrc.js
  7. 6 0
      cordova-hcp.json
  8. 57 53
      src/pages/main/index.vue

+ 18 - 0
.babelrc View File

@@ -0,0 +1,18 @@
1
+{
2
+  "presets": [
3
+    ["env", {
4
+      "modules": false,
5
+      "targets": {
6
+        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7
+      }
8
+    }],
9
+    "stage-2"
10
+  ],
11
+  "plugins": ["transform-vue-jsx", "transform-runtime"],
12
+  "env": {
13
+    "test": {
14
+      "presets": ["env", "stage-2"],
15
+      "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
16
+    }
17
+  }
18
+}

+ 9 - 0
.editorconfig View File

@@ -0,0 +1,9 @@
1
+root = true
2
+
3
+[*]
4
+charset = utf-8
5
+indent_style = space
6
+indent_size = 2
7
+end_of_line = lf
8
+insert_final_newline = true
9
+trim_trailing_whitespace = true

+ 5 - 0
.eslintignore View File

@@ -0,0 +1,5 @@
1
+/build/
2
+/config/
3
+/dist/
4
+/*.js
5
+/test/unit/coverage/

+ 29 - 0
.eslintrc.js View File

@@ -0,0 +1,29 @@
1
+// https://eslint.org/docs/user-guide/configuring
2
+
3
+module.exports = {
4
+  root: true,
5
+  parserOptions: {
6
+    parser: 'babel-eslint'
7
+  },
8
+  env: {
9
+    browser: true,
10
+  },
11
+  extends: [
12
+    // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13
+    // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14
+    'plugin:vue/essential', 
15
+    // https://github.com/standard/standard/blob/master/docs/RULES-en.md
16
+    'standard'
17
+  ],
18
+  // required to lint *.vue files
19
+  plugins: [
20
+    'vue'
21
+  ],
22
+  // add your custom rules here
23
+  rules: {
24
+    // allow async-await
25
+    'generator-star-spacing': 'off',
26
+    // allow debugger during development
27
+    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
28
+  }
29
+}

+ 19 - 0
.gitignore View File

@@ -0,0 +1,19 @@
1
+.DS_Store
2
+node_modules/
3
+/dist/
4
+npm-debug.log*
5
+yarn-debug.log*
6
+yarn-error.log*
7
+/test/unit/coverage/
8
+/test/e2e/reports/
9
+selenium-debug.log
10
+
11
+# Editor directories and files
12
+.idea
13
+.vscode
14
+*.suo
15
+*.ntvs*
16
+*.njsproj
17
+*.sln
18
+.svn
19
+.dist

+ 10 - 0
.postcssrc.js View File

@@ -0,0 +1,10 @@
1
+// https://github.com/michael-ciniawsky/postcss-load-config
2
+
3
+module.exports = {
4
+  "plugins": {
5
+    "postcss-import": {},
6
+    "postcss-url": {},
7
+    // to edit target browsers: use "browserslist" field in package.json
8
+    "autoprefixer": {}
9
+  }
10
+}

+ 6 - 0
cordova-hcp.json View File

@@ -0,0 +1,6 @@
1
+{
2
+    "name": "name",
3
+    "update": "now",
4
+    "min_native_interface": 3,
5
+    "content_url": "http://pad.kuyicloud.com"
6
+}

+ 57 - 53
src/pages/main/index.vue View File

@@ -2,7 +2,11 @@
2 2
   <div class="mainBox">
3 3
     <div class="newBox">
4 4
       <div class="mainContent">
5
-        <record-page @refAdvice="refAdvice" :un_read_wait_num="unReadWaitNum" :un_read_dialysis_num="unReadDialysisNum" ></record-page>
5
+        <record-page
6
+          @refAdvice="refAdvice"
7
+          :un_read_wait_num="unReadWaitNum"
8
+          :un_read_dialysis_num="unReadDialysisNum"
9
+        ></record-page>
6 10
       </div>
7 11
       <side-bar :active_index="0" :total_read_dot="readNum"></side-bar>
8 12
     </div>
@@ -10,35 +14,35 @@
10 14
 </template>
11 15
 
12 16
 <script>
13
-import RecordPage from './RecordPage'
14
-import SideBar from '@/pages/layout/SideBar'
15
-import { getDialysisScheduals, getWaitingScheduals } from '@/api/dialysis'
16
-import { parseTime } from '@/utils/index'
17
+import RecordPage from "./RecordPage";
18
+import SideBar from "@/pages/layout/SideBar";
19
+import { getDialysisScheduals, getWaitingScheduals } from "@/api/dialysis";
20
+import { parseTime } from "@/utils/index";
17 21
 
18 22
 export default {
19
-  name: 'Main',
20
-  data () {
23
+  name: "Main",
24
+  data() {
21 25
     return {
22 26
       timer: null,
23 27
       scheduals: [],
24 28
       advice_groups: [],
25 29
       unReadWaitNum: 0,
26 30
       unReadDialysisNum: 0
27
-    }
31
+    };
28 32
   },
29 33
   components: {
30 34
     RecordPage,
31 35
     SideBar
32 36
   },
33
-  created () {
37
+  created() {
34 38
     // this.requestScheduals()
35 39
     // this.requestDialysisScheduals()
36 40
   },
37
-  mounted () {
41
+  mounted() {
42
+    //  console.log("更新")
38 43
     // this.timer = window.setInterval(() => {
39 44
     //   setTimeout(this.requestScheduals(), 0)
40 45
     // }, 10000)
41
-
42 46
     // this.timerDia = window.setInterval(() => {
43 47
     //   setTimeout(this.requestDialysisScheduals(), 0)
44 48
     // }, 10000)
@@ -57,32 +61,32 @@ export default {
57 61
   //   })
58 62
   // },
59 63
   methods: {
60
-    refAdvice () {
61
-      this.requestScheduals()
62
-      this.requestDialysisScheduals()
64
+    refAdvice() {
65
+      this.requestScheduals();
66
+      this.requestDialysisScheduals();
63 67
     },
64
-    requestScheduals () {
65
-      var storedata = this.$store.getters.waitscheduals
66
-      var scheduals = storedata.waitscheduals
68
+    requestScheduals() {
69
+      var storedata = this.$store.getters.waitscheduals;
70
+      var scheduals = storedata.waitscheduals;
67 71
       if (Object.keys(storedata).length > 0) {
68
-        this.scheduals = scheduals
69
-        console.log(this.scheduals)
70
-        let doctorAdvice = []
72
+        this.scheduals = scheduals;
73
+        console.log(this.scheduals);
74
+        let doctorAdvice = [];
71 75
         for (let i = 0; i < this.scheduals.length; i++) {
72 76
           for (let y = 0; y < this.scheduals[i].doctor_advice.length; y++) {
73 77
             if (this.scheduals[i].dialysis_order == null) {
74 78
               if (this.scheduals[i].doctor_advice[y].execution_state == 2) {
75
-                doctorAdvice.push(this.scheduals[i].doctor_advice[y])
79
+                doctorAdvice.push(this.scheduals[i].doctor_advice[y]);
76 80
               }
77 81
             }
78 82
           }
79 83
         }
80 84
 
81
-        const sorted = this.groupBy(doctorAdvice, function (item) {
82
-          return [item.groupno]
83
-        })
84
-        this.unReadWaitNum = sorted.length
85
-      } 
85
+        const sorted = this.groupBy(doctorAdvice, function(item) {
86
+          return [item.groupno];
87
+        });
88
+        this.unReadWaitNum = sorted.length;
89
+      }
86 90
       // else {
87 91
       //   var date = parseTime(Date.parse(new Date()), '{y}-{m}-{d}')
88 92
       //   getWaitingScheduals({ date: date }).then(rs => {
@@ -117,29 +121,29 @@ export default {
117 121
       //   })
118 122
       // }
119 123
     },
120
-    requestDialysisScheduals () {
121
-      var storedata = this.$store.getters.scheduals
122
-      var scheduals = storedata.scheduals
124
+    requestDialysisScheduals() {
125
+      var storedata = this.$store.getters.scheduals;
126
+      var scheduals = storedata.scheduals;
123 127
       if (Object.keys(storedata).length > 0) {
124
-        let doctorAdvice = []
128
+        let doctorAdvice = [];
125 129
         for (let index = 0; index < scheduals.length; index++) {
126
-          const schedual = scheduals[index]
130
+          const schedual = scheduals[index];
127 131
           if (schedual.dialysis_order == null) {
128
-            continue
132
+            continue;
129 133
           }
130 134
           for (let y = 0; y < schedual.doctor_advice.length; y++) {
131 135
             if (schedual.doctor_advice[y].execution_state == 2) {
132
-              doctorAdvice.push(schedual.doctor_advice[y])
136
+              doctorAdvice.push(schedual.doctor_advice[y]);
133 137
             }
134 138
           }
135 139
         }
136 140
 
137
-        const sorted = this.groupBy(doctorAdvice, function (item) {
138
-          return [item.groupno]
139
-        })
141
+        const sorted = this.groupBy(doctorAdvice, function(item) {
142
+          return [item.groupno];
143
+        });
140 144
 
141
-        this.unReadDialysisNum = sorted.length
142
-      } 
145
+        this.unReadDialysisNum = sorted.length;
146
+      }
143 147
       // else {
144 148
       //   var date = this.$store.getters.app.dialysis_area.schedule_date
145 149
       //   var type = 0
@@ -179,29 +183,29 @@ export default {
179 183
       //     .catch(v => {})
180 184
       // }
181 185
     },
182
-    groupBy (array, f) {
183
-      const groups = {}
184
-      array.forEach(function (o) {
185
-        const group = JSON.stringify(f(o))
186
-        groups[group] = groups[group] || []
187
-        groups[group].push(o)
188
-      })
189
-      return Object.keys(groups).map(function (group) {
190
-        return groups[group]
191
-      })
186
+    groupBy(array, f) {
187
+      const groups = {};
188
+      array.forEach(function(o) {
189
+        const group = JSON.stringify(f(o));
190
+        groups[group] = groups[group] || [];
191
+        groups[group].push(o);
192
+      });
193
+      return Object.keys(groups).map(function(group) {
194
+        return groups[group];
195
+      });
192 196
     },
193
-    getData () {
194
-      console.log('111111')
197
+    getData() {
198
+      console.log("111111");
195 199
       // this.requestScheduals()
196 200
       // this.requestDialysisScheduals()
197 201
     }
198 202
   },
199 203
   computed: {
200
-    readNum: function () {
201
-      return this.unReadWaitNum + this.unReadDialysisNum
204
+    readNum: function() {
205
+      return this.unReadWaitNum + this.unReadDialysisNum;
202 206
     }
203 207
   }
204
-}
208
+};
205 209
 </script>
206 210
 
207 211
 <style style="stylesheet/scss" lang="scss" scoped>