Explorar o código

Merge branch 'main' of http://git.cc-lotus.info/Information/cxyy-admin into main

zs hai 7 meses
pai
achega
cb603e866f

+ 0 - 1
src/components/Breadcrumb/index.vue

@@ -47,7 +47,6 @@ function getBreadcrumb() {
 
 const getMenu = (route) => {
   const menu = menus.value.find((f) => f.path === route.path)
-  console.log(menu)
   if (menu) route.meta.title = get(menu, 'name')
   return route
 }

+ 10 - 0
src/lang/package/zh-cn/pages.js

@@ -744,5 +744,15 @@ export default {
     ium: '初始化用户目录',
     ir: '初始化角色数据',
     irm: '初始化角色菜单'
+  },
+  contactApply: {
+    apply_user: '申请用户',
+    target_user: '被申请用户',
+    source: '数据来源',
+    source_id: '数据来源id',
+    source_name: '数据来源标题',
+    exam_admin: '审核的管理员',
+    status: '状态',
+    examTitle: '信息审核',
   }
 }

+ 47 - 0
src/store/api/user/contactApply.js

@@ -0,0 +1,47 @@
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/utils/axios-wrapper'
+import { get } from 'lodash-es'
+const url = '/contactApply'
+const axios = new AxiosWrapper()
+
+export const ContactApplyStore = defineStore('contactApply', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info } = {}) => {
+    let cond = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${url}`, cond)
+    return res
+  }
+  const fetch = async (payload) => {
+    const res = await axios.$get(`${url}/${payload}`)
+    return res
+  }
+  const create = async (payload) => {
+    const res = await axios.$post(`${url}`, payload)
+    return res
+  }
+  const update = async (payload) => {
+    const id = get(payload, 'id', get(payload, '_id'))
+    const res = await axios.$post(`${url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload) => {
+    const res = await axios.$delete(`${url}/${payload}`)
+    return res
+  }
+  const examine = async (payload) => {
+    const id = get(payload, 'id')
+    const status = get(payload, 'status')
+    const res = await axios.$post(`${url}/examine`, { id, status })
+    return res
+  }
+  return {
+    query,
+    fetch,
+    create,
+    update,
+    del,
+    examine
+  }
+})

+ 2 - 1
src/views/exam/index.vue

@@ -20,7 +20,8 @@ import { get } from 'lodash-es'
 import { defineAsyncComponent } from 'vue'
 const componentList = ref({
   contact: defineAsyncComponent(() => import('./parts/contact.vue')),
-  company: defineAsyncComponent(() => import('./parts/company.vue'))
+  company: defineAsyncComponent(() => import('./parts/company.vue')),
+  setting: defineAsyncComponent(() => import('./parts/setting.vue')),
 })
 const value = ref()
 const viewComponent = ref()

+ 136 - 3
src/views/exam/parts/contact.vue

@@ -1,8 +1,141 @@
 <template>
-  <div id="contact">
-    <p>contact</p>
+  <div id="contactApply" v-loading="loading">
+    <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset">
+      <template #status="{ item }">
+        <el-select v-model="searchForm[item.model]" clearable filterable :placeholder="$t('pages.contactApply.statusSelectPlaceholder')" style="width: 100%; min-width: 200px">
+          <el-option v-for="i in examStatusList" :key="i.id" :label="i.label" :value="i.value"></el-option>
+        </el-select>
+      </template>
+    </custom-search-bar>
+    <custom-button-bar :fields="buttonFields"></custom-button-bar>
+    <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @edit="toEdit" @exam="toExam">
+      <template #status="{ row }">
+        <el-tag v-if="row.status == '1'" type="success">{{ getDict(row.status, 'status') }}</el-tag>
+        <el-tag v-else-if="row.status == '0'" type="warning">{{ getDict(row.status, 'status') }}</el-tag>
+        <el-tag v-else-if="row.status == '-1'" type="danger">{{ getDict(row.status, 'status') }}</el-tag>
+      </template>
+    </custom-table>
+    <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
+      <template v-if="dialog.type == '2'">
+        <el-row>
+          <el-col :span="24">
+            <custom-desc v-model="form" :fields="statusFields"></custom-desc>
+          </el-col>
+        </el-row>
+        <el-row style="text-align: center; padding-top: 20px" justify="center">
+          <el-col :span="6" style="">
+            <el-button type="success" @click="exam('1')">{{ $t('common.agree') }}</el-button>
+          </el-col>
+          <el-col :span="6" style="text-align: center">
+            <el-button type="danger" @click="exam('-1')">{{ $t('common.refuse') }}</el-button>
+          </el-col>
+        </el-row>
+      </template>
+    </el-dialog>
   </div>
 </template>
 
-<script setup></script>
+<script setup>
+//商协会
+import { ContactApplyStore } from '@/store/api/user/contactApply'
+import { DictDataStore } from '@/store/api/system/dictData'
+import { get, cloneDeep } from 'lodash-es'
+const store = ContactApplyStore()
+const dictDataStore = DictDataStore()
+const $checkRes = inject('$checkRes')
+let skip = 0
+const limit = inject('limit')
+const { t } = useI18n()
+// #region 列表页面设置
+const fields = [
+  { label: t('pages.contactApply.apply_user'), model: 'apply_user_name' },
+  { label: t('pages.contactApply.target_user'), model: 'target_user_name' },
+  { label: t('pages.contactApply.source'), model: 'sourceZh' },
+  { label: t('pages.contactApply.source_name'), model: 'source_name' },
+  { label: t('pages.contactApply.exam_admin'), model: 'exam_admin_name' },
+  { label: t('pages.contactApply.status'), model: 'status', custom: true }
+]
+const buttonFields = []
+const opera = [{ label: t('common.exam'), method: 'exam', type: 'warning', display: (i) => i.status !== '1' }]
+// #endregion
+
+// #region 列表操作
+const dialog = ref({ show: false })
+const toReset = async () => {
+  searchForm.value = {}
+  await search()
+}
+const toExam = (data) => {
+  form.value = cloneDeep(data)
+  dialog.value = { type: '2', show: true, title: t('pages.contactApply.examTitle') }
+}
+const toClose = () => {
+  form.value = {}
+  dialog.value = { show: false }
+}
+// #endregion
+
+// #region 表单
+const form = ref({})
+const statusFields = ref([
+  { label: t('pages.contactApply.apply_user'), model: 'apply_user_name' },
+  { label: t('pages.contactApply.target_user'), model: 'target_user_name' },
+  { label: t('pages.contactApply.source'), model: 'sourceZh' },
+  { label: t('pages.contactApply.source_name'), model: 'source_name' }
+])
+const exam = async (status) => {
+  const data = { id: get(form, 'value.id'), status }
+  const res = await store.examine(data)
+  if ($checkRes(res, true)) {
+    search({ skip, limit })
+    toClose()
+  }
+}
+// #endregion
+
+const loading = ref(false)
+onMounted(async () => {
+  loading.value = true
+  await searchOther()
+  await search({ skip, limit })
+  loading.value = false
+})
+// #region 字典表
+const examStatusList = ref([])
+const searchOther = async () => {
+  let result
+  result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
+  if ($checkRes(result)) examStatusList.value = result.data
+}
+const getDict = (data, type) => {
+  let list
+  let result
+  switch (type) {
+    case 'status':
+      list = examStatusList.value
+      break
+    default:
+      break
+  }
+  if (!list) return result
+  const i = list.find((f) => f.value === data)
+  if (!i) return result
+  return get(i, 'label')
+}
+// #endregion
+
+// #region 查询数据
+const searchForm = ref({})
+const data = ref([])
+const total = ref(0)
+const search = async (query = { skip, limit }) => {
+  const nq = { skip: get(query, 'skip'), limit: get(query, 'limit'), ...searchForm.value }
+  const res = await store.query(nq)
+  if ($checkRes(res)) {
+    data.value = get(res, 'data', [])
+    total.value = get(res, 'total', 0)
+  }
+}
+// #endregion
+</script>
 <style scoped></style>

+ 95 - 0
src/views/exam/parts/setting.vue

@@ -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>