YY 2 years ago
parent
commit
a985d67460

+ 30 - 0
src/components/c-dialog.vue

@@ -0,0 +1,30 @@
+<template>
+  <div id="e-dialog">
+    <el-dialog :title="dialog.title" v-model="dialog.show" :width="width" :before-close="handleClose" :close-on-click-modal="false" :append-to-body="true">
+      <slot name="info"></slot>
+    </el-dialog>
+  </div>
+</template>
+
+<script lang="ts" setup>
+import { toRefs } from 'vue';
+const props = defineProps({
+  dialog: { type: Object, default: () => {} },
+  width: { type: String, default: '40%' },
+});
+const { dialog } = toRefs(props);
+const { width } = toRefs(props);
+const emit = defineEmits(['handleClose']);
+const handleClose = () => {
+  emit('handleClose');
+};
+</script>
+
+<style lang="scss" scoped>
+:deep(.el-dialog__body) {
+  padding: 10px;
+  min-height: 30px;
+  max-height: 400px;
+  overflow-y: auto;
+}
+</style>

+ 1 - 0
src/components/c-table.vue

@@ -4,6 +4,7 @@
       ref="table"
       :row-key="rowKey"
       :data="data"
+      size="small"
       border
       stripe
       :max-height="height !== null ? height : ''"

+ 161 - 0
src/components/common/studio/info.vue

@@ -0,0 +1,161 @@
+<template>
+  <div id="info">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <!-- <data-form :fields="fields" :form="form" :rules="{}" :isSave="false" :span="24" labelWidth="130px">   -->
+        <component :is="CForm" :fields="field" :rules="{}" :form="form" labelWidth="auto" :isSave="false">
+          <template #zy_fields>
+            <span v-for="(i, index) in form.zyfieldsList" :key="index" class="direction">
+              <span>{{ index + 1 }}.</span>{{ i.name }}
+            </span>
+          </template>
+          <template #team>
+            <data-table :fields="teamfields" :opera="[]" :data="form.team" :usePage="false"> </data-table>
+          </template>
+          <template #hz_fields>
+            <span v-for="(i, index) in form.hzfieldsList" :key="index" class="direction">
+              <span>{{ index + 1 }}.</span>{{ i.name }}
+            </span>
+          </template>
+          <template #hz_direction>
+            <span v-for="(i, index) in form.hz_direction" :key="index" class="direction">
+              <span>{{ index + 1 }}.</span>{{ i.name }}
+            </span>
+          </template>
+          <template #settle_file="{ item }">
+            <el-link class="link" :href="i.url" :underline="false" v-for="(i, index) in form[item.model]" :key="index" target="_blank">
+              <i class="el-icon-view el-icon--right"></i><span>{{ index + 1 }}.{{ i.name }}</span>
+            </el-link>
+          </template>
+          <template #unit_settle_file="{ item }">
+            <el-link class="link" :href="i.url" :underline="false" v-for="(i, index) in form[item.model]" :key="index" target="_blank">
+              <i class="el-icon-view el-icon--right"></i><span>{{ index + 1 }}.{{ i.name }}</span>
+            </el-link>
+          </template>
+          <template #build_file="{ item }">
+            <el-link class="link" :href="i.url" :underline="false" v-for="(i, index) in form[item.model]" :key="index" target="_blank">
+              <i class="el-icon-view el-icon--right"></i><span>{{ index + 1 }}.{{ i.name }}</span>
+            </el-link>
+          </template></component
+        >
+        <!-- </data-form> -->
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script lang="ts" setup>
+import CForm from '@/components/c-form.vue';
+import { ref, toRefs, watch } from 'vue';
+import store from '@/stores/counter';
+import type { Ref } from 'vue';
+import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const sysdictdata = DictDataStore();
+interface teamItem {}
+interface zyItem {
+  name: string;
+}
+const props = defineProps({
+  info: { type: Object, default: () => {} },
+  type: { type: String },
+});
+const { info } = toRefs(props);
+const { type } = toRefs(props);
+let field: Ref<any[]> = ref([]);
+let form: Ref<{ team: Array<teamItem>; zyfieldsList: Array<zyItem>; hzfieldsList: Array<zyItem>; hz_direction: Array<zyItem> }> = ref({
+  team: [],
+  zyfieldsList: [],
+  hzfieldsList: [],
+  hz_direction: [],
+});
+let fieldsList: Ref<any[]> = ref([]);
+let teamfields: Ref<any[]> = ref([
+  { label: '序号', options: { type: 'index' } },
+  { label: '姓名', model: 'name' },
+  { label: '工作单位', model: 'company' },
+  { label: '职称', model: 'zc' },
+  { label: '手机号码', model: 'phone' },
+]);
+
+// 查询
+const search = async (e) => {
+  let user = store.state.user;
+  if (user && user.role_type != '1') {
+    if (e.unit_phone && e.unit_phone.is_show == false) e.unit_phone.phone = '暂未公开';
+    if (e.unit_email && e.unit_email.is_show == false) e.unit_email.email = '暂未公开';
+  }
+  form.value = e;
+  // 整理依托单位显示内容
+  let fields: Ref<any[]> = ref([
+    { label: '依托单位名称', model: 'company_name', options: { readonly: true } },
+    { label: '专业领域', model: 'zy_fields', custom: true },
+    { label: '申报日期', model: 'apply_time', options: { readonly: true } },
+    { label: '工作室名称', model: 'name', options: { readonly: true } },
+    { label: '入驻科学家', model: 'scientist_name', options: { readonly: true } },
+    { label: '团队成员', model: 'team', custom: true },
+    { label: '合作领域', model: 'hz_fields', custom: true },
+    { label: '合作方向', model: 'hz_direction', custom: true },
+    { label: '入驻协议', model: 'settle_file', custom: true },
+    { label: '科学家所在单位同意入驻证明材料', model: 'unit_settle_file', custom: true },
+    { label: '工作室建设方案', model: 'build_file', custom: true },
+  ]);
+  if (type.value == 'web') {
+    // 1-管理员-不处理
+    // 3-依托单位-判断是否是自己的数据
+    if (user && user.role_type == '3' && user._id == e.user_id) {
+      console.log('1');
+    } else {
+      fields.value = fields.value.filter(
+        (i) =>
+          i.model != 'apply_time' &&
+          i.model != 'scientist_name' &&
+          i.model != 'team' &&
+          i.model != 'hz_fields' &&
+          i.model != 'hz_direction' &&
+          i.model != 'settle_file' &&
+          i.model != 'unit_settle_file' &&
+          i.model != 'build_file'
+      );
+    }
+  }
+  field.value = fields.value;
+
+  e.zyfieldsList = getFields(e.zy_fields);
+  e.hzfieldsList = getFields(e.hz_fields);
+  form.value = e;
+};
+// 获得领域
+const getFields = (e) => {
+  let field = [];
+  for (const val of e) {
+    let data = fieldsList.value.find((i) => i.dict_value == val);
+    if (data) field.push({ name: data.dict_label });
+  }
+  return field;
+};
+const searchOther = async () => {
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_field' });
+  fieldsList.value = p1.data as [];
+};
+watch(info, async (newVal, oldVal) => {
+  if (newVal && newVal._id) {
+    await searchOther();
+    await search(newVal);
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.direction {
+  display: inline-block;
+  background-color: #409eff;
+  border-radius: 5px;
+  padding: 0 5px;
+  margin: 0 5px 5px 0;
+  color: #ffffff;
+  line-height: 2.5;
+  span {
+    padding: 0 5px 0 0;
+  }
+}
+</style>

+ 0 - 20
src/components/common/unit/info.vue

@@ -2,7 +2,6 @@
   <div id="infos">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <!-- <data-form :fields="fields" :form="form" :rules="{}" :isSave="false" :span="24"> -->
         <component :is="CForm" :fields="field" :rules="{}" :form="form" labelWidth="auto" :isSave="false">
           <template #card="{ item }">
             <el-link class="link" :href="i.url" :underline="false" v-for="(i, index) in form[item.model]" :key="index" target="_blank">
@@ -45,14 +44,6 @@ import CForm from '@/components/c-form.vue';
 import { ref, toRefs, watch } from 'vue';
 import store from '@/stores/counter';
 import type { Ref } from 'vue';
-interface operaItem {
-  label: string;
-  model: string;
-  method: string;
-  confirm?: boolean;
-  type?: string;
-  display?: any;
-}
 const props = defineProps({
   info: { type: Object, default: () => {} },
   type: { type: String },
@@ -99,17 +90,6 @@ watch(info, (newVal, oldVal) => {
     search(newVal);
   }
 });
-// watch: {
-//     info: {
-//       deep: true,
-//       immediate: true,
-//       handler(val) {
-//         if (val && val._id) {
-//           this.search(val);
-//         }
-//       },
-//     },
-//   },
 </script>
 
 <style lang="scss" scoped>

+ 21 - 16
src/views/center/studio/flair/index.vue

@@ -32,13 +32,15 @@
         </el-col>
       </el-col>
     </el-row>
-    <el-dialog v-model="dialog.show" :title="dialog.title" :before-close="handleClose">
-      <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
-        <template #status>
-          <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
-        </template>
-      </component>
-    </el-dialog>
+    <component :is="CDialog" :dialog="dialog" @handleClose="handleClose">
+      <template v-slot:info>
+        <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
+          <template #status>
+            <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
+          </template>
+        </component>
+      </template>
+    </component>
   </div>
 </template>
 <script setup lang="ts">
@@ -48,6 +50,7 @@ import moment from 'moment';
 import partsSearch from '@/components/c-search.vue';
 import CTable from '@/components/c-table.vue';
 import CForm from '@/components/c-form.vue';
+import CDialog from '@/components/c-dialog.vue';
 // #endregion
 import type { Ref } from 'vue';
 import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
@@ -63,7 +66,7 @@ import { UnitStudioApplyStore } from '@common/src/stores/studio/role/unitStudioA
 import type { IQueryResult } from '@/util/types.util';
 const applyflair = ApplyflairStore();
 const studio = StudioStore();
-const dictData = DictDataStore();
+const sysdictdata = DictDataStore();
 const message = MessageStore();
 const unitStudioApply = UnitStudioApplyStore();
 const { proxy } = getCurrentInstance() as any;
@@ -134,10 +137,14 @@ onMounted(async () => {
 // 查询
 const search = async (e: { skip: number; limit: number }) => {
   const { skip, limit } = e;
-
-  let info = { limit: limit, skip: skip, ...searchForm.value, studio_id: '' };
-  if (route.query.studio_id) info.studio_id = route.query.studio_id;
-  const res: IQueryResult = await applyflair.query(info);
+  let info: Ref<{ limit: number; skip: number; searchForm: object; studio_id: string | string[] }> = ref({
+    limit: limit,
+    skip: skip,
+    searchForm: searchForm.value,
+    studio_id: '',
+  });
+  if (route.query.studio_id) info.value.studio_id = route.query.studio_id;
+  const res: IQueryResult = await applyflair.query(info.value);
   tableData.value = res.data as any[];
   total.value = res.total;
 };
@@ -149,15 +156,13 @@ const partSearch = (form: { [x: string]: any }) => {
 
 // 审核
 const toExam = (data: object) => {
-  console.log(data);
-
   form.value = data;
   dialog.value = { title: '信息管理', show: true, type: '1' };
 };
 // 审核保存
 const toSave = async (data: { _id: string; status: string }) => {
   let obj = { id: data._id, status: data.status };
-  let res: IQueryResult = await applyflair.create(obj);
+  let res: IQueryResult = await applyflair.update(obj);
   if (res.errcode == 0) {
     ElMessage({ type: 'success', message: '维护信息成功' });
     createMess(data);
@@ -196,7 +201,7 @@ const handleSelect = () => {};
 // 查询其他信息
 const searchOther = async () => {
   // 字典表---审核状态
-  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_status' });
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_status' });
   statusList.value = p1.data as [];
   // 角色
   const p2 = await studio.query({ status: '7' });

+ 1 - 1
src/views/center/studio/info/export.vue

@@ -4,7 +4,7 @@
       <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
         <el-col :span="24" class="one">
           <c-search :is_back="true" @toBack="toBack()">
-            <template slot="custombtn">
+            <template v-slot="custombtn">
               <el-button type="success" size="small" @click="toExport()">导出</el-button>
               <!-- <el-button type="success" size="small" v-print="{ id: 'demo', popTitle: info.name }">打印</el-button> -->
             </template>

+ 192 - 181
src/views/center/studio/info/index.vue

@@ -1,190 +1,201 @@
 <template>
   <div id="index">
-    <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one">
-          <c-search :is_search="true" :fields="fields" @search="btSearch"> </c-search>
-        </el-col>
-        <el-col :span="24" class="two">
-          <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @view="toView" @exam="toExam" @export="toExport">
-          </data-table>
-        </el-col>
+    <el-col class="main animate__animated animate__backInRight">
+      <el-col :span="24" class="one">
+        <component :is="partsSearch" :is_search="true" :fields="fields" @search="partSearch"> </component>
       </el-col>
-    </el-row>
-    <c-dialog :dialog="dialog" @toClose="toClose">
-      <template v-slot:info>
-        <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
-          <el-form :model="form" :rules="rules" ref="form" label-width="auto">
-            <el-form-item label="审核状态" prop="status">
-              <el-select v-model="form.status" clearable filterable placeholder="请选择审核状态" style="width: 100%">
-                <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
-              </el-select>
-            </el-form-item>
-            <el-form-item label="审核意见" prop="remark">
-              <el-input v-model="form.remark" placeholder="请输入审核意见" type="textarea"></el-input>
-            </el-form-item>
-            <el-form-item>
-              <el-button size="small" type="primary" @click="toSubmit('form')">提交审核</el-button>
-            </el-form-item>
-          </el-form>
-        </el-col>
-      </template>
-    </c-dialog>
+      <el-col :span="24" class="two">
+        <component
+          :is="CTable"
+          :fields="fields"
+          :opera="opera"
+          :select="false"
+          :selected="selected"
+          @handleSelect="handleSelect"
+          @query="search"
+          :data="tableData"
+          :total="total"
+          @view="toView"
+          @exam="toExam"
+          @export="toExport"
+        >
+        </component>
+      </el-col>
+    </el-col>
   </div>
+  <component :is="CDialog" :dialog="dialog" @handleClose="handleClose">
+    <template v-slot:info>
+      <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
+        <template #status>
+          <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
+        </template>
+      </component>
+    </template>
+  </component>
 </template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('studio');
-const { mapActions: unitStudioApply } = createNamespacedHelpers('unitStudioApply');
-const { mapActions: message } = createNamespacedHelpers('message');
-const { mapActions: sysdictdata } = createNamespacedHelpers('sysdictdata');
-const moment = require('moment');
-export default {
-  name: 'index',
-  props: {},
-  components: {},
-  data: function () {
-    return {
-      searchInfo: {},
-      fields: [
-        { label: '序号', options: { type: 'index' } },
-        { label: '依托单位', model: 'company_name', isSearch: true },
-        { label: '工作室名称', model: 'name', isSearch: true },
-        { label: '入驻科学家', model: 'scientist_name', isSearch: true },
-        { label: '申报日期', model: 'apply_time' },
-        {
-          label: '申报状态',
-          model: 'status',
-          format: (i) => {
-            let data = this.statusList.find((r) => r.dict_value == i);
-            if (data) return data.dict_label;
-          },
-        },
-      ],
-      opera: [
-        { label: '详情', method: 'view' },
-        { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
-        { label: '导出', method: 'export' },
-      ],
-      list: [],
-      total: 0,
-      // 领域
-      fieldList: [],
-      // 审核状态
-      statusList: [],
-      dialog: { title: '信息审核', show: false, type: '1' },
-      form: {},
-      rules: {
-        status: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
-        remark: [{ required: true, message: '请输入审核意见', trigger: 'blur' }],
-      },
-    };
-  },
-  async created() {
-    await this.searchOther();
-    await this.search();
-  },
-  methods: {
-    ...mapActions(['query', 'update']),
-    ...unitStudioApply({ CFetch: 'fetch' }),
-    ...message({ mCreate: 'create' }),
-    ...sysdictdata({ sQuery: 'query' }),
-    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
-      let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
-      if (this.$checkRes(res)) {
-        this.$set(this, `list`, res.data);
-        this.$set(this, `total`, res.total);
-      }
-    },
-    btSearch(query) {
-      this.$set(this, `searchInfo`, query);
-      this.search();
-    },
-    // 详情
-    toView({ data }) {
-      this.$router.push({ path: '/center/studio/info/info', query: { id: data.id } });
-    },
-    // 导出
-    toExport({ data }) {
-      this.$router.push({
-        path: '/center/studio/info/export',
-        query: { id: data._id, company_id: data.company_id, scientistinfo_id: data.scientistinfo_id },
-      });
-    },
-    // 审核
-    toExam({ data }) {
-      this.$set(this, `form`, data);
-      this.dialog = { title: '信息审核', show: true, type: '1' };
-    },
-    // 提交审核
-    toSubmit(formName) {
-      this.$refs[formName].validate(async (valid) => {
-        if (valid) {
-          let data = this.form;
-          let obj = { id: data._id, status: data.status };
-          let res = await this.update(obj);
-          if (this.$checkRes(res, `信息审核成功`, res.errmsg)) this.createMess(data);
-        } else {
-          console.log('error submit!!');
-          return false;
-        }
-      });
-    },
-    // 发送系统消息
-    async createMess(data) {
-      let res = await this.CFetch(data.user_id);
-      if (this.$checkRes(res)) {
-        let status = this.statusList.find((r) => r.dict_value == data.status);
-        if (status) {
-          let obj = {
-            user_id: this.user._id,
-            title: '审核通知',
-            send_time: moment().format('YYYY-MM-DD HH:mm:ss'),
-            type: '3',
-            user: [{ id: data.user_id, company: data.company, phone: res.data.phone }],
-            content: '您好,您所申报《' + data.name + '》的建设申请,' + status.dict_label + ',原因:' + data.remark,
-          };
-          let arr = await this.mCreate(obj);
-          if (this.$checkRes(arr, `系统信息发送成功`, arr.errmsg)) this.toClose();
-        }
-      }
-    },
-    // 关闭弹框
-    toClose() {
-      this.form = {};
-      this.dialog = { title: '信息审核', show: false, type: '1' };
-      this.search();
-    },
-    // 查询其他信息
-    async searchOther() {
-      let res;
-      // 申报状态
-      res = await this.sQuery({ dict_type: 'studio_studio_status' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `statusList`, res.data);
-      }
-      // 领域
-      res = await this.sQuery({ dict_type: 'studio_field' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `fieldList`, res.data);
-      }
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  watch: {
-    test: {
-      deep: true,
-      immediate: true,
-      handler(val) {},
+<script setup lang="ts">
+import store from '@/stores/counter';
+import moment from 'moment';
+// #region 组件
+import partsSearch from '@/components/c-search.vue';
+import CTable from '@/components/c-table.vue';
+import CForm from '@/components/c-form.vue';
+import CDialog from '@/components/c-dialog.vue';
+// #endregion
+import type { Ref } from 'vue';
+import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
+import type { FormRules } from 'element-plus';
+import { ElMessage } from 'element-plus';
+import { useRouter } from 'vue-router';
+// #region 接口
+import { StudioStore } from '@common/src/stores/studio/studios/studio'; // 列表 // 列表
+import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
+import { MessageStore } from '@common/src/stores/studio/other/message'; // 系统消息
+import { UnitStudioApplyStore } from '@common/src/stores/studio/role/unitStudioApply';
+import type { IQueryResult } from '@/util/types.util';
+const studio = StudioStore();
+const sysdictdata = DictDataStore();
+const message = MessageStore();
+const unitStudioApply = UnitStudioApplyStore();
+const { proxy } = getCurrentInstance() as any;
+const router = useRouter();
+// #endregion
+// 列表数据
+let tableData: Ref<any[]> = ref([]);
+// 列表
+let fields: Ref<any[]> = ref([
+  { label: '序号', options: { type: 'index' } },
+  { label: '依托单位', model: 'company_name', isSearch: true },
+  { label: '工作室名称', model: 'name', isSearch: true },
+  { label: '入驻科学家', model: 'scientist_name', isSearch: true },
+  { label: '申报日期', model: 'apply_time' },
+  {
+    label: '申报状态',
+    model: 'status',
+    format: (i) => {
+      let data = statusList.value.find((r) => r.dict_value == i);
+      if (data) return data.dict_label;
     },
   },
+]);
+// 操作
+let opera: Ref<any[]> = ref([
+  { label: '详情', method: 'view' },
+  { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
+  { label: '导出', method: 'export' },
+]);
+// 多选
+let selected: Ref<any[]> = ref([]);
+// 总数
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit: number = proxy.$limit;
+// 查询数据
+let searchForm: Ref<{}> = ref({});
+// 弹框
+const dialog: Ref<{ type: string; show: boolean; title: string }> = ref({ type: '1', show: false, title: '信息管理' });
+// 审核表单
+let form: Ref<{}> = ref({});
+// 必填项
+const rules = reactive<FormRules>({
+  status: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
+  remark: [{ required: true, message: '请输入审核意见', trigger: 'blur' }],
+});
+// 表单
+let infoFields: Ref<any[]> = ref([
+  { label: '审核状态', model: 'status', type: 'select' },
+  { label: '审核意见', model: 'remark', type: 'textarea' },
+]);
+// 状态
+let statusList: Ref<any[]> = ref([]);
+let fieldList: Ref<any[]> = ref([]);
+onMounted(async () => {
+  await searchOther();
+  await search({ skip, limit });
+});
+// 查询
+const search = async (e: { skip: number; limit: number }) => {
+  const { skip, limit } = e;
+  let info = { limit: limit, skip: skip, ...searchForm.value };
+  const res: IQueryResult = await studio.query(info);
+  tableData.value = res.data as any[];
+  console.log(res.data);
+
+  total.value = res.total;
+};
+// 查询
+const partSearch = (form: { [x: string]: any }) => {
+  searchForm.value = form;
+  search({ skip, limit });
 };
-</script>
 
-<style lang="scss" scoped></style>
+// 修改
+const toView = async (data: { _id: string }) => {
+  router.push({ path: '/center/studio/info/info', query: { id: data._id } });
+};
+// 审核
+const toExam = (data: object) => {
+  form.value = data;
+  dialog.value = { title: '信息管理', show: true, type: '1' };
+};
+// 删除
+const toExport = async (data: { _id: string; company_id: string; scientistinfo_id: string }) => {
+  router.push({
+    path: '/center/studio/info/export',
+    query: { id: data._id, company_id: data.company_id, scientistinfo_id: data.scientistinfo_id },
+  });
+};
+// 审核保存
+const toSave = async (data: { _id: string; status: string }) => {
+  let obj = { id: data._id, status: data.status };
+  let res: IQueryResult = await studio.update(obj);
+  if (res.errcode == 0) {
+    ElMessage({ type: 'success', message: '维护信息成功' });
+    createMess(data);
+  } else ElMessage({ type: 'warning', message: `${res.errmsg}` });
+};
+// // 发送系统消息
+const createMess = async (data) => {
+  let user = store.state.user;
+  let res = await unitStudioApply.fetch(data.unit_id);
+  let status = statusList.value.find((r) => r.dict_value == data.status);
+  if (res.errcode == 0) {
+    let obj = {
+      user_id: user._id,
+      title: '审核通知',
+      send_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+      type: '3',
+      user: [{ id: data.user_id, company: data.company, phone: res.data.phone }],
+      content: '您好,您所申报《' + data.name + '》的建设申请,' + status.dict_label + ',原因:' + data.remark,
+    };
+    let arr = await message.create(obj);
+    if (arr.errcode == 0) {
+      ElMessage({ type: 'success', message: '系统信息发送成功' });
+      handleClose();
+    }
+  }
+};
+
+// 关闭弹窗
+const handleClose = () => {
+  form.value = {};
+  search({ skip, limit });
+  dialog.value = { title: '信息管理', show: false, type: '' };
+};
+// 选择
+const handleSelect = () => {};
+// 查询其他信息
+const searchOther = async () => {
+  // 字典表---审核状态
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_status' });
+  statusList.value = p1.data as [];
+  // 领域
+  const p2 = await sysdictdata.query({ dict_type: 'studio_field' });
+  fieldList.value = p2.data as [];
+};
+</script>
+<style scoped>
+.main .one {
+  margin: 0 0 10px 0;
+}
+</style>

+ 38 - 78
src/views/center/studio/info/info.vue

@@ -3,91 +3,51 @@
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
         <el-col :span="24" class="one">
-          <c-search :is_back="true" @toBack="toBack()">
-            <!-- <template slot="custombtn">
-              <el-button type="warning" size="small" @click="toExport()">导出PDF</el-button>
-            </template> -->
-          </c-search>
+          <component :is="partsSearch" :is_back="true" @toBack="toBack()"></component>
         </el-col>
         <el-col :span="24" class="two">
-          <studio-info :info="info"></studio-info>
+          <component :is="studioInfo" :info="info"></component>
         </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('studio');
-const { mapActions: scientistsettle } = createNamespacedHelpers('scientistsettle');
-
-export default {
-  name: 'info',
-  props: {},
-  components: {
-    studioInfo: () => import('@c/common/studio/info.vue'),
-  },
-  data: function () {
-    return {
-      info: { team: [] },
-    };
-  },
-  created() {
-    this.search();
-  },
-  methods: {
-    ...mapActions(['fetch']),
-    ...scientistsettle(['query']),
-    async search() {
-      if (this.id) {
-        let res = await this.fetch(this.id);
-        if (this.$checkRes(res)) {
-          res.data.team = await this.sarchTeam();
-          this.$set(this, `info`, res.data);
-        }
-      }
-    },
-    // 查询团队信息
-    async sarchTeam() {
-      let list = [];
-      let res = await this.query({ studio_id: this.id });
-      if (this.$checkRes(res)) {
-        if (res.total > 0) {
-          let data = res.data[0];
-          list = data.team;
-        }
-      }
-      return list;
-    },
-    // 返回
-    toBack() {
-      window.history.go('-1');
-    },
-    // 导出pdf
-    toExport() {
-      this.$router.push({
-        path: '/center/studio/info/export',
-        query: { id: this.id, company_id: this.info.company_id, scientistinfo_id: this.info.scientistinfo_id },
-      });
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-    id() {
-      return this.$route.query.id;
-    },
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  watch: {
-    test: {
-      deep: true,
-      immediate: true,
-      handler(val) {},
-    },
-  },
+<script setup lang="ts">
+import partsSearch from '@/components/c-search.vue';
+import studioInfo from '@/components/common/studio/info.vue';
+import { useRoute } from 'vue-router';
+import type { Ref } from 'vue';
+import { ref, onMounted } from 'vue';
+import { StudioStore } from '@common/src/stores/studio/studios/studio'; // 列表
+import { ScientistsettleStore } from '@common/src/stores/studio/studios/scientistsettle'; // 字典表
+import type { IQueryResult } from '@/util/types.util';
+const scientistsettle = ScientistsettleStore();
+const studio = StudioStore();
+let route = useRoute();
+let info: Ref<{ team: any[] }> = ref({ team: [] });
+onMounted(async () => {
+  await search();
+});
+const search = async () => {
+  if (route.query.id) {
+    let id = route.query.id;
+    const res: IQueryResult = await studio.fetch(id);
+    info.value = res.data as { team: any };
+    await sarchTeam();
+  }
+};
+const sarchTeam = async () => {
+  let id = route.query.id;
+  let list = [];
+  let res = await scientistsettle.query({ studio_id: id });
+  if (res.total > 0) {
+    let data = res.data[0];
+    list = data.team;
+  }
+  info.value.team = list;
+};
+const toBack = () => {
+  window.history.go(-1);
 };
 </script>
 

+ 17 - 14
src/views/center/users/company/index.vue

@@ -27,13 +27,15 @@
       </el-col>
     </el-col>
   </div>
-  <el-dialog v-model="dialog.show" title="文件夹" :before-close="handleClose">
-    <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
-      <template #status>
-        <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
-      </template>
-    </component>
-  </el-dialog>
+  <component :is="CDialog" :dialog="dialog" @handleClose="handleClose">
+    <template v-slot:info>
+      <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
+        <template #status>
+          <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
+        </template>
+      </component>
+    </template>
+  </component>
 </template>
 <script setup lang="ts">
 import store from '@/stores/counter';
@@ -42,6 +44,7 @@ import moment from 'moment';
 import partsSearch from '@/components/c-search.vue';
 import CTable from '@/components/c-table.vue';
 import CForm from '@/components/c-form.vue';
+import CDialog from '@/components/c-dialog.vue';
 // #endregion
 import type { Ref } from 'vue';
 import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
@@ -56,7 +59,7 @@ import { UnitStore } from '@common/src/stores/users/unit';
 import { RoleStore } from '@common/src/stores/admin/role';
 import type { IQueryResult } from '@/util/types.util';
 const unitStudioApply = UnitStudioApplyStore();
-const dictData = DictDataStore();
+const sysdictdata = DictDataStore();
 const message = MessageStore();
 const role = RoleStore();
 const unit = UnitStore();
@@ -86,7 +89,8 @@ let fields: Ref<any[]> = ref([
 // 操作
 let opera: Ref<any[]> = ref([
   { label: '详情', method: 'view' },
-  { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
+  { label: '审核', method: 'exam', type: 'warning' },
+  // { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
   { label: '删除', method: 'del', type: 'danger', confirm: true },
 ]);
 // 多选
@@ -140,15 +144,13 @@ const toView = async (data: { _id: string }) => {
 };
 // 审核
 const toExam = (data: object) => {
-  console.log(data);
-
   form.value = data;
   dialog.value = { title: '信息管理', show: true, type: '1' };
 };
 // 审核保存
 const toSave = async (data: { _id: string; status: string }) => {
-  let obj = { id: data._id, status: data.status };
-  let res: IQueryResult = await unitStudioApply.create(obj);
+  let obj = { _id: data._id, status: data.status };
+  let res: IQueryResult = await unitStudioApply.update(obj);
   if (obj.status == '1') updateRole(data);
   if (res.errcode == 0) {
     ElMessage({ type: 'success', message: '维护信息成功' });
@@ -166,6 +168,7 @@ const updateRole = async (e) => {
       unit_name: userInfo.data.unit_name,
     };
     let res = await unit.update(object);
+    if (res.errcode == 0) ElMessage({ type: 'success', message: '分配角色成功' });
   }
 };
 // // 发送系统消息
@@ -208,7 +211,7 @@ const handleSelect = () => {};
 // 查询其他信息
 const searchOther = async () => {
   // 字典表---审核状态
-  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_status' });
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_status' });
   statusList.value = p1.data as [];
   // 角色
   const p2 = await role.query({ code: 'studio-unit', account_type: '3', status: 'Y' });

+ 2 - 2
src/views/center/users/company/info.vue

@@ -23,7 +23,7 @@ import { UnitStudioApplyStore } from '@common/src/stores/studio/role/unitStudioA
 import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
 const unitStudioApply = UnitStudioApplyStore();
-const dictData = DictDataStore();
+const sysdictdata = DictDataStore();
 let route = useRoute();
 let info: Ref<{}> = ref({});
 // 行业领域
@@ -57,7 +57,7 @@ const toBack = () => {
 // 查询其他信息
 const searchOther = async () => {
   // 字典表---行业领域
-  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_field' });
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_field' });
   fieldList.value = p1.data as [];
 };
 </script>

+ 30 - 26
src/views/center/users/scientist/index.vue

@@ -6,9 +6,6 @@
           <template #status>
             <el-option v-for="i in statusList" :key="i.model" :label="i.dict_label" :value="i.dict_value"></el-option>
           </template>
-          <!-- <template #unit_phone>
-            <el-input v-model="searchForm.unit_phone" placeholder="请输入单位联系电话" clearable size="small"></el-input>
-          </template> -->
         </component>
       </el-col>
       <el-col :span="24" class="two">
@@ -26,20 +23,19 @@
           @exam="toExam"
           @del="toDel"
         >
-          <!-- <template #unit_phone="{ row, item }">
-            {{ row[item.model].phone }}
-          </template> -->
         </component>
       </el-col>
     </el-col>
   </div>
-  <el-dialog v-model="dialog.show" title="文件夹" :before-close="handleClose">
-    <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
-      <template #status>
-        <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
-      </template>
-    </component>
-  </el-dialog>
+  <component :is="CDialog" :dialog="dialog" @handleClose="handleClose">
+    <template v-slot:info>
+      <component :is="CForm" :fields="infoFields" :rules="rules" :form="form" labelWidth="auto" @save="toSave">
+        <template #status>
+          <el-option v-for="(item, index) in statusList" :key="index" :label="item.dict_label" :value="item.dict_value"></el-option>
+        </template>
+      </component>
+    </template>
+  </component>
 </template>
 <script setup lang="ts">
 import store from '@/stores/counter';
@@ -48,6 +44,7 @@ import moment from 'moment';
 import partsSearch from '@/components/c-search.vue';
 import CTable from '@/components/c-table.vue';
 import CForm from '@/components/c-form.vue';
+import CDialog from '@/components/c-dialog.vue';
 // #endregion
 import type { Ref } from 'vue';
 import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
@@ -62,7 +59,7 @@ import { UsersStore } from '@common/src/stores/users/users';
 import { RoleStore } from '@common/src/stores/admin/role';
 import type { IQueryResult } from '@/util/types.util';
 const userStudioApply = UserStudioApplyStore();
-const dictData = DictDataStore();
+const sysdictdata = DictDataStore();
 const message = MessageStore();
 const role = RoleStore();
 const users = UsersStore();
@@ -97,7 +94,8 @@ let fields: Ref<any[]> = ref([
 // 操作
 let opera: Ref<any[]> = ref([
   { label: '详情', method: 'view' },
-  { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
+  { label: '审核', method: 'exam', type: 'warning' },
+  // { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
   { label: '删除', method: 'del', type: 'danger', confirm: true },
 ]);
 // 多选
@@ -156,8 +154,8 @@ const toExam = (data: object) => {
 };
 // 审核保存
 const toSave = async (data: { _id: string; status: string }) => {
-  let obj = { id: data._id, status: data.status };
-  let res: IQueryResult = await userStudioApply.create(obj);
+  let obj = { _id: data._id, status: data.status };
+  let res: IQueryResult = await userStudioApply.update(obj);
   if (obj.status == '1') updateRole(data);
   if (res.errcode == 0) {
     ElMessage({ type: 'success', message: '维护信息成功' });
@@ -166,21 +164,20 @@ const toSave = async (data: { _id: string; status: string }) => {
 };
 // // 分配角色
 const updateRole = async (e) => {
-  let userInfo = await users.fetch(e.unit_id);
+  let userInfo = await users.fetch(e.user_id);
   if (userInfo.errcode == 0) {
     let object = {
       _id: userInfo.data._id,
       role: [...userInfo.data.role, roleInfo.value._id],
-      account: userInfo.data.account,
-      unit_name: userInfo.data.unit_name,
     };
     let res = await users.update(object);
+    if (res.errcode == 0) ElMessage({ type: 'success', message: '分配角色成功' });
   }
 };
 // // 发送系统消息
 const createMess = async (data) => {
   let user = store.state.user;
-  let res = await users.fetch(data.unit_id);
+  let res = await users.fetch(data.user_id);
   if (res.errcode == 0) {
     let obj = {
       user_id: user._id,
@@ -198,11 +195,18 @@ const createMess = async (data) => {
   }
 };
 // 删除
-const toDel = async (data: { _id: string }) => {
-  const res: IQueryResult = await userStudioApply.del(data._id);
+const toDel = async (data: { _id: string; user_id: string }) => {
+  const res: IQueryResult = await users.fetch(data.user_id);
   if (res.errcode == 0) {
-    ElMessage({ type: 'success', message: '删除成功' });
-    search({ skip, limit });
+    if (res.data && res.data._id) {
+      ElMessage({ type: 'warning', message: '科学家账号暂无删除,无法删除' });
+    } else {
+      const p1: IQueryResult = await userStudioApply.delete(data._id);
+      if (p1.errcode == 0) {
+        ElMessage({ type: 'success', message: '删除成功' });
+        search({ skip, limit });
+      }
+    }
   }
 };
 
@@ -217,7 +221,7 @@ const handleSelect = () => {};
 // 查询其他信息
 const searchOther = async () => {
   // 字典表---审核状态
-  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_status' });
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_status' });
   statusList.value = p1.data as [];
   // 角色
   const p2 = await role.query({ code: 'studio-users', account_type: '3', status: 'Y' });

+ 6 - 6
src/views/center/users/scientist/info.vue

@@ -31,7 +31,7 @@ import { UserStudioApplyStore } from '@common/src/stores/studio/role/userStudioA
 import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
 const userStudioApply = UserStudioApplyStore();
-const dictData = DictDataStore();
+const sysdictdata = DictDataStore();
 let route = useRoute();
 let info: Ref<{}> = ref({});
 // 行业领域
@@ -85,21 +85,21 @@ const toBack = () => {
 // 查询其他信息
 const searchOther = async () => {
   // 字典表---行业领域
-  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_field' });
+  const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_field' });
   fieldList.value = p1.data as [];
   // 字典表---是否为在职人员
-  const p2: IQueryResult = await dictData.query({ dict_type: 'studio_scientist_is_job' });
+  const p2: IQueryResult = await sysdictdata.query({ dict_type: 'studio_scientist_is_job' });
   isjobList.value = p2.data as [];
   // 字典表---专业技术职称
-  const p3: IQueryResult = await dictData.query({ dict_type: 's-builddesire-zc' });
+  const p3: IQueryResult = await sysdictdata.query({ dict_type: 's-builddesire-zc' });
   let data: any = p3.data as [];
   data.filter((i) => i.dict_value != '0');
   zcList.value = data;
   // 字典表---学历
-  const p4: IQueryResult = await dictData.query({ dict_type: 'education' });
+  const p4: IQueryResult = await sysdictdata.query({ dict_type: 'education' });
   educationList.value = p4.data as [];
   // 字典表---学历
-  const p5: IQueryResult = await dictData.query({ dict_type: 'degree' });
+  const p5: IQueryResult = await sysdictdata.query({ dict_type: 'degree' });
   degreeList.value = p5.data as [];
 };
 </script>

+ 12 - 3
tsconfig.json

@@ -1,10 +1,11 @@
 {
   "extends": "@vue/tsconfig/tsconfig.web.json",
-  "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "../common/src/stores/user", "../common/src/stores/user"],
+  // "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "../common/src/stores/user", "../common/src/stores/user"],
+  "include":["src/**/*.ts","src/**/*.d.ts","src/**/*.tsx","src/**/*.vue","src/untils/baiduMap.js","src/untils/debuonce.js","**/*.ts","**/*.tsx"],
   "compilerOptions": {
     "target": "esnext",
     "module": "esnext",
-    "strict": false,
+    "strict": true,
     "jsx": "preserve",
     "moduleResolution": "node",
     "baseUrl": ".",
@@ -13,11 +14,19 @@
     },
     "isolatedModules": false,
     "suppressImplicitAnyIndexErrors": true,
+    "sourceMap":true,
+    "resolveJsonModule":true,
+    "esModuleInterop":true,
+    "lib":["esnext","dom"],
+    "allowSyntheticDefaultImports":true,
   },
 
   "references": [
     {
       "path": "./tsconfig.node.json"
     }
-  ]
+  ],
+
 }
+
+