瀏覽代碼

工号绑定

seimin 2 年之前
父節點
當前提交
c7199bb1dd
共有 3 個文件被更改,包括 199 次插入58 次删除
  1. 1 1
      config/index.js
  2. 28 1
      src/views/Login.vue
  3. 170 56
      src/views/newIncident.vue

+ 1 - 1
config/index.js

@@ -14,7 +14,7 @@ module.exports = {
14 14
     proxyTable: {
15 15
       '/service': {//自定义名字,代表的是以下target中的内容
16 16
         // target: host.host+'/service/',//微信
17
-        target: 'http://192.168.3.105',//微信
17
+        target: 'http://192.168.3.111',//微信
18 18
         changeOrigin: true,//是否允许跨域
19 19
         // pathRewrite: {
20 20
         //   '^/service': ''

+ 28 - 1
src/views/Login.vue

@@ -74,7 +74,8 @@ export default {
74 74
         that.login();
75 75
       } else {
76 76
         var code = {
77
-          code: url[1]
77
+          code: url[1],
78
+          type: 'user',
78 79
           // name: "微信处理人"
79 80
         };
80 81
         // alert("2--传code参数:");
@@ -104,6 +105,32 @@ export default {
104 105
                 icon: "cubeic-alert"
105 106
               })
106 107
               .show();
108
+          } else if (res.data.state == 403) {
109
+            // 没有填写微信和工号
110
+            this.$createDialog({
111
+              type: 'prompt',
112
+              title: '请填写工号',
113
+              prompt: {
114
+                value: '',
115
+                placeholder: '请填写工号'
116
+              },
117
+              onConfirm: (e, promptValue) => {
118
+                console.log(e, promptValue);
119
+                that.$http.post("service/auth/bindAccount", {account:promptValue,wechat:res.data.wechat}).then(res1=>{
120
+                  if(res1.data.status == 403){
121
+                    that
122
+                      .$createDialog({
123
+                        type: "alert",
124
+                        title: '请联系管理员进行添加',
125
+                        icon: "cubeic-alert"
126
+                      })
127
+                      .show();
128
+                  }else{
129
+                     this.login();
130
+                  }
131
+                })
132
+              }
133
+            }).show()
107 134
           } else {
108 135
             that
109 136
               .$createDialog({

+ 170 - 56
src/views/newIncident.vue

@@ -35,7 +35,6 @@
35 35
           v-if="valConfig == 2"
36 36
           class="btn_plcaeholde btn_local"
37 37
         >
38
-          <!-- <cube-button @click="showPlacePicker()">{{selectedPlaceTxt?selectedPlaceTxt:'请输入故障地点'}}</cube-button> -->
39 38
           <input
40 39
             type="text"
41 40
             class="inp_local"
@@ -46,6 +45,20 @@
46 45
           />
47 46
         </cube-form-item>
48 47
         <cube-form-item
48
+          :field="fields[25]"
49
+          v-if="valConfig == 2"
50
+          class="btn_plcaeholde btn_local"
51
+        >
52
+          <input
53
+            type="text"
54
+            class="inp_local"
55
+            placeholder="请输入报修人"
56
+            v-model="userInpVal"
57
+            @input="changeUserList()"
58
+            @click="showUserPicker()"
59
+          />
60
+        </cube-form-item>
61
+        <cube-form-item
49 62
           v-if="valConfig == 1"
50 63
           :field="fields[0]"
51 64
         ></cube-form-item>
@@ -322,8 +335,9 @@ const solution = {
322 335
 export default {
323 336
   data() {
324 337
     return {
338
+      selectDeptIndex:[0],
339
+      selectUserIndex:[0],
325 340
       validity: {},
326
-
327 341
       valid: undefined,
328 342
       action: {
329 343
         target:
@@ -353,16 +367,20 @@ export default {
353 367
       incidentTitle: "", //事件主题
354 368
       referenceInfo: {}, //引用信息
355 369
       placeSelectData: [], //区域地点下拉框选项
356
-      inpLocalVal: "", //故障地点输入框
370
+      // inpLocalVal: "", //故障地点输入框
357 371
       faultLocationList: [], //区域地点拼接下拉框选项
358 372
       deptInpVal: "", //报修科室输入框
359 373
       deptList: [], //报修科室下拉选项
360 374
       deptRes: "", //下拉框科室信息
375
+      userInpVal: "", //报修人输入框
376
+      userList: [], //报修人下拉选项
377
+      userRes: "", //下拉框报修人信息
361 378
       model: {
362 379
         contactsInformation: "",
363 380
         placeValue: [],
364 381
         address: "", //故障地点
365 382
         requester: "", //报修科室
383
+        requesterUser: "", //报修人
366 384
         houseNumber: "", //详细地址
367 385
         description: "", //事件描述
368 386
         // bxcode: "",
@@ -700,7 +718,7 @@ export default {
700 718
           modelKey: "requester",
701 719
           label: "报修科室:",
702 720
           props: {
703
-            options: this.requesterList,
721
+            options: [],
704 722
             title: "请选择报修科室",
705 723
             placeholder: "请选择报修科室"
706 724
           },
@@ -752,10 +770,32 @@ export default {
752 770
             title: "请选择院区",
753 771
             placeholder: "请选择院区"
754 772
           },
773
+          events: {
774
+            change: (value, index, text) => {
775
+              console.log(value, index, text);
776
+              console.log(this.model);
777
+              if (this.valConfig == 2) {
778
+                this.getDept();
779
+              }
780
+            }
781
+          },
755 782
           rules: {
756 783
             required: true
757 784
           }
758 785
         },
786
+        {
787
+          type: "select",
788
+          modelKey: "requesterUser",
789
+          label: "报修人:",
790
+          props: {
791
+            options: [],
792
+            title: "请选择报修人",
793
+            placeholder: "请选择报修人"
794
+          },
795
+          rules: {
796
+            required: false
797
+          }
798
+        },
759 799
       ]
760 800
     };
761 801
   },
@@ -862,6 +902,10 @@ export default {
862 902
             }else if(this.loginUser.branch){
863 903
               this.model.branch = this.loginUser.branch.id;
864 904
             }
905
+            // 获取报修科室
906
+            // if (this.valConfig == 2) {
907
+            //   this.getDept();
908
+            // }
865 909
           }
866 910
         });
867 911
     },
@@ -1170,19 +1214,19 @@ export default {
1170 1214
             that.$route.params.abnormal;
1171 1215
         }
1172 1216
       } else {
1173
-        that.name = that.loginUser.name;
1174
-        that.model.contactsInformation = that.loginUser.phone;
1175
-        that.model.contacts = that.loginUser.name;
1176
-        that.model.houseNumber = that.loginUser.houseNumber;
1177
-      }
1178
-      if (that.loginUser.place && that.loginUser.place.length) {
1179
-        if (that.loginUser.place.id) {
1180
-          if (that.loginUser.place.area) {
1181
-            that.model.placeValue[0] = that.loginUser.place.area.id;
1182
-          }
1183
-          that.model.placeValue[1] = that.loginUser.place.id;
1184
-        }
1217
+        // that.name = that.loginUser.name;
1218
+        // that.model.contactsInformation = that.loginUser.phone;
1219
+        // that.model.contacts = that.loginUser.name;
1220
+        // that.model.houseNumber = that.loginUser.houseNumber;
1185 1221
       }
1222
+      // if (that.loginUser.place && that.loginUser.place.length) {
1223
+      //   if (that.loginUser.place.id) {
1224
+      //     if (that.loginUser.place.area) {
1225
+      //       that.model.placeValue[0] = that.loginUser.place.area.id;
1226
+      //     }
1227
+      //     that.model.placeValue[1] = that.loginUser.place.id;
1228
+      //   }
1229
+      // }
1186 1230
 
1187 1231
       if (localStorage.getItem("model")) {
1188 1232
         that.model = JSON.parse(localStorage.getItem("model"));
@@ -1705,25 +1749,38 @@ export default {
1705 1749
     },
1706 1750
     // 报修科室
1707 1751
     showDeptPicker() {
1752
+      this.deptList = [];
1708 1753
       this.deptPicker.show();
1754
+      this.getDept(true);
1755
+    },
1756
+    // 报修人
1757
+    showUserPicker() {
1758
+      this.userList = [];
1759
+      this.userPicker.show();
1760
+      this.getUser(true);
1709 1761
     },
1710 1762
     // 选中报修科室
1711 1763
     selectDeptHandler(selectedVal, selectedIndex, selectedTxt) {
1712 1764
       console.log(selectedVal, selectedIndex, selectedTxt);
1713
-      this.deptInpVal = selectedTxt;
1714
-      this.model.requester = this.deptRes[selectedIndex];
1715
-      console.log(this.deptRes[selectedIndex]);
1716
-      this.inpLocalVal = this.model.address = this.deptRes[selectedIndex].place
1717
-        .area
1718
-        ? this.deptRes[selectedIndex].place.area.area
1719
-          ? this.deptRes[selectedIndex].place.place
1720
-            ? this.deptRes[selectedIndex].place.area.area +
1721
-              this.deptRes[selectedIndex].place.place
1722
-            : this.deptRes[selectedIndex].place.area.area
1723
-          : this.deptRes[selectedIndex].place.area
1724
-        : this.deptRes[selectedIndex].place.place;
1725
-      if (this.deptRes[selectedIndex].phone) {
1726
-        this.model.contactsInformation = this.deptRes[selectedIndex].phone;
1765
+      this.deptInpVal = selectedTxt[0];
1766
+      this.selectDeptIndex = selectedIndex;
1767
+      if(!selectedVal[0]){
1768
+        return;
1769
+      }
1770
+      let index = selectedIndex[0].toString();
1771
+      this.model.requester = this.deptRes[index];
1772
+      console.log(this.deptRes[index]);
1773
+      // this.inpLocalVal = this.model.address = this.deptRes[index].place
1774
+      //   .area
1775
+      //   ? this.deptRes[index].place.area.area
1776
+      //     ? this.deptRes[index].place.place
1777
+      //       ? this.deptRes[index].place.area.area +
1778
+      //         this.deptRes[index].place.place
1779
+      //       : this.deptRes[index].place.area.area
1780
+      //     : this.deptRes[index].place.area
1781
+      //   : this.deptRes[index].place.place;
1782
+      if (this.deptRes[index].phone) {
1783
+        this.model.contactsInformation = this.deptRes[index].phone;
1727 1784
       }
1728 1785
       // this.model.houseNumber = this.selectedPlaceTxt = selectedTxt.join(" ");
1729 1786
       // var place = {
@@ -1747,6 +1804,30 @@ export default {
1747 1804
       // };
1748 1805
       // localStorage.setItem("place", JSON.stringify(place));
1749 1806
     },
1807
+    // 选中报修人
1808
+    selectUserHandler(selectedVal, selectedIndex, selectedTxt) {
1809
+      console.log(selectedVal, selectedIndex, selectedTxt);
1810
+      this.userInpVal = selectedTxt[0];
1811
+      this.selectUserIndex = selectedIndex;
1812
+      if(!selectedVal[0]){
1813
+        return;
1814
+      }
1815
+      let index = selectedIndex[0].toString();
1816
+      this.model.requesterUser = this.userRes[index];
1817
+      console.log(this.userRes[index]);
1818
+      if (this.userRes[index].phone) {
1819
+        this.model.contactsInformation = this.userRes[index].phone;
1820
+      }
1821
+    },
1822
+    // 取消选中报修人
1823
+    cancelUserHandler() {
1824
+      if (this.model.requesterUser) {
1825
+        this.userInpVal = this.model.requesterUser.name + '('+ this.model.requesterUser.account +')';
1826
+      } else if (!this.model.requesterUser) {
1827
+        this.userInpVal = "";
1828
+        this.model.requesterUser = "";
1829
+      }
1830
+    },
1750 1831
     getAreaData() {
1751 1832
       this.$http
1752 1833
         .post("service/user/data/fetchDataList/area", {
@@ -1853,47 +1934,83 @@ export default {
1853 1934
       }, 600);
1854 1935
     },
1855 1936
     // 报修科室
1856
-    getDept(type) {
1857
-      var that = this;
1937
+    getDept(isFirst) {
1858 1938
       this.$http
1859 1939
         .post("service/user/data/fetchDataList/department", {
1860 1940
           idx: 0,
1861
-          sum: 50,
1862
-          department: { dept: that.deptInpVal || "" }
1941
+          sum: 1000,
1942
+          department: {
1943
+            branch: this.model.branch,
1944
+            selectType:"pinyin_qs",
1945
+            dept: isFirst ? '': (this.deptInpVal || "")
1946
+          }
1863 1947
         })
1864
-        .then(function(res) {
1948
+        .then((res) => {
1865 1949
           var data = res.data.list;
1866
-          if (type == 1) {
1867
-            that.deptList.length = 0;
1868
-            that.$set(that.deptList, true, []);
1869
-            that.deptList;
1870
-          }
1871
-          that.deptRes = res.data.list;
1950
+          this.deptRes = res.data.list;
1951
+          this.deptList = [];
1872 1952
           for (var i = 0; i < data.length; i++) {
1873
-            that.deptList.push({
1953
+            this.deptList.push({
1874 1954
               text: data[i].dept,
1875 1955
               value: data[i].id
1876 1956
             });
1877 1957
           }
1878
-
1879
-          that.deptPicker = that.$createCascadePicker({
1880
-            title: "报修科室选择",
1881
-            data: that.deptList,
1882
-            onSelect: that.selectDeptHandler,
1883
-            onCancel: that.cancelDeptHandler
1884
-          });
1958
+          console.log(this.deptList)
1959
+          this.deptPicker.setData(this.deptList, isFirst?this.selectDeptIndex:[0])
1960
+        });
1961
+    },
1962
+    // 报修人
1963
+    getUser(isFirst) {
1964
+      this.$http
1965
+        .post("service/user/data/fetchDataList/requester", {
1966
+          idx: 0,
1967
+          sum: 1000,
1968
+          requester: {
1969
+            searchKey: isFirst ? '': (this.userInpVal || "")
1970
+          }
1971
+        })
1972
+        .then((res) => {
1973
+          var data = res.data.list;
1974
+          this.userRes = res.data.list;
1975
+          this.userList = [];
1976
+          for (var i = 0; i < data.length; i++) {
1977
+            this.userList.push({
1978
+              text: data[i].name + '('+ data[i].account +')',
1979
+              value: data[i].id
1980
+            });
1981
+          }
1982
+          console.log(this.userList)
1983
+          this.userPicker.setData(this.userList, isFirst?this.selectUserIndex:[0])
1885 1984
         });
1886 1985
     },
1887 1986
     changeDeptList() {
1888 1987
       var that = this;
1889 1988
       clearTimeout(that.timer);
1890 1989
       that.timer = setTimeout(() => {
1891
-        this.getDept(1);
1990
+        this.getDept();
1991
+      }, 600);
1992
+    },
1993
+    changeUserList() {
1994
+      clearTimeout(this.timer);
1995
+      this.timer = setTimeout(() => {
1996
+        this.getUser();
1892 1997
       }, 600);
1893 1998
     }
1894 1999
   },
1895 2000
   created() {
1896 2001
     console.log(this.$route.params.data);
2002
+    this.deptPicker = this.$createCascadePicker({
2003
+      title: "报修科室选择",
2004
+      data: this.deptList,
2005
+      onSelect: this.selectDeptHandler,
2006
+      onCancel: this.cancelDeptHandler
2007
+    });
2008
+    this.userPicker = this.$createCascadePicker({
2009
+      title: "报修人选择",
2010
+      data: this.userList,
2011
+      onSelect: this.selectUserHandler,
2012
+      onCancel: this.cancelUserHandler
2013
+    });
1897 2014
     //获取院区
1898 2015
     this.getBranch();
1899 2016
     //获取事件来源
@@ -1922,9 +2039,6 @@ export default {
1922 2039
     this.getPlaceData();
1923 2040
     // 获取故障地点
1924 2041
     // this.getFaultLocation();
1925
-    if (this.valConfig == 2) {
1926
-      this.getDept();
1927
-    }
1928 2042
   },
1929 2043
   beforeRouteLeave(to, from, next) {
1930 2044
     console.log(to);
@@ -1968,9 +2082,9 @@ export default {
1968 2082
   border: none;
1969 2083
 }
1970 2084
 
1971
-.btn_local {
1972
-  /* z-index: 101; */
1973
-}
2085
+/* .btn_local {
2086
+  z-index: 101;
2087
+} */
1974 2088
 .inp_local {
1975 2089
   outline: none;
1976 2090
   width: 100%;