zkTaskList.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="zkTaskList" ref="zktaskList">
  3. <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">
  4. <!-- 所有 -->
  5. <custom-tab-pane label="所有" name="zkTaskListViewRef_1">
  6. <ZkTaskListView ref="zkTaskListViewRef_1" state="" style="height: 100%;"></ZkTaskListView>
  7. </custom-tab-pane>
  8. <!-- 待质控 -->
  9. <custom-tab-pane label="待质控" name="zkTaskListViewRef_2">
  10. <ZkTaskListView ref="zkTaskListViewRef_2" state="7002" style="height: 100%;"></ZkTaskListView>
  11. </custom-tab-pane>
  12. <!-- 质控中 -->
  13. <custom-tab-pane label="质控中" name="zkTaskListViewRef_3">
  14. <ZkTaskListView ref="zkTaskListViewRef_3" state="7003" style="height: 100%;"></ZkTaskListView>
  15. </custom-tab-pane>
  16. <!-- 完成 -->
  17. <custom-tab-pane label="完成" name="zkTaskListViewRef_4">
  18. <ZkTaskListView ref="zkTaskListViewRef_4" state="" finishFlag="1" style="height: 100%;"></ZkTaskListView>
  19. </custom-tab-pane>
  20. </custom-tabs>
  21. <!-- 签收任务/开始质控对话框 -->
  22. <uni-popup ref="operatorDialog" type="dialog">
  23. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageInfo.popupMessage.title" :content="pageInfo.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  24. </uni-popup>
  25. </view>
  26. </template>
  27. <script setup>
  28. import http from '@/utils/request';
  29. import {ystabbar} from '@/pages/index/tabShow.js'
  30. import {ref,reactive,getCurrentInstance, computed, nextTick,watch} from "vue";
  31. import {onLoad,onShow,onUnload,onPageScroll,onReachBottom,onPullDownRefresh} from "@dcloudio/uni-app";
  32. import ZkTaskListView from "./zkTaskListView.vue"
  33. const zkTaskListViewRef_1 = ref(null)
  34. const pageInfo = reactive({
  35. current:-1,
  36. tabs: ["所有", "待质控", "质控中", "完成"],
  37. detailStatus: '',
  38. // 任务编号
  39. taskId:'',
  40. isKszk:'',
  41. // 对话框
  42. popupMessage:{
  43. // 标题
  44. title:'',
  45. // 提示内容
  46. showMessage:''
  47. }
  48. });
  49. const {proxy} = getCurrentInstance()
  50. const showIcon = reactive({
  51. nowIcon: '',
  52. showIcon: '/static/blackDisplay.png',
  53. hideIcon: '/static/blackHide.png'
  54. })
  55. const statusIcon = reactive({
  56. daiIcon: '/static/dai_icon.png',
  57. wanIcon: '/static/wan_icon.png',
  58. zhiIcon: '/static/zhi_icon.png'
  59. })
  60. // 切换显示与隐藏
  61. const changeState = (type) => {
  62. if (type == 'header') {
  63. console.log("头部切换")
  64. if (eyeIcon.nowIcon == eyeIcon.hideIcon) {
  65. eyeIcon.nowIcon = eyeIcon.showIcon
  66. } else {
  67. eyeIcon.nowIcon = eyeIcon.hideIcon
  68. }
  69. } else if (type == 'list') {
  70. console.log("列表切换")
  71. if (showIcon.nowIcon == showIcon.hideIcon) {
  72. showIcon.nowIcon = showIcon.showIcon
  73. } else {
  74. showIcon.nowIcon = showIcon.hideIcon
  75. }
  76. }
  77. }
  78. // 定义签收任务/开始质控对话框
  79. const operatorDialog=ref(null)
  80. // 签收任务/开始质控对话框确定事件
  81. const operatorDialogConfirm=()=>{
  82. if(pageInfo.popupMessage.title=='开始质控'){
  83. getStartTask()
  84. }else{
  85. getSignTask()
  86. }
  87. operatorDialog._value.close()
  88. }
  89. // 签收任务/开始质控对话框取消事件
  90. const operatorDialogClose=()=>{
  91. operatorDialog._value.close()
  92. }
  93. // 签收接口输入参数
  94. const signFormData=reactive({
  95. // 任务id
  96. taskId:''
  97. })
  98. // 开始质控接口输入参数
  99. const startFormData=reactive({
  100. // 任务id
  101. taskId:''
  102. })
  103. // 签收接口
  104. const getSignTask=()=>{
  105. http.get("app-api/index/qs",signFormData).then(res=>{
  106. console.log(res)
  107. if(res==true){
  108. uni.showToast({
  109. title:'签收成功',
  110. icon:'success'
  111. })
  112. }else{
  113. uni.showToast({
  114. title:'签收失败',
  115. icon:'error'
  116. })
  117. }
  118. })
  119. }
  120. // 开始质控接口
  121. const getStartTask=()=>{
  122. http.get("app-api/index/kszkByid",startFormData).then(res=>{
  123. console.log(res)
  124. // 1表示开始质控,-1表示不是组长不能质控,其他表示开始质控失败
  125. if(res==1){
  126. uni.navigateTo({
  127. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
  128. })
  129. }else if(res=-1){
  130. // 提示-只有组长能够开始质控
  131. uni.showModal({
  132. title: '提示',
  133. content: '只有组长能够开始质控',
  134. confirmColor: 'rgba(190, 163, 117, 1)', //确定字体颜色
  135. showCancel: false,//没有取消按钮的弹框
  136. buttonText: '确定'
  137. })
  138. }else{
  139. uni.showToast({
  140. title: '开始质控失败',
  141. icon:'none'
  142. });
  143. }
  144. })
  145. }
  146. const IndexName = ref("zkTaskListViewRef_1")
  147. const changeIndex=(e)=>{
  148. console.log('change-----------')
  149. IndexName.value = e.name
  150. pageInfo.current = e.value
  151. if(taskListRef()){
  152. taskListRef().fetch()
  153. }
  154. }
  155. const taskListRef = ()=>{
  156. const taskList = proxy.$refs[IndexName.value]
  157. return taskList
  158. }
  159. // 页面滚动触发事件
  160. onPageScroll((detail) => {
  161. //页面滚动事件
  162. uni.pageScrollTo({
  163. scrollTop: detail.scrollTop,
  164. duration: 0
  165. })
  166. })
  167. // 上拉加载
  168. onReachBottom(() => {
  169. console.log("父上拉加载");
  170. taskListRef().reachBottom()
  171. })
  172. //下拉刷新
  173. onPullDownRefresh(() => {
  174. console.log("父下拉刷新");
  175. taskListRef().pullDownRefresh()
  176. })
  177. onShow(()=>{
  178. ystabbar()
  179. nextTick(()=>{
  180. pageInfo.current = 0
  181. })
  182. uni.$off("signTask")
  183. uni.$off("startTask")
  184. uni.$on("signTask",(e)=>{
  185. signFormData.taskId=e.id
  186. pageInfo.taskId=e.id
  187. operatorDialog._value.open();
  188. pageInfo.popupMessage.title='签收'
  189. pageInfo.popupMessage.showMessage='是否确认签收任务?'
  190. })
  191. uni.$on("startTask",(e)=>{
  192. startFormData.taskId=e.id
  193. pageInfo.taskId=e.id
  194. if(e.isKszk==false){
  195. operatorDialog._value.open()
  196. pageInfo.popupMessage.title='开始质控'
  197. pageInfo.popupMessage.showMessage='是否确认开始质控任务?'
  198. }else{
  199. uni.navigateTo({
  200. url:'/pages/ypczk/zkTask/zkTask?taskId='+pageInfo.taskId
  201. })
  202. }
  203. })
  204. uni.$off("finishTask")
  205. uni.$on("finishTask",()=>{
  206. pageInfo.current=4
  207. })
  208. })
  209. </script>
  210. <style lang="scss" scoped>
  211. @import 'indexList.scss';
  212. </style>