123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <template>
- <view class="zkTaskList" ref="zktaskList">
- <custom-tabs type="zkTaskListViewRef" :value="pageInfo.current" :fixed="true" :activeTextStyle="{color:'rgba(190, 163, 117, 1)'}" :activeLineStyle="{'background-color':'rgba(190, 163, 117, 1)',height:'6rpx'}" @change="changeIndex">
- <!-- 所有 -->
- <custom-tab-pane label="所有" name="zkTaskListViewRef_1">
- <ZkTaskListView ref="zkTaskListViewRef_1" style="height: 100%;"></ZkTaskListView>
- </custom-tab-pane>
- <!-- 待质控 -->
- <custom-tab-pane label="待质控" name="zkTaskListViewRef_2">
- <ZkTaskListView ref="zkTaskListViewRef_2" state="7002" style="height: 100%;"></ZkTaskListView>
- </custom-tab-pane>
- <!-- 质控中 -->
- <custom-tab-pane label="质控中" name="zkTaskListViewRef_3">
- <ZkTaskListView ref="zkTaskListViewRef_3" state="7003" style="height: 100%;"></ZkTaskListView>
- </custom-tab-pane>
- <!-- 完成 -->
- <custom-tab-pane label="完成" name="zkTaskListViewRef_4">
- <ZkTaskListView ref="zkTaskListViewRef_4" state="7004,7007,7008,7009,7010" finishFlag="1" style="height: 100%;"></ZkTaskListView>
- </custom-tab-pane>
- </custom-tabs>
- <!-- 签收任务/开始质控对话框 -->
- <uni-popup ref="operatorDialog" type="dialog">
- <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageInfo.popupMessage.title" :content="pageInfo.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
- </uni-popup>
- </view>
- </template>
- <script setup>
- import http from '@/utils/request';
- import {ystabbar} from '@/pages/index/tabShow.js'
- import {ref,reactive,getCurrentInstance, computed, nextTick,watch} from "vue";
- import {onLoad,onShow,onReady,onUnload,onPageScroll,onReachBottom,onPullDownRefresh} from "@dcloudio/uni-app";
- import ZkTaskListView from "./zkTaskListView.vue"
-
- const zkTaskListViewRef_1 = ref(null)
-
- const pageInfo = reactive({
- current:-1,
- detailStatus: '',
- // 任务编号
- taskId:'',
- isKszk:'',
- // 对话框
- popupMessage:{
- // 标题
- title:'',
- // 提示内容
- showMessage:''
- }
- });
-
- const {proxy} = getCurrentInstance()
- 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 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 operatorDialog=ref(null)
-
- // 签收任务/开始质控对话框确定事件
- const operatorDialogConfirm=()=>{
- if(pageInfo.popupMessage.title=='开始质控'){
- getStartTask()
- }else{
- getSignTask()
- }
- operatorDialog._value.close()
- }
-
- // 签收任务/开始质控对话框取消事件
- const operatorDialogClose=()=>{
- operatorDialog._value.close()
- }
-
- // 签收接口输入参数
- const signFormData=reactive({
- // 任务id
- taskId:''
- })
-
- // 开始质控接口输入参数
- const startFormData=reactive({
- // 任务id
- taskId:''
- })
-
- // 签收接口
- const getSignTask=()=>{
- http.get("app-api/index/qs",signFormData).then(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=>{
- // 1表示开始质控,-1表示不是组长不能质控,其他表示开始质控失败
- if(res==1){
- uni.navigateTo({
- url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
- })
- }else if(res=-1){
- // 提示-只有组长能够开始质控
- uni.showModal({
- title: '提示',
- content: '只有组长能够开始质控',
- confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
- showCancel: false,//没有取消按钮的弹框
- buttonText: '确定'
- })
- }else{
- uni.showToast({
- title: '开始质控失败',
- icon:'none'
- });
- }
- })
- }
-
-
- const IndexName = ref("zkTaskListViewRef_1")
- const changeIndex=(e)=>{
- console.log('change-----------')
- IndexName.value = e.name
- pageInfo.current = e.value
- if(taskListRef()){
- taskListRef().fetch()
- }
- }
-
- const taskListRef = ()=>{
- const taskList = proxy.$refs[IndexName.value]
- return taskList
- }
-
- // 页面滚动触发事件
- onPageScroll((detail) => {
- //页面滚动事件
- uni.pageScrollTo({
- scrollTop: detail.scrollTop,
- duration: 0
- })
- })
-
- // 上拉加载
- onReachBottom(() => {
- taskListRef().reachBottom()
- })
-
- //下拉刷新
- onPullDownRefresh(() => {
- taskListRef().pullDownRefresh()
- })
-
- // 获取待质控数量
- const getZkNumber=()=>{
- http.get("app-api/index/getZkNumber").then(res=>{
- if(res==0){
- uni.removeTabBarBadge({
- index:1
- })
- }else{
- uni.setTabBarBadge({
- index:1,
- text:res.toString()
- })
- }
- })
- }
-
- onReady(()=>{
- ystabbar()
- getZkNumber()
- nextTick(()=>{
- pageInfo.current = 0
- })
- uni.$off("signTask")
- uni.$off("startTask")
- uni.$on("signTask",(e)=>{
- signFormData.taskId=e.id
- pageInfo.taskId=e.id
- operatorDialog._value.open();
- pageInfo.popupMessage.title='签收'
- pageInfo.popupMessage.showMessage='是否确认签收任务?'
- })
- uni.$on("startTask",(e)=>{
- startFormData.taskId=e.id
- pageInfo.taskId=e.id
- if(e.isKszk==false){
- operatorDialog._value.open()
- pageInfo.popupMessage.title='开始质控'
- pageInfo.popupMessage.showMessage='是否确认开始质控任务?'
- }else{
- uni.navigateTo({
- url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
- })
- }
- })
- uni.$off("finishTask")
- uni.$on("finishTask",()=>{
- pageInfo.current=4
- })
- })
-
- </script>
- <style lang="scss" scoped>
- @import 'indexList.scss';
- </style>
|