index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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">
  5. <el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="108px">
  6. <el-form-item label="关键字" prop="keywords">
  7. <el-input v-model="queryParams.keywords" placeholder="请输入关键字" clearable style="width: 200px" @keyup.enter="handleQuery" />
  8. </el-form-item>
  9. <el-form-item label="状态" prop="status">
  10. <el-select v-model="queryParams.status" clearable>
  11. <el-option v-for="dict in approval_query_type" :value="dict.value" :label="dict.label"></el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="是否有管理员" prop="hasAdmin">
  15. <el-select v-model="queryParams.hasAdmin" clearable>
  16. <el-option label="全部" value="" />
  17. <el-option label="是" value="1" />
  18. <el-option label="否" value="0" />
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item>
  22. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  23. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  24. </el-form-item>
  25. </el-form>
  26. </div>
  27. </transition>
  28. <el-card shadow="never">
  29. <template #header v-if="false"></template>
  30. <el-table v-loading="loading" :data="userList" border>
  31. <el-table-column type="index" width="55" align="center" label="序号" />
  32. <el-table-column label="姓名" align="left" prop="name" width="200">
  33. <template #default="scope">
  34. <div style="display: flex;align-items: center;">
  35. <el-avatar size="small" :src="scope.row.userInfo.avatar" />
  36. <div style="margin-left: 10px;">{{ scope.row.userInfo.name }}</div>
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="手机号" align="left" prop="phone" width="200">
  41. <template #default="scope">
  42. <div style="display: flex;align-items: center;">
  43. <div style="margin-left: 10px;">{{ scope.row.userInfo.phone }}</div>
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="申请企业" align="center" prop="cpyName" width="300">
  48. <template #default="scope">
  49. <div style="display: flex;align-items: center;">
  50. <el-avatar size="small" :src="scope.row.cpyInfo.storePhoto" />
  51. <div style="margin-left: 10px;">{{ scope.row.cpyInfo.cpyName }}</div>
  52. </div>
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="是否有管理员" align="center" prop="hasAdmin" width="90">
  56. <template #default="{ row }">
  57. <dict-tag :options="yes_no" :value="row.hasAdmin"></dict-tag>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="统一社会信用代码" align="center" prop="cpyName" width="250">
  61. <template #default="scope">
  62. <div style="margin-left: 10px;">{{ scope.row.cpyInfo.creditCode }}</div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="时间申请" align="center" prop="createTime" width="200" />
  66. <el-table-column prop="res" width="90" label="状态">
  67. <template #default="{ row }">
  68. <div :style="{ color: approval_query_type.find((item: any) => item.value === row.res).elTagClass }">
  69. {{ selectDictLabel(approval_query_type, row.res) }}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  74. <template #default="scope">
  75. <div v-if="scope.row.res == '0'">
  76. <el-button @click="handleApproval(scope.row, '1')" type="success">审核通过</el-button>
  77. <el-button @click="handleApproval(scope.row, '2')" type="warning">审核不通过</el-button>
  78. </div>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
  83. </el-card>
  84. </div>
  85. </template>
  86. <script setup name="app-user-bind" lang="ts">
  87. import { bindInfoApproval } from '@/api/settled';
  88. import { BindInfoCpyListVo, QueryUserBindInfoBo } from '@/api/enterprise/recordCompany/types';
  89. import { listUserBindInfo } from '@/api/enterprise/recordCompany';
  90. import { CircleCheck, CircleClose } from '@element-plus/icons-vue';
  91. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  92. const userList = ref<BindInfoCpyListVo[]>([]);
  93. const loading = ref(true);
  94. const total = ref(0);
  95. const queryFormRef = ref<ElFormInstance>();
  96. const { approval_query_type, yes_no } = toRefs<any>(proxy?.useDict('approval_query_type', 'yes_no'));
  97. const data = reactive<PageData<any, any>>({
  98. form: {},
  99. queryParams: {
  100. pageNum: 1,
  101. pageSize: 10,
  102. cpyName: undefined,
  103. userName: undefined,
  104. keywords: undefined,
  105. hasAdmin: undefined,
  106. status: '0',
  107. params: {}
  108. },
  109. rules: {}
  110. });
  111. const { queryParams } = toRefs(data);
  112. /** 查询app用户列表 */
  113. const getList = async () => {
  114. loading.value = true;
  115. const res = await listUserBindInfo(queryParams.value);
  116. userList.value = res.rows;
  117. total.value = res.total;
  118. loading.value = false;
  119. };
  120. /** 搜索按钮操作 */
  121. const handleQuery = () => {
  122. queryParams.value.pageNum = 1;
  123. getList();
  124. };
  125. /** 重置按钮操作 */
  126. const resetQuery = () => {
  127. queryFormRef.value?.resetFields();
  128. handleQuery();
  129. };
  130. /**
  131. * 申请审批
  132. */
  133. const handleApproval = async (row: any, res: string) => {
  134. if (res === '1') {
  135. ElMessageBox.confirm('该成员审核通过?', '提示', {
  136. confirmButtonText: '确认',
  137. cancelButtonText: '取消',
  138. type: 'success',
  139. icon: markRaw(CircleCheck)
  140. })
  141. .then(() => {
  142. const params = {
  143. approvalType: +row.hasAdmin ? '0' : '1',
  144. targetId: row.id,
  145. res: res,
  146. };
  147. approvalAjax(params);
  148. })
  149. .catch(() => {
  150. proxy?.$modal.msgWarning('取消审核');
  151. });
  152. } else {
  153. ElMessageBox.prompt('该成员审核不通过', '提示', {
  154. confirmButtonText: '确认',
  155. cancelButtonText: '取消',
  156. inputPlaceholder: '不通过理由',
  157. inputErrorMessage: '请填写不通过理由',
  158. type: 'error',
  159. icon: markRaw(CircleClose),
  160. inputValidator: (value) => {
  161. return value ? true : false;
  162. }
  163. })
  164. .then(({ value }) => {
  165. const params = {
  166. approvalType: '2',
  167. targetId: row.id,
  168. res,
  169. msg: value
  170. };
  171. approvalAjax(params);
  172. })
  173. .catch(() => {
  174. proxy?.$modal.msgWarning('取消审核');
  175. });
  176. }
  177. };
  178. const approvalAjax = async (params: any) => {
  179. proxy?.$modal.loading('审核中...');
  180. const res = await bindInfoApproval(params).catch(() => {});
  181. proxy?.$modal.closeLoading();
  182. if (!res) return;
  183. proxy?.$modal.msgSuccess('操作完成');
  184. getList();
  185. };
  186. onMounted(() => {
  187. getList();
  188. });
  189. </script>
  190. <style scoped lang="scss">
  191. .cpy-container {
  192. margin-top: 20px;
  193. margin-bottom: 20px;
  194. .cpy-item {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: baseline;
  198. border-bottom: 1px solid green;
  199. }
  200. }
  201. .center-btn-container {
  202. display: flex;
  203. .el-button {
  204. flex: 1;
  205. }
  206. }
  207. </style>