index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <z-paging ref="paging" v-model="list" bgColor="#f7f7f7" @query="query" hide-no-more-inside>
  3. <template #top>
  4. <up-navbar title="加工及包装赋码任务" :fixed="false"> </up-navbar>
  5. </template>
  6. <template>
  7. <view class="pd3-24-24-0">
  8. <view class="">
  9. <ut-tabs mode="subsection" v-model="form.restFlag" :tabs="tabs" @change="onRefresh"></ut-tabs>
  10. </view>
  11. </view>
  12. <view class="d-flex a-c pd-24 pb-0 bg-#f7f7f7">
  13. <view class="min-w-170 flex1">
  14. <ut-action-sheet v-model="form.taskType" :tabs="[{ label: '全部', value: '' }, ...pt_process_type]" @change="onRefresh" title="选择原料类型">
  15. <view class="d-flex search-select-item a-c">
  16. <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ selectDictLabel(pt_process_type, form.taskType) || '全部' }}</view>
  17. <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
  18. </view>
  19. </ut-action-sheet>
  20. </view>
  21. <view class="h-86 pl-20 w-100%">
  22. <ut-search ref="searchRef" v-model="form.keyword" @search="changeSeach" @change="changeSeach" margin="0" :border="false" placeholder="搜药材名、批号" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
  23. </view>
  24. </view>
  25. <view class="pd-24">
  26. <template v-for="(item, index) in list" :key="index">
  27. <view class="bg-#fff b-radius pd-24 p-rtv mb-16">
  28. <view v-if="+item?.processType == 1 && +item?.processMedType == 1" class="bg-#91C747 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: absolute; top: 0rpx; left: 0rpx">种子初加工</view>
  29. <view v-if="+item?.processType == 1 && +item?.processMedType == 2" class="bg-#C7A262 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: absolute; top: 0rpx; left: 0rpx">药材初加工</view>
  30. <view v-if="+item?.processType == 2" class="bg-#37A954 c-#fff f-w-5 pd-10 pt-4 pb-4 f-s-20" style="border-radius: 16rpx 0 16rpx 0; width: max-content; position: absolute; top: 0rpx; left: 0rpx">趁鲜切制</view>
  31. <view v-if="item?.processingDate || item?.processingDateEnd" class="d-flex a-c j-ed">
  32. <view class="c-#999 f-s-24">{{ item?.processingDate }} 至 {{ item?.processingDateEnd }}</view>
  33. </view>
  34. <view class="mb-10 d-flex a-c" @click="gotodetaillist(item)">
  35. <view class="">
  36. <span v-if="item?.variety" class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.variety }}</span>
  37. <span v-else class="f-s-34 c-#333 f-w-500 mr-10">{{ item?.medicineName }}(鲜制)</span>
  38. <span class="f-s-24 c-#666" v-if="+item?.processMedType == 1">{{ selectDictLabel(pt_stock_type, item?.processMedType) }}</span>
  39. </view>
  40. <view class="flex1"></view>
  41. <up-icon name="arrow-right" size="26rpx"></up-icon>
  42. </view>
  43. <view class="pd2-4-0 f-s-28">
  44. <span class="c-#666">加工批号:</span>
  45. <span class="c-#333 f-w-500">{{ item?.processCode }}</span>
  46. </view>
  47. <view v-if="+item?.processType == 1" class="pd2-4-0 f-s-28">
  48. <span class="c-#666">执行标准:</span>
  49. <span class="c-#333 f-w-500">{{ selectDictLabel(pt_standard_type, item?.standardType) }}</span>
  50. <span class="c-#666" v-if="item?.standardDetailName">({{ item?.standardDetailName }})</span>
  51. </view>
  52. <view v-else class="pd2-4-0 f-s-28">
  53. <span class="c-#666">执行标准:</span>
  54. <span class="c-#666" v-if="item?.standardDetailName">{{ item?.standardDetailName }}</span>
  55. </view>
  56. <view class="pd2-4-0 f-s-28">
  57. <span class="c-#666">加工工艺:</span>
  58. <template v-for="(items, indexs) in item?.ptech?.split(',')" v-if="item?.ptech" :key="indexs">
  59. <span v-if="indexs !== 0" class="c-#999 f-s-32 ml-10 mr-10">→ </span>
  60. <span class="f-s-32">{{ items }}</span>
  61. </template>
  62. <template v-else>
  63. <span class="c-#999 f-s-32">-</span>
  64. </template>
  65. </view>
  66. <view class="pd2-4-0 f-s-28">
  67. <span class="c-#666">加工负责人:</span>
  68. <span class="c-#333 f-w-500">{{ item?.contactName }}</span>
  69. </view>
  70. <Output :data="item" />
  71. </view>
  72. </template>
  73. </view>
  74. </template>
  75. <view class="h-210" v-if="list?.length"></view>
  76. <view v-if="list?.length" :style="{ height: `${safeAreaBottom}px` }"></view>
  77. <template #empty>
  78. <view class="d-flex flex-cln a-c">
  79. <ut-empty class="mg-at" color="#ccc" size="28rpx" image="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/noEmptyBase.png">暂无加工任务</ut-empty>
  80. <text class="c-#ccc f-s-28">点击下方按钮去添加吧~</text>
  81. </view>
  82. </template>
  83. <template #bottom>
  84. <ut-tabar activeTab="processing"></ut-tabar>
  85. </template>
  86. </z-paging>
  87. <ut-suspension v-if="sus?.left" :imageWidth="60" :imageHeight="60" :x="sus?.left" :y="sus?.bottom" :inertia="false" :snap-threshold="40">
  88. <image src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/common/btn_add_logo.png" mode="widthFix" class="w-120 h-120" @click="showDeleteDialog = true"></image>
  89. </ut-suspension>
  90. <ut-confirm-dialog v-model:show="showDeleteDialog" width="80vw" title="请选择要创建的任务类型" :confirmText="'确认选择'" :cancelText="'取消'" @confirm="handlechoseConfirm" @cancel="handleDeleteCancel">
  91. <view class="" v-for="item in pt_process_type" :key="item?.value">
  92. <view style="border: 1rpx solid" :style="{ backgroundColor: item?.value == basetype ? '#EBF6EE' : '#f7f7f7', borderColor: item?.value == basetype ? '#37A954' : 'transparent' }" class="pr-30 d-flex a-c mb-20 radius-100" @click="handlechose(item.value)">
  93. <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '1'">
  94. <up-avatar size="90rpx" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/TaskType_plant.png"></up-avatar>
  95. </view>
  96. <view class="radius-50% mg-8 bg-#F0F0F0" v-if="item?.value == '2'">
  97. <up-avatar size="90rpx" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/port/TaskType_breeding.png"></up-avatar>
  98. </view>
  99. <view class="c-#333 f-s-34">
  100. {{ item?.label }}
  101. </view>
  102. <view class="flex1"></view>
  103. <view class="d-flex">
  104. <img v-if="basetype === item.value" class="w-30 h-30" src="https://ta.zycpzs.cn/oss-file/smart-trace/szyy/images-plt/plant/chooseSuccessfully.png" mode="widthFix" alt="" />
  105. </view>
  106. </view>
  107. </view>
  108. </ut-confirm-dialog>
  109. </template>
  110. <script setup lang="ts">
  111. import { useClientRequest } from '@/utils/request';
  112. import Output from './models/output.vue';
  113. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  114. const { pt_process_type, pt_stock_type, pt_standard_type } = toRefs<any>(proxy?.useDict('pt_process_type', 'pt_stock_type', 'pt_standard_type'));
  115. const sus = ref({
  116. left: 0,
  117. bottom: 0,
  118. });
  119. const systemInfo = uni.getSystemInfoSync();
  120. const windowInfo = uni.getWindowInfo();
  121. const safeAreaBottom = windowInfo.safeAreaInsets.bottom;
  122. sus.value.left = systemInfo.windowWidth - 10;
  123. sus.value.bottom = systemInfo.windowHeight - 200;
  124. const showDeleteDialog = ref(false);
  125. const basetype = ref();
  126. const handlechose = (item: string) => {
  127. basetype.value = item;
  128. };
  129. // 处理取消
  130. const handleDeleteCancel = () => {
  131. showDeleteDialog.value = false;
  132. basetype.value = '';
  133. };
  134. const handlechoseConfirm = () => {
  135. if (!basetype.value) {
  136. uni.showToast({
  137. title: '请选择要创建的任务类型',
  138. icon: 'none',
  139. duration: 2000,
  140. });
  141. return;
  142. }
  143. uni.$u.route({ type: 'navigateTo', url: '/plant/processing/processing-create/index', params: { taskType: basetype.value } });
  144. };
  145. const paging = ref();
  146. const list = ref<any[]>([]);
  147. const tabs = [
  148. {
  149. label: '加工',
  150. value: '0',
  151. },
  152. {
  153. label: '包装赋码',
  154. value: '1',
  155. },
  156. ];
  157. const form = ref({
  158. storageType: '4',
  159. });
  160. const query = async (pageNum: number, pageSize: number) => {
  161. const params = {
  162. pageNum,
  163. pageSize,
  164. ...form.value,
  165. };
  166. const res = await useClientRequest.get('/plt-api/app/processe/pageList', params);
  167. if (res) {
  168. const { rows } = res;
  169. paging.value.complete(rows);
  170. }
  171. };
  172. const gotodetaillist = (item: any) => {
  173. uni.$u.route({
  174. type: 'navigateTo',
  175. url: '/plant/processing/processing-detail-list/index',
  176. params: { id: item?.id },
  177. });
  178. };
  179. const onRefresh = () => {
  180. paging.value?.reload();
  181. };
  182. onMounted(() => {
  183. uni.$on('updateprocesstasklist', function () {
  184. paging.value?.reload();
  185. });
  186. });
  187. </script>
  188. <style scoped lang="scss">
  189. .search-select-item {
  190. height: 86rpx;
  191. background-color: #fff;
  192. border-radius: 10rpx;
  193. box-sizing: border-box;
  194. padding: 12rpx;
  195. }
  196. </style>