index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div>
  3. <ListPage :column="listPageData.tableColumn" :tableApi="listPageData.tableApi" :isSelect="listPageData.isSelect"
  4. :scopeBtns="listPageData.scopeBtns" :searchBtns="listPageData.searchBtns" ref="userTableRef"
  5. v-if="options && options.length > 0" />
  6. <DialogForm ref="dialogFormRef" :title="title" :column="dialogData.column" @submit="submitForm" />
  7. </div>
  8. </template>
  9. <script setup>
  10. import { ref } from 'vue';
  11. import ListPage from '@/views/components/ListPage/index.vue';
  12. import { listUser } from "@/api/staff/user";
  13. import { getTreeList } from "@/api/staff/price.js";
  14. import DialogForm from '@/views/components/DialogForm/index.vue';
  15. const { proxy } = getCurrentInstance();
  16. const { volunteer_app_status } = proxy.useDict("volunteer_app_status");
  17. const options = ref([]);
  18. const userTableRef = ref();
  19. const dialogFormRef = ref(null);
  20. const listPageData = reactive({
  21. tableColumn: [
  22. {
  23. label: '用户ID',
  24. prop: 'userId',
  25. width: '180px'
  26. },
  27. {
  28. label: '注册时间',
  29. prop: 'createTime',
  30. type: 'date',
  31. isSearch: false,
  32. width: '180px'
  33. },
  34. {
  35. label: '姓名',
  36. prop: 'nickName',
  37. type: 'input',
  38. isSearch: true,
  39. },
  40. {
  41. label: '用户名',
  42. prop: 'userName',
  43. },
  44. {
  45. label: '性别',
  46. prop: 'sex',
  47. type: 'render',
  48. render:(row) => {
  49. return row.sex === '0' ? '男' : '女'
  50. }
  51. },
  52. {
  53. label: '电话',
  54. prop: 'phonenumber',
  55. type: 'input',
  56. isSearch: true
  57. },
  58. {
  59. label: '住址',
  60. prop: 'adress',
  61. },
  62. ],
  63. searchBtns: [],
  64. tableApi: listUser,//接口地址
  65. isSelect: false,//是否勾选
  66. scopeBtns: [
  67. // {
  68. // label: '审核',
  69. // type: 'primary',
  70. // hasPermi: ['manage:examine'],
  71. // key: 'examine',
  72. // func: (row) => {
  73. // console.log(row)
  74. // openDialog(row, 'examine')
  75. // },
  76. // show: (row) => {
  77. // return row.appStatus == 1
  78. // }
  79. // },
  80. // {
  81. // label: '查看',
  82. // type: 'primary',
  83. // hasPermi: ['manage:details'],
  84. // key: 'details',
  85. // func: (row) => {
  86. // console.log(row)
  87. // openDialog(row)
  88. // }
  89. // },
  90. // {
  91. // label: '删除',
  92. // type: 'danger',
  93. // hasPermi: ['manage:delete'],
  94. // key: 'delete',
  95. // func: (row) => {
  96. // console.log(row)
  97. // handleDelete([row.id])
  98. // }
  99. // }
  100. ]
  101. })
  102. const dialogData = reactive({
  103. title: '',
  104. column: [
  105. {
  106. label: '姓名',
  107. prop: 'name',
  108. type: 'input',
  109. },
  110. {
  111. label: '年龄',
  112. prop: 'age',
  113. type: 'input',
  114. },
  115. {
  116. label: '电话',
  117. prop: 'phonenumber',
  118. type: 'input',
  119. },
  120. {
  121. label: '家庭地址',
  122. prop: 'address',
  123. type: 'input',
  124. },
  125. {
  126. label: '服务项目/类别',
  127. prop: 'businessManagementId',
  128. type: 'cascader',
  129. isSearch: true,
  130. options: options,
  131. props: { label: 'businessName', value: 'id', checkStrictly:true },
  132. },
  133. {
  134. label: '身份证件',
  135. prop: 'idCardPicture',
  136. type: 'img',
  137. },
  138. {
  139. label: '职业证书',
  140. prop: 'certificationPicture',
  141. type: 'img',
  142. },
  143. {
  144. label: '技能简介',
  145. prop: 'skillDescribe',
  146. type: 'textarea',
  147. },
  148. {
  149. label: '审核状态',
  150. prop: 'appStatus',
  151. type: 'radio',
  152. rules: [
  153. { required: true, message: '请选择审核状态', trigger: 'blur' }
  154. ],
  155. options: [
  156. {
  157. label: '通过',
  158. value: '2'
  159. },
  160. {
  161. label: '不通过',
  162. value: '3'
  163. }
  164. ]
  165. },
  166. ]
  167. })
  168. const { title } = toRefs(dialogData);
  169. const parentId = ref(0);
  170. const openDialog = (row, type) => {
  171. console.log('row', row);
  172. try {
  173. const disabledData = {
  174. name: true,
  175. age: true,
  176. phonenumber: true,
  177. address: true,
  178. skillDescribe: true,
  179. businessManagementId: true,
  180. }
  181. if (type) {
  182. //审核
  183. title.value = '审核'
  184. } else {
  185. disabledData['appStatus'] = true;
  186. //查看详情
  187. title.value = '查看详情'
  188. }
  189. dialogFormRef.value.initForm(row, disabledData)
  190. } catch (error) {
  191. console.log('error', error);
  192. } finally {
  193. console.log('dialogFormRef.value', dialogFormRef.value);
  194. dialogFormRef.value.handleDialog(true);
  195. }
  196. }
  197. const handleDelete = (ids) => {
  198. proxy.$modal.confirm('是否确认删除角色编号为"' + ids + '"的数据项?').then(function () {
  199. return true
  200. }).then(() => {
  201. userTableRef.value.resetForm();
  202. proxy.$modal.msgSuccess("删除成功");
  203. }).catch(() => { });
  204. }
  205. const submitForm = async (parmas) => {
  206. try {
  207. console.log('submit', parmas);
  208. // if (title.value === '审核') {
  209. // const res = await approval({
  210. // volunteerInfoId: parmas.volunteerInfoId,
  211. // appStatus: parmas.appStatus,
  212. // rejectReason: parmas.rejectReason
  213. // })
  214. // if (up_res.code === 200) {
  215. // proxy.$modal.msgSuccess("审核成功");
  216. // return;
  217. // }
  218. // proxy.$modal.msgSuccess(res.msg);
  219. // }
  220. } catch (error) {
  221. console.log('error', error);
  222. } finally {
  223. userTableRef.value.resetForm();
  224. dialogFormRef.value.handleDialog(false);
  225. }
  226. }
  227. const getTreeListData = async () => {
  228. try {
  229. const res = await getTreeList({ parentId: parentId.value });
  230. console.log('res', res);
  231. options.value = res.data;
  232. } catch (error) {
  233. }
  234. }
  235. getTreeListData();
  236. </script>
  237. <style lang='scss' scoped></style>