updatePassword.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <view>
  3. <!-- //查找 -->
  4. <view class="search">
  5. <view class="search-title">
  6. {{$t('dosugar.equipmentClientID')}}
  7. </view>
  8. <view class="search-input">
  9. <input type="text" :placeholder="$t('dosugar.placeholder')" v-model="searchClientId" />
  10. </view>
  11. <view class="search-button">
  12. <button type="primary" class="" @click="search()">
  13. <p class="">{{$t('alarmClock.add')}}</P>
  14. </button>
  15. </view>
  16. </view>
  17. <!-- //多选下拉框 -->
  18. <view class="select-item">
  19. <ld-select :multiple="true" :list="equipmentNameList" label-key="label" value-key="value"
  20. :placeholder="$t('alarmClock.placeholder')" clearable v-model="equipmentIds" @change="selectChange2"></ld-select>
  21. </view>
  22. <view class="search">
  23. <view class="search-title">
  24. {{$t('updatePassword.adminPwd')}}:
  25. </view>
  26. <view class="search-input2">
  27. <input type="text" v-model="adminPwd" />
  28. </view>
  29. </view>
  30. <view class="search">
  31. <view class="search-title">
  32. {{$t('updatePassword.guestPwd')}}:
  33. </view>
  34. <view class="search-input2">
  35. <input type="text" v-model="guestPwd" />
  36. </view>
  37. </view>
  38. <view class="line"></view>
  39. <!-- //提交按钮 -->
  40. <view class="tr">
  41. <button type="primary" formType="submit" @click="update()" class="button">
  42. <p class="p1">{{$t('alarmClock.update')}}</p>
  43. </button>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. mapState,
  50. mapActions,
  51. mapMutations
  52. } from 'vuex'
  53. import MxDatePicker from "../../components/mx-datepicker/mx-datepicker.vue";
  54. // import ldSelect from "../../components/ld-select/ld-select.vue";
  55. import ldSelect from "../../components/ld-select/ld-select.vue"
  56. import likeButton from "../../components/like-button/like-button.vue";
  57. export default {
  58. components: {
  59. MxDatePicker,
  60. ldSelect,
  61. likeButton
  62. },
  63. data() {
  64. return {
  65. value: '',
  66. searchClientId: null,
  67. equipmentName: null,
  68. equipmentNameList: [],
  69. globalUser: {},
  70. equipmentIds: [],
  71. adminPwd:null,
  72. guestPwd:null
  73. }
  74. },
  75. onShow() {
  76. this.globalUser = uni.getStorageSync("globalUser");
  77. var token = uni.getStorageSync("token");
  78. if (token.length > 1) {
  79. this.getEquipmentListData();
  80. } else {
  81. uni.reLaunch({
  82. url: '../../../pages/Login/Login',
  83. });
  84. }
  85. },
  86. onLoad() {
  87. },
  88. methods: {
  89. ...mapActions('chart', ['getEquipmentListByUser', 'addAlarmClock', 'addAlarmClockItem', 'updateAlarmClock']),
  90. getEquipmentListData() {
  91. this.getEquipmentListByUser(this.globalUser)
  92. .then(data => {
  93. // this.merchantList = data;
  94. // console.log("1223");
  95. var listName = data[0].equipmentList;
  96. var equipmentNameList = this.equipmentNameList;
  97. var co = {};
  98. co["value"] = 'all';
  99. co["label"] = '全部机器ALL machine';
  100. equipmentNameList.push(co);
  101. for (var i = 0; i < listName.length; i++) {
  102. var cov = {};
  103. cov["value"] = listName[i].id;
  104. cov["label"] = "名称:" + listName[i].name + " 编号:" + listName[i].clientId.substring(
  105. listName[i].clientId.length - 6, listName[i].clientId.length);
  106. equipmentNameList.push(cov);
  107. }
  108. this.equipmentNameList = equipmentNameList;
  109. var listId = data[0].id;
  110. if (listId != null && listId != '1') {
  111. uni.setStorageSync("listName", listName);
  112. }
  113. uni.stopPullDownRefresh();
  114. }, _ => void uni.stopPullDownRefresh());
  115. },
  116. onSelected(e) { //选择
  117. this.showPicker = false;
  118. if (e) {
  119. this[this.type] = e.value;
  120. //选择的值
  121. // console.log('value => ' + e.value);
  122. //原始的Date对象
  123. // console.log('date => ' + e.date);
  124. }
  125. },
  126. // bindPickerChange: function(e) {
  127. // this.indexType = e.target.value
  128. // },
  129. addEids(equipmentIds) {
  130. // console.log('equipmentIds' + equipmentIds);
  131. var eids = equipmentIds.split(",");
  132. var idss = this.equipmentIds;
  133. var is = this.equipmentNameList
  134. for (var k = 0; k < eids.length; k++) {
  135. var id = eids[k];
  136. if (id != "" && id != '') {
  137. this.equipmentIds.push(parseInt(id));
  138. }
  139. }
  140. },
  141. search() {
  142. // console.log("search");
  143. var clientId = this.searchClientId;
  144. var list = uni.getStorageSync("listName");
  145. var n = 0;
  146. for (var i = 0; i < list.length; i++) {
  147. var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
  148. if (code == clientId) {
  149. n++;
  150. var id = list[i].id;
  151. this.equipmentIds.push(id);
  152. break;
  153. }
  154. }
  155. if (n == 0) {
  156. uni.showModal({
  157. title: "提示",
  158. content: "找不到该机器",
  159. success: (res) => {
  160. }
  161. })
  162. }
  163. if (n > 0) {
  164. uni.showModal({
  165. title: "提示",
  166. content: "已添加该机器",
  167. success: (res) => {
  168. }
  169. })
  170. }
  171. },
  172. selectChange2(val) {
  173. //有改动文件 import likeButton from "../../components/like-button/like-button.vue";
  174. if (val == "all") {
  175. this.equipmentIds = [];
  176. var list = uni.getStorageSync("listName");
  177. for (var i = 0; i < list.length; i++) {
  178. this.equipmentIds.push(list[i].id);
  179. }
  180. } else {
  181. this.equipmentIds = val
  182. }
  183. // console.log('this.equipmentIds => ' + this.equipmentIds);
  184. },
  185. switchChange: function(e) {
  186. this.status = e.target.value;
  187. },
  188. update() {
  189. var that = this;
  190. uni.showModal({
  191. title: that.$t('equipmentStatusList.tip'),
  192. content:that.$t('updatePassword.sure') ,
  193. success: (re) => {
  194. if (re.confirm) {
  195. var serverurl = that.serverurl;
  196. var token = uni.getStorageSync("token");
  197. uni.request({
  198. url: serverurl + '/TEquipment/updatePassword?equipmentIds='+that.equipmentIds+'&guestPwd='+that.guestPwd+'&adminPwd='+that.adminPwd,
  199. // data: {
  200. // "equipmentIds": that.equipmentIds,
  201. // "guestPwd": that.guestPwd,
  202. // "adminPwd": that.adminPwd,
  203. // },
  204. method: "POST",
  205. header: {
  206. 'token': token
  207. },
  208. success: (res) => {
  209. if(res.data.code){
  210. uni.showToast({
  211. title: res.data.message,
  212. duration: 1000
  213. });
  214. }
  215. }
  216. });
  217. }
  218. }
  219. })
  220. },
  221. }
  222. }
  223. </script>
  224. <style>
  225. .test {
  226. text-align: center;
  227. padding: 10px 0;
  228. }
  229. .time {
  230. font-size: 78upx;
  231. }
  232. .btime {
  233. margin: 20upx;
  234. font-size: 28upx;
  235. }
  236. /* button {
  237. margin: 20upx;
  238. font-size: 28upx;
  239. } */
  240. /* #ifdef MP-ALIPAY */
  241. .uni-badge {
  242. margin-left: 20rpx;
  243. }
  244. /* #endif */
  245. .uni-badge {
  246. font-size: 40upx;
  247. }
  248. .example-body {
  249. flex-direction: row;
  250. justify-content: flex-start;
  251. padding-bottom: 15upx;
  252. font-size: 40upx;
  253. }
  254. .uni-badge-left-margin {
  255. font-size: 40upx;
  256. margin-left: 50upx;
  257. }
  258. .uni-list-cell {
  259. padding-top: 20upx;
  260. padding-bottom: 10upx;
  261. font-size: 35upx;
  262. }
  263. .line {
  264. height: 2upx;
  265. background: #8C959F;
  266. }
  267. .search {
  268. width: 100%;
  269. padding-top: 15upx;
  270. padding-bottom: 25upx;
  271. display: flex;
  272. flex-direction: row;
  273. justify-content: flex-start;
  274. }
  275. .search-title {
  276. width: 28%;
  277. text-align: center;
  278. font-size: 26upx;
  279. font-family: "PingFang-SC-Bold";
  280. }
  281. .search-input {
  282. width: 45%;
  283. text-align: center;
  284. font-size: 26upx;
  285. font-family: "PingFang-SC-Bold";
  286. box-shadow: 0upx 0upx 20upx #D3D3D3;
  287. border-radius: 5upx;
  288. }
  289. .search-input2 {
  290. width: 65%;
  291. text-align: center;
  292. font-size: 26upx;
  293. font-family: "PingFang-SC-Bold";
  294. box-shadow: 0upx 0upx 20upx #D3D3D3;
  295. border-radius: 5upx;
  296. }
  297. .search-button {
  298. width: 20%;
  299. padding-left: 7upx;
  300. text-align: center;
  301. }
  302. .select-item {
  303. /* padding-top: 20upx; */
  304. }
  305. .tr {
  306. padding-top: 15upx;
  307. display: flex;
  308. flex-direction: row;
  309. justify-content: flex-start;
  310. font-size: 48upx;
  311. font-family: "PingFang-SC-Bold";
  312. position: fixed;
  313. bottom: 100upx;
  314. width: 100%;
  315. }
  316. .button {
  317. margin: auto;
  318. width: 60%;
  319. height: 100upx;
  320. }
  321. .p1 {
  322. font-size: 48upx;
  323. }
  324. </style>