updatePassword.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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" size="mini" 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. uni.setNavigationBarTitle({
  78. title: this.$t('remoteList.password')
  79. });
  80. var token = uni.getStorageSync("token");
  81. if (token.length > 1) {
  82. this.getEquipmentListData();
  83. } else {
  84. uni.reLaunch({
  85. url: '../../../pages/Login/Login',
  86. });
  87. }
  88. },
  89. onLoad() {
  90. },
  91. methods: {
  92. ...mapActions('chart', ['getEquipmentListByUser', 'addAlarmClock', 'addAlarmClockItem', 'updateAlarmClock']),
  93. getEquipmentListData() {
  94. this.getEquipmentListByUser(this.globalUser)
  95. .then(data => {
  96. // this.merchantList = data;
  97. // console.log("1223");
  98. var listName = data[0].equipmentList;
  99. var equipmentNameList = this.equipmentNameList;
  100. var co = {};
  101. co["value"] = 'all';
  102. co["label"] = '全部机器ALL machine';
  103. equipmentNameList.push(co);
  104. for (var i = 0; i < listName.length; i++) {
  105. var cov = {};
  106. cov["value"] = listName[i].id;
  107. cov["label"] = this.$t('common.name') + listName[i].name + ' , '+ this.$t('common.ID') + listName[i].clientId.substring(
  108. listName[i].clientId.length - 6, listName[i].clientId.length);
  109. equipmentNameList.push(cov);
  110. }
  111. this.equipmentNameList = equipmentNameList;
  112. var listId = data[0].id;
  113. if (listId != null && listId != '1') {
  114. uni.setStorageSync("listName", listName);
  115. }
  116. uni.stopPullDownRefresh();
  117. }, _ => void uni.stopPullDownRefresh());
  118. },
  119. onSelected(e) { //选择
  120. this.showPicker = false;
  121. if (e) {
  122. this[this.type] = e.value;
  123. //选择的值
  124. // console.log('value => ' + e.value);
  125. //原始的Date对象
  126. // console.log('date => ' + e.date);
  127. }
  128. },
  129. // bindPickerChange: function(e) {
  130. // this.indexType = e.target.value
  131. // },
  132. addEids(equipmentIds) {
  133. // console.log('equipmentIds' + equipmentIds);
  134. var eids = equipmentIds.split(",");
  135. var idss = this.equipmentIds;
  136. var is = this.equipmentNameList
  137. for (var k = 0; k < eids.length; k++) {
  138. var id = eids[k];
  139. if (id != "" && id != '') {
  140. this.equipmentIds.push(parseInt(id));
  141. }
  142. }
  143. },
  144. search() {
  145. // console.log("search");
  146. var clientId = this.searchClientId;
  147. var list = uni.getStorageSync("listName");
  148. var n = 0;
  149. for (var i = 0; i < list.length; i++) {
  150. var code = list[i].clientId.substring(list[i].clientId.length - 6, list[i].clientId.length);
  151. if (code == clientId) {
  152. n++;
  153. var id = list[i].id;
  154. this.equipmentIds.push(id);
  155. break;
  156. }
  157. }
  158. if (n == 0) {
  159. uni.showModal({
  160. title: "提示",
  161. content: "找不到该机器",
  162. success: (res) => {
  163. }
  164. })
  165. }
  166. if (n > 0) {
  167. uni.showModal({
  168. title: "提示",
  169. content: "已添加该机器",
  170. success: (res) => {
  171. }
  172. })
  173. }
  174. },
  175. selectChange2(val) {
  176. //有改动文件 import likeButton from "../../components/like-button/like-button.vue";
  177. if (val == "all") {
  178. this.equipmentIds = [];
  179. var list = uni.getStorageSync("listName");
  180. for (var i = 0; i < list.length; i++) {
  181. this.equipmentIds.push(list[i].id);
  182. }
  183. } else {
  184. this.equipmentIds = val
  185. }
  186. // console.log('this.equipmentIds => ' + this.equipmentIds);
  187. },
  188. switchChange: function(e) {
  189. this.status = e.target.value;
  190. },
  191. update() {
  192. var that = this;
  193. uni.showModal({
  194. title: that.$t('equipmentStatusList.tip'),
  195. content:that.$t('updatePassword.sure') ,
  196. success: (re) => {
  197. if (re.confirm) {
  198. var serverurl = that.serverurl;
  199. var token = uni.getStorageSync("token");
  200. uni.request({
  201. url: serverurl + '/TEquipment/updatePassword?equipmentIds='+that.equipmentIds+'&guestPwd='+that.guestPwd+'&adminPwd='+that.adminPwd,
  202. // data: {
  203. // "equipmentIds": that.equipmentIds,
  204. // "guestPwd": that.guestPwd,
  205. // "adminPwd": that.adminPwd,
  206. // },
  207. method: "POST",
  208. header: {
  209. 'token': token
  210. },
  211. success: (res) => {
  212. if(res.data.code){
  213. uni.showToast({
  214. title: res.data.message,
  215. duration: 1000
  216. });
  217. }
  218. }
  219. });
  220. }
  221. }
  222. })
  223. },
  224. }
  225. }
  226. </script>
  227. <style>
  228. .test {
  229. text-align: center;
  230. padding: 10px 0;
  231. }
  232. .time {
  233. font-size: 78upx;
  234. }
  235. .btime {
  236. margin: 20upx;
  237. font-size: 28upx;
  238. }
  239. /* button {
  240. margin: 20upx;
  241. font-size: 28upx;
  242. } */
  243. /* #ifdef MP-ALIPAY */
  244. .uni-badge {
  245. margin-left: 20rpx;
  246. }
  247. /* #endif */
  248. .uni-badge {
  249. font-size: 40upx;
  250. }
  251. .example-body {
  252. flex-direction: row;
  253. justify-content: flex-start;
  254. padding-bottom: 15upx;
  255. font-size: 40upx;
  256. }
  257. .uni-badge-left-margin {
  258. font-size: 40upx;
  259. margin-left: 50upx;
  260. }
  261. .uni-list-cell {
  262. padding-top: 20upx;
  263. padding-bottom: 10upx;
  264. font-size: 35upx;
  265. }
  266. .line {
  267. height: 2upx;
  268. background: #8C959F;
  269. }
  270. .search {
  271. width: 100%;
  272. padding-top: 15upx;
  273. display: flex;
  274. flex-direction: row;
  275. justify-content: flex-start;
  276. }
  277. .search-title {
  278. width: 28%;
  279. text-align: center;
  280. font-size: 26upx;
  281. font-family: "PingFang-SC-Bold";
  282. }
  283. .search-input{
  284. width: 48%;
  285. height: 25px;
  286. text-align: center;
  287. font-size: 26upx;
  288. /* font-family: "PingFang-SC-Bold"; */
  289. box-shadow: 0upx 0upx 20upx #D3D3D3;
  290. border-radius: 5upx;
  291. }
  292. .search-button{
  293. width: 20%;
  294. padding-left: 10px;
  295. padding-bottom: 5px;
  296. text-align: center;
  297. height: 60upx;
  298. text-align: left;
  299. }
  300. .search-input2 {
  301. width: 65%;
  302. text-align: center;
  303. font-size: 26upx;
  304. font-family: "PingFang-SC-Bold";
  305. box-shadow: 0upx 0upx 20upx #D3D3D3;
  306. border-radius: 5upx;
  307. }
  308. .select-item {
  309. /* padding-top: 20upx; */
  310. }
  311. .tr {
  312. padding-top: 15upx;
  313. display: flex;
  314. flex-direction: row;
  315. justify-content: flex-start;
  316. font-size: 48upx;
  317. font-family: "PingFang-SC-Bold";
  318. position: fixed;
  319. bottom: 100upx;
  320. width: 100%;
  321. }
  322. .button {
  323. margin: auto;
  324. width: 60%;
  325. height: 100upx;
  326. }
  327. .p1 {
  328. font-size: 48upx;
  329. }
  330. </style>