jhwxapp/miniprogram/pages/quality_manage/index.js

545 lines
13 KiB
JavaScript
Raw Normal View History

2023-09-03 14:08:39 +08:00
// pages/Quality-Assurance/index.js
const app = getApp()
Page({
2024-03-19 23:25:38 +08:00
/**
* 页面的初始数据
*/
data: {
active: 2,
initData: {},
projectData: {},
projectId: '',
projectName: '',
loginName: "",
deptId: "",
measureStatistics: [{
name: "其它",
value: 0,
prop: 0
}],
securityCheck: {
routineRectificationRate: 0, //常规整改率
routineProblemTotal: 0, //常规问题总数
routineCheckNumber: 0, //常规检查次数
specialRectificationRate: 0, //专项整改率
specialProblemTotal: 0, //专项问题总数
specialCheckNumber: 0, //专项检查次数
2023-09-03 14:08:39 +08:00
},
2024-03-19 23:25:38 +08:00
checkDetectionData: {
type1Value: 0,
type1PassRate: 100,
type2Value: 0,
type2PassRate: 100,
type3Value: 0,
type3PassRate: 100,
type4Value: 0,
type4PassRate: 100,
},
//举牌验收
2024-08-31 10:48:34 +08:00
checkValueData: [{
type: 1,
typeName: '常规验收',
total: 0,
pass: 0,
passRate: 0.00
},
{
type: 2,
typeName: '隐蔽验收',
total: 0,
pass: 0,
passRate: 0.00
}
],
checkValueList: [],
2024-03-19 23:25:38 +08:00
materialSealStatistics: [{
name: "其它",
value: 0,
prop: 0
}],
todoDb: 0,
approveDb: 0,
aq: 0,
zl: 0,
qyfsDb: 0,
scslDb: 0,
jpysDb: 0,
clfyDb: 0,
2024-07-09 21:42:49 +08:00
gcgnDb: 0,
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let that = this;
//获取缓存数据
wx.getStorage({
key: 'userinfo',
success: res => {
that.setData({
loginName: res.data.loginName,
projectId: app.globalData.projectId,
projectNameArgs: app.globalData.projectName,
initData: {
text: app.globalData.projectName,
id: app.globalData.projectId
2023-09-03 14:08:39 +08:00
}
})
2024-03-19 23:25:38 +08:00
that.selectMenuList(res.data.loginName);
that.initPage(app.globalData.projectId);
that.awaitTask(res.data.minRoleId, res.data.deptId, res.data.loginName, res.data.userId);
}
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
selectMenuList: function (loginName) {
var that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/selectRoleMenuList',
data: {
username: loginName,
type: "zl"
},
method: "get",
success: function (res) {
res = res.data;
if (res.code == '200') {
that.setData({
menuList: res.data
})
2023-09-03 14:08:39 +08:00
}
2024-03-19 23:25:38 +08:00
}
})
},
2023-09-03 14:08:39 +08:00
//初始化页面
2024-03-19 23:25:38 +08:00
initPage(projectId) {
2023-09-03 14:08:39 +08:00
this.getMeasureData(projectId);
this.getQualityCheck(projectId);
this.getCheckDetectionData(projectId);
this.getMaterialSealData(projectId);
this.getCheckingData(projectId);
2024-08-31 10:48:34 +08:00
this.getCheckingList(projectId);
2023-09-03 14:08:39 +08:00
},
/**
* 实测实量数据
*/
getMeasureData(projectId) {
wx.request({
url: app.globalData.reqUrl + '/wechat/projectMeasure/selectGroupCountByProjectId',
2024-03-19 23:25:38 +08:00
data: {
projectId: projectId
},
method: "get",
2023-09-03 14:08:39 +08:00
success: res => {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == 200 && res.data) {
let sum = 0;
res.data.forEach((it, idx) => {
sum += it.total;
2023-09-03 14:08:39 +08:00
});
2024-03-19 23:25:38 +08:00
let measureStatistics = [];
res.data.forEach((it, idx) => {
measureStatistics.push({
name: it.measureTypeName,
value: it.total,
prop: (it.total / sum * 100).toFixed(2)
});
2023-09-03 14:08:39 +08:00
});
//数据绑定
this.setData({
measureStatistics
})
}
}
})
},
2024-03-19 23:25:38 +08:00
/**
2023-09-03 14:08:39 +08:00
* 获取质量检查数据
*/
getQualityCheck(projectId) {
wx.request({
url: app.globalData.reqUrl + '/wechat/projectProblemmodify/selectGroupCountByProjectId',
2024-03-19 23:25:38 +08:00
data: {
projectId: projectId,
infoType: "1"
},
method: "get",
2023-09-03 14:08:39 +08:00
success: res => {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == 200) {
2023-09-03 14:08:39 +08:00
//数据绑定
2024-03-19 23:25:38 +08:00
res.data.forEach((it, idx) => {
if (it.problemType == "1") {
2023-09-03 14:08:39 +08:00
this.setData({
"securityCheck.routineRectificationRate": (it.comTotal / it.total * 100).toFixed(2),
"securityCheck.routineProblemTotal": it.comTotal,
"securityCheck.routineCheckNumber": it.total
})
2024-03-19 23:25:38 +08:00
} else {
2023-09-03 14:08:39 +08:00
this.setData({
"securityCheck.specialRectificationRate": (it.comTotal / it.total * 100).toFixed(2),
"securityCheck.specialProblemTotal": it.comTotal,
"securityCheck.specialCheckNumber": it.total,
})
}
});
}
}
})
},
//取样复试数据
2024-03-19 23:25:38 +08:00
getCheckDetectionData(projectId) {
2023-09-03 14:08:39 +08:00
wx.request({
url: app.globalData.reqUrl + '/wechat/projectDetection/selectGroupCountByProjectId',
2024-03-19 23:25:38 +08:00
data: {
projectId: projectId
},
method: "get",
2023-09-03 14:08:39 +08:00
success: res => {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == 200 && res.data) {
2023-09-03 14:08:39 +08:00
//数据绑定
2024-03-19 23:25:38 +08:00
res.data.forEach((it, idx) => {
if (!it.passTotal) {
2024-03-09 14:01:46 +08:00
it.passTotal = 0;
}
2024-03-19 23:25:38 +08:00
if (it.checkType == "1") {
2023-09-03 14:08:39 +08:00
this.setData({
"checkDetectionData.type1Value": it.total,
2024-03-09 14:01:46 +08:00
"checkDetectionData.type1PassRate": (it.passTotal / it.total * 100).toFixed(2)
2023-09-03 14:08:39 +08:00
});
2024-03-19 23:25:38 +08:00
} else if (it.checkType == "2") {
2023-09-03 14:08:39 +08:00
this.setData({
"checkDetectionData.type2Value": it.total,
2024-03-09 14:01:46 +08:00
"checkDetectionData.type2PassRate": (it.passTotal / it.total * 100).toFixed(2)
2023-09-03 14:08:39 +08:00
});
2024-03-19 23:25:38 +08:00
} else if (it.checkType == "3") {
2023-09-03 14:08:39 +08:00
this.setData({
"checkDetectionData.type3Value": it.total,
2024-03-09 14:01:46 +08:00
"checkDetectionData.type3PassRate": (it.passTotal / it.total * 100).toFixed(2)
2023-09-03 14:08:39 +08:00
});
2024-03-19 23:25:38 +08:00
} else {
2023-09-03 14:08:39 +08:00
this.setData({
"checkDetectionData.type4Value": it.total,
2024-03-09 14:01:46 +08:00
"checkDetectionData.type4PassRate": (it.passTotal / it.total * 100).toFixed(2)
2023-09-03 14:08:39 +08:00
});
}
});
}
}
})
},
/**
* 材料封样数据
*/
getMaterialSealData(projectId) {
wx.request({
url: app.globalData.reqUrl + '/wechat/projectMaterialSeal/selectGroupCountByProjectId',
2024-03-19 23:25:38 +08:00
data: {
projectId: projectId
},
method: "get",
2023-09-03 14:08:39 +08:00
success: res => {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == 200 && res.data) {
let sum = 0;
let otherSum = 0;
let flag = true;
res.data.forEach((it, idx) => {
sum += it.total;
if (idx > 4 && res.data.length > 6) {
otherSum += it.total;
2023-09-11 09:45:21 +08:00
}
2023-09-03 14:08:39 +08:00
});
2024-03-19 23:25:38 +08:00
let materialSealStatistics = [];
res.data.forEach((it, idx) => {
if (flag) {
2023-09-11 09:45:21 +08:00
let typeName = it.type;
2024-03-19 23:25:38 +08:00
if (typeName.length > 6) {
2023-09-11 09:45:21 +08:00
//字符串截取
2024-03-19 23:25:38 +08:00
typeName = typeName.substring(typeName.length - 7, typeName.length);
2023-09-11 09:45:21 +08:00
}
2024-03-19 23:25:38 +08:00
materialSealStatistics.push({
name: typeName,
value: it.total,
prop: (it.total / sum * 100).toFixed(2)
});
if (idx > 3 && res.data.length > 6) {
2023-09-11 09:45:21 +08:00
//防止变形,这里统计剩余所有
2024-03-19 23:25:38 +08:00
materialSealStatistics.push({
name: "其它部位",
value: otherSum,
prop: (otherSum / sum * 100).toFixed(2)
});
flag = false;
2023-09-11 09:45:21 +08:00
}
2023-09-03 14:08:39 +08:00
}
});
//数据绑定
this.setData({
materialSealStatistics
})
}
}
})
},
/**
* 举牌验收数据
*/
getCheckingData(projectId) {
wx.request({
url: app.globalData.reqUrl + '/wechat/projectchecking/findStatisticsByProjectId',
2024-03-19 23:25:38 +08:00
data: {
projectId: projectId
},
method: "get",
2023-09-03 14:08:39 +08:00
success: res => {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == 200 && res.data) {
2024-08-31 10:48:34 +08:00
let dataList = this.data.checkValueData;
2024-03-19 23:25:38 +08:00
res.data.forEach((it, idx) => {
2023-09-03 14:08:39 +08:00
//数据绑定
2024-08-31 10:48:34 +08:00
it.passRate = (it.pass / it.total * 100).toFixed(2);
if (it.type == 1) {
dataList[0] = it;
} else {
dataList[1] = it;
}
2023-09-03 14:08:39 +08:00
});
2024-08-31 10:48:34 +08:00
this.setData({
checkValueData: dataList
})
}
}
})
},
/**
* 举牌验收详情
*/
getCheckingList(projectId) {
wx.request({
url: app.globalData.reqUrl + '/wechat/projectchecking/findStatisticsInfosByProjectId',
data: {
projectId: projectId
},
method: "get",
success: res => {
res = res.data;
if (res.code == 200 && res.data) {
let list = [];
res.data.forEach((it, idx) => {
it.passRate = (it.pass / it.total * 100).toFixed(2);
list.push(it);
});
this.setData({
checkValueList: list
})
2023-09-03 14:08:39 +08:00
}
}
})
},
2024-03-19 23:25:38 +08:00
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 生命周期函数--监听页面显示
*/
onShow() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
//项目切换 返回值
onProjectSelect(e) {
let projectId = e.detail.id;
let projectName = e.detail.text;
app.globalData.projectId = projectId;
app.globalData.projectName = projectName;
this.setData({
projectId: projectId,
projectName: projectName,
})
this.onLoad()
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
goMenu: function (event) {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: event.currentTarget.dataset.url
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 实测实量页面
*/
goSCSL: function () {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: '../../pageage/project_measure/list/index'
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 质量隐患排查
*/
goYHPC: function () {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: '../../pageage/project_problemmodify/quality/list/index'
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 取样复试
*/
goQYFS: function () {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: '../../pageage/project_checkDetection/list/index'
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 材料封样
*/
goCLFY: function () {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: '../../pageage/project_materialSeal/list/index'
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
/**
* 举牌验收
*/
goJPYS: function () {
wx.setStorageSync('nav-menu', "zl");
wx.redirectTo({
url: '../../pageage/project_checking/list/index'
})
},
2023-09-03 14:08:39 +08:00
2024-03-19 23:25:38 +08:00
// 底部导航
onChange(event) {
2023-09-03 14:08:39 +08:00
// event.detail 的值为当前选中项的索引
2024-03-19 23:25:38 +08:00
this.setData({
active: event.detail
});
},
/**
* 项目概况页面
*/
XMGK: function () {
wx.redirectTo({
url: '../xiangmugaikuang/index'
})
},
//跳转到安全管理
AQGL: function () {
wx.redirectTo({
url: '../safety_manage/index'
})
},
//跳转到进度管理
JDGL: function () {
//app.toast("敬请期待!");
wx.redirectTo({
url: '../../pageage/project_schedule/list/index'
})
},
/**
* 更多功能
*/
GDGN: function () {
wx.redirectTo({
url: '../gengduogongneng/index'
})
},
//查询当前登录人的代办任务
awaitTask(minRoleId, deptId, loginName, userId) {
2023-09-17 15:28:13 +08:00
let param = {
2024-03-19 23:25:38 +08:00
"businessKey": app.globalData.projectId,
"nowRole": minRoleId,
"nowDept": deptId,
"nowUserName": loginName,
"nowUser": userId,
"activeName": "await"
2023-09-17 15:28:13 +08:00
}
var that = this;
wx.request({
url: app.globalData.reqUrl + '/wechat/flowTask/myAwaitFlowTaskListCount',
2024-03-19 23:25:38 +08:00
data: param,
2023-09-17 15:28:13 +08:00
method: "post",
success: function (res) {
res = res.data;
2024-03-19 23:25:38 +08:00
if (res.code == "200") {
2023-09-17 15:28:13 +08:00
that.setData({
2024-08-31 10:48:34 +08:00
todoDb: res.data.todo + res.data.approveLZYJ,
2024-03-19 23:25:38 +08:00
approveDb: res.data.approve + res.data.zlCount,
aq: res.data.aqCount,
zl: res.data.zlCount,
qyfsDb: res.data.approveQYFS,
scslDb: res.data.approveSCSL,
jpysDb: res.data.approveJPYS,
2024-07-09 21:42:49 +08:00
clfyDb: res.data.approveCLFY,
gcgnDb: res.data.approveGCGN
2023-09-24 23:17:05 +08:00
})
2024-03-19 23:25:38 +08:00
console.log(that.data)
2023-09-17 15:28:13 +08:00
}
}
})
},
2023-09-03 14:08:39 +08:00
})