zkTask.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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-th align="center" width="150rpx">操作人</uni-th>
  100. </uni-tr>
  101. <!-- 表格数据行 -->
  102. <uni-tr v-for="(item, index) in pageData.djList" :key="index">
  103. <uni-td align="center">{{item.cfbh}}</uni-td>
  104. <uni-td align="center">{{item.ts}}</uni-td>
  105. <uni-td align="center" :style="changeColor(item.bhgx,'red')">{{item.bhgx}}</uni-td>
  106. <uni-td align="center" :style="changeColor(item.djCount,'blue')">{{item.djCount}}</uni-td>
  107. <uni-td align="center">{{item.creatorName}}</uni-td>
  108. </uni-tr>
  109. </uni-table>
  110. <view class="see_more" @click="seeMore('dj')">
  111. <text>查看更多</text>
  112. <uni-icons type="right"></uni-icons>
  113. </view>
  114. </uni-card>
  115. </view>
  116. <!-- 代煎企业作业环境质控 -->
  117. <view class="djqyhj_Task">
  118. <uni-card>
  119. <uni-section title="代煎企业作业环境质控" type="line">
  120. <template v-slot:right>
  121. <view class="sub_title">不合格数<view class="sub_title_text">{{pageData.detailList.hjzkbhg}}</view>
  122. </view>
  123. </template>
  124. </uni-section>
  125. <view class="image_upload">
  126. <uni-file-picker readonly :modelValue="pageData.imageList" file-mediatype="image">
  127. </uni-file-picker>
  128. </view>
  129. <view class="see_more" @click="seeMore('djqyhj')">
  130. <text>新增</text>
  131. <uni-icons type="right"></uni-icons>
  132. </view>
  133. </uni-card>
  134. </view>
  135. <!-- 完成质控 -->
  136. <view class="finish_button" v-if="pageData.finishStatus">
  137. <button class="button" @click="finishTask()">完成质控</button>
  138. </view>
  139. <!-- 完成质控弹出框 -->
  140. <uni-popup ref="operatorDialog" type="dialog">
  141. <uni-popup-dialog type="info" confirmText="确定" cancelText="取消" :title="pageData.popupMessage.title" :content="pageData.popupMessage.showMessage" @confirm="operatorDialogConfirm" @close="operatorDialogClose"></uni-popup-dialog>
  142. </uni-popup>
  143. </view>
  144. </template>
  145. <script setup>
  146. import {reactive,ref} from "vue";
  147. import {onLoad,onShow,onUnload,onPullDownRefresh} from "@dcloudio/uni-app";
  148. import http from '@/utils/request';
  149. import {uploadImageModelValue} from '@/pages/controls/image/OssService';
  150. const pageData = reactive({
  151. detailList: {},
  152. // 质控任务
  153. taskList: {},
  154. // 代配
  155. dpList: {},
  156. // 代煎
  157. djList: {},
  158. // 图片列表
  159. imageList: [],
  160. // 质控状态
  161. taskStatus: '',
  162. // 质控完成状态
  163. finishStatus: true,
  164. // 环境质控完成状态
  165. hjzkFinishStatus: '',
  166. // 对话框
  167. popupMessage:{
  168. // 标题
  169. title:'完成质控',
  170. // 提示内容
  171. showMessage:'是否确认完成质控任务'
  172. }
  173. })
  174. // 显示与隐藏突变
  175. const showIcon = reactive({
  176. nowIcon: '',
  177. showIcon: '/static/blackDisplay.png',
  178. hideIcon: '/static/blackHide.png'
  179. })
  180. // 查询质控作业--根据Id 和 完成质控 入参
  181. const zkzyData = reactive({
  182. id: ''
  183. })
  184. // 切换显示状态
  185. const changeState = () => {
  186. if (showIcon.nowIcon == showIcon.showIcon) {
  187. showIcon.nowIcon = showIcon.hideIcon
  188. } else {
  189. showIcon.nowIcon = showIcon.showIcon
  190. }
  191. }
  192. // 新增代配/代煎质控
  193. const addTask = (type) => {
  194. if (type == 'dp') {
  195. // 新增代配
  196. pageData.taskStatus = 'dp'
  197. } else if (type == 'dj') {
  198. // 新增代煎
  199. pageData.taskStatus = 'dj'
  200. }
  201. uni.navigateTo({
  202. url: '/pages/ypczk/zkTask/choosePrescription?taskStatus=' + pageData.taskStatus
  203. })
  204. }
  205. // 查看更多
  206. const seeMore = (type) => {
  207. let jumpUrl = ''
  208. console.log(JSON.stringify(pageData));
  209. if (type == 'dp') {
  210. // 代配跳转
  211. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  212. } else if (type == 'dj') {
  213. // 代煎跳转
  214. jumpUrl = '/pages/ypczk/zkTask/zkTaskDetail/detailsList?taskInfo=' + encodeURIComponent(JSON.stringify(pageData.taskList))
  215. } else if (type == 'djqyhj') {
  216. // 环境质控跳转
  217. jumpUrl = '/pages/ypczk/zkTask/djhjTask'
  218. }
  219. uni.navigateTo({
  220. url: jumpUrl
  221. })
  222. }
  223. const operatorDialog=ref(null)
  224. const operatorDialogConfirm=()=>{
  225. uni.showLoading({
  226. title: '',
  227. mask: true
  228. });
  229. http.get("app-api/zkzy/finish", zkzyData).then(res => {
  230. uni.hideLoading()
  231. if (res != null) {
  232. operatorDialog.value.close()
  233. uni.navigateBack({
  234. delta: 1,
  235. success: () => {
  236. uni.$emit("finishTask")
  237. }
  238. });
  239. }
  240. })
  241. }
  242. const operatorDialogClose=()=>{
  243. operatorDialog.value.close()
  244. }
  245. // 完成质控
  246. const finishTask = () => {
  247. operatorDialog.value.open()
  248. }
  249. // 查询质控作业--根据Id
  250. const getZkData = () => {
  251. uni.showLoading({
  252. title: '',
  253. mask: true
  254. });
  255. http.get("app-api/zkzy/findZkzyById", zkzyData).then(res => {
  256. uni.hideLoading()
  257. pageData.detailList = res
  258. pageData.taskList = res.task
  259. pageData.djList = res.djCfDetail.slice(0, 3)
  260. pageData.dpList = res.dpCfDetail.slice(0, 3)
  261. pageData.hjzkFinishStatus = res.hjzkStatus
  262. pageData.detailList.dpbhg = dpbhgNumber(res.dpCfDetail)
  263. // 获取图片
  264. if (pageData.detailList.hjzkImgUrl != null && pageData.detailList.hjzkImgUrl != '') {
  265. pageData.imageList = showImage(pageData.detailList.hjzkImgUrl)
  266. }
  267. isfinishAllTask(res.task)
  268. })
  269. }
  270. // 代配不合格数
  271. const dpbhgNumber = (data) => {
  272. let number = 0
  273. data.forEach(item => {
  274. if (item.cfbhg == 1 || item.mxbhg > 0) {
  275. number++;
  276. }
  277. })
  278. return number
  279. }
  280. // 显示图片
  281. const showImage = (id) => {
  282. return uploadImageModelValue(id)
  283. }
  284. // 判断当前用户是否为组员(组员为true)
  285. const isZy = () => {
  286. try {
  287. const value = uni.getStorageSync("userInfo")
  288. if (pageData.taskList.zyIds.indexOf(value.id) != -1) {
  289. return true
  290. } else {
  291. return false
  292. }
  293. } catch (e) {
  294. //TODO handle the exception
  295. }
  296. }
  297. // 是否可以完成质控
  298. const isfinishAllTask = (e) => {
  299. // 总数量、代煎完成数量、代配完成数量不达标
  300. // 是否组员
  301. if (e.djWcCount >= e.djCyCount && e.dpWcCount >= e.dpCyCount && e.totalWcCount >= e.totalCyCount &&
  302. pageData.hjzkFinishStatus == '2' && pageData.imageList.length != 0 && pageData.imageList!=null && !isZy()) {
  303. pageData.finishStatus = true
  304. } else {
  305. pageData.finishStatus = false
  306. }
  307. }
  308. // 存入taskData(taskId)
  309. const setTaskId = () => {
  310. uni.setStorageSync("saveTaskId", {
  311. taskId: zkzyData.id
  312. })
  313. }
  314. const changeColor = (name,color) => {
  315. // 根据状态值返回不同的样式对象
  316. return {
  317. color: name > 0 ? color : 'black'
  318. };
  319. }
  320. onLoad((data) => {
  321. if (data != null) {
  322. zkzyData.id = data.taskId
  323. }
  324. setTaskId()
  325. })
  326. onShow(() => {
  327. showIcon.nowIcon = showIcon.hideIcon
  328. getZkData()
  329. })
  330. </script>
  331. <style lang="scss" scoped>
  332. @import './index.scss'
  333. </style>