workbench.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. const app = getApp();
  2. Page({
  3. data: {
  4. isAuth: false,
  5. showAuthWin: false,
  6. showChaType: false,
  7. isPrem:false,
  8. device:false,
  9. modalHidden:true,
  10. region: [],
  11. systemMenu:[],
  12. isIcon:'N',
  13. seleteType:[{transportStatus:'00',transportStatusName:'入库'},{transportStatus:'10',transportStatusName:'出库'},{transportStatus:'20',transportStatusName:'结束'}],
  14. showDialog: false,// 详情弹窗
  15. showDialogChild: false,// 选择扫描 or 输入弹窗
  16. tableCoin: [{
  17. name: 'X201',
  18. img: '../../img/work_icon11.png',
  19. status: true,
  20. type: 'lableX201'
  21. },
  22. {
  23. name: 'X202',
  24. img: '../../img/X202.png',
  25. status: true,
  26. type: 'lableX202'
  27. },
  28. {
  29. name: 'X203',
  30. img: '../../img/work_icon11.png',
  31. status: true,
  32. type: 'lableX203'
  33. },
  34. {
  35. name: 'X101',
  36. img: '../../img/x1.png',
  37. status: true,
  38. type: 'lableX101'
  39. },
  40. {
  41. name: 'X102',
  42. img: '../../img/x102.png',
  43. status: true,
  44. type: 'lableX102'
  45. },
  46. {
  47. name: 'X103',
  48. img: '../../img/x2.png',
  49. status: true,
  50. type: 'lableX103'
  51. },
  52. {
  53. name: 'X104',
  54. img: '../../img/x1.png',
  55. status: true,
  56. type: 'lableX104'
  57. },
  58. {
  59. name: 'X105',
  60. img: '../../img/rfid.png',
  61. status: true,
  62. type: 'lableX105'
  63. },
  64. {
  65. name: 'X106',
  66. img: '../../img/x1.png',
  67. status: true,
  68. type: 'lableX106'
  69. },
  70. {
  71. name: 'X107',
  72. img: '../../img/x2.png',
  73. status: true,
  74. type: 'lableX107'
  75. },
  76. ],
  77. },
  78. onShow: function () {
  79. var that = this;
  80. //判断token,若有则假设已经登录
  81. if (wx.getStorageSync('token')) {
  82. wx.removeStorageSync('userInfo');
  83. app.requestP({
  84. url: "/user/getUserInfo",
  85. }).then(function(res){
  86. wx.setStorageSync('userInfo',res.data.data)
  87. that.setData({
  88. user : res.data.data
  89. })
  90. //获取菜单列表
  91. that.getMenu();
  92. }).catch(err=>{
  93. app.showToptip(that,'error',err.data.msg)
  94. })
  95. this.getUserDefaultMenuList();
  96. }else{
  97. //获取菜单列表
  98. that.getMenu();
  99. }
  100. //移除之前缓存的用户信息,确保拿到用户最新数据
  101. var tabarData = app.globalData.tabarData;
  102. if(Object.keys(tabarData).length !=0 ){
  103. const {loginRole, ifOverFlow, status, path} = tabarData;
  104. this.matchPage(loginRole,ifOverFlow,status,path);
  105. }
  106. var coinStatus = JSON.parse(wx.getStorageSync('labelStatus'));
  107. console.log(coinStatus)
  108. var tableCoin = this.data.tableCoin;
  109. var temp = '';
  110. tableCoin.map((coinType, index) => {
  111. Object.keys(coinStatus).forEach(key => {
  112. if (key == coinType.type) {
  113. temp = 'tableCoin[' + index + '].status'
  114. this.setData({
  115. [temp]: coinStatus[key]
  116. })
  117. }
  118. })
  119. })
  120. },
  121. /**
  122. * 生命周期函数--监听页面隐藏
  123. */
  124. onHide: function () {
  125. app.globalData.tabarData = {};
  126. },
  127. tapMenu(e) {
  128. let type = e.currentTarget.dataset.type
  129. let path = e.currentTarget.dataset.path
  130. //判断token,若有则假设已经登录
  131. if (!wx.getStorageSync('token')) {
  132. wx.redirectTo({
  133. url: '/pages/login/login',
  134. })
  135. return;
  136. }
  137. //获取用户信息,判断userInfo是否过期
  138. let userInfo = wx.getStorageSync('userInfo');
  139. /**
  140. * status: 用户角色审核状态
  141. * 0 没有选择任何角色也没做任何认证
  142. * 10 审核中
  143. * 20 审核通过
  144. * ifOverFlow:是否通过验证
  145. * N 没有选择角色
  146. * Y 已选择角色
  147. * 非register时,如果是Y说明已经处于认证状态
  148. * admin创建企业,personnel选择了企业
  149. * loginRole:用户权限
  150. * admin 管理员
  151. * doctor 医生
  152. * register 自由注册 可申请为操作员
  153. * personnel 操作员 已选择企业未认证
  154. *
  155. */
  156. const {loginRole,ifOverFlow,status} = userInfo;
  157. this.matchPage(loginRole,ifOverFlow,status,path);
  158. },
  159. matchPage(loginRole,ifOverFlow,status,path) {
  160. if(path == 'localSetting'){ //本地设置无任何权限
  161. wx.navigateTo({
  162. url: '/pages/setting/localSetting/localSetting',
  163. })
  164. return;
  165. }else if(path == 'scanSetting'){//扫描设置无任何权限
  166. wx.navigateTo({
  167. url: '/pages/setting/scanSetting/scanSetting',
  168. })
  169. return;
  170. }
  171. //判断是否选择角色
  172. if(loginRole == 'personnel' || loginRole == 'admin'){
  173. this.setData({path,loginRole});
  174. if(ifOverFlow == 'Y' && loginRole!='register'){
  175. if(status == 20){
  176. this.isAuth(path,loginRole);
  177. }else if(status == 10){
  178. app.showToptip(this,'worning','身份审核中,审核通过可以使用该功能');
  179. }else if(status == 0){
  180. app.showToptip(this,'worning','您还没有选择身份,请选择您的身份并提交认证');
  181. wx.navigateTo({
  182. url: '/pages/userAuth/chooseRole',
  183. })
  184. }
  185. }else if(ifOverFlow == 'N' && loginRole != 'register'){
  186. // this.isAuth(path);
  187. if(loginRole == 'personnel' && path != 'workerManager'){
  188. this.showModel('/pages/userAuth/workerSelect');
  189. }else if(loginRole == 'doctor' && path == 'find' || path == 'companyInfo'){
  190. this.showModel('/pages/userAuth/doctorInfo');
  191. }else if(loginRole == 'admin'){
  192. this.showModel('/pages/userAuth/adminInfo');
  193. }else{
  194. app.showToptip(this,'worning','您当前身份暂无权限');
  195. }
  196. }
  197. }else{
  198. this.setData({path,loginRole});
  199. app.showToptip(this,'worning','您还没有选择身份,请选择您的身份');
  200. wx.navigateTo({
  201. url: '/pages/userAuth/chooseRole',
  202. })
  203. }
  204. },
  205. isAuth(path,loginRole){
  206. //判断用户点击了哪个按钮
  207. if (loginRole == 'admin' || loginRole =='personnel'){
  208. if (path == "find") {
  209. //查一查
  210. this.showChaWin();
  211. } else if(path == 'orderList'){
  212. //订单列表
  213. wx.navigateTo({
  214. url: '/pages/workbench/orderList/orderList'
  215. })
  216. }else if (path == 'warningconfig') {
  217. //预警配置
  218. wx.navigateTo({
  219. url: '/pages/workbench/warningconfig/warningconfig'
  220. })
  221. } else if (path == 'coldChain') {
  222. //冷链管理
  223. wx.navigateTo({
  224. url: '/pages/workbench/tempList/tempList',
  225. })
  226. } else if (path == 'productManager') {
  227. //产品管理
  228. wx.navigateTo({
  229. url: '/pages/workbench/product/product'
  230. })
  231. } else if (path == 'commandSend') {
  232. //指令下发
  233. this.setData({
  234. isPrem: true
  235. });
  236. } else if (path == 'factorycheck') {
  237. //出厂检测
  238. this.device();
  239. } else if (path == 'iodep') {
  240. //出库入库
  241. this.showChaWin();
  242. } else if (path == 'companyInfo') {
  243. // 企业信息
  244. wx.navigateTo({
  245. url: '/pages/companyManager/companyInfo/companyInfo',
  246. })
  247. } else if (path == 'workerManager' && loginRole == 'admin') {
  248. //员工管理
  249. wx.navigateTo({
  250. url: '/pages/companyManager/companyUser/companyUser',
  251. })
  252. }else if(path == 'zyShop'){
  253. //中义商城
  254. wx.navigateTo({
  255. url: '/pages/zyShop/zyShop',
  256. })
  257. }else if(path == 'onAndOff'){
  258. // 激活锁闭
  259. app.showToptip(this,'worning','小程序暂不支持此功能,请移动到APP操作!');
  260. }else {
  261. app.showToptip(this,'worning','您当前身份暂无权限');
  262. }
  263. }else if(loginRole == 'doctor'){
  264. if (path == "find") {
  265. //查一查
  266. this.showChaWin();
  267. }else if (path == 'companyInfo') {
  268. // 企业信息
  269. wx.navigateTo({
  270. url: '/pages/companyManager/companyInfo/companyInfo',
  271. })
  272. } else{
  273. app.showToptip(this,'worning','您当前身份暂无权限');
  274. }
  275. }
  276. },
  277. getMenu() {
  278. const that = this;
  279. //如果有token,则去拉取菜单列表,相反则只显示界面
  280. var loginRole = '';
  281. if(wx.getStorageSync('token')){
  282. var user = this.data.user;
  283. console.log(user);
  284. loginRole = user.loginRole
  285. }
  286. app.requestP({
  287. needToken: false,
  288. url: "/query/listMenu",
  289. data:{
  290. roleKey:loginRole || '',
  291. }
  292. }).then(function (res) {
  293. that.setData({
  294. menuList: res.data.data
  295. })
  296. }).catch(err=>{
  297. app.showToptip(that,'error',err.data.msg)
  298. })
  299. },
  300. myevent(e){
  301. var that = this;
  302. var systemMenu = this.data.systemMenu;
  303. var arr = [];
  304. let userInfo = wx.getStorageSync('userInfo');
  305. systemMenu.map(item=>{
  306. arr.push(item.menuId)
  307. })
  308. this.setData({
  309. isIcon:e.detail.flag
  310. })
  311. if(e.detail.flag == 'N'){
  312. app.requestP({
  313. url:'/userDeaultMenu/add',
  314. method:'post',
  315. data:{
  316. userId:userInfo.userId,
  317. menuIds:arr
  318. }
  319. }).then(res=>{
  320. app.showToptip(that,'success',res.data.msg)
  321. }).catch(err=>{
  322. app.showToptip(that,'error',err.data.msg)
  323. })
  324. }
  325. },
  326. getUserDefaultMenuList(){
  327. var that = this;
  328. app.requestP({
  329. url:'/userDeaultMenu/list',
  330. method:'post',
  331. }).then(res=>{
  332. that.setData({
  333. systemMenu:res.data.data
  334. })
  335. }).catch(err=>{
  336. app.showToptip(that,'error',err.data.msg)
  337. })
  338. },
  339. iconJian(e){
  340. var that = this;
  341. var menuId = e.currentTarget.dataset.menuId;
  342. var index = e.currentTarget.dataset.index;
  343. var systemMenu = this.data.systemMenu;
  344. var arr = systemMenu;
  345. arr.splice(index,1);
  346. this.setData({
  347. systemMenu:arr
  348. })
  349. },
  350. iconJia(e){
  351. var that = this;
  352. var systemMenu = this.data.systemMenu;
  353. var menu = e.currentTarget.dataset.menu;
  354. if(systemMenu.length >= 4){
  355. app.showToptip(this,'error','常用功能按钮最多为4个')
  356. }else{
  357. for(var i=0;i<systemMenu.length;i++){
  358. if(systemMenu[i].menuId == menu.id){
  359. app.showToptip(that,'error','已经有该按钮,请勿重复选择')
  360. return;
  361. }
  362. }
  363. var arr = systemMenu;
  364. arr.push({...menu,menuName:menu.label,menuId:menu.id,});
  365. this.setData({
  366. systemMenu:arr
  367. })
  368. }
  369. console.log(systemMenu);
  370. },
  371. getUser() {
  372. const that = this
  373. //去拉取用户数据
  374. app.requestP({
  375. url: "/user/getUserInfo",
  376. }).then(function (res) {
  377. wx.setStorageSync('userInfo', res.data.data)
  378. that.setData({
  379. user: res.data.data
  380. })
  381. })
  382. },
  383. //权限弹窗控制
  384. showAuthWin() {
  385. this.setData({
  386. showAuthWin: true
  387. })
  388. },
  389. closeAuthWin() {
  390. this.setData({
  391. showAuthWin: false
  392. })
  393. },
  394. //查一查弹框控制
  395. showChaWin() {
  396. this.setData({
  397. showChaType: true
  398. })
  399. },
  400. closeChaWin() {
  401. this.setData({
  402. showChaType: false,
  403. device:false
  404. })
  405. },
  406. device(){
  407. this.setData({
  408. device: true
  409. })
  410. },
  411. //开启扫码系统
  412. goScan(e) {
  413. var type = e.currentTarget.dataset.item;
  414. var that = this;
  415. var {path,devicetype} = that.data;
  416. wx.scanCode({
  417. success: function (res) {
  418. var {result} = res;
  419. if(result.indexOf('imei=') != -1){
  420. result = result.slice(result.indexOf('imei=')+5,result.length)
  421. }
  422. if(path == 'find'){
  423. if(that.data.loginRole == 'doctor'){
  424. wx.navigateTo({
  425. url: '/pages/workbench/scanningType/scanningType?inoculatorId='+result+'&path='+path,
  426. })
  427. }else{
  428. that.searchChainCheckBind(result).then(res=>{
  429. var id = res.data.msg;
  430. that.closeChaWin()
  431. that.setData({
  432. showDialog:!that.data.showDialog,
  433. detailId:id,
  434. showDialogChild:!that.data.showDialogChild,
  435. deviceCode:result //867992041247453
  436. })
  437. })
  438. }
  439. }else if(path == 'factorycheck'){
  440. wx.navigateTo({
  441. url: '/pages/device/info?imei='+result+'&devicetype='+devicetype,
  442. })
  443. }else if(path == 'iodep'){
  444. that.searchChainCheckBind(result).then(res=>{
  445. const {transportStatus,id,code} = res.data.chain;
  446. that.setData({
  447. transportStatus,
  448. iodepId:id,
  449. modalHidden:!that.data.modalHidden,
  450. showDialogChild:!that.data.showDialogChild,
  451. seleteType:that.setSeleteType(transportStatus),
  452. });
  453. })
  454. }
  455. },
  456. fail:function(err){
  457. app.showToptip(that, 'error', '二维码无效');
  458. }
  459. })
  460. },
  461. // 查询当前冷链是否绑定
  462. searchChainCheckBind(result){
  463. var that = this;
  464. return new Promise((resolve,reject)=>{
  465. app.requestP({
  466. url:'/chainBound/checkBind',
  467. method:'post',
  468. data:{
  469. deviceCode:result,
  470. }
  471. }).then(res=>{
  472. if(res.data.data != 1){
  473. app.showToptip(that,'error',res.data.msg);
  474. return;
  475. }
  476. app.requestP({
  477. url:'/chain/scan',
  478. method:'post',
  479. contentType:' application/json',
  480. data:{
  481. inoculatorId:'',
  482. payload:result,
  483. type:that.data.devicetype,
  484. }
  485. }).then(res=>{
  486. resolve(res)
  487. }).catch(err=>{
  488. reject()
  489. app.showToptip(that,'error',err.data.msg);
  490. })
  491. }).catch(err=>{
  492. reject()
  493. app.showToptip(that,'error',err.data.msg);
  494. })
  495. })
  496. },
  497. setTransportStatus(transportStatus){
  498. var seleteType = this.data.seleteType;
  499. var deptType;
  500. for(var i=0;i<seleteType.length;i++){
  501. if(seleteType[i].transportStatus == transportStatus){
  502. deptType = i;
  503. break;
  504. }
  505. }
  506. return deptType;
  507. },
  508. setSeleteType(transportStatus){
  509. var seleteType = this.data.seleteType;
  510. var type;
  511. for(var i=0;i<seleteType.length;i++){
  512. if(seleteType[i].transportStatus == transportStatus){
  513. seleteType.splice(i,1);
  514. break;
  515. }
  516. }
  517. this.setTransportStatus(transportStatus);
  518. return seleteType;
  519. },
  520. closePremWin(){
  521. this.setData({
  522. isPrem:false,
  523. iptValue:''
  524. })
  525. },
  526. setValue:function (e){
  527. const that = this;
  528. var iptValue = e.detail.value.substr(0,6)
  529. this.setData({
  530. iptValue
  531. })
  532. if(iptValue.length>=6){
  533. app.requestP({
  534. url:'/commandAuth/checkPremise',
  535. method:'post',
  536. data:{
  537. password:iptValue
  538. }
  539. }).then(res=>{
  540. this.setData({
  541. isPrem:false,
  542. iptValue:''
  543. })
  544. wx.navigateTo({
  545. url: '/pages/instruct/instruct',
  546. })
  547. }).catch(err=>{
  548. this.setData({
  549. isPrem:false,
  550. iptValue:''
  551. })
  552. app.showToptip(that, "error",err.data.msg);
  553. })
  554. }
  555. },
  556. setModalVal(e){
  557. this.setData({
  558. modalVal:e.detail.value
  559. })
  560. },
  561. modalBindaconfirm(){ //二型保存地址
  562. var that = this;
  563. var {region,modalVal,transportStatus,iodepId,seleteType,deptType} = that.data;
  564. var addr = region.join('')+modalVal;
  565. if(region.join('') && modalVal && seleteType[deptType].transportStatus){
  566. app.requestP({
  567. url:'/chain/editTransport',
  568. // contentType:' application/json',
  569. method:'post',
  570. data:{
  571. addr,
  572. chainId:iodepId,
  573. transportStatus:seleteType[deptType].transportStatus, // 00 已入库 //10 已出库 //20 已结束
  574. }
  575. }).then(res=>{
  576. that.setData({
  577. modalHidden:!that.data.modalHidden,
  578. region:[],
  579. modalVal:'',
  580. iodepId:'',
  581. deptType:'',
  582. seleteType:[{transportStatus:'00',transportStatusName:'入库'},{transportStatus:'10',transportStatusName:'出库'},{transportStatus:'20',transportStatusName:'结束'}],
  583. })
  584. app.showToptip(that,'success',res.data.msg);
  585. }).catch(err=>{
  586. app.showToptip(that,'error',err.data.msg);
  587. })
  588. }else{
  589. app.showToptip(that,'error','地址和运输状态不能为空');
  590. }
  591. },
  592. //取消按钮点击事件
  593. modalBindcancel:function(){
  594. this.setData({
  595. modalHidden:!this.data.modalHidden,
  596. region:[],
  597. modalVal:'',
  598. iodepId:'',
  599. deptType:'',
  600. seleteType:[{transportStatus:'00',transportStatusName:'入库'},{transportStatus:'10',transportStatusName:'出库'},{transportStatus:'20',transportStatusName:'结束'}],
  601. })
  602. },
  603. regionChange: function(e) {
  604. this.setData({
  605. region: e.detail.value
  606. })
  607. },
  608. showModel(url){ //提示弹框
  609. wx.showModal({
  610. title: '您还未认证,暂无权限',
  611. // content: '确定要删除该图片?',
  612. showCancel: true, //是否显示取消按钮
  613. cancelText: "取消", //默认是“取消”
  614. cancelColor: '#000', //取消文字的颜色
  615. confirmText: "去认证", //默认是“确定”
  616. confirmColor: '#2D59E6', //确定文字的颜色
  617. success: function (res) {
  618. if (res.cancel) {
  619. //点击取消,默认隐藏弹框
  620. } else {
  621. //点击去认证
  622. wx.navigateTo({
  623. url: url,
  624. })
  625. }
  626. },
  627. fail: function (res) {}, //接口调用失败的回调函数
  628. complete: function (res) {}, //接口调用结束的回调函数(调用成功、失败都会执行)
  629. })
  630. },
  631. setType(e){
  632. var value = e.detail.value;
  633. var that = this;
  634. that.setData({
  635. deptType:value
  636. })
  637. },
  638. toggleDialog() { //详情弹窗
  639. this.setData({
  640. showDialog: !this.data.showDialog,
  641. devicetype:''
  642. });
  643. },
  644. goDetail(){
  645. var detailId = this.data.detailId;
  646. var deviceCode = this.data.deviceCode;
  647. wx.navigateTo({
  648. url: '/pages/workbench/hierarchy/hierarchy?id='+detailId+'&deviceCode='+deviceCode,
  649. })
  650. this.setData({
  651. showDialog:!this.data.showDialog,
  652. devicetype:''
  653. })
  654. },
  655. clearBind(){
  656. var that = this;
  657. var detailId = that.data.detailId;
  658. var deviceCode = that.data.deviceCode;
  659. app.requestP({
  660. url:'/chainBound/unbind',
  661. method:'post',
  662. contentType:' application/json',
  663. data:{
  664. chainId:detailId,
  665. deviceCode,
  666. }
  667. }).then(res=>{
  668. that.setData({
  669. detailId:'',
  670. showDialog:!that.data.showDialog,
  671. })
  672. app.showToptip(that,'success',res.data.msg)
  673. }).catch(err=>{
  674. app.showToptip(that,'error',err.data.msg)
  675. })
  676. },
  677. isScan(){
  678. //goScan
  679. this.setData({
  680. showDialogChild:!this.data.showDialogChild
  681. })
  682. },
  683. inputBind(){
  684. var that = this;
  685. var {path,devicetype} = that.data;
  686. wx.showModal({
  687. title: '请输入标签编号',
  688. editable:true,
  689. success (res) {
  690. if (res.confirm) {
  691. var numreg = /^[0-9]*$/;
  692. if(res.content){
  693. if(!numreg.test(res.content)){
  694. app.showToptip(that, "error", "标签编号只能为数字!");
  695. that.inputBind()
  696. return;
  697. }
  698. if(path == 'factorycheck'){
  699. wx.navigateTo({
  700. url: '/pages/device/info?imei='+res.content+'&devicetype='+devicetype,
  701. })
  702. }else if(path == 'iodep'){
  703. that.searchChainCheckBind(res.content).then(result=>{
  704. const {transportStatus,id,code} = result.data.chain;
  705. that.setData({
  706. transportStatus,
  707. iodepId:id,
  708. modalHidden:!that.data.modalHidden,
  709. showDialogChild:!that.data.showDialogChild,
  710. seleteType:that.setSeleteType(transportStatus),
  711. });
  712. })
  713. }else if(path == 'find'){
  714. that.searchChainCheckBind(res.content).then(result=>{
  715. var id = result.data.msg;
  716. that.closeChaWin()
  717. that.setData({
  718. showDialog:!that.data.showDialog,
  719. detailId:id,
  720. showDialogChild:!that.data.showDialogChild,
  721. deviceCode:res.content //867992041247453
  722. })
  723. })
  724. }
  725. }else{
  726. app.showToptip(that, "error",'标签编号不能为空!')
  727. that.inputBind()
  728. }
  729. }else{
  730. //pass
  731. }
  732. }
  733. })
  734. },
  735. downDialog() { //弹窗关闭
  736. this.setData({
  737. showDialogChild: !this.data.showDialogChild,
  738. devicetype:''
  739. });
  740. },
  741. goScanSetting(e) {
  742. var type = e.currentTarget.dataset.type
  743. var uris = type?"?from="+type:""
  744. wx.navigateTo({
  745. url: '/pages/setting/scanSetting/scanSetting'+uris,
  746. })
  747. },
  748. addChain(e) {
  749. const type = e.currentTarget.dataset.type;
  750. const path = this.data.path;
  751. const noAdd = ['lableX101', 'lableX102', 'lableX103', 'lableX105', 'lableX106', 'lableX107','NFC'];
  752. if (noAdd.indexOf(type) != -1) {
  753. app.showToptip(this, 'error', '该标签暂不支持在小程序操作,请移动到APP操作!')
  754. return;
  755. }
  756. // 104 一型无源
  757. switch (type) {
  758. case 'lableX104':
  759. wx.navigateTo({
  760. url: '/pages/nfc/zhuisu2?path='+path+'&type=X104&loginRole='+this.data.loginRole,
  761. })
  762. break;
  763. default:
  764. this.setData({
  765. showDialogChild:!this.data.showDialogChild,
  766. devicetype:type.substr(5)
  767. })
  768. break;
  769. }
  770. },
  771. toggleDialog() { //弹窗关闭
  772. this.setData({
  773. showDialog: !this.data.showDialog,
  774. devicetype:''
  775. });
  776. },
  777. })