index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="p-3">
  3. <div class="bg-fff flex1 ov-hd d-flex flex-cln">
  4. <div class="pd-16 border-bottom">
  5. <el-form ref="formRef" :model="paramForm" :inline="true" label-width="auto">
  6. <el-form-item label="产品类别:" class="search-form-item" prop="classType">
  7. <el-select v-model="paramForm.classType" placeholder="请选择" @change="onSearch" style="width: 120px;">
  8. <el-option v-for="item in class_type" :key="item.value" :label="item.label" :value="item.value"></el-option>
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="审核状态:" class="search-form-item" prop="res">
  12. <el-select v-model="paramForm.res" placeholder="请选择" @change="onSearch" style="width: 120px;">
  13. <el-option v-for="item in check_status" :key="item.value" :label="item.label" :value="item.value"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="生成时间:" class="search-form-item" prop="dateTime">
  17. <div style="width: 240px" class="d-flex">
  18. <DateRange v-model="paramForm.dateTime" v-model:start-date="paramForm.startAt" v-model:end-date="paramForm.endAt" @change="onSearch"></DateRange>
  19. </div>
  20. </el-form-item>
  21. <el-form-item prop="keywords" label="关键字搜索:" class="search-form-item">
  22. <el-input v-model="paramForm.keywords" style="width: 260px;" @keyup.enter="onSearch" class="input-with-search" clearable placeholder="搜生成批号、产品名称、备注"></el-input>
  23. </el-form-item>
  24. <el-form-item class="search-form-item">
  25. <el-button @click="onSearch" type="primary">搜索</el-button>
  26. <el-button @click="resetSearch">重置</el-button>
  27. </el-form-item>
  28. </el-form>
  29. </div>
  30. <div class="flex1 ov-hd pd-16 d-flex flex1 ov-hd flex-cln">
  31. <div class="flex1 ov-hd">
  32. <vxe-table :data="list" border :loading="loading" min-height="0" max-height="100%">
  33. <vxe-column type="seq" title="序号" width="50">
  34. <template #default="{ $rowIndex }">
  35. {{ paramForm.pageSize * (paramForm.pageNum - 1) + $rowIndex + 1 }}
  36. </template>
  37. </vxe-column>
  38. <vxe-column field="batchSn" class-name="c-333 f-w-5" width="100" title="生成批号"></vxe-column>
  39. <vxe-column min-width="300" title="产品信息">
  40. <template #default="{ row }">
  41. <RowProGB :row="row"></RowProGB>
  42. </template>
  43. </vxe-column>
  44. <vxe-column field="cpyName" class-name="c-333 f-w-5" width="100" title="申请企业名称"></vxe-column>
  45. <vxe-column min-width="160" title="码数量" :formatter="colNoData">
  46. <template #default="{ row }">
  47. <div class="f-w-5 c-333">{{ row.codeAllCount || '-' }}</div>
  48. <div class="f-12 c-999">
  49. <template v-for="(item, index) in row?.codeInfo" :key="index">
  50. <div class="mr20">{{ item?.level }}级:{{ item?.count || 0 }}</div>
  51. </template>
  52. </div>
  53. </template>
  54. </vxe-column>
  55. <vxe-column field="useCount" width="80" title="使用记录" :formatter="colNoData">
  56. <template #default="{ row }">
  57. <el-button v-if="row.useCount" @click="clickLookUseLog(row)" type="primary" text class="small-f-14" size="small">{{ row.useCount }}条</el-button>
  58. <template v-else>-</template>
  59. </template>
  60. </vxe-column>
  61. <vxe-column field="downloadCount" width="80" title="下载次数" :formatter="colNoData"></vxe-column>
  62. <vxe-column field="downloadTime" width="110" title="最近下载时间" :formatter="colNoData"></vxe-column>
  63. <vxe-column width="110" title="审核状态">
  64. <template #default="{ row }">
  65. <div>{{ selectDictLabel(check_status, row?.res) || '-' }}</div>
  66. <div class="f-s-12 c-#999" v-if="row?.res == '2'">理由: {{ row?.msg }}</div>
  67. </template>
  68. </vxe-column>
  69. <vxe-column width="110" title="生成状态" :formatter="colNoData">
  70. <template #default="{ row }">
  71. <template v-if="row.status * 1 == 1">生成成功</template>
  72. <template v-else-if="row.status * 1 == 11">未开始</template>
  73. <template v-else>生成中</template>
  74. </template>
  75. </vxe-column>
  76. <vxe-column field="remark" min-width="130" title="备注" :formatter="colNoData"></vxe-column>
  77. <vxe-column field="createByName" min-width="100" title="创建人" :formatter="colNoData"></vxe-column>
  78. <vxe-column field="createTime" width="110" title="创建时间" :formatter="colNoData"></vxe-column>
  79. <vxe-column fixed="right" title="操作" align="center" width="240">
  80. <template #default="{ row }">
  81. <template v-if="row?.res === '0'">
  82. <el-button @click="handleApproval(row, '1')" type="success">审核通过</el-button>
  83. <el-button @click="handleApproval(row, '2')" type="warning">审核不通过</el-button>
  84. </template>
  85. </template>
  86. </vxe-column>
  87. <template #empty>
  88. <Empty description="暂无数据"></Empty>
  89. </template>
  90. </vxe-table>
  91. </div>
  92. <el-pagination v-model:page-size="paramForm.pageSize" background v-model:current-page="paramForm.pageNum" layout="total, sizes, prev, pager, next, jumper" :total="total" hide-on-single-page @size-change="changePageSize" @current-change="changePage" />
  93. </div>
  94. </div>
  95. </div>
  96. </template>
  97. <script setup name="Lm-list" lang="ts">
  98. import { approvalSwyqCodeLog, swyqCodeLogList } from '@/api/gb';
  99. import { debounce } from 'lodash';
  100. import { RowProGB } from './model';
  101. import { CircleCheck, CircleClose } from '@element-plus/icons-vue';
  102. import { colNoData } from '@/utils/models';
  103. import { DateRange, searchTabs } from '@/views/models';
  104. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  105. const dict = proxy?.useDict('class_type', 'expiration_unit', 'code_type', 'ref_type', 'pack_status', 'trace_level', 'check_status');
  106. const { check_status, class_type } = toRefs<any>(dict);
  107. const showDown = ref(false);
  108. const showUseLog = ref(false);
  109. const showUseLogList = ref(false);
  110. const downId = ref<any>(null);
  111. const clickDownload = (row: any) => {
  112. downId.value = row?.id;
  113. showDown.value = true;
  114. };
  115. const rowInfo = ref<any>(null);
  116. const clickAddUseLog = (row: any) => {
  117. rowInfo.value = row;
  118. showUseLog.value = true;
  119. };
  120. const clickLookUseLog = (row: any) => {
  121. rowInfo.value = row;
  122. showUseLogList.value = true;
  123. };
  124. const list = ref<any[]>([]);
  125. const loading = ref(false);
  126. const total = ref(0);
  127. const paramForm = ref({
  128. pageSize: 10,
  129. pageNum: 1,
  130. keywords: '',
  131. swyqFlag: '1',
  132. dateTime: [],
  133. startAt: '',
  134. endAt: '',
  135. source: '1',
  136. classType: '',
  137. res: '' // 审核状态
  138. });
  139. const onSearch = () => {
  140. paramForm.value.pageNum = 1;
  141. getList();
  142. };
  143. const getList = debounce(async () => {
  144. loading.value = true;
  145. const res = await swyqCodeLogList({ ...paramForm.value }).catch(() => {});
  146. loading.value = false;
  147. if (!res || res.code !== 200) return;
  148. total.value = res.total;
  149. list.value = [...res.rows];
  150. }, 600);
  151. const approvalAjax = async (params: any) => {
  152. proxy?.$modal.loading('审核中...');
  153. const res = await approvalSwyqCodeLog(params).catch(() => {});
  154. proxy?.$modal.closeLoading();
  155. if (!res) return;
  156. proxy?.$modal.msgSuccess('操作完成');
  157. getList();
  158. };
  159. const changePageSize = (pageSize: number) => {
  160. paramForm.value.pageSize = pageSize;
  161. getList();
  162. };
  163. const changePage = (pageNum: number) => {
  164. paramForm.value.pageNum = pageNum;
  165. getList();
  166. };
  167. const formRef = ref<any>(null);
  168. // 重置搜索
  169. const resetSearch = () => {
  170. paramForm.value.pageNum = 1;
  171. formRef.value?.resetFields();
  172. paramForm.value.startAt = '';
  173. paramForm.value.endAt = '';
  174. getList();
  175. };
  176. /**
  177. * 申请审批
  178. */
  179. const handleApproval = async (row: any, res: string) => {
  180. if (res === '1') {
  181. ElMessageBox.confirm('该成员审核通过?', '提示', {
  182. confirmButtonText: '确认',
  183. cancelButtonText: '取消',
  184. type: 'success',
  185. icon: markRaw(CircleCheck)
  186. })
  187. .then(() => {
  188. const params = {
  189. approvalType: '2',
  190. targetId: row.id,
  191. res
  192. };
  193. approvalAjax(params);
  194. })
  195. .catch(() => {
  196. proxy?.$modal.msgWarning('取消审核');
  197. });
  198. } else {
  199. ElMessageBox.prompt('该成员审核不通过', '提示', {
  200. confirmButtonText: '确认',
  201. cancelButtonText: '取消',
  202. inputPlaceholder: '不通过理由',
  203. inputErrorMessage: '请填写不通过理由',
  204. type: 'error',
  205. icon: markRaw(CircleClose),
  206. inputValidator: (value) => {
  207. return value ? true : false;
  208. }
  209. })
  210. .then(({ value }) => {
  211. const params = {
  212. approvalType: '2',
  213. targetId: row.id,
  214. res,
  215. msg: value
  216. };
  217. approvalAjax(params);
  218. })
  219. .catch(() => {
  220. proxy?.$modal.msgWarning('取消审核');
  221. });
  222. }
  223. };
  224. onMounted(() => {
  225. getList();
  226. });
  227. </script>
  228. <style lang="scss">
  229. .el-form-item--default {
  230. &.search-form-item {
  231. margin: 5px;
  232. .el-form-item__label {
  233. padding-right: 0;
  234. }
  235. }
  236. }
  237. </style>