index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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" :tabList="tabList" tabsearchKey="appStatus" />
  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 { list, approval } from "@/api/staff/volunteer.js";
  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: '注册时间',
  24. prop: 'createTime',
  25. type: 'date',
  26. isSearch: false,
  27. keys: ['start', 'end'],
  28. width: '180px'
  29. },
  30. {
  31. label: '姓名',
  32. prop: 'name',
  33. },
  34. {
  35. label: '服务项目',
  36. prop: 'businessManagementId',
  37. type: 'cascader',
  38. isSearch: true,
  39. tableProp: 'projectName',
  40. options: options,
  41. props: { label: 'businessName', value: 'id', checkStrictly:true },
  42. },
  43. {
  44. label: '项目类别',
  45. prop: 'projectTypeName',
  46. },
  47. // {
  48. // label: '科目',
  49. // prop: 'projectTypeName',
  50. // },
  51. {
  52. label: '手机号',
  53. prop: 'phonenumber',
  54. type: 'input',
  55. isSearch: true
  56. },
  57. {
  58. label: '家庭地址',
  59. prop: 'address',
  60. },
  61. {
  62. label: '身份证件',
  63. prop: 'idCardPicture',
  64. type: 'img',
  65. },
  66. {
  67. label: '职业证书',
  68. prop: 'volunteerPicture',
  69. type: 'img',
  70. },
  71. {
  72. label: '技能简介',
  73. prop: 'skillDescribe',
  74. width: '400px',
  75. },
  76. {
  77. label: '审核状态',
  78. prop: 'appStatus',
  79. type:'dict',
  80. dict: volunteer_app_status
  81. },
  82. ],
  83. searchBtns: [
  84. // {
  85. // label: '批量删除',
  86. // func: () => {
  87. // const ids = userTableRef.value.ids;
  88. // console.log('批量删除', ids)
  89. // handleDelete(ids);
  90. // },
  91. // key: 'deletes',
  92. // hasPermi: ['manage:delete'],
  93. // type: 'danger'
  94. // },
  95. ],
  96. tableApi: list,//接口地址
  97. isSelect: false,//是否勾选
  98. scopeBtns: [
  99. {
  100. label: '审核',
  101. type: 'primary',
  102. hasPermi: ['manage:examine'],
  103. key: 'examine',
  104. func: (row) => {
  105. console.log(row)
  106. openDialog(row, 'examine')
  107. },
  108. show: (row) => {
  109. return row.appStatus == 1
  110. }
  111. },
  112. {
  113. label: '查看详情',
  114. type: 'primary',
  115. hasPermi: ['manage:details'],
  116. key: 'details',
  117. func: (row) => {
  118. console.log(row)
  119. openDialog(row)
  120. }
  121. },
  122. // {
  123. // label: '删除',
  124. // type: 'danger',
  125. // hasPermi: ['manage:delete'],
  126. // key: 'delete',
  127. // func: (row) => {
  128. // console.log(row)
  129. // handleDelete([row.id])
  130. // }
  131. // }
  132. ]
  133. })
  134. const dialogData = reactive({
  135. title: '',
  136. column: [
  137. {
  138. label: '姓名',
  139. prop: 'name',
  140. type: 'input',
  141. },
  142. {
  143. label: '年龄',
  144. prop: 'age',
  145. type: 'input',
  146. },
  147. {
  148. label: '电话',
  149. prop: 'phonenumber',
  150. type: 'input',
  151. },
  152. {
  153. label: '家庭地址',
  154. prop: 'address',
  155. type: 'input',
  156. },
  157. {
  158. label: '服务项目/类别',
  159. prop: 'businessManagementId',
  160. type: 'cascader',
  161. isSearch: true,
  162. options: options,
  163. props: { label: 'businessName', value: 'id', checkStrictly:true },
  164. },
  165. {
  166. label: '身份证件',
  167. prop: 'idCardPicture',
  168. type: 'img',
  169. },
  170. {
  171. label: '职业证书',
  172. prop: 'certificationPicture',
  173. type: 'img',
  174. },
  175. {
  176. label: '技能简介',
  177. prop: 'skillDescribe',
  178. type: 'textarea',
  179. },
  180. {
  181. label: '审核状态',
  182. prop: 'appStatus',
  183. type: 'radio',
  184. rules: [
  185. { required: true, message: '请选择审核状态', trigger: 'blur' }
  186. ],
  187. options: [
  188. {
  189. label: '通过',
  190. value: '2'
  191. },
  192. {
  193. label: '不通过',
  194. value: '3'
  195. }
  196. ]
  197. },
  198. ]
  199. })
  200. const { title } = toRefs(dialogData);
  201. const parentId = ref(0);
  202. const tabList = [
  203. {
  204. title: '已通过',
  205. name: '2',
  206. },
  207. {
  208. title: '待审核',
  209. name: '1',
  210. },
  211. ]
  212. const openDialog = (row, type) => {
  213. console.log('row', row);
  214. try {
  215. const disabledData = {
  216. name: true,
  217. age: true,
  218. phonenumber: true,
  219. address: true,
  220. skillDescribe: true,
  221. businessManagementId: true,
  222. }
  223. if (type) {
  224. //审核
  225. title.value = '审核'
  226. } else {
  227. disabledData['appStatus'] = true;
  228. //查看详情
  229. title.value = '查看详情'
  230. }
  231. dialogFormRef.value.initForm(row, disabledData)
  232. } catch (error) {
  233. console.log('error', error);
  234. } finally {
  235. console.log('dialogFormRef.value', dialogFormRef.value);
  236. dialogFormRef.value.handleDialog(true);
  237. }
  238. }
  239. const handleDelete = (ids) => {
  240. proxy.$modal.confirm('是否确认删除角色编号为"' + ids + '"的数据项?').then(function () {
  241. return true
  242. }).then(() => {
  243. userTableRef.value.resetForm();
  244. proxy.$modal.msgSuccess("删除成功");
  245. }).catch(() => { });
  246. }
  247. const submitForm = async (parmas) => {
  248. try {
  249. console.log('submit', parmas);
  250. if (title.value === '审核') {
  251. const res = await approval({
  252. volunteerInfoId: parmas.volunteerInfoId,
  253. appStatus: parmas.appStatus,
  254. rejectReason: parmas.rejectReason
  255. })
  256. if (up_res.code === 200) {
  257. proxy.$modal.msgSuccess("审核成功");
  258. return;
  259. }
  260. proxy.$modal.msgSuccess(res.msg);
  261. }
  262. } catch (error) {
  263. console.log('error', error);
  264. } finally {
  265. userTableRef.value.resetForm();
  266. dialogFormRef.value.handleDialog(false);
  267. }
  268. }
  269. const getTreeListData = async () => {
  270. try {
  271. const res = await getTreeList({ parentId: parentId.value });
  272. console.log('res', res);
  273. options.value = res.data;
  274. } catch (error) {
  275. }
  276. }
  277. getTreeListData();
  278. </script>
  279. <style lang='scss' scoped></style>