1178 lines
36 KiB
Vue
1178 lines
36 KiB
Vue
|
<template>
|
|||
|
<view>
|
|||
|
<view class="reader-box" v-if="isScaning">
|
|||
|
<view class="reader" id="reader-sbxx"></view>
|
|||
|
</view>
|
|||
|
<view class="page" v-else>
|
|||
|
<!-- 车间 -->
|
|||
|
<mpvue-picker themeColor="#007AFF" ref="cjPicker" mode="selector" :deepLength="deepLength"
|
|||
|
@onConfirm="pickerCjConfirm" :pickerValueArray="cjList"></mpvue-picker>
|
|||
|
<mpvue-picker themeColor="#007AFF" ref="mpvuePicker" mode="selector" :deepLength="deepLength"
|
|||
|
@onConfirm="pickerConfirm" :pickerValueArray="task_level"></mpvue-picker>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname" style="color: #333">{{
|
|||
|
ztList[info.zt] + "(" + "生箔卷号:" + info.jh + ")"
|
|||
|
}}</view>
|
|||
|
<!-- <view class="itemtext">
|
|||
|
<input class="iteminput" disabled placeholder="自动生成" :value="devInfo.xcjcdh" />
|
|||
|
</view> -->
|
|||
|
<!-- <view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" placeholder="设备编号或扫码" :value="devInfo.serialno"/>
|
|||
|
<uni-icons type="scan" class="myarrowright" style="right: 0px;"></uni-icons>
|
|||
|
</view> -->
|
|||
|
</view>
|
|||
|
<view class="item" v-if="info.zt == 1 || info.zt == 2">
|
|||
|
<view class="item-btn">
|
|||
|
<!-- <button type="primary" class="btn" @click="dealProblem()">
|
|||
|
基本信息
|
|||
|
</button> -->
|
|||
|
<button type="primary" class="btn" @click="problemToOther()">
|
|||
|
生箔记录
|
|||
|
</button>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="detail_name_container">
|
|||
|
<view :class="[current_num == 1 ? 'current' : '']" @click="changecurrent(1)">基本信息</view>
|
|||
|
<view :class="[current_num == 2 ? 'current' : '']" @click="changecurrent(2)">生箔记录</view>
|
|||
|
</view>
|
|||
|
|
|||
|
<view v-show="current_num == 1">
|
|||
|
<view class="top_container detail_list_top">
|
|||
|
<view class="report_status">任务概况</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">生箔卷号</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.jh" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">生产日期</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.scrq" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">物料编码</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.wlbm" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">规格型号</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.ggxh" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">克重(g/㎡)</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.kz" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">设备名称</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.sbmc" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">上卷时间</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.sjsj" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">下卷时间</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.xjsj" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">废箔量</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.fbl" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">边料</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.bl" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">车间</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.cj" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">备注</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="info.bz" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view v-show="current_num == 2">
|
|||
|
<view v-for="(item, index) in info.zbList" style="margin-bottom: 20rpx">
|
|||
|
<view class="top_container detail_list_top" style="display: flex; justify-content: space-between">
|
|||
|
<view class="report_status">[{{ item.czy }}]{{ item.bb }} {{ item.jlsj }}</view>
|
|||
|
<view style="display: flex">
|
|||
|
<view class="report_btn" v-if="info.zt == 1 || info.zt == 2" @click="problemToOther(index, item.id)">编辑
|
|||
|
</view>
|
|||
|
<view class="report_btn" style="color: red; margin-left: 10px" v-if="info.zt == 1 || info.zt == 2"
|
|||
|
@click="remove(index)">
|
|||
|
删除</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">抛光记录</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="item.pgjl" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">抛光时长(min)</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="item.pgsj" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">工作时长(h)</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="item.gzsc" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">生箔卷重(kg)</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="item.sbjz" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="item">
|
|||
|
<view class="itemname">铜箔质量问题记录</view>
|
|||
|
<view class="itemtext">
|
|||
|
<input class="iteminput InputRightMargin" disabled :value="item.tbzlwtjl" />
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<mx-datepicker type="datetime" :value="info.planTime" :show="showPicker" @confirm="onSelected"
|
|||
|
@cancel="onSelected"></mx-datepicker>
|
|||
|
<view class="goHome" @click="goMain('repairInfo')">
|
|||
|
<img src="../../static/img/gohome.png" />
|
|||
|
</view>
|
|||
|
<view class="mysearchlist" style="z-index: 10000">
|
|||
|
<chooseUserSingle ref="mysearchlist" :showsearch.sync="show_search_user1" :itemInfo_.sync="search_value_user1">
|
|||
|
</chooseUserSingle>
|
|||
|
</view>
|
|||
|
<view class="mysearchlist" style="z-index: 10000">
|
|||
|
<chooseUserMulti ref="mysearchlist" :showsearch.sync="show_search_user2" :itemInfo_.sync="search_value_user2">
|
|||
|
</chooseUserMulti>
|
|||
|
</view>
|
|||
|
<view class="mysearchlist" style="z-index: 10000">
|
|||
|
<chooseEquipmentSingle ref="mysearchlist" :showsearch.sync="show_search_user3"
|
|||
|
:itemInfo_.sync="search_value_user3">
|
|||
|
</chooseEquipmentSingle>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
import { config } from "../../request/js/config.js";
|
|||
|
import chooseUserSingle from "@/components/xinsoft-search-list/chooseUserSingle.vue";
|
|||
|
import chooseUserMulti from "@/components/xinsoft-search-list/chooseUserMulti.vue";
|
|||
|
import chooseEquipmentSingle from "@/components/xinsoft-search-list/chooseEquipmentSingle.vue";
|
|||
|
import mpvuePicker from "@/components/mpvue-picker/mpvuePicker.vue";
|
|||
|
import mxDatepicker from "@/components/mx-datepicker/mx-datepicker.vue";
|
|||
|
import uniIcons from "@/components/uni-icons/uni-icons.vue";
|
|||
|
import jweixin from "@/jweixin-module/index.js";
|
|||
|
import { Html5Qrcode } from "html5-qrcode";
|
|||
|
export default {
|
|||
|
components: {
|
|||
|
mxDatepicker,
|
|||
|
mpvuePicker,
|
|||
|
uniIcons,
|
|||
|
chooseUserSingle,
|
|||
|
chooseUserMulti,
|
|||
|
chooseEquipmentSingle,
|
|||
|
},
|
|||
|
data() {
|
|||
|
return {
|
|||
|
ztList: {
|
|||
|
1: "未开始",
|
|||
|
2: "生产中",
|
|||
|
3: "已完成",
|
|||
|
},
|
|||
|
current_num: 1,
|
|||
|
html5Qrcode: null,
|
|||
|
isScaning: false,
|
|||
|
config: config,
|
|||
|
task_level: [],
|
|||
|
imgsrc_list: [],
|
|||
|
imgsrc_list_local: [],
|
|||
|
showPicker: false,
|
|||
|
deepLength: 1,
|
|||
|
devInfo: {},
|
|||
|
zrr: {},
|
|||
|
csr: [],
|
|||
|
repairInfo: {},
|
|||
|
info: {},
|
|||
|
id: "",
|
|||
|
bxr: "",
|
|||
|
targetList: [],
|
|||
|
show_search_user1: false,
|
|||
|
search_value_user1: "",
|
|||
|
show_search_user2: false,
|
|||
|
search_value_user2: "",
|
|||
|
show_search_user3: false,
|
|||
|
search_value_user3: "",
|
|||
|
cjList: [],
|
|||
|
//时间选择器
|
|||
|
timeFrom: null,
|
|||
|
selFrom: null,
|
|||
|
};
|
|||
|
},
|
|||
|
onLoad(option) {
|
|||
|
var _this = this;
|
|||
|
this.id = option.id || "";
|
|||
|
// var otherInfos = uni.getStorageSync('otherInfo');
|
|||
|
uni.getStorage({
|
|||
|
key: "userInfo",
|
|||
|
success: function (res) {
|
|||
|
_this.bxr = res.data.name;
|
|||
|
},
|
|||
|
});
|
|||
|
|
|||
|
//如果是编辑,就根据接口获取数据,
|
|||
|
if (option.id) {
|
|||
|
this.id = option.id;
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/mdh/sbbg/detail",
|
|||
|
method: "GET",
|
|||
|
params: {
|
|||
|
id: option.id,
|
|||
|
},
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
let records = res.data.data;
|
|||
|
// let xctp = this.isJsonString(
|
|||
|
// this.current_num == 1 ? records.xctp : records.zgtp
|
|||
|
// )
|
|||
|
// ? JSON.parse(this.current_num == 1 ? records.xctp : records.zgtp)
|
|||
|
// : this.current_num == 1
|
|||
|
// ? records.xctp
|
|||
|
// : records.zgtp;
|
|||
|
// if (Array.isArray(xctp)) {
|
|||
|
// this.imgsrc_list_local = xctp;
|
|||
|
// } else {
|
|||
|
|
|||
|
// this.imgsrc_list_local=
|
|||
|
// this.current_num == 1 ? records.xctp.split(',') : records.zgtp.split(',')
|
|||
|
|
|||
|
// }
|
|||
|
this.info = records;
|
|||
|
// this.zrr = {
|
|||
|
// userId: records.engineerUserId,
|
|||
|
// name: records.engineerUserName,
|
|||
|
// };
|
|||
|
|
|||
|
// res.data.ccIdList.forEach((vals, index) => {
|
|||
|
// var json = {
|
|||
|
// userId: vals.id,
|
|||
|
// name: vals.name,
|
|||
|
// };
|
|||
|
// this.targetList.push(json);
|
|||
|
// });
|
|||
|
// for (var i = 0; i < res.data.repairEventImage.length; i++) {
|
|||
|
// this.imgsrc_list.push(res.data.repairEventImage[i].filePath);
|
|||
|
// this.imgsrc_list_local.push(
|
|||
|
// config.imgURL + res.data.repairEventImage[i].filePath
|
|||
|
// );
|
|||
|
// }
|
|||
|
// this.info = {
|
|||
|
// planTime: records.planTime, //要求完成时间
|
|||
|
// solution: records.reventConent, //故障描述
|
|||
|
// level_value: records.reventLevelId, //存储任务等级
|
|||
|
// level_label: records.reventLevelName,
|
|||
|
// id: this.id,
|
|||
|
// };
|
|||
|
// this.repairInfo = {
|
|||
|
// info: this.info,
|
|||
|
// imgsrc_list: this.imgsrc_list,
|
|||
|
// imgsrc_list_local: this.imgsrc_list_local,
|
|||
|
// csr: this.targetList,
|
|||
|
// zrr: this.zrr,
|
|||
|
// devInfo: this.devInfo,
|
|||
|
// };
|
|||
|
// uni.setStorage({
|
|||
|
// key: "repairInfo",
|
|||
|
// data: _this.repairInfo,
|
|||
|
// success: function () {},
|
|||
|
// });
|
|||
|
}
|
|||
|
});
|
|||
|
// .catch((err) => {
|
|||
|
// uni.showToast({
|
|||
|
// title: "获取信息失败",
|
|||
|
// icon: "none",
|
|||
|
// duration: 2000,
|
|||
|
// });
|
|||
|
// });
|
|||
|
} else {
|
|||
|
this.info = {};
|
|||
|
//如果不是,是新增,获取session中的数据。
|
|||
|
// uni.getStorage({
|
|||
|
// key: "repairInfo",
|
|||
|
// success: function (res) {
|
|||
|
// var session = res.data;
|
|||
|
// _this.devInfo = session.devInfo || {};
|
|||
|
// _this.info = session.info || {};
|
|||
|
// _this.targetList = session.csr || [];
|
|||
|
// _this.zrr = session.zrr || [];
|
|||
|
// _this.imgsrc_list = session.imgsrc_list || [];
|
|||
|
// _this.imgsrc_list_local = session.imgsrc_list_local || [];
|
|||
|
// },
|
|||
|
// });
|
|||
|
}
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/dict/getDictsByType",
|
|||
|
params: {
|
|||
|
type: "cj",
|
|||
|
},
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.statusCode == "200") {
|
|||
|
var useType = res.data.datas;
|
|||
|
for (let i = 0; i < useType.length; i++) {
|
|||
|
var myVal = {
|
|||
|
label: useType[i].name,
|
|||
|
value: useType[i].id,
|
|||
|
};
|
|||
|
_this.cjList.push(myVal);
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
.catch((err) => {
|
|||
|
console.log(err);
|
|||
|
});
|
|||
|
//初始化获取 任务等级数据字典。
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/dict/getDictsByType",
|
|||
|
params: {
|
|||
|
type: "jclb",
|
|||
|
},
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.statusCode == "200") {
|
|||
|
var useType = res.data.datas;
|
|||
|
for (let i = 0; i < useType.length; i++) {
|
|||
|
var myVal = {
|
|||
|
label: useType[i].name,
|
|||
|
value: useType[i].id,
|
|||
|
};
|
|||
|
_this.task_level.push(myVal);
|
|||
|
}
|
|||
|
// if (!_this.info.level_value) {
|
|||
|
// _this.info.level_value = useType[0].id;
|
|||
|
// _this.info.level_label = useType[0].name;
|
|||
|
// _this.infoChange();
|
|||
|
// }
|
|||
|
}
|
|||
|
})
|
|||
|
.catch((err) => {
|
|||
|
console.log(err);
|
|||
|
});
|
|||
|
},
|
|||
|
watch: {
|
|||
|
search_value_user1(val) {
|
|||
|
const { NAME, userId } = val;
|
|||
|
const params = {
|
|||
|
id: this.info.id,
|
|||
|
userId: userId,
|
|||
|
};
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/hl/ahgl/xcjc/tran",
|
|||
|
params: params,
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
uni.showToast({
|
|||
|
title: "转派成功",
|
|||
|
icon: "none",
|
|||
|
duration: 2000,
|
|||
|
});
|
|||
|
this.getList();
|
|||
|
}
|
|||
|
});
|
|||
|
// this.info[this.selFrom[0]] = NAME;
|
|||
|
// this.info[this.selFrom[1]] = userId;
|
|||
|
// this.info = { ...this.info };
|
|||
|
// let obj = { userId: newv.userId, name: newv.NAME };
|
|||
|
// this.zrr = obj;
|
|||
|
// var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
// if (!repairInfo) {
|
|||
|
// repairInfo = {};
|
|||
|
// }
|
|||
|
// repairInfo.zrr = this.zrr;
|
|||
|
// uni.setStorage({
|
|||
|
// key: "repairInfo",
|
|||
|
// data: repairInfo,
|
|||
|
// success: function () {},
|
|||
|
// });
|
|||
|
},
|
|||
|
search_value_user2(newv) {
|
|||
|
var detail = [];
|
|||
|
newv.forEach((item) => {
|
|||
|
let obj = { userId: item.userId, name: item.NAME };
|
|||
|
detail.push(obj);
|
|||
|
});
|
|||
|
if (newv.length > 0) {
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
this.targetList = detail;
|
|||
|
repairInfo.csr = this.targetList;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
}
|
|||
|
},
|
|||
|
search_value_user3(newv) {
|
|||
|
let obj = {
|
|||
|
id: newv.id,
|
|||
|
name: newv.name,
|
|||
|
serialno: newv.serialno,
|
|||
|
model: newv.model,
|
|||
|
type: newv.type,
|
|||
|
site: newv.site,
|
|||
|
};
|
|||
|
this.devInfo = obj;
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.devInfo = this.devInfo;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
},
|
|||
|
},
|
|||
|
mounted() {
|
|||
|
this.initiateWX();
|
|||
|
},
|
|||
|
methods: {
|
|||
|
// 问题处理
|
|||
|
dealProblem() {
|
|||
|
uni.navigateTo({
|
|||
|
url: "/pages/xcjc/deal" + "?id=" + this.info.id,
|
|||
|
});
|
|||
|
},
|
|||
|
//问题转派
|
|||
|
problemToOther(val, id) {
|
|||
|
const { zt } = this.info;
|
|||
|
if (zt != 1&&zt!=2) {
|
|||
|
uni.showToast({
|
|||
|
title: "非未开始状态不能操作",
|
|||
|
icon: "none",
|
|||
|
duration: 2000,
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (val || val == 0) {
|
|||
|
uni.navigateTo({
|
|||
|
url: `/pages/sbbg/add?id=${this.info.id}&index=${val}`,
|
|||
|
});
|
|||
|
} else {
|
|||
|
uni.navigateTo({
|
|||
|
url: `/pages/sbbg/add?id=${this.info.id}`,
|
|||
|
});
|
|||
|
}
|
|||
|
},
|
|||
|
changecurrent(num) {
|
|||
|
this.current_num = num;
|
|||
|
this.imgsrc_list_local = [];
|
|||
|
let records = this.info;
|
|||
|
let xctp = this.isJsonString(
|
|||
|
this.current_num == 1 ? records.xctp : records.zgtp
|
|||
|
)
|
|||
|
? JSON.parse(this.current_num == 1 ? records.xctp : records.zgtp)
|
|||
|
: this.current_num == 1
|
|||
|
? records.xctp
|
|||
|
: records.zgtp;
|
|||
|
if (Array.isArray(xctp)) {
|
|||
|
this.imgsrc_list_local = xctp;
|
|||
|
} else {
|
|||
|
this.imgsrc_list_local =
|
|||
|
this.current_num == 1
|
|||
|
? records.xctp.split(",")
|
|||
|
: records.zgtp.split(",");
|
|||
|
}
|
|||
|
this.info = records;
|
|||
|
},
|
|||
|
isJsonString(str) {
|
|||
|
try {
|
|||
|
JSON.parse(str);
|
|||
|
return true;
|
|||
|
} catch (e) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
},
|
|||
|
openQrcode() {
|
|||
|
this.isScaning = true;
|
|||
|
Html5Qrcode.getCameras().then((devices) => {
|
|||
|
if (devices && devices.length) {
|
|||
|
this.html5Qrcode = new Html5Qrcode("reader-sbxx");
|
|||
|
this.html5Qrcode.start(
|
|||
|
{
|
|||
|
facingMode: "environment",
|
|||
|
},
|
|||
|
{
|
|||
|
focusMode: "continuous", //设置连续聚焦模式
|
|||
|
fps: 5, //设置扫码识别速度
|
|||
|
qrbox: 280, //设置二维码扫描框大小
|
|||
|
},
|
|||
|
(decodeText, decodeResult) => {
|
|||
|
if (decodeText) {
|
|||
|
let data = JSON.parse(decodeText);
|
|||
|
if (data.id) {
|
|||
|
this.getQrCodeInfo(data.id);
|
|||
|
this.stopScan(); //关闭扫码功能
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
(err) => {
|
|||
|
// this.stopScan();
|
|||
|
// console.log(err); //错误信息
|
|||
|
}
|
|||
|
);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
stopScan() {
|
|||
|
this.isScaning = false;
|
|||
|
if (this.html5Qrcode) {
|
|||
|
this.html5Qrcode.stop();
|
|||
|
}
|
|||
|
},
|
|||
|
//获取微信相关
|
|||
|
initiateWX() {
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/weChat/getSignature",
|
|||
|
params: {
|
|||
|
// url:"http://120.132.17.220:18093/gyhl-app/"
|
|||
|
url: window.location.href.split("#")[0],
|
|||
|
},
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
var s = res.data;
|
|||
|
jweixin.config({
|
|||
|
beta: true,
|
|||
|
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|||
|
appId: s.corpId, // 必填,公众号的唯一标识
|
|||
|
timestamp: s.timestamp, // 必填,生成签名的时间戳
|
|||
|
nonceStr: s.nonceStr, // 必填,生成签名的随机串
|
|||
|
signature: s.signature.toLowerCase(), // 必填,签名,见附录1
|
|||
|
jsApiList: [
|
|||
|
"onMenuShareTimeline",
|
|||
|
"onMenuShareAppMessage",
|
|||
|
"onMenuShareQQ",
|
|||
|
"onMenuShareWeibo",
|
|||
|
"onMenuShareQZone",
|
|||
|
"scanQRCode",
|
|||
|
],
|
|||
|
});
|
|||
|
} else {
|
|||
|
uni.showToast({
|
|||
|
title: res.msg ? res.msg : "获取微信配置失败",
|
|||
|
icon: "none",
|
|||
|
duration: 2000,
|
|||
|
});
|
|||
|
}
|
|||
|
})
|
|||
|
.catch((err) => {
|
|||
|
uni.showToast({
|
|||
|
title: err,
|
|||
|
icon: "none",
|
|||
|
duration: 2000,
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
onNavigationBarButtonTap() {
|
|||
|
this.openQrcode();
|
|||
|
},
|
|||
|
/** 点击顶部按钮的方法 */
|
|||
|
// onNavigationBarButtonTap() {
|
|||
|
// console.log("你点击了按钮")
|
|||
|
// // 允许从相机和相册扫码
|
|||
|
// let _this = this;
|
|||
|
// jweixin.scanQRCode({
|
|||
|
// desc: 'scanQRCode desc',
|
|||
|
// needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
|
|||
|
// scanType: ['qrCode'], // 可以指定扫二维码还是条形码(一维码),默认二者都有"qrCode", "barCode"
|
|||
|
// success: function(res) {
|
|||
|
// if (res.errMsg != 'scanQRCode:ok') {
|
|||
|
// uni.showToast({
|
|||
|
// title: '扫描结果:' + res.resultStr,
|
|||
|
// icon: 'none',
|
|||
|
// duration: 2000
|
|||
|
// });
|
|||
|
// } else {
|
|||
|
// //扫码正确
|
|||
|
// let resultStr = res.resultStr;
|
|||
|
// try {
|
|||
|
// resultStr = JSON.parse(resultStr);
|
|||
|
// if (resultStr.id) {
|
|||
|
|
|||
|
// _this.getQrCodeInfo(resultStr.id);
|
|||
|
// } else {
|
|||
|
// uni.showToast({
|
|||
|
// title: '二维码错误,请扫描正确的二维码',
|
|||
|
// icon: 'none',
|
|||
|
// duration: 2000
|
|||
|
// });
|
|||
|
// }
|
|||
|
// } catch (e) {
|
|||
|
// uni.showToast({
|
|||
|
// title: '二维码错误,请扫描正确的二维码',
|
|||
|
// icon: 'none',
|
|||
|
// duration: 2000
|
|||
|
// });
|
|||
|
// }
|
|||
|
// }
|
|||
|
// // 回调
|
|||
|
// },
|
|||
|
// error: function(res) {
|
|||
|
// uni.showToast({
|
|||
|
// title: 'error:' + res,
|
|||
|
// icon: 'none',
|
|||
|
// duration: 2000
|
|||
|
// });
|
|||
|
// if (res.errMsg.indexOf('function_not_exist') > 0) {
|
|||
|
// alert('版本过低请升级');
|
|||
|
// }
|
|||
|
// }
|
|||
|
// });
|
|||
|
// },
|
|||
|
|
|||
|
//调用接口获取二维码信息
|
|||
|
getQrCodeInfo(id) {
|
|||
|
var _this = this;
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/device/detail",
|
|||
|
params: {
|
|||
|
deviceId: id,
|
|||
|
},
|
|||
|
method: "POST",
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
let obj = {
|
|||
|
id: res.data.data.id,
|
|||
|
name: res.data.data.name,
|
|||
|
serialno: res.data.data.serialno,
|
|||
|
model: res.data.data.model ? res.data.data.model : "",
|
|||
|
type: res.data.data.type_mes ? res.data.data.type_mes : "",
|
|||
|
site: res.data.data.site ? res.data.data.site : "",
|
|||
|
};
|
|||
|
_this.devInfo = obj;
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.devInfo = this.devInfo;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
} else {
|
|||
|
uni.showToast({
|
|||
|
title: res.data.msg ? res.data.msg : "扫码失败",
|
|||
|
icon: "none",
|
|||
|
duration: 2000,
|
|||
|
});
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
selectDevice() {
|
|||
|
this.show_search_user3 = true;
|
|||
|
// uni.navigateTo({
|
|||
|
// url: "selectDevice?flag=addRepair"
|
|||
|
// });
|
|||
|
},
|
|||
|
selectPeople1(val) {
|
|||
|
this.selFrom = val;
|
|||
|
this.show_search_user1 = true;
|
|||
|
// uni.navigateTo({
|
|||
|
// url: "repairTurnTo?flag="+flag+'&url=addRepair'
|
|||
|
// });
|
|||
|
},
|
|||
|
selectPeople2(data) {
|
|||
|
this.show_search_user2 = true;
|
|||
|
},
|
|||
|
formatCsrName(data) {
|
|||
|
var returnName = "";
|
|||
|
for (var i = 0; i < data.length; i++) {
|
|||
|
if (i == 3) {
|
|||
|
returnName += data[i].name + "等等";
|
|||
|
break;
|
|||
|
} else {
|
|||
|
returnName += data[i].name + ",";
|
|||
|
}
|
|||
|
}
|
|||
|
returnName = returnName.substring(0, returnName.length - 1);
|
|||
|
return returnName;
|
|||
|
},
|
|||
|
infoChange: function () {
|
|||
|
//保存当前修改信息
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.info = this.info;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
},
|
|||
|
showCj() {
|
|||
|
// this.pickerValueDefault = [0];
|
|||
|
this.$refs.cjPicker.show();
|
|||
|
},
|
|||
|
// 车间
|
|||
|
pickerCjConfirm(e) {
|
|||
|
this.info.cj = e.label;
|
|||
|
this.info.cjid = e.value[0];
|
|||
|
this.infoChange();
|
|||
|
this.$forceUpdate();
|
|||
|
},
|
|||
|
pickerConfirm(e) {
|
|||
|
this.info.jclb = e.label;
|
|||
|
this.info.jclbid = e.value[0];
|
|||
|
this.infoChange();
|
|||
|
this.$forceUpdate();
|
|||
|
},
|
|||
|
showSinglePicker() {
|
|||
|
// this.pickerValueDefault = [0];
|
|||
|
this.$refs.mpvuePicker.show();
|
|||
|
},
|
|||
|
onShowDatePicker(val) {
|
|||
|
this.timeFrom = val;
|
|||
|
//显示
|
|||
|
this.showPicker = true;
|
|||
|
},
|
|||
|
onSelected(e) {
|
|||
|
//选择
|
|||
|
this.showPicker = false;
|
|||
|
var _this = this;
|
|||
|
if (e) {
|
|||
|
this.planTime = e.value + ":00";
|
|||
|
_this.info[this.timeFrom] = this.planTime;
|
|||
|
this.infoChange();
|
|||
|
}
|
|||
|
},
|
|||
|
//上传
|
|||
|
chooseImg() {
|
|||
|
this.uploadImg();
|
|||
|
},
|
|||
|
//重新上传
|
|||
|
reUpload(index) {
|
|||
|
this.uploadImg(index);
|
|||
|
},
|
|||
|
uploadImg(indexnum) {
|
|||
|
var _this = this;
|
|||
|
//#ifdef APP-PLUS
|
|||
|
var count_ = 9;
|
|||
|
//#endif
|
|||
|
//#ifndef APP-PLUS
|
|||
|
var count_ = 1;
|
|||
|
//#endif
|
|||
|
if (indexnum != undefined) {
|
|||
|
count_ = 1;
|
|||
|
}
|
|||
|
uni.chooseImage({
|
|||
|
count: count_,
|
|||
|
success: (chooseImageRes) => {
|
|||
|
const tempFilePaths = chooseImageRes.tempFilePaths;
|
|||
|
//#ifdef APP-PLUS
|
|||
|
let imgs = chooseImageRes.tempFilePaths.map((value, index) => {
|
|||
|
return {
|
|||
|
name: "file" + (index + 1), //注意这一行,uni的hello的示例中,这里为key名+index,这样是无法和使用一个固定key名接多个文件的php接口对接上的改为数组下标形式的字符串就解决这个问题了。其效果等同于在html页面上多个同name文件域同时提交表单。
|
|||
|
uri: value,
|
|||
|
};
|
|||
|
});
|
|||
|
uni.uploadFile({
|
|||
|
url: config.baseURL + "/apis/file/uploadMulti", //接口地址
|
|||
|
files: imgs,
|
|||
|
fileType: "image",
|
|||
|
name: "files",
|
|||
|
success: (uploadFileRes) => {
|
|||
|
var arr = [];
|
|||
|
for (
|
|||
|
var i = 0;
|
|||
|
i < JSON.parse(uploadFileRes.data).result.length;
|
|||
|
i++
|
|||
|
) {
|
|||
|
arr.push(JSON.parse(uploadFileRes.data).result[i].filePath);
|
|||
|
}
|
|||
|
if (indexnum != undefined) {
|
|||
|
//是重新上传
|
|||
|
_this.imgsrc_list[indexnum] = arr[0];
|
|||
|
_this.imgsrc_list_local[indexnum] =
|
|||
|
chooseImageRes.tempFilePaths[0];
|
|||
|
} else {
|
|||
|
_this.imgsrc_list = _this.imgsrc_list.concat(arr);
|
|||
|
_this.imgsrc_list_local = _this.imgsrc_list_local.concat(
|
|||
|
chooseImageRes.tempFilePaths
|
|||
|
);
|
|||
|
}
|
|||
|
_this.$forceUpdate();
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.imgsrc_list = _this.imgsrc_list;
|
|||
|
repairInfo.imgsrc_list_local = _this.imgsrc_list_local;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
},
|
|||
|
fail: function () {
|
|||
|
uni.showToast({
|
|||
|
title: "上传图片失败",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
},
|
|||
|
});
|
|||
|
//#endif
|
|||
|
//#ifndef APP-PLUS
|
|||
|
uni.uploadFile({
|
|||
|
url: config.baseURL + "/apis/file/upload", //接口地址
|
|||
|
filePath: tempFilePaths[0],
|
|||
|
fileType: "image",
|
|||
|
name: "file",
|
|||
|
success: (uploadFileRes) => {
|
|||
|
var arr = [];
|
|||
|
if (indexnum != undefined) {
|
|||
|
//是重新上传
|
|||
|
_this.imgsrc_list[indexnum] = JSON.parse(
|
|||
|
uploadFileRes.data
|
|||
|
).filePath;
|
|||
|
_this.imgsrc_list_local[indexnum] =
|
|||
|
chooseImageRes.tempFilePaths[0];
|
|||
|
} else {
|
|||
|
_this.imgsrc_list.push(JSON.parse(uploadFileRes.data).filePath);
|
|||
|
_this.imgsrc_list_local.push(chooseImageRes.tempFilePaths);
|
|||
|
}
|
|||
|
_this.$forceUpdate();
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.imgsrc_list = _this.imgsrc_list;
|
|||
|
repairInfo.imgsrc_list_local = _this.imgsrc_list_local;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
},
|
|||
|
fail: function () {
|
|||
|
uni.showToast({
|
|||
|
title: "上传图片失败",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
},
|
|||
|
});
|
|||
|
//#endif
|
|||
|
},
|
|||
|
});
|
|||
|
},
|
|||
|
//删除图片
|
|||
|
deleteImg(index) {
|
|||
|
this.imgsrc_list.splice(index, 1);
|
|||
|
this.imgsrc_list_local.splice(index, 1);
|
|||
|
this.$forceUpdate();
|
|||
|
var repairInfo = uni.getStorageSync("repairInfo");
|
|||
|
if (!repairInfo) {
|
|||
|
repairInfo = {};
|
|||
|
}
|
|||
|
repairInfo.imgsrc_list = _this.imgsrc_list;
|
|||
|
repairInfo.imgsrc_list_local = _this.imgsrc_list_local;
|
|||
|
uni.setStorage({
|
|||
|
key: "repairInfo",
|
|||
|
data: repairInfo,
|
|||
|
success: function () {},
|
|||
|
});
|
|||
|
},
|
|||
|
getDetail() {
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: "/apis/mdh/sbbg/detail",
|
|||
|
method: "GET",
|
|||
|
params: {
|
|||
|
id: this.id,
|
|||
|
},
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
let records = res.data.data;
|
|||
|
this.info = records;
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
del(index) {
|
|||
|
let list = this.info.zbList;
|
|||
|
list.splice(index, 1);
|
|||
|
this.info.zbList = list;
|
|||
|
let url = "apis/mdh/sbbg/edit";
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: url,
|
|||
|
data: this.info,
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
// uni.removeStorageSync("repairInfo");
|
|||
|
uni.showToast({
|
|||
|
title: "操作成功",
|
|||
|
duration: 1000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
this.getDetail();
|
|||
|
// setTimeout(function () {
|
|||
|
// uni.redirectTo({
|
|||
|
// url: "/pages/sbbg/detail",
|
|||
|
// });
|
|||
|
// }, 1000);
|
|||
|
}
|
|||
|
})
|
|||
|
.catch((err) => {
|
|||
|
uni.showToast({
|
|||
|
title: "操作失败",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
this.getDetail();
|
|||
|
});
|
|||
|
},
|
|||
|
remove(index) {
|
|||
|
let _this = this;
|
|||
|
uni.showModal({
|
|||
|
title: "",
|
|||
|
content: "确定删除吗?",
|
|||
|
success: function (res) {
|
|||
|
if (res.confirm) {
|
|||
|
_this.del(index);
|
|||
|
}
|
|||
|
},
|
|||
|
});
|
|||
|
},
|
|||
|
|
|||
|
//点击暂存和确认提交 需要进行的操作。
|
|||
|
goAddRepair(flag) {
|
|||
|
console.log("flag", this.info, this.imgsrc_list);
|
|||
|
if (!(this.imgsrc_list && this.imgsrc_list.length > 0)) {
|
|||
|
uni.showToast({
|
|||
|
title: "请上传现场图片",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
let submitData = {};
|
|||
|
submitData = this.info;
|
|||
|
submitData.xctp = JSON.stringify(this.imgsrc_list);
|
|||
|
let url;
|
|||
|
if (!submitData.id) {
|
|||
|
//提交进行的操作
|
|||
|
url = "apis/hl/ahgl/xcjc/add";
|
|||
|
} else if (submitData.id) {
|
|||
|
//暂存进行的操作。
|
|||
|
url = "apis/hl/ahgl/xcjc/edit";
|
|||
|
}
|
|||
|
if (!submitData.jcrq) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择检验日期",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (!submitData.jcry) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择检验人员",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (!submitData.cj) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择车间",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (!submitData.jclb) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择检查类别",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (!submitData.zrr) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择责任人",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
if (!submitData.yqwcrq) {
|
|||
|
uni.showToast({
|
|||
|
title: "请选择要求完成时间",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
// console.log(this.otherInfo);
|
|||
|
//调取接口进行保存。
|
|||
|
this.$http
|
|||
|
.request({
|
|||
|
url: url,
|
|||
|
data: submitData,
|
|||
|
})
|
|||
|
.then((res) => {
|
|||
|
if (res.data.code == 0) {
|
|||
|
// uni.removeStorageSync("repairInfo");
|
|||
|
uni.showToast({
|
|||
|
title: "操作成功",
|
|||
|
duration: 1000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
setTimeout(function () {
|
|||
|
uni.redirectTo({
|
|||
|
url: "/pages/xcjc/6s",
|
|||
|
});
|
|||
|
}, 1000);
|
|||
|
}
|
|||
|
})
|
|||
|
.catch((err) => {
|
|||
|
uni.showToast({
|
|||
|
title: "操作失败",
|
|||
|
duration: 2000,
|
|||
|
icon: "none",
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
},
|
|||
|
|
|||
|
onBackPress(options) {
|
|||
|
//取消默认的返回事件.用来返回上一页时重新加载页面,删除本地缓存的巡检操作
|
|||
|
// if (options.from === 'backButton' || options.from === 'backbutton' || options.from === 'navigateBack') {
|
|||
|
// uni.redirectTo({
|
|||
|
// url: "patrolDetail?id=" + this.id
|
|||
|
// });
|
|||
|
// return true;
|
|||
|
// }
|
|||
|
},
|
|||
|
};
|
|||
|
</script>
|
|||
|
<style scoped>
|
|||
|
.current:after {
|
|||
|
position: absolute;
|
|||
|
content: "";
|
|||
|
width: 80upx;
|
|||
|
height: 8upx;
|
|||
|
background-color: #3382ff;
|
|||
|
bottom: 8upx;
|
|||
|
left: 20upx;
|
|||
|
border-radius: 8upx;
|
|||
|
}
|
|||
|
|
|||
|
.report_btn {
|
|||
|
color: #3382ff;
|
|||
|
cursor: pointer;
|
|||
|
}
|
|||
|
|
|||
|
.item-btn {
|
|||
|
width: 25%;
|
|||
|
margin-top: 20rpx;
|
|||
|
display: flex;
|
|||
|
align-items: center;
|
|||
|
justify-content: flex-start;
|
|||
|
}
|
|||
|
|
|||
|
.btn {
|
|||
|
width: auto;
|
|||
|
height: 100%;
|
|||
|
font-size: 24rpx;
|
|||
|
justify-content: center;
|
|||
|
align-items: center;
|
|||
|
}
|
|||
|
|
|||
|
.reader-box {
|
|||
|
position: fixed;
|
|||
|
top: 0;
|
|||
|
bottom: 0;
|
|||
|
left: 0;
|
|||
|
right: 0;
|
|||
|
background-color: rgba(0, 0, 0, 0.5);
|
|||
|
}
|
|||
|
|
|||
|
.reader {
|
|||
|
width: 100%;
|
|||
|
/* width: 540rpx; */
|
|||
|
/* /height: 540rpx; */
|
|||
|
position: absolute;
|
|||
|
top: 50%;
|
|||
|
left: 50%;
|
|||
|
transform: translate(-50%, -50%);
|
|||
|
}
|
|||
|
|
|||
|
>>>.picker-item .lb-picker-column .lb-picker-column-label {
|
|||
|
-webkit-transition: all 0.3s;
|
|||
|
transition: all 0.3s;
|
|||
|
line-height: 55px !important;
|
|||
|
}
|
|||
|
|
|||
|
>>>.select-tab-fixed-top {
|
|||
|
left: 0;
|
|||
|
width: 100%;
|
|||
|
z-index: 2;
|
|||
|
white-space: nowrap;
|
|||
|
}
|
|||
|
|
|||
|
>>>.popup-layer {
|
|||
|
position: fixed;
|
|||
|
top: var(--window-top);
|
|||
|
margin-top: 40px;
|
|||
|
}
|
|||
|
</style>
|