Selaa lähdekoodia

取子级数据

lifanagju_citu 7 kuukautta sitten
vanhempi
commit
f8bcdbc746

+ 27 - 16
src/views/recruit/personal/PersonalCenter/resume/online/components/workExperience.vue

@@ -272,22 +272,33 @@ const handleDelete = ({ id }) => {
   })
 }
 
-// 获取字典内容
-const dictList = [
-  { type: 'positionData', key: 'positionId' }
-]
-const getDictData = async (obj) => {
-  const item = formItems.value.options.find(e => e.key === obj.key)
-  if (item) { //  && !item.items?.length
-    const { data } = await getDict(obj.type, null, obj.type)
-    item.items = data || []
-    dictItemsObj[obj.key] = data || []
-  }
-}
-const getOptions = () => {
-  dictList.forEach(obj =>  getDictData(obj))
-}
-getOptions()
+// // 获取字典内容
+// const dictList = [
+//   { type: 'positionTreeChildrenData', key: 'positionTreeChildrenData' }
+// ]
+// const getDictData = async (obj) => {
+//   const item = formItems.value.options.find(e => e.key === obj.key)
+//   if (item) { //  && !item.items?.length
+//     const { data } = await getDict(obj.type, null, obj.type)
+//     item.items = data || []
+//     dictItemsObj[obj.key] = data || []
+//   }
+// }
+
+// const getOptions = () => {
+//   dictList.forEach(obj =>  getDictData(obj))
+// }
+// getOptions()
+
+// 岗位treeChildren
+let positionTreeChildrenData = []
+getDict('positionTreeData', null, 'positionTreeData').then(({ data }) => {
+  data = data?.length && data || []
+  data.forEach(e => {
+    if (e?.children?.length) positionTreeChildrenData = positionTreeChildrenData.concat(e.children)
+  })
+  formItems.value.options.find(e => e.key === 'positionId').items = positionTreeChildrenData
+})
 
 </script>