代码优化

This commit is contained in:
BianLzhaoMin 2024-08-19 14:31:13 +08:00
parent 853ce4fa02
commit f34db1d21d
10 changed files with 3386 additions and 3351 deletions

View File

@ -3,8 +3,7 @@
<view <view
class="single-fetch" class="single-fetch"
v-for="(fetch, index) in fetchMaterialList" v-for="(fetch, index) in fetchMaterialList"
:key="index" :key="index">
>
<view class="fetch-upper"> <view class="fetch-upper">
<!-- <checkbox-group <!-- <checkbox-group
v-show="fetch.taskStatus != '35'" v-show="fetch.taskStatus != '35'"
@ -14,11 +13,13 @@
<checkbox :checked="fetch.checked" /> <checkbox :checked="fetch.checked" />
</checkbox-group> --> </checkbox-group> -->
<view class="upper-lef"> <view class="upper-lef">
{{ fetch.createBy == null ? '' : fetch.createBy.slice(0, 1) }} {{
fetch.createBy == null ? "" : fetch.createBy.slice(0, 1)
}}
</view> </view>
<view class="upper-rig"> <view class="upper-rig">
<h4 style="font-size: 16px;">{{ fetch.createBy }}</h4> <h4 style="font-size: 16px">{{ fetch.createBy }}</h4>
<h4 style="color: #989898;">{{ fetch.phoneNumber }}</h4> <h4 style="color: #989898">{{ fetch.phoneNumber }}</h4>
</view> </view>
</view> </view>
<view class="fetch-lower"> <view class="fetch-lower">
@ -49,35 +50,31 @@
</view> </view>
<view class="fetch-btns"> <view class="fetch-btns">
<view <view
style="background-color: #3788FF;" style="background-color: #3788ff"
@click="seeDetail(fetch.taskId)" @click="seeDetail(fetch.taskId)"
v-show="fetch.taskStatus != '35'" v-show="fetch.taskStatus != '35'">
> <uni-icons style="color: #fff" type="eye"></uni-icons>
<uni-icons style="color: #fff;" type="eye"></uni-icons>
查看 查看
</view> </view>
<view <view
style="background-color: #FCA30D;" style="background-color: #fca30d"
v-show="fetch.taskStatus == 31 && roles.includes('jjfgs')" v-show="fetch.taskStatus == 31 && roles.includes('jjfgs')"
@click="toggleOpenModal(fetch)" @click="toggleOpenModal(fetch)">
> <uni-icons style="color: #fff" type="auth"></uni-icons>
<uni-icons style="color: #fff;" type="auth"></uni-icons>
机具分公司审核 机具分公司审核
</view> </view>
<view <view
style="background-color: #FCA30D;" style="background-color: #fca30d"
v-show="fetch.taskStatus == 32 && roles.includes('sgb')" v-show="fetch.taskStatus == 32 && roles.includes('sgb')"
@click="toggleOpenModal(fetch)" @click="toggleOpenModal(fetch)">
> <uni-icons style="color: #fff" type="auth"></uni-icons>
<uni-icons style="color: #fff;" type="auth"></uni-icons>
施管部审核 施管部审核
</view> </view>
<view <view
style="background-color: #FCA30D;" style="background-color: #fca30d"
v-show="fetch.taskStatus == 117 && roles.includes('jjfgs')" v-show="fetch.taskStatus == 117 && roles.includes('jjfgs')"
@click="toggleOpenModal(fetch)" @click="toggleOpenModal(fetch)">
> <uni-icons style="color: #fff" type="auth"></uni-icons>
<uni-icons style="color: #fff;" type="auth"></uni-icons>
机具分公司确认 机具分公司确认
</view> </view>
<!-- <view <!-- <view
@ -190,25 +187,32 @@
审核 审核
</view> </view>
</view> --> </view> -->
<uni-popup <uni-popup ref="popup" type="center" :mask-click="false">
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup"> <view class="popup">
<view class="pop-top"> <view class="pop-top">
<h4>审批</h4> <h4>审批</h4>
<uni-icons <uni-icons
style="color: #AAAAAA; font-weight: bold;" style="color: #aaaaaa; font-weight: bold"
type="closeempty" type="closeempty"
@click="closePopup" @click="closePopup">
>
</uni-icons> </uni-icons>
</view> </view>
<h4 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">是否通过审批</h4> <h4
style="
width: 85%;
margin: 2vh auto;
font-weight: normal;
text-align: center;
">
是否通过审批
</h4>
<view class="select-area"> <view class="select-area">
<view @click="modalConfirm">通过</view> <view @click="modalConfirm">通过</view>
<view @click="modalReject" v-show="modalList.taskStatus != 117">驳回</view> <view
@click="modalReject"
v-show="modalList.taskStatus != 117"
>驳回</view
>
<!-- <uni-forms ref="examForm" :modelValue="examFormData" :rules="rules" label-position="top"> <!-- <uni-forms ref="examForm" :modelValue="examFormData" :rules="rules" label-position="top">
<uni-forms-item name="ifPass" required label="是否通过" label-width="150"> <uni-forms-item name="ifPass" required label="是否通过" label-width="150">
<uni-data-select <uni-data-select
@ -226,33 +230,34 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<uni-popup <uni-popup ref="popup1" type="center" :mask-click="false">
ref="popup1"
type="center"
:mask-click="false"
>
<view class="popup1"> <view class="popup1">
<view class="pop-top"> <view class="pop-top">
<h4>驳回原因</h4> <h4>驳回原因</h4>
<uni-icons <uni-icons
style="color: #AAAAAA; font-weight: bold;" style="color: #aaaaaa; font-weight: bold"
type="closeempty" type="closeempty"
@click="closePopup1" @click="closePopup1">
>
</uni-icons> </uni-icons>
</view> </view>
<view class="select-area"> <view class="select-area">
<uni-easyinput v-model="rejectReason" maxlength="50" placeholder="请填写驳回原因"></uni-easyinput> <uni-easyinput
v-model="rejectReason"
maxlength="50"
placeholder="请填写驳回原因"></uni-easyinput>
<view class="btn" @click="confirmReject">驳回</view> <view class="btn" @click="confirmReject">驳回</view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<u-loading-page :loading="showLoading" color="#000" loading-text="加载中,请稍后..."></u-loading-page> <u-loading-page
:loading="showLoading"
color="#000"
loading-text="加载中,请稍后..."></u-loading-page>
</view> </view>
</template> </template>
<script> <script>
import { basePath } from '../../public' import { basePath } from "../../public";
export default { export default {
data() { data() {
return { return {
@ -262,91 +267,91 @@ import { basePath } from '../../public'
showLoading: false, showLoading: false,
allChecked: false, allChecked: false,
examFormData: { examFormData: {
ifPass: '', ifPass: "",
noPassReason: '' noPassReason: "",
}, },
ifPassRange: [ ifPassRange: [
{ text: '是', value: '0' }, { text: "是", value: "0" },
{ text: '否', value: '1' } { text: "否", value: "1" },
], ],
rules: { rules: {
ifPass: { ifPass: {
rules: [ rules: [
{ {
required: true, required: true,
errorMessage: '请选择是否通过!' errorMessage: "请选择是否通过!",
}
]
}
}, },
fetchMaterialList: [
], ],
},
},
fetchMaterialList: [],
examList: [], examList: [],
deviceList: [], deviceList: [],
roles: uni.getStorageSync('roles'), roles: uni.getStorageSync("roles"),
modalList: {}, modalList: {},
rejectReason: '' rejectReason: "",
} };
}, },
methods: { methods: {
seeDetail(taskId) { seeDetail(taskId) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/fetchMaterialDetail/fetchMaterialDetail?taskId=${taskId}` url: `/pages/fetchMaterialDetail/fetchMaterialDetail?taskId=${taskId}`,
}) });
}, },
checkAll() { checkAll() {
this.allChecked = !this.allChecked this.allChecked = !this.allChecked;
if (this.allChecked) { if (this.allChecked) {
this.fetchMaterialList.map(item => { this.fetchMaterialList.map((item) => {
if (item.checked == false) { if (item.checked == false) {
item.checked = true item.checked = true;
} }
}) });
} else { } else {
this.fetchMaterialList.map(item => { this.fetchMaterialList.map((item) => {
if (item.checked == true) { if (item.checked == true) {
item.checked = false item.checked = false;
} }
}) });
} }
}, },
checkClick(item) { checkClick(item) {
item.checked = !item.checked item.checked = !item.checked;
if (!item.checked) { if (!item.checked) {
this.allChecked = false this.allChecked = false;
} else { } else {
const goods = this.fetchMaterialList.every(item => { const goods = this.fetchMaterialList.every((item) => {
return item.checked === true return item.checked === true;
}) });
if (goods) { if (goods) {
this.allChecked = true this.allChecked = true;
} else { } else {
this.allChecked = false this.allChecked = false;
} }
} }
}, },
toggleOpenModal(info) { toggleOpenModal(info) {
this.modalList = info this.modalList = info;
this.$refs.popup.open() this.$refs.popup.open();
}, },
modalConfirm() { modalConfirm() {
let that = this let that = this;
that.modalList.leaseApplyInfoList[0].examineStatusId = that.modalList.examineStatusId that.modalList.leaseApplyInfoList[0].examineStatusId =
that.modalList.examineStatusId;
that.examList = { that.examList = {
taskId: that.modalList.taskId, taskId: that.modalList.taskId,
leaseApplyInfoList: that.modalList.leaseApplyInfoList, leaseApplyInfoList: that.modalList.leaseApplyInfoList,
leaseApplyDetails: that.modalList.leaseApplyInfoList[0].leaseApplyDetails leaseApplyDetails:
} that.modalList.leaseApplyInfoList[0].leaseApplyDetails,
};
switch (that.modalList.taskStatus) { switch (that.modalList.taskStatus) {
case 31: case 31:
that.examList.taskStatus = 32 that.examList.taskStatus = 32;
break; break;
case 32: case 32:
that.examList.taskStatus = 117 that.examList.taskStatus = 117;
break; break;
case 117: case 117:
that.examList.taskStatus = 33 that.examList.taskStatus = 33;
break; break;
} }
/* that.examList = { /* that.examList = {
@ -356,7 +361,7 @@ import { basePath } from '../../public'
leaseApplyDetails: that.modalList.leaseApplyInfoList[0].leaseApplyDetails leaseApplyDetails: that.modalList.leaseApplyInfoList[0].leaseApplyDetails
} */ } */
console.log(that.modalList, that.examList); console.log(that.modalList, that.examList);
that.toggleSubmit(that.examList) that.toggleSubmit(that.examList);
/* for (let i = 0; i < that.modalList.leaseApplyInfoList.length; i++) { /* for (let i = 0; i < that.modalList.leaseApplyInfoList.length; i++) {
that.modalList.leaseApplyInfoList[i].companyAuditBy = uni.getStorageSync('userInfo').userid that.modalList.leaseApplyInfoList[i].companyAuditBy = uni.getStorageSync('userInfo').userid
that.modalList.leaseApplyInfoList[i].deptAuditBy = uni.getStorageSync('userInfo').userid that.modalList.leaseApplyInfoList[i].deptAuditBy = uni.getStorageSync('userInfo').userid
@ -402,24 +407,28 @@ import { basePath } from '../../public'
that.toggleSubmit(that.examList) */ that.toggleSubmit(that.examList) */
}, },
modalReject() { modalReject() {
let that = this let that = this;
console.log(that.modalList); console.log(that.modalList);
that.examList = { that.examList = {
taskId: that.modalList.taskId, taskId: that.modalList.taskId,
leaseApplyInfoList: that.modalList.leaseApplyInfoList, leaseApplyInfoList: that.modalList.leaseApplyInfoList,
leaseApplyDetails: that.modalList.leaseApplyInfoList[0].leaseApplyDetails leaseApplyDetails:
} that.modalList.leaseApplyInfoList[0].leaseApplyDetails,
};
switch (that.modalList.taskStatus) { switch (that.modalList.taskStatus) {
case 31: case 31:
that.examList.taskStatus = 99 that.examList.taskStatus = 98;
that.examList.leaseApplyInfoList[0].status = 2 that.examList.examineStatusId = 98;
that.examList.leaseApplyInfoList[0].status = 2;
break; break;
case 32: case 32:
that.examList.taskStatus = 100 that.examList.taskStatus = 99;
that.examList.leaseApplyInfoList[0].status = 2 that.examList.examineStatusId = 99;
that.examList.leaseApplyInfoList[0].status = 2;
break; break;
} }
that.modalList.leaseApplyInfoList[0].examineStatusId = that.examList.taskStatus that.modalList.leaseApplyInfoList[0].examineStatusId =
that.examList.taskStatus;
// if (that.modalList.taskStatus == 32) that.modalList.taskStatus = 100 // if (that.modalList.taskStatus == 32) that.modalList.taskStatus = 100
/* for (let i = 0; i < that.modalList.leaseApplyInfoList.length; i++) { /* for (let i = 0; i < that.modalList.leaseApplyInfoList.length; i++) {
that.modalList.leaseApplyInfoList[i].companyAuditBy = uni.getStorageSync('userInfo').userid that.modalList.leaseApplyInfoList[i].companyAuditBy = uni.getStorageSync('userInfo').userid
@ -469,15 +478,15 @@ import { basePath } from '../../public'
} }
console.log(that.examList); */ console.log(that.examList); */
// that.rejectSubmit(that.examList) // that.rejectSubmit(that.examList)
that.$refs.popup1.open() that.$refs.popup1.open();
}, },
confirmReject() { confirmReject() {
let that = this let that = this;
if (that.rejectReason == '') { if (that.rejectReason == "") {
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '请填写驳回原因!' title: "请填写驳回原因!",
}) });
} else { } else {
console.log(that.modalList); console.log(that.modalList);
/* if (that.modalList.taskStatus == 31) { /* if (that.modalList.taskStatus == 31) {
@ -485,9 +494,10 @@ import { basePath } from '../../public'
} else if (that.modalList.taskStatus == 32) { } else if (that.modalList.taskStatus == 32) {
that.examList.leaseApplyInfoList[0].directAuditRemark = that.rejectReason that.examList.leaseApplyInfoList[0].directAuditRemark = that.rejectReason
} */ } */
that.examList.leaseApplyInfoList[0].companyAuditRemark = that.rejectReason that.examList.leaseApplyInfoList[0].companyAuditRemark =
that.rejectReason;
console.log(that.examList); console.log(that.examList);
that.rejectSubmit(that.examList) that.rejectSubmit(that.examList);
} }
}, },
/* toggleExam () { /* toggleExam () {
@ -525,10 +535,10 @@ import { basePath } from '../../public'
}) })
}, */ }, */
closePopup() { closePopup() {
this.$refs.popup.close() this.$refs.popup.close();
}, },
closePopup1() { closePopup1() {
this.$refs.popup1.close() this.$refs.popup1.close();
}, },
/* formSubmit () { /* formSubmit () {
let that = this let that = this
@ -538,126 +548,139 @@ import { basePath } from '../../public'
}) })
}, */ }, */
toggleSubmit(list) { toggleSubmit(list) {
let that = this let that = this;
that.$api.fetchExam.subExam(list).then(res => { that.$api.fetchExam
.subExam(list)
.then((res) => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
that.closePopup() that.closePopup();
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg, title: res.data.msg,
success: () => { success: () => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/fetchExam/fetchExam' url: "/pages/fetchExam/fetchExam",
}) });
} },
}) });
} else { } else {
that.closePopup() that.closePopup();
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg title: res.data.msg,
}) });
} }
}).catch(err => {
console.log(err);
}) })
.catch((err) => {
console.log(err);
});
}, },
rejectSubmit(list) { rejectSubmit(list) {
let that = this let that = this;
that.$api.fetchExam.rejectExamCq(list).then(res => { that.$api.fetchExam
.rejectExamCq(list)
.then((res) => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
that.closePopup() that.closePopup();
that.closePopup1() that.closePopup1();
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg, title: res.data.msg,
success: () => { success: () => {
uni.redirectTo({ uni.redirectTo({
url: '/pages/fetchExam/fetchExam' url: "/pages/fetchExam/fetchExam",
}) });
} },
}) });
} else { } else {
that.closePopup() that.closePopup();
that.closePopup1() that.closePopup1();
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg title: res.data.msg,
}) });
} }
}).catch(err => {
console.log(err);
}) })
.catch((err) => {
console.log(err);
});
}, },
initFetch() { initFetch() {
let that = this let that = this;
that.showLoading = true that.showLoading = true;
that.$api.fetchExam.fetchTrueExamListCq({ that.$api.fetchExam
.fetchTrueExamListCq({
souceBy: 0, souceBy: 0,
pageNum: that.pageNum, pageNum: that.pageNum,
pageSize: that.pageSize pageSize: that.pageSize,
}).then(res => { })
.then((res) => {
console.log(res); console.log(res);
if (res.data.code == 200) { if (res.data.code == 200) {
that.pageTotal = res.data.data.total that.pageTotal = res.data.data.total;
if (res.data.data.rows.length == 0) { if (res.data.data.rows.length == 0) {
that.showLoading = false that.showLoading = false;
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '未查询到相关数据!' title: "未查询到相关数据!",
}) });
} else { } else {
that.fetchMaterialList = [...that.fetchMaterialList, ...res.data.data.rows] that.fetchMaterialList = [
that.showLoading = false ...that.fetchMaterialList,
...res.data.data.rows,
];
that.showLoading = false;
console.log(that.fetchMaterialList); console.log(that.fetchMaterialList);
} }
} else if (res.data.code == 500) { } else if (res.data.code == 500) {
that.showLoading = false that.showLoading = false;
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: '登录状态已过期,请重新登录!', title: "登录状态已过期,请重新登录!",
success: () => { success: () => {
uni.removeStorageSync('token') uni.removeStorageSync("token");
uni.removeStorageSync('userInfo') uni.removeStorageSync("userInfo");
uni.reLaunch({ uni.reLaunch({
url: '/pages/login/login' url: "/pages/login/login",
}) });
} },
}) });
} else { } else {
that.showLoading = false that.showLoading = false;
uni.showToast({ uni.showToast({
icon: 'none', icon: "none",
title: res.data.msg title: res.data.msg,
}) });
} }
}).catch(err => { })
.catch((err) => {
console.log(err); console.log(err);
}) });
} },
}, },
onShow() { onShow() {
let that = this let that = this;
console.log(that.roles); console.log(that.roles);
for (let i = 0; i < that.roles.length; i++) { for (let i = 0; i < that.roles.length; i++) {
if (that.roles[i] == 'em02') { if (that.roles[i] == "em02") {
that.roles[i] = 'jjfgs' that.roles[i] = "jjfgs";
} else if (that.roles[i] == 'em01') { } else if (that.roles[i] == "em01") {
that.roles[i] = 'sgb' that.roles[i] = "sgb";
} }
} }
if (that.roles.includes('admin')) that.roles = ['admin', 'fgs', 'sgb', 'ajb', 'jjfgs', 'tsfgs'] if (that.roles.includes("admin"))
that.initFetch() that.roles = ["admin", "fgs", "sgb", "ajb", "jjfgs", "tsfgs"];
that.initFetch();
}, },
onReachBottom() { onReachBottom() {
console.log(this.fetchMaterialList, this.pageTotal); console.log(this.fetchMaterialList, this.pageTotal);
if (this.fetchMaterialList.length >= this.pageTotal) return; if (this.fetchMaterialList.length >= this.pageTotal) return;
this.pageNum++ this.pageNum++;
this.initFetch() this.initFetch();
}, },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@ -678,14 +701,14 @@ import { basePath } from '../../public'
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 15rpx; padding: 15rpx;
border-bottom: 1px solid #D7D7D7; border-bottom: 1px solid #d7d7d7;
display: flex; display: flex;
align-items: center; align-items: center;
.upper-lef { .upper-lef {
width: 12%; width: 12%;
height: 5vh; height: 5vh;
border-radius: 15rpx; border-radius: 15rpx;
background-color: #378AFF; background-color: #378aff;
color: #fff; color: #fff;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -709,7 +732,7 @@ import { basePath } from '../../public'
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 15rpx; padding: 15rpx;
border-bottom: 1px solid #D7D7D7; border-bottom: 1px solid #d7d7d7;
view { view {
width: 100%; width: 100%;
display: flex; display: flex;
@ -717,7 +740,7 @@ import { basePath } from '../../public'
margin-bottom: 15rpx; margin-bottom: 15rpx;
font-size: 14px; font-size: 14px;
span { span {
color: #9D9D9D; color: #9d9d9d;
padding-right: 20rpx; padding-right: 20rpx;
} }
h4 { h4 {
@ -765,8 +788,8 @@ import { basePath } from '../../public'
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
background-color: #fff; background-color: #fff;
border: 1px solid #3788FF; border: 1px solid #3788ff;
color: #3788FF; color: #3788ff;
} }
} }
} }
@ -789,7 +812,7 @@ import { basePath } from '../../public'
box-sizing: border-box; box-sizing: border-box;
padding: 10rpx 50rpx; padding: 10rpx 50rpx;
border-radius: 30rpx; border-radius: 30rpx;
background-color: #3788FF; background-color: #3788ff;
font-size: 14px; font-size: 14px;
color: #fff; color: #fff;
} }
@ -800,7 +823,7 @@ import { basePath } from '../../public'
background-color: #fff; background-color: #fff;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden; overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff); background: linear-gradient(#d9e7fe, #fff, #fff, #fff);
.pop-top { .pop-top {
width: 100%; width: 100%;
height: 5vh; height: 5vh;
@ -820,7 +843,7 @@ import { basePath } from '../../public'
box-sizing: border-box; box-sizing: border-box;
font-size: 30rpx; font-size: 30rpx;
padding: 12rpx 24rpx; padding: 12rpx 24rpx;
background-color: #3788FF; background-color: #3788ff;
color: #fff; color: #fff;
border-radius: 20rpx; border-radius: 20rpx;
} }
@ -832,7 +855,7 @@ import { basePath } from '../../public'
background-color: #fff; background-color: #fff;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden; overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff); background: linear-gradient(#d9e7fe, #fff, #fff, #fff);
.pop-top { .pop-top {
width: 100%; width: 100%;
height: 5vh; height: 5vh;
@ -852,7 +875,7 @@ import { basePath } from '../../public'
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-color: #3788FF; background-color: #3788ff;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
border-radius: 15rpx; border-radius: 15rpx;

Binary file not shown.

View File

@ -1 +1 @@
https://app.liuyingyong.cn/build/download/e13516f0-5b71-11ef-a692-0d1d40453f9f https://app.liuyingyong.cn/build/download/859056e0-5def-11ef-ab2a-6d88694bee30

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long