zkTask.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="qualitycontrolTask">
  3. <!-- 飞行质控任务 -->
  4. <view class="flightTask">
  5. <uni-card>
  6. <uni-section :title="pageData.taskList.name" type="line">
  7. <!-- <template v-slot:right>
  8. <image style="width: 50rpx; height: 50rpx;" :src="showIcon.nowIcon" @click="changeState()">
  9. </image>
  10. </template> -->
  11. </uni-section>
  12. <view class="flightTask_list">
  13. <view class="flightTask_title">
  14. <view class="flightTask_text">被质控代煎企业</view>
  15. <view class="flightTask_righttext">{{pageData.taskList.bzkOrgName}}</view>
  16. </view>
  17. <view class="flightTask_title">
  18. <view class="flightTask_text">组长</view>
  19. <view class="flightTask_righttext">{{pageData.taskList.zzName}}</view>
  20. </view>
  21. <view class="flightTask_title">
  22. <view class="flightTask_text">组员</view>
  23. <view class="flightTask_righttext">{{pageData.taskList.zyNames}}</view>
  24. </view>
  25. <view class="flightTask_title">
  26. <view class="flightTask_text">地址</view>
  27. <view class="flightTask_righttext">{{pageData.taskList.address}}</view>
  28. </view>
  29. <view class="flightTask_title">
  30. <view class="flightTask_text">总数量:</view>
  31. <view class="flightTask_righttext">
  32. {{pageData.taskList.totalWcCount+'/'+pageData.taskList.totalCyCount}}</view>
  33. </view>
  34. <view class="flightTask_title">
  35. <view class="flightTask_text">代煎完成数量:</view>
  36. <view class="flightTask_righttext">
  37. {{pageData.taskList.djWcCount+'/'+pageData.taskList.djCyCount}}</view>
  38. </view>
  39. <view class="flightTask_title">
  40. <view class="flightTask_text">代配完成数量:</view>
  41. <view class="flightTask_righttext">
  42. {{pageData.taskList.dpWcCount+'/'+pageData.taskList.dpCyCount}}</view>
  43. </view>
  44. </view>
  45. </uni-card>
  46. </view>
  47. <!-- 代配作业质控 -->
  48. <view class="dp_or_dj_Task">
  49. <uni-card>
  50. <uni-section title="代配作业质控" type="line">
  51. <template v-slot:right>
  52. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.dpbhg}}</view>
  53. </view>
  54. </template>
  55. </uni-section>
  56. <view>
  57. <button class="button" @click="addTask('dp')"> + 新增</button>
  58. </view>
  59. <uni-table class="dp_table">
  60. <!-- 表头行 -->
  61. <uni-tr>
  62. <uni-th align="center" width="150rpx">处方编号</uni-th>
  63. <uni-th align="center" width="150rpx">贴数(贴)</uni-th>
  64. <uni-th align="center" width="150rpx">平均误差(%)</uni-th>
  65. <uni-th align="center" width="150rpx">操作人</uni-th>
  66. </uni-tr>
  67. <!-- 表格数据行 -->
  68. <uni-tr v-for="(item, index) in pageData.dpList" :key="index">
  69. <uni-td align="center">{{item.cfbh}}</uni-td>
  70. <uni-td align="center">{{item.ts}}</uni-td>
  71. <uni-td align="center">{{item.wc}}</uni-td>
  72. <uni-td align="center">{{item.creatorName}}</uni-td>
  73. </uni-tr>
  74. </uni-table>
  75. <view class="see_more" @click="seeMore('dp')">
  76. <text>查看更多</text>
  77. <uni-icons type="right"></uni-icons>
  78. </view>
  79. </uni-card>
  80. </view>
  81. <!-- 代煎作业质控 -->
  82. <view class="dp_or_dj_Task">
  83. <uni-card>
  84. <uni-section title="代煎作业质控" type="line">
  85. <!-- <template v-slot:right>
  86. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.djbhg}}</view></view>
  87. </template> -->
  88. </uni-section>
  89. <view>
  90. <button class="button" @click="addTask('dj')"> + 新增</button>
  91. </view>
  92. <uni-table class="dp_table">
  93. <!-- 表头行 -->
  94. <uni-tr>
  95. <uni-th align="center" width="150rpx">处方编号</uni-th>
  96. <uni-th align="center" width="150rpx">贴数(贴)</uni-th>
  97. <uni-th align="center" width="150rpx">不合格项</uni-th>
  98. <uni-th align="center" width="150rpx">操作人</uni-th>
  99. </uni-tr>
  100. <!-- 表格数据行 -->
  101. <uni-tr v-for="(item, index) in pageData.djList" :key="index">
  102. <uni-td align="center">{{item.cfbh}}</uni-td>
  103. <uni-td align="center">{{item.ts}}</uni-td>
  104. <uni-td align="center">{{item.bhgx}}</uni-td>
  105. <uni-td align="center">{{item.creatorName}}</uni-td>
  106. </uni-tr>
  107. </uni-table>
  108. <view class="see_more" @click="seeMore('dj')">
  109. <text>查看更多</text>
  110. <uni-icons type="right"></uni-icons>
  111. </view>
  112. </uni-card>
  113. </view>
  114. <!-- 代煎企业作业环境质控 -->
  115. <view class="djqyhj_Task">
  116. <uni-card>
  117. <uni-section title="代煎企业作业环境质控" type="line">
  118. <template v-slot:right>
  119. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.hjzkbhg}}</view>
  120. </view>
  121. </template>
  122. </uni-section>
  123. <view class="image_upload">
  124. <uni-file-picker readonly :modelValue="pageData.imageList" file-mediatype="image">
  125. </uni-file-picker>
  126. </view>
  127. <view class="see_more" @click="seeMore('djqyhj')">
  128. <text>新增</text>
  129. <uni-icons type="right"></uni-icons>
  130. </view>
  131. </uni-card>
  132. </view>
  133. <!-- 完成质控 -->
  134. <view class="finish_button" v-if="pageData.finishStatus">
  135. <button class="button" @click="finishTask()">完成质控</button>
  136. </view>
  137. <!-- 完成质控弹出框 -->
  138. <uni-popup ref="operatorDialog" type="dialog">
  139. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  140. </uni-popup>
  141. </view>
  142. </template>
  143. <script setup>
  144. import {reactive,ref} from "vue";
  145. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  146. import http from '@/utils/request';
  147. import {uploadImageModelValue} from '@/pages/controls/image/OssService';
  148. const pageData = reactive({
  149. detailList: {},
  150. // 质控任务
  151. taskList: {},
  152. // 代配
  153. dpList: {},
  154. // 代煎
  155. djList: {},
  156. // 图片列表
  157. imageList: [],
  158. // 质控状态
  159. taskStatus: '',
  160. // 质控完成状态
  161. finishStatus: true,
  162. // 环境质控完成状态
  163. hjzkFinishStatus: '',
  164. // 对话框
  165. popupMessage:{
  166. // 标题
  167. title:'完成质控',
  168. // 提示内容
  169. showMessage:'是否确认完成质控任务'
  170. }
  171. })
  172. // 显示与隐藏突变
  173. const showIcon = reactive({
  174. nowIcon: '',
  175. showIcon: '/static/blackDisplay.png',
  176. hideIcon: '/static/blackHide.png'
  177. })
  178. // 查询质控作业--根据Id 和 完成质控 入参
  179. const zkzyData = reactive({
  180. id: ''
  181. })
  182. // 切换显示状态
  183. const changeState = () => {
  184. if (showIcon.nowIcon == showIcon.showIcon) {
  185. showIcon.nowIcon = showIcon.hideIcon
  186. } else {
  187. showIcon.nowIcon = showIcon.showIcon
  188. }
  189. }
  190. // 新增代配/代煎质控
  191. const addTask = (type) => {
  192. if (type == 'dp') {
  193. // 新增代配
  194. pageData.taskStatus = 'dp'
  195. } else if (type == 'dj') {
  196. // 新增代煎
  197. pageData.taskStatus = 'dj'
  198. }
  199. uni.navigateTo({
  200. url: '/pages/ypczk/zkTask/choosePrescription?taskStatus=' + pageData.taskStatus
  201. })
  202. }
  203. // 查看更多
  204. const seeMore = (type) => {
  205. let jumpUrl = ''
  206. if (type == 'dp') {
  207. // 代配跳转
  208. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList'
  209. } else if (type == 'dj') {
  210. // 代煎跳转
  211. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList'
  212. } else if (type == 'djqyhj') {
  213. // 环境质控跳转
  214. jumpUrl = '/pages/ypczk/zkTask/djhjTask'
  215. }
  216. uni.navigateTo({
  217. url: jumpUrl
  218. })
  219. }
  220. const operatorDialog=ref(null)
  221. const operatorDialogConfirm=()=>{
  222. uni.showLoading({
  223. title: '',
  224. mask: true
  225. });
  226. http.get("app-api/zkzy/finish", zkzyData).then(res => {
  227. uni.hideLoading()
  228. if (res != null) {
  229. operatorDialog.value.close()
  230. uni.navigateBack({
  231. delta: 1,
  232. success: () => {
  233. uni.$emit("finishTask")
  234. }
  235. });
  236. }
  237. })
  238. }
  239. const operatorDialogClose=()=>{
  240. operatorDialog.value.close()
  241. }
  242. // 完成质控
  243. const finishTask = () => {
  244. operatorDialog.value.open()
  245. }
  246. // 查询质控作业--根据Id
  247. const getZkData = () => {
  248. uni.showLoading({
  249. title: '',
  250. mask: true
  251. });
  252. http.get("app-api/zkzy/findZkzyById", zkzyData).then(res => {
  253. uni.hideLoading()
  254. pageData.detailList = res
  255. pageData.taskList = res.task
  256. pageData.djList = res.djCfDetail.slice(0, 3)
  257. pageData.dpList = res.dpCfDetail.slice(0, 3)
  258. pageData.hjzkFinishStatus = res.hjzkStatus
  259. pageData.detailList.dpbhg = dpbhgNumber(res.dpCfDetail)
  260. // 获取图片
  261. if (pageData.detailList.hjzkImgUrl != null && pageData.detailList.hjzkImgUrl != '') {
  262. pageData.imageList = showImage(pageData.detailList.hjzkImgUrl)
  263. }
  264. isfinishAllTask(res.task)
  265. })
  266. }
  267. // 代配不合格数
  268. const dpbhgNumber = (data) => {
  269. let number = 0
  270. data.forEach(item => {
  271. if (item.cfbhg == 1 || item.mxbhg > 0) {
  272. number++;
  273. }
  274. })
  275. return number
  276. }
  277. // 显示图片
  278. const showImage = (id) => {
  279. return uploadImageModelValue(id)
  280. }
  281. // 判断当前用户是否为组员(组员为true)
  282. const isZy = () => {
  283. try {
  284. const value = uni.getStorageSync("userInfo")
  285. if (pageData.taskList.zyIds.indexOf(value.id) != -1) {
  286. return true
  287. } else {
  288. return false
  289. }
  290. } catch (e) {
  291. //TODO handle the exception
  292. }
  293. }
  294. // 是否可以完成质控
  295. const isfinishAllTask = (e) => {
  296. // 总数量、代煎完成数量、代配完成数量不达标
  297. // 是否组员
  298. if (e.djWcCount >= e.djCyCount && e.dpWcCount >= e.dpCyCount && e.totalWcCount >= e.totalCyCount &&
  299. pageData.hjzkFinishStatus == '2' && pageData.imageList.length != 0 && pageData.imageList!=null && !isZy()) {
  300. pageData.finishStatus = true
  301. } else {
  302. pageData.finishStatus = false
  303. }
  304. }
  305. // 存入taskData(taskId)
  306. const setTaskId = () => {
  307. uni.setStorageSync("saveTaskId", {
  308. taskId: zkzyData.id
  309. })
  310. }
  311. onLoad((data) => {
  312. if (data != null) {
  313. zkzyData.id = data.taskId
  314. }
  315. setTaskId()
  316. })
  317. onShow(() => {
  318. showIcon.nowIcon = showIcon.hideIcon
  319. getZkData()
  320. })
  321. </script>
  322. <style lang="scss" scoped>
  323. @import './index.scss'
  324. </style>