index.vue 7.5 KB

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