|
@@ -0,0 +1,95 @@
|
|
|
+<template>
|
|
|
+ <div id="setting">
|
|
|
+ <el-card header="联系申请审核设置">
|
|
|
+ <custom-form v-model="form" :fields="fields" @save="toSave">
|
|
|
+ <template #demand>
|
|
|
+ <el-option v-for="i in deptList" :key="i.id" :label="i.name" :value="i.id"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #supply>
|
|
|
+ <el-option v-for="i in deptList" :key="i.id" :label="i.name" :value="i.id"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #project>
|
|
|
+ <el-option v-for="i in deptList" :key="i.id" :label="i.name" :value="i.id"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #achievement>
|
|
|
+ <el-option v-for="i in deptList" :key="i.id" :label="i.name" :value="i.id"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #incubator>
|
|
|
+ <el-option v-for="i in deptList" :key="i.id" :label="i.name" :value="i.id"></el-option>
|
|
|
+ </template>
|
|
|
+ </custom-form>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { DeptStore } from '@/store/api/system/dept'
|
|
|
+import { DesignStore } from '@/store/api/platform/design'
|
|
|
+import { onMounted } from 'vue'
|
|
|
+import { get, omit } from 'lodash-es'
|
|
|
+const store = DesignStore()
|
|
|
+const deptStore = DeptStore()
|
|
|
+const $checkRes = inject('$checkRes')
|
|
|
+const form = ref({})
|
|
|
+const dataId = ref()
|
|
|
+/**
|
|
|
+ * 需求数据:投资部
|
|
|
+ * 供给数据:投资部
|
|
|
+ * 项目数据:投资部
|
|
|
+ * 成果数据:创合部
|
|
|
+ * 孵化基地:创合部
|
|
|
+ */
|
|
|
+const fields = ref([
|
|
|
+ { label: '需求数据', selectplaceholder: '请选择负责审核的部门', model: 'demand', type: 'select' },
|
|
|
+ { label: '供给数据', selectplaceholder: '请选择负责审核的部门', model: 'supply', type: 'select' },
|
|
|
+ { label: '项目数据', selectplaceholder: '请选择负责审核的部门', model: 'project', type: 'select' },
|
|
|
+ { label: '成果数据', selectplaceholder: '请选择负责审核的部门', model: 'achievement', type: 'select' },
|
|
|
+ { label: '孵化基地', selectplaceholder: '请选择负责审核的部门', model: 'incubator', type: 'select' }
|
|
|
+])
|
|
|
+
|
|
|
+const toSave = async () => {
|
|
|
+ if (!dataId) return
|
|
|
+ const contactApplyConfig = form.value
|
|
|
+ const res = await store.update({ id: dataId.value, contactApplyConfig })
|
|
|
+ $checkRes(res, true, res.errmsg)
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getOtherList()
|
|
|
+ search()
|
|
|
+})
|
|
|
+const search = async () => {
|
|
|
+ const res = await store.query()
|
|
|
+ if ($checkRes(res)) {
|
|
|
+ const contactApplyConfig = get(res, 'data.0.contactApplyConfig', {})
|
|
|
+ form.value = contactApplyConfig
|
|
|
+ dataId.value = get(res, 'data.0.id')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const deptList = ref([])
|
|
|
+const getOtherList = async () => {
|
|
|
+ const result = await deptStore.query()
|
|
|
+ if ($checkRes(result)) {
|
|
|
+ const originData = get(result, 'data', [])
|
|
|
+ const odList = flattenDept(originData)
|
|
|
+ deptList.value = odList
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const flattenDept = (list) => {
|
|
|
+ const returnData = []
|
|
|
+ for (const i of list) {
|
|
|
+ const od = omit(i, ['children'])
|
|
|
+ returnData.push(od)
|
|
|
+ const children = get(i, 'children', [])
|
|
|
+ if (children.length > 0) {
|
|
|
+ const childrenList = flattenDept(children)
|
|
|
+ returnData.push(...childrenList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return returnData
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style scoped></style>
|