| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048 |
- import * as echarts from '../../ec-canvas/echarts';
- var dateTimePicker = require('../../utils/dateTimePicker');
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- details: {
- chainName: '-',
- chainCode: '-',
- packageTypeName: '-',
- productName: '-',
- num: '-',
- startTime: '-',
- transportStatusName: '-',
- userName: '-',
- telephone: '-',
- productId: '',
- status: '',
- chainId: '',
- },
- boundDevice: {},
- ec: {
- lazyLoad: true,
- },
- nav: 0,
- startDate: "", //开始时间
- endDate: "", //结束时间
- isshow: true,
- isShowText: '显示冷链',
- deviceCode: '',
- modalHidden: true,
- modalVal: '', // 解除预警信息
- deptType: '',
- seleteType: [{
- transportStatus: '00',
- transportStatusName: '已入库'
- }, {
- transportStatus: '10',
- transportStatusName: '已出库'
- }, {
- transportStatus: '20',
- transportStatusName: '已结束'
- }],
- region: [],
- allMoer: false,
- chainBoundId: '',
- tableCoin: [{
- name: 'X201',
- img: '../../img/work_icon11.png',
- status: true,
- type: 'lableX201'
- },
- {
- name: 'X202',
- img: '../../img/X202.png',
- status: true,
- type: 'lableX202'
- },
- {
- name: 'X203',
- img: '../../img/work_icon11.png',
- status: true,
- type: 'lableX203'
- },
- {
- name: 'X101',
- img: '../../img/x1.png',
- status: true,
- type: 'lableX101'
- },
- {
- name: 'X102',
- img: '../../img/x102.png',
- status: true,
- type: 'lableX102'
- },
- {
- name: 'X103',
- img: '../../img/x2.png',
- status: true,
- type: 'lableX103'
- },
- {
- name: 'X104',
- img: '../../img/x1.png',
- status: true,
- type: 'lableX104'
- },
- {
- name: 'X105',
- img: '../../img/rfid.png',
- status: true,
- type: 'lableX105'
- },
- {
- name: 'X106',
- img: '../../img/x1.png',
- status: true,
- type: 'lableX106'
- },
- {
- name: 'X107',
- img: '../../img/x2.png',
- status: true,
- type: 'lableX107'
- },
- ],
- showDialog: false, //扫码弹窗
- transportOrder:{},
- allActive: '展开更多',
- isAll: false,
- showChainTimeStatus:false,// 运单补录展示状态
- // 时间
- dateTimeArray1: null,
- dateTime1: null,
- startYear: null,
- endYear: null,
- estiTime:null,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- const that = this;
- //获取用户信息,判断userInfo是否过期
- let userInfo = wx.getStorageSync('userInfo');
- /**
- * status: 用户角色审核状态
- * 0 没有选择任何角色也没做任何认证
- * 10 审核中
- * 20 审核通过
- * ifOverFlow:是否通过验证
- * N 没有选择角色
- * Y 已选择角色
- * 非register时,如果是Y说明已经处于认证状态
- * admin创建企业,personnel选择了企业
- * loginRole:用户权限
- * admin 管理员
- * doctor 医生
- * register 自由注册 可申请为操作员
- * personnel 操作员 已选择企业未认证
- *
- */
- const {loginRole,ifOverFlow,status} = userInfo;
- that.setData({
- ispdfBut: loginRole == 'admin' ? true : loginRole == 'personnel' ? true : false,
- options,
- userInfo: wx.getStorageSync('userInfo')
- });
- this.getTime();
- //获取定位信息
- wx.getLocation({
- altitude: 'altitude',
- success(res) {
- that.setData({
- latitude: res.latitude,
- longitude: res.longitude,
- userLatitude: res.latitude,
- userLongitude: res.longitude,
- })
- },
- error() {
- app.showToptip(that, "worning", "获取位置信息失败")
- }
- })
- },
- onShow() {
- var options = this.data.options;
- this.getTransInfo(options);
- this.getInfo(options);
- this.getBoundDevice(options);
- var coinStatus = JSON.parse(wx.getStorageSync('labelStatus'));
- var tableCoin = this.data.tableCoin;
- var temp = '';
- tableCoin.map((coinType, index) => {
- Object.keys(coinStatus).forEach(key => {
- if (key == coinType.type) {
- temp = 'tableCoin[' + index + '].status'
- this.setData({
- [temp]: coinStatus[key]
- })
- }
- })
- })
- },
- getTransInfo(params = {}) {
- var that = this;
- wx.showLoading({
- title: '正在加载...',
- mask: true
- })
- app.requestP({
- url: "/transport/get?id="+params.cid,
- method: "get",
- }).then(res => {
- var transportOrder = res.data.transportOrder;
- that.setData({transportOrder})
- })
- },
- getInfo(params = {}) {
- var that = this;
- const { deviceType, deviceCode, pid, chainBoundId } = params;
- var seleteType = that.data.seleteType;
- wx.showLoading({
- title: '正在加载...',
- mask: true
- })
- app.requestP({
- url: "/chain/info",
- method: "post",
- data: {
- chainId: params.id || '',
- parentId: pid || 0,
- }
- }).then(res => {
- var data = res.data.data;
- const {
- chainId
- } = data;
- that.setData({
- details: data,
- // deptType:that.setTransportStatus(data.transportStatus),
- seleteType: that.setSeleteType(data.transportStatus),
- deviceCode,
- chainBoundId,
- })
- that.getHistory({
- chainId,
- searchTag: '0',
- deviceCode,
- chainBoundId,
- });
- that.getTempLine({
- chainId,
- searchTag: '0',
- deviceCode,
- deviceType,
- chainBoundId
- })
- }).catch(err => {
- app.showToptip(that, "error", "数据获取失败,请稍后再试")
- // 隐藏导航栏加载框
- wx.hideNavigationBarLoading();
- // 停止下拉动作
- wx.stopPullDownRefresh();
- })
- },
- setTransportStatus(transportStatus) {
- var seleteType = this.data.seleteType;
- var deptType;
- for (var i = 0; i < seleteType.length; i++) {
- if (seleteType[i].transportStatus == transportStatus) {
- deptType = i;
- break;
- }
- }
- return deptType;
- },
- setSeleteType(transportStatus) {
- var seleteType = this.data.seleteType;
- var type;
- for (var i = 0; i < seleteType.length; i++) {
- if (seleteType[i].transportStatus == transportStatus) {
- seleteType.splice(i, 1);
- break;
- }
- }
- this.setTransportStatus(transportStatus); //暂时不用
- return seleteType;
- },
- setType(e) {
- //数据
- var value = e.detail.value;
- var that = this;
- var chainId = that.data.details.chainId;
- var seleteType = that.data.seleteType;
- that.setData({
- deptType: value + ""
- })
- // app.requestP({
- // url:'/chain/editTransport',
- // method:'post',
- // data:{
- // addr:'',
- // chainId,
- // transportStatus:seleteType[value].transportStatus,
- // }
- // }).then(res=>{
- // that.setData({
- // deptType:value+''
- // })
- // app.showToptip(that,'success',res.data.msg)
- // }).catch(err=>{
- // app.showToptip(that,'error',err.data.msg)
- // })
- },
- setTransportStatus(transportStatus) {
- var seleteType = this.data.seleteType;
- var deptType;
- for (var i = 0; i < seleteType.length; i++) {
- if (seleteType[i].transportStatus == transportStatus) {
- deptType = i;
- break;
- }
- }
- return deptType;
- },
- getBoundDevice(params = {}) {
- var that = this;
- wx.showLoading({
- title: '正在加载...',
- mask: true
- })
- app.requestP({
- url: "/chainBound/boundDevice",
- method: 'post',
- data: {
- chainId: params.id
- }
- }).then(res => {
- const data = res.data.data;
- Object.keys(data).forEach(key => {
- if (data[key].length == 0) {
- delete data[key]
- }
- // 没有子冷链概念
- if(key == 'childNum'){
- delete data[key]
- }
- })
- that.setData({
- boundDevice: data
- })
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg)
- })
- },
- goDetails(e) {
- var that = this;
- var json = encodeURIComponent(JSON.stringify(e.currentTarget.dataset));
- wx.navigateTo({
- url: '/pages/query/vvmInfo?details=' + json + '&id=' + that.data.options.id,
- })
- },
- getHistory(params = {}) {
- var that = this;
- //chainId,deviceCode,endTime,searchTag,startTime
- app.requestP({
- url: '/chainLocal/localHistory',
- method: 'post',
- contentType: ' application/json',
- data: {
- ...params,
- }
- }).then(res => {
- that.setData({
- deviceCode: res.data.data.deviceCode || that.data.deviceCode || 'N/A',
- })
- that.setLocus(res.data.data);
- }).catch(err => {
- that.setLocus({
- points: []
- });
- // app.showToptip(that, 'error', err.data.msg)
- })
- },
- goChainCold() {
- var that = this;
- wx.navigateTo({
- url: '/pages/query/childlist/childlist?chainId=' + that.data.details.chainId
- })
- },
- setLocus(data) {
- const that = this;
- const {
- status,
- transportType,
- points
- } = data;
- let locations = points;
- for (let i in locations) { //设置起始marker
- locations[i].id = i - 0
- if (i == 0) {
- locations[i].iconPath = "/img/map_icon1.png";
- locations[i].width = 38;
- locations[i].height = 40;
- }
- if (i == locations.length - 1) {
- locations[i].iconPath = "/img/index_icon_" + transportType + '' + status + '' + ".png";
- locations[i].width = 54;
- locations[i].height = 54;
- }
- locations[i].latitude = locations[i].lat;
- locations[i].longitude = locations[i].lng;
- }
- that.mapCtx = wx.createMapContext('index_map');
- if (locations.length) {
- that.setData({
- latitude: locations[0].lat || that.data.userLatitude,
- longitude: locations[0].lng || that.data.userLongitude,
- markers: [locations[0], locations[locations.length - 1]],
- polyline: [{
- color: '#2D59E6',
- width: 2,
- points: points,
- // arrowLine:true
- }]
- })
- that.mapCtx.includePoints({
- points: points,
- padding: [50, 50, 50, 50]
- })
- } else {
- that.setData({
- latitude: that.data.userLatitude,
- longitude: that.data.userLongitude,
- markers: [{
- iconPath: '/img/index_icon_5000.png',
- width: '54',
- height: '54',
- latitude: that.data.latitude,
- longitude: that.data.longitude
- }],
- polyline: [{
- color: '#2D59E6',
- width: 2,
- points: [],
- // arrowLine:true
- }]
- })
- }
- that.data.locations = locations
- },
- getTempLine(params = {}) {
- const that = this;
- app.requestP({
- url: '/chain/tempLine',
- method: 'post',
- contentType: ' application/json',
- data: {
- ...params
- }
- }).then(res => {
- var data = res.data.data.temps;
- that.setData({
- temperature: data
- })
- if (data.length != 0) {
- that.setTemp(data);
- } else {
- // app.showToptip(that, 'error', '暂无温度数据');
- }
- }).catch(err => {
- // app.showToptip(that, 'error', '暂无温度数据');
- })
- },
- setTemp(data) {
- const that = this;
- that.ecWen = that.selectComponent('#ecDomWen');
- that.ecWen.init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr // new
- });
- var option = that.getOption();
- option.xAxis.data = data.map(v => v.createTime.replace(" ", "\n"))
- option.series[0].data = data.map(v => v.temp)
- option.dataZoom = [{
- type: "slider",
- start: 0,
- end: (100 / data.length) * 15, //显示五个
- },
- {
- type: "inside",
- start: 0,
- end: (100 / data.length) * 15, //显示五个
- },
- ]
- chart.setOption(option);
- return chart;
- })
- },
- getOption() {
- return {
- tooltip: {
- show: true,
- formatter: '{b}\n{c}℃',
- trigger: "axis",
- position: "top"
- },
- grid: {
- top: '5%',
- left: '0%',
- right: '5%',
- bottom: '18%',
- containLabel: true
- },
- xAxis: {
- type: 'category',
- nameTextStyle: {
- color: "#77869E",
- fontSize: 10
- },
- axisLabel: {
- color: "#cccccc",
- fontSize: 8,
- },
- axisLine: {
- onZero: false,
- lineStyle: {
- color: "#cccccc"
- }
- },
- axisTick: {
- show: false
- },
- splitLine: {
- show: true,
- },
- data: ['16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30', '16:00 \n 2021-06-30']
- },
- yAxis: {
- type: 'value',
- splitNumber: 10,
- max: 40,
- axisLine: {
- lineStyle: {
- color: "#cccccc"
- },
- show: true
- },
- },
- series: [{
- type: 'line',
- showSymbol: false,
- smooth: true,
- lineStyle: {
- width: 1,
- color: "#328EFD", //#D4D4D4
- },
- markLine: {
- lineStyle: {
- color: "#F22424",
- },
- data: [{
- yAxis: 40
- }]
- },
- markPoint: {
- symbolSize: 30,
- //symbol:'diamond',
- label: {
- fontSize: 8,
- },
- data: [{
- type: 'max',
- name: '最大值'
- },
- {
- type: 'min',
- name: '最小值'
- }
- ]
- },
- areaStyle: {
- origin: "start",
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [{
- offset: 0,
- color: '#FFFFFF' //
- }, {
- offset: 1,
- color: '#4C96FE' //#D4D4D4
- }],
- global: false
- }
- },
- data: [18, 36, 25, 30, -20, 40, 33]
- }]
- }
- },
- endDateChange(e) {
- this.setData({
- endDate: e.detail.value
- })
- },
- startDateChange(e) {
- this.setData({
- startDate: e.detail.value
- })
- },
- submitDate() {
- this.getTemp(1, this.data.options);
- },
- getTemp(type, params = {}) {
- var that = this;
- const {deviceCode,deviceType} = params;
- const chainId = that.data.details.chainId;
- var endDate = that.data.endDate;
- var startDate = that.data.startDate;
- if (type == 1) {
- if (endDate && startDate) {} else {
- app.showToptip(that, "worning", "请选择起止时间")
- return
- }
- }
- wx.showLoading({
- mask: true
- })
- this.getHistory({
- chainId,
- searchTag: 1,
- deviceCode,
- endTime: endDate + ' 23:59:59',
- startTime: startDate + ' 00:00:00'
- });
- this.getTempLine({
- chainId,
- searchTag: 1,
- deviceCode,
- deviceType,
- endTime: endDate + ' 23:59:59',
- startTime: startDate + ' 00:00:00'
- })
- },
- setNav(e) {
- var nav = e.currentTarget.dataset.val;
- const { deviceCode, deviceType, chainBoundId } = this.data.options;
- this.setData({
- nav,
- temperature: []
- });
- if (nav == 0 || nav == 2) {
- const chainId = this.data.details.chainId;
- this.getHistory({
- chainId,
- searchTag: nav,
- deviceCode,
- chainBoundId: chainBoundId || ''
- });
- this.getTempLine({
- chainId,
- searchTag: nav,
- deviceCode,
- deviceType,
- chainBoundId: chainBoundId || ''
- })
- }
- },
- isShow() {
- if (this.data.isshow) {
- this.setData({
- isShowText: '隐藏冷链',
- isshow: false
- })
- } else {
- this.setData({
- isShowText: '显示冷链',
- isshow: true
- })
- }
- },
- isAllMoer() {
- this.setData({
- allMoer: !this.data.allMoer
- })
- },
- cleanWarning(e) { // 解除预警
- const {
- details: {
- chainId
- },
- userInfo: {
- loginRole
- }
- } = this.data;
- var status = e.currentTarget.dataset.status;
- if (status == 10 || status == 20) {
- if (loginRole !== "doctor") {
- wx.navigateTo({
- url: '/pages/query/clearWarning/clearWarning?chainId=' + chainId, //details
- })
- } else {
- app.showToptip(this, 'error', '暂无权限');
- }
- }
- },
- goPdf(e) {
- var chainId = e.currentTarget.dataset.id;
- var transportOrderUid = e.currentTarget.dataset.orderid;
- wx.navigateTo({
- url: '/pages/workbench/scanningType/reportPdf/reportPdf?id=' + chainId+'&orderid='+transportOrderUid,
- })
- },
- regionChange: function (e) {
- this.setData({
- region: e.detail.value
- })
- },
- setModalVal(e) {
- this.setData({
- modalVal: e.detail.value
- })
- },
- setmodalHidden(e) {
- var transportStatus = e.currentTarget.dataset.transportstatus;
- if (transportStatus == '00' || transportStatus == '10') {
- this.setData({
- modalHidden: !this.data.modalHidden,
- })
- } else if (transportStatus == '20') {
- app.showToptip(this, 'error', '冷链已结束,请勿修改运输状态')
- }
- },
- //取消按钮点击事件
- modalBindcancel: function () {
- this.setData({
- modalHidden: !this.data.modalHidden,
- region: [],
- modalVal: '',
- iodepId: '',
- })
- },
- modalBindaconfirm() { //二型保存地址
- var that = this;
- var {
- region,
- modalVal,
- iodepId,
- seleteType,
- deptType
- } = that.data;
- var {
- chainId,
- transportStatus
- } = that.data.details;
- var addr = region.join('') + modalVal;
- if (region.join('') && modalVal) {
- app.requestP({
- url: '/chain/editTransport',
- // contentType:' application/json',
- method: 'post',
- data: {
- addr,
- chainId, // 00 已入库 //10 已出库 //20 已结束
- transportStatus: seleteType[deptType].transportStatus,
- }
- }).then(res => {
- that.setData({
- modalHidden: !that.data.modalHidden,
- region: [],
- modalVal: '',
- iodepId: '',
- })
- that.getInfo({
- id: chainId
- });
- app.showToptip(that, 'success', res.data.msg);
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg);
- })
- } else {
- app.showToptip(that, 'error', '地址和运输状态不能为空');
- }
- },
- goTempDetail() {
- var {
- chainId
- } = this.data.details;
- var nav = this.data.nav;
- wx.navigateTo({
- url: '/pages/query/tempDetails/tempDetails?chainId=' + chainId + '&searchTag=' + nav,
- })
- },
- //查一查弹框控制
- showChaWin() {
- this.setData({
- showChaType: true
- })
- },
- closeChaWin() {
- this.setData({
- showChaType: false,
- })
- },
- chainCode(e) {
- var that = this;
- var chainId = e.currentTarget.dataset.id;
- var type = e.currentTarget.dataset.type;
- var code = e.currentTarget.dataset.code;
- that.scanCode().then(result => {
- app.requestP({
- url: '/chainSource/add',
- method: 'post',
- contentType: 'application/json',
- data: {
- chainId,
- [type]: result.code
- }
- }).then(res => {
- app.showToptip(that, 'success', res.data.msg);
- that.getInfo({
- id: chainId,
- pid: 0
- });
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg);
- })
- })
- },
- scanCode() {
- var that = this;
- return new Promise((resolve, reject) => {
- wx.scanCode({
- scanType: ['barCode', 'qrCode'],
- success: function (res) {
- const {
- result
- } = res;
- resolve({
- code: result
- })
- },
- fail: function (err) {
- app.showToptip(that, 'error', '扫码失败');
- }
- })
- })
- },
- copyCode(e) {
- wx.setClipboardData({
- data: e.currentTarget.dataset.code
- })
- },
- goScanSetting() {
- wx.navigateTo({
- url: '/pages/setting/scanSetting/scanSetting',
- })
- },
- addChain(e) {
- const type = e.currentTarget.dataset.type;
- var details = this.data.details;
- var type1 = ['X201','X202','X203'];
- var type2 = ['X101','X102','X103','X104','X106','X107'];
- if(type1.indexOf(type) != -1){
- this.setData({
- showDialog:true,
- devicetype:type
- })
- }else{
- if(type == 'X105'){
- app.showToptip(this,'error','当前设备不支持RFID形式')
- }else if(type2.indexOf(type) != -1){
- wx.navigateTo({
- url: '/pages/nfc/encryptionNfc/encryptionNfc?type='+type+'&path=addLabel'+"&chainId="+details.chainId,
- })
- }
- }
- // 104 一型无源
- // switch (type) {
- // case 'lableX104':
- // wx.navigateTo({
- // url: '/pages/nfc/zhuisu2?id='+details.chainId+'&type=X104&addLabel=20',
- // })
- // break;
- // default:
- // this.setData({
- // showDialog: !this.data.showDialog,
- // devicetype:type
- // })
- // break;
- // }
- },
- toggleDialog() { //弹窗关闭
- this.setData({
- showDialog: !this.data.showDialog,
- devicetype:''
- });
- },
- chainBind() {
- var that = this;
- wx.scanCode({
- success: function (res) {
- const { result } = res;
- if (result.indexOf('imei=') != -1) {
- result = result.slice(result.indexOf('imei=') + 5, result.length)
- }
- that.setchainBoundBind(result);
- },
- fail: function (err) {
- app.showToptip(that, 'error', '二维码无效');
- }
- })
- },
- setchainBoundBind(result) {
- var that = this;
- var options = this.data.options;
- const {details,devicetype,latitude,longitude} = that.data;
- app.requestP({
- url: '/chainBound/checkBind',
- method: 'post',
- data: {
- deviceCode: result,
- }
- }).then(res => {
- if (res.data.data == 0) {
- app.requestP({
- url: '/chainBound/bind',
- method: 'post',
- contentType: ' application/json',
- data: {
- chainId: details.chainId,
- deviceCode: result,
- type: devicetype.substr(5),
- lat: latitude,
- lng: longitude
- }
- }).then(response => {
- app.showToptip(that, 'success', '绑定成功!');
- that.getInfo(options);
- that.getBoundDevice(options);
- }).catch(error => {
- app.showToptip(that, 'error', error.data.msg)
- })
- } else {
- app.showToptip(that, 'error', res.data.msg)
- }
- }).catch(err => {
- app.showToptip(that, 'error', err.data.msg)
- })
- },
- inputBind() {
- var that = this
- wx.showModal({
- title: '请输入标签编号',
- editable: true,
- success(res) {
- if (res.confirm) {
- var numreg = /^[0-9]*$/;
- if (res.content) {
- // if (!numreg.test(res.content)) {
- // app.showToptip(that, "error", "标签编号只能为数字!");
- // that.inputBind()
- // return;
- // }
- that.setchainBoundBind(res.content)
- } else {
- app.showToptip(that, "error", '标签编号不能为空!')
- that.inputBind()
- }
- } else {
- //pass
- }
- }
- })
- },
- onAll() {
- if (!this.data.isAll) {
- this.setData({
- allActive: '收回',
- isAll: true,
- })
- } else {
- this.setData({
- allActive: '展开更多',
- isAll: false,
- })
- }
- },
- // 运单补录
- showChainTime(){
- this.setData({
- showChainTimeStatus:!this.data.showChainTimeStatus
- })
- },
- getTime(){
- // 获取完整的年月日 时分秒,以及默认显示的数组
- var obj = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
- var obj1 = dateTimePicker.dateTimePicker(this.data.startYear, this.data.endYear);
- // 精确到分的处理,将数组的秒去掉
- //var lastArray = obj1.dateTimeArray.pop();
- //var lastTime = obj1.dateTime.pop();
- this.setData({
- dateTimeArray1: obj1.dateTimeArray,
- dateTime1: obj1.dateTime
- });
- },
- // 选择日期时间
- changeDateTime1(e) {
- var that = this;
- this.setData({
- dateTime1: e.detail.value,
- // estiTime:
- },()=>{
- var dateTimeArray1 = that.data.dateTimeArray1;
- var dateTime1 = that.data.dateTime1;
- var years = dateTimeArray1[0][dateTime1[0]] //年
- var month = dateTimeArray1[1][dateTime1[1]] // 月
- var day = dateTimeArray1[2][dateTime1[2]] // 日
- var hours = dateTimeArray1[3][dateTime1[3]] // 时
- var min = dateTimeArray1[4][dateTime1[4]] // 分
- var seconds = dateTimeArray1[5][dateTime1[5]] // 秒
- var startTime = years+'-'+month+'-'+day+' '+hours+':'+min+':'+seconds;
- const {code,uid} = that.data.transportOrder;
- this.updteVvmTransportOrder({code,uid,startTime})
- });
- },
- changeDateTimeColumn1(e) {
- var arr = this.data.dateTime1,
- dateArr = this.data.dateTimeArray1;
- arr[e.detail.column] = e.detail.value;
- dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]]);
- this.setData({
- dateTimeArray1: dateArr,
- dateTime1: arr
- });
- },
- updteVvmTransportOrder(form){
- var that = this;
- app.requestP({
- url: '/transport/updteVvmTransportOrder',
- method: 'post',
- contentType: 'application/json',
- data: form
- }).then(res=>{
- app.showToptip(that, 'success', res.data.msg)
- }).catch(err=>{
- app.showToptip(that, 'error', err.data.msg)
- })
- },
- goEditOrder(){
- const {transportName,transportType,driverName,plateNum,code,uid} = this.data.transportOrder;
- wx.navigateTo({
- url: '/pages/query/editOrder/editOrder?transportName='+transportName+'&transport='+transportType+'&driverName='+driverName+'&plateNum='+plateNum+'&code='+code+'&uid='+uid,
- })
- }
- })
|