index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div class="p-2">
  3. <transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
  4. <div class="search" v-show="showSearch">
  5. <el-form :model="queryParams" ref="queryFormRef" label-width="100px">
  6. <el-row :gutter="15">
  7. <el-col :xl="6" :lg="8" :sm="12">
  8. <el-form-item label="模版类别" prop="tplType">
  9. <el-select v-model="queryParams.tplType" style="width: 100%;" placeholder="请选择审核状态" clearable>
  10. <el-option v-for="dict in class_type" :key="dict.value" :label="dict.label" :value="dict.value" />
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xl="6" :lg="8" :sm="12">
  15. <el-form-item label="企业名称" prop="cpyName">
  16. <el-input v-model="queryParams.cpyName" placeholder="请输入企业名称" clearable @keyup.enter="handleQuery" />
  17. </el-form-item>
  18. </el-col>
  19. <el-col :xl="6" :lg="8" :sm="12">
  20. <el-form-item label="信用代码" prop="creditCode">
  21. <el-input v-model="queryParams.creditCode" placeholder="请输入信用代码" clearable @keyup.enter="handleQuery" />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :xl="6" :lg="8" :sm="12">
  25. <el-form-item label="审核状态" prop="status">
  26. <el-select v-model="queryParams.status" style="width: 100%;" placeholder="请选择审核状态" clearable>
  27. <el-option v-for="dict in cpy_res_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :xl="6" :lg="8" :sm="12">
  32. <el-form-item>
  33. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  34. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. </el-form>
  39. </div>
  40. </transition>
  41. <el-card shadow="never">
  42. <el-table v-loading="loading" :data="list" border>
  43. <el-table-column type="index" width="55" title="序号" align="center" />
  44. <el-table-column label="模版类别" align="center">
  45. <template #default="{ row }">
  46. {{ selectDictLabel(class_type, row.tplType) || '-' }}
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="企业名称" min-width="150" align="center" prop="cpyName" />
  50. <el-table-column label="统一社会信用代码" min-width="100" align="center" prop="creditCode" />
  51. <el-table-column label="模版名称" min-width="150" align="center" prop="tplName" />
  52. <el-table-column label="提交人" align="center" prop="lastModUserName" />
  53. <el-table-column label="提交时间" align="center" prop="lastModTime" />
  54. <el-table-column label="审核状态" align="center">
  55. <template #default="{ row }">
  56. {{ selectDictLabel(cpy_res_status, row.status) || '-' }}
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="操作" width="300" fixed="right" class-name="small-padding fixed-width">
  60. <template #default="{ row }">
  61. <el-button @click="h5Preview(row)" text type="primary">预览</el-button>
  62. <template v-if="row.status === '0'">
  63. <el-button @click="handleApproval(row, '1')" text type="success">审核通过</el-button>
  64. <el-button @click="handleApproval(row, '2')" text type="danger">审核不通过</el-button>
  65. </template>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  70. </el-card>
  71. </div>
  72. <H5ModelLook v-if="showH5Tem" v-model:show="showH5Tem" title="模版预览" :src="temSrc"></H5ModelLook>
  73. </template>
  74. <script setup name="H5-custom-list" lang="ts">
  75. import { h5TplApprove, h5TplList } from '@/api/h5-custom';
  76. import { colNoData } from '@/utils/models';
  77. import { H5ModelLook } from '@/views/components';
  78. import { CircleCheck, CircleClose } from '@element-plus/icons-vue';
  79. import { getCurrentInstance, reactive, ref, toRefs } from 'vue';
  80. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  81. const { class_type, cpy_res_status } = toRefs<any>(proxy?.useDict('class_type', 'cpy_res_status'));
  82. const list = ref<any[]>([]);
  83. const showH5Tem = ref(false);
  84. const temSrc = ref('');
  85. const loading = ref(true);
  86. const showSearch = ref(true);
  87. const total = ref(0);
  88. const queryFormRef = ref<ElFormInstance>();
  89. const data = reactive<any>({
  90. queryParams: {
  91. pageNum: 1,
  92. pageSize: 10,
  93. cpyName: undefined,
  94. tplType: undefined,
  95. tel: undefined,
  96. creditCode: undefined,
  97. status: '0'
  98. },
  99. });
  100. const { queryParams, form } = toRefs(data);
  101. // 模版预览
  102. const h5Preview = (row: any) => {
  103. const { appid } = row
  104. const mapId: any = {
  105. '1838028510242902017': 'a/',
  106. '1785120816244535298': ''
  107. }
  108. temSrc.value = import.meta.env.VITE_H5_URL + (mapId[appid] || '') + 'pages/index/tem-preview?id=' + row.id + '&myl=1&state=' + new Date().getTime();
  109. showH5Tem.value = true;
  110. };
  111. // 审批办理
  112. const handleApproval = async (row: any, res: string) => {
  113. const { cpyName } = row;
  114. if (res === '1') {
  115. ElMessageBox.confirm('模版审核通过?', '提示', {
  116. confirmButtonText: '确认',
  117. cancelButtonText: '取消',
  118. type: 'success',
  119. icon: markRaw(CircleCheck)
  120. })
  121. .then(() => {
  122. const params = {
  123. targetId: row.id,
  124. res
  125. };
  126. approvalAjax(params);
  127. })
  128. .catch(() => {
  129. proxy?.$modal.msgWarning('取消审核');
  130. });
  131. } else {
  132. ElMessageBox.prompt('模版审核不通过', '提示', {
  133. confirmButtonText: '确认',
  134. cancelButtonText: '取消',
  135. inputPlaceholder: '不通过理由',
  136. inputErrorMessage: '请填写不通过理由',
  137. type: 'error',
  138. icon: markRaw(CircleClose),
  139. inputValidator: (value) => {
  140. return value ? true : false;
  141. }
  142. })
  143. .then(({ value }) => {
  144. const params = {
  145. targetId: row.id,
  146. res,
  147. msg: value
  148. };
  149. approvalAjax(params);
  150. })
  151. .catch(() => {
  152. proxy?.$modal.msgWarning('取消审核');
  153. });
  154. }
  155. };
  156. const approvalAjax = async (params: any) => {
  157. proxy?.$modal.loading('审核中...');
  158. const res = await h5TplApprove(params).catch(() => { });
  159. proxy?.$modal.closeLoading();
  160. if (!res) return;
  161. proxy?.$modal.msgSuccess('操作完成');
  162. getList();
  163. };
  164. /** 查询企业备案信息列表 */
  165. const getList = async () => {
  166. loading.value = true;
  167. const res = await h5TplList(queryParams.value);
  168. list.value = res.rows;
  169. total.value = res.total;
  170. loading.value = false;
  171. };
  172. /** 搜索按钮操作 */
  173. const handleQuery = () => {
  174. queryParams.value.pageNum = 1;
  175. getList();
  176. };
  177. /** 重置按钮操作 */
  178. const resetQuery = () => {
  179. queryFormRef.value?.resetFields();
  180. handleQuery();
  181. };
  182. onMounted(() => {
  183. getList();
  184. });
  185. </script>