123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <!-- 首页-组长 -->
- <template>
- <view class="view_container leaderIndex">
- <!-- 头部 -->
- <view class="leaderIndex_header">
- <view class="info">
- <view class="info_img">
- <image :src="pageData.headImg" class="headImg"></image>
- </view>
- <text class="userName">{{pageData.userName}}</text>
- <image :src="eyeIcon.nowIcon" class="eyeIcon" @click="changeState('header')"></image>
- </view>
- <view class="slogan">
- <image src="/static/slogan_header_img.png" class="slogan_img"></image>
- </view>
- </view>
- <!-- 标题 -->
- <view class="leaderIndex_title">
- <view class="title_left">
- <text>任务列表</text>
- <!-- <uni-badge class="uni-badge-left-margin" :text="pageData.taskNum" /> -->
- </view>
- <view class="title_right" @click="toDetail">
- <text class="right_text">查看全部</text>
- <uni-icons type="right"></uni-icons>
- </view>
- </view>
- <!-- 列表 -->
- <view class="leaderIndex_list">
- <uni-card v-for="(item,index) in pageData.taskList" padding="10rpx 0">
- <view class="list_title">
- <image :src="item.taskStatusIcon" class="statusIcon"></image>
- <view>{{item.name}}</view>
- <image :src="showIcon.nowIcon" class="showIcon" @click="changeState('list')"></image>
- </view>
- <view class="list_content">
- <text class="list_item">任务编号<text class="list_item_text">{{item.id}}</text></text>
- <text class="list_item">组长<text class="list_item_text">{{item.zzName}}</text></text>
- <text class="list_item">待质控代煎企业<text class="list_item_text">{{item.bzkOrgName}}</text></text>
- <text class="list_item">地址<text class="list_item_text">{{item.address}}</text></text>
- <text class="list_item">完成日期<text class="list_item_text">{{item.finishTime}}</text></text>
- </view>
- <view class="list_button">
- <view class="button_group">
- <view class="button_item" @click="signTask(item)">签收</view>
- <view class="button_item" @click="startTask(item)">开始质控</view>
- </view>
- </view>
- </uni-card>
- </view>
- <!-- 签收任务/开始质控对话框 -->
- <uni-popup ref="operatorDialog" type="dialog">
- <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
- </uni-popup>
- </view>
- </template>
- <script setup>
- import http from '@/utils/request';
- import { ref,reactive } from "vue";
- import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
- const pageData=reactive({
- // 任务编号
- taskId:'',
- headImg:'/static/logo.png',
- userName:'王军',
- taskNum:2,
- taskList:[],
- // 对话框
- popupMessage:{
- // 标题
- title:'',
- // 提示内容
- showMessage:''
- }
- })
- const eyeIcon=reactive({
- nowIcon:'',
- showIcon:'/static/whiteDisplay.png',
- hideIcon:'/static/whiteHide.png'
- })
- const showIcon=reactive({
- nowIcon:'',
- showIcon:'/static/blackDisplay.png',
- hideIcon:'/static/blackHide.png'
- })
- const statusIcon=reactive({
- daiIcon:'/static/dai_icon.png',
- wanIcon:'/static/wan_icon.png',
- zhiIcon:'/static/zhi_icon.png'
- })
- // 签收接口输入参数
- const signFormData=reactive({
- // 任务id
- id:''
- })
- // 开始质控接口输入参数
- const startFormData=reactive({
- // 任务id
- id:''
- })
- // 定义签收任务/开始质控对话框
- const operatorDialog=ref()
- // 定义质控提醒对话框
- const remindDialog=ref()
- // 签收任务/开始质控对话框确定事件
- const operatorDialogConfirm=()=>{
- if(pageData.popupMessage.title=='开始质控'){
- startFormData.id = pageData.taskId
- getStartTask()
- }else{
- signFormData.id=pageData.taskId
- getSignTask()
- }
- operatorDialog._value.close()
- }
- // 签收任务/开始质控对话框取消事件
- const operatorDialogClose=()=>{
- operatorDialog._value.close()
- }
- // 签收接口
- const getSignTask=()=>{
- http.get("app-api/index/qs",signFormData).then(res=>{
- console.log(res)
- if(res==true){
- uni.showToast({
- title:'签收成功',
- icon:'success'
- })
- }else{
- uni.showToast({
- title:'签收失败',
- icon:'error'
- })
- }
- })
- }
- // 开始质控接口
- const getStartTask=()=>{
- http.get("app-api/index/kszkByid",startFormData).then(res=>{
- console.log(res)
- if(res==true){
- uni.navigateTo({
- url:'/pages/ypczk/zkTask/zkTask?taskId='+pageData.taskId
- })
- }else{
- // 提示-只有组长能够开始质控
- uni.showModal({
- title: '提示',
- content: '只有组长能够开始质控',
- confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
- showCancel: false,//没有取消按钮的弹框
- buttonText: '确定',
- success: function (res) {
- console.log(res)
- }
- })
- }
- })
- }
- // 切换显示与隐藏
- const changeState=(type)=>{
- if(type=='header'){
- console.log("头部切换")
- if(eyeIcon.nowIcon==eyeIcon.hideIcon){
- eyeIcon.nowIcon=eyeIcon.showIcon
- }else{
- eyeIcon.nowIcon=eyeIcon.hideIcon
- }
- }else if(type=='list'){
- console.log("列表切换")
- if(showIcon.nowIcon==showIcon.hideIcon){
- showIcon.nowIcon=showIcon.showIcon
- }else{
- showIcon.nowIcon=showIcon.hideIcon
- }
- }
- }
- // 跳转到任务详情
- const toDetail=()=>{
- console.log("跳转到任务详情")
- uni.switchTab({
- url:'/pages/ypczk/zkTask/zkTaskList'
- })
- }
- // 签收
- const signTask=(e)=>{
- console.log("签收")
- pageData.taskId=e.id
- operatorDialog._value.open()
- pageData.popupMessage.title='签收'
- pageData.popupMessage.showMessage='是否确认签收任务?'
- }
- // 开始质控
- const startTask=(e)=>{
- console.log("开始质控")
- pageData.taskId=e.id
- operatorDialog._value.open()
- pageData.popupMessage.title='开始质控'
- pageData.popupMessage.showMessage='是否确认开始质控任务?'
- }
- onPullDownRefresh(()=>{
- console.log("下拉刷新")
- setTimeout(uni.stopPullDownRefresh(),2000)
-
- })
- // 获取任务列表
- const getTaskData=()=>{
- http.get("app-api/index/findList").then(res=>{
- console.log(res)
- pageData.taskList=res.data
- pageData.taskList.forEach(item=>{
- if(item.wcrq1!=null && item.wcrq2!=null){
- item.finishTime=item.wcrq1 +' ~ '+item.wcrq2
- }
- if(item.status=='7003'){
- item.taskStatusIcon=statusIcon.daiIcon
- }else if(item.status=='7004'){
- item.taskStatusIcon=statusIcon.wanIcon
- }else{
- item.taskStatusIcon=statusIcon.zhiIcon
- }
- })
- console.log(pageData.taskList)
- })
- }
- onShow(()=>{
- eyeIcon.nowIcon=eyeIcon.hideIcon
- showIcon.nowIcon=showIcon.hideIcon
- getTaskData()
- })
- </script>
- <style lang="scss" scoped>
- @import 'index.scss';
- </style>
|