|
@@ -1,11 +1,187 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
- <el-col :span="24" class="main"> 发布技术支持 </el-col>
|
|
|
+ <el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <component :is="partsSearch" :is_search="true" :fields="fields" @search="partSearch">
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="i in statusList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
|
|
|
+ </template>
|
|
|
+ </component>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <component :is="Btn1" @toAdd="toAdd"></component>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="thr">
|
|
|
+ <component
|
|
|
+ :is="CTable"
|
|
|
+ :fields="fields"
|
|
|
+ :opera="opera"
|
|
|
+ :select="false"
|
|
|
+ :selected="selected"
|
|
|
+ @handleSelect="handleSelect"
|
|
|
+ @query="search"
|
|
|
+ :data="tableData"
|
|
|
+ :total="total"
|
|
|
+ @view="toView"
|
|
|
+ @edit="toEdit"
|
|
|
+ @del="toDel"
|
|
|
+ >
|
|
|
+ <template #is_use="{ row, item }">
|
|
|
+ <el-button :type="row[item.model] == 'Y' ? 'primary' : 'danger'" size="mini" @click="toUse(row)">{{
|
|
|
+ row[item.model] == 'Y' ? '是' : '否'
|
|
|
+ }}</el-button>
|
|
|
+ </template>
|
|
|
+ </component>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
+<script setup lang="ts">
|
|
|
+import store from '@/stores/counter';
|
|
|
+// #region 组件
|
|
|
+import partsSearch from '@/components/c-search.vue';
|
|
|
+import CTable from '@/components/c-table.vue';
|
|
|
+import Btn1 from '@/components/btn-1.vue';
|
|
|
+// #endregion
|
|
|
+import type { Ref } from 'vue';
|
|
|
+import { ref, onMounted, getCurrentInstance } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+// #region 接口
|
|
|
+import { TecholsupportStore } from '@common/src/stores/studio/supplydemand/techolsupport'; //技术支持
|
|
|
+import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
|
|
|
+import { UserStudioApplyStore } from '@common/src/stores/studio/role/userStudioApply'; //个人账号申请科学家工作室权限表
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const techolsupport = TecholsupportStore();
|
|
|
+const sysdictdata = DictDataStore();
|
|
|
+const userStudioApply = UserStudioApplyStore();
|
|
|
+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: 'title', isSearch: true },
|
|
|
+ { label: '发布时间', model: 'date' },
|
|
|
+ { label: '科学家姓名', model: 'scientist_name', isSearch: true },
|
|
|
+ { label: '联系方式', model: 'phone', isSearch: true },
|
|
|
+ { label: '单位名称', model: 'company_name', isSearch: true },
|
|
|
+ { label: '是否启用', model: 'is_use', custom: true },
|
|
|
+ {
|
|
|
+ label: '审核状态',
|
|
|
+ model: 'status',
|
|
|
+ type: 'select',
|
|
|
+ format: (i) => {
|
|
|
+ let data = statusList.value.find((r) => r.dict_value == i);
|
|
|
+ if (data) return data.dict_label;
|
|
|
+ },
|
|
|
+ isSearch: true,
|
|
|
+ },
|
|
|
+]);
|
|
|
+// 操作
|
|
|
+let opera: Ref<any[]> = ref([
|
|
|
+ { label: '详情', method: 'view' },
|
|
|
+ { label: '修改', method: 'edit', type: 'warning', display: (i) => i.status == '0' },
|
|
|
+ { label: '删除', method: 'del', type: 'danger', confirm: true },
|
|
|
+]);
|
|
|
+// 多选
|
|
|
+let selected: Ref<any[]> = ref([]);
|
|
|
+// 总数
|
|
|
+let total: Ref<number> = ref(0);
|
|
|
+let skip = 0;
|
|
|
+let limit: number = proxy.$limit;
|
|
|
+// 用户信息
|
|
|
+let user: Ref<{ _id: string; name: string; unit_name: string; nick_name: string }> = ref({ _id: '', name: '', unit_name: '', nick_name: '' });
|
|
|
+// 个人用户信息
|
|
|
+let userInfo: Ref<{ _id: String; user_id: String; status: String }> = ref({ _id: '', user_id: '', status: '' });
|
|
|
+// 查询数据
|
|
|
+let searchForm: Ref<{}> = ref({});
|
|
|
+// 状态
|
|
|
+let statusList: Ref<any[]> = ref([]);
|
|
|
+// 是否使用
|
|
|
+let isuseList: Ref<any[]> = ref([]);
|
|
|
|
|
|
-<script setup lang="ts"></script>
|
|
|
-
|
|
|
-<style scoped></style>
|
|
|
+onMounted(async () => {
|
|
|
+ user.value = store.state.user;
|
|
|
+ await searchUser();
|
|
|
+ await searchOther();
|
|
|
+ await search({ skip, limit });
|
|
|
+});
|
|
|
+const searchUser = async () => {
|
|
|
+ const res: IQueryResult = await userStudioApply.query({ user_id: user.value._id });
|
|
|
+ let list = res.data as any[];
|
|
|
+ if (res.total > 0) userInfo.value = list[0];
|
|
|
+};
|
|
|
+// 查询
|
|
|
+const search = async (e: { skip: number; limit: number }) => {
|
|
|
+ if (userInfo && userInfo.value.user_id && userInfo.value.status == '1') {
|
|
|
+ const { skip, limit } = e;
|
|
|
+ let info = { limit: limit, skip: skip, ...searchForm.value, user_id: userInfo.value.user_id };
|
|
|
+ const res: IQueryResult = await techolsupport.query(info);
|
|
|
+ tableData.value = res.data as any[];
|
|
|
+ total.value = res.total;
|
|
|
+ } else {
|
|
|
+ ElMessage({ type: 'warning', message: `用户未完成信息填报/信息填报未完成审核,无法查询相关信息` });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查询
|
|
|
+const partSearch = (form: { [x: string]: any }) => {
|
|
|
+ searchForm.value = form;
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+// 添加
|
|
|
+const toAdd = () => {
|
|
|
+ if (userInfo && userInfo.value.user_id && userInfo.value.status == '1') {
|
|
|
+ router.push({ path: '/user/support/add' });
|
|
|
+ } else {
|
|
|
+ ElMessage({ message: '用户未完成信息填报/信息填报未完成审核,无法查询相关信息', type: 'warning' });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 是否启用
|
|
|
+const toUse = async (data: { is_use: string }) => {
|
|
|
+ data.is_use = data.is_use == 'Y' ? 'N' : 'Y';
|
|
|
+ const res: IQueryResult = await techolsupport.update(data);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ message: '维护信息成功', type: 'success' });
|
|
|
+ search({ skip, limit });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查看
|
|
|
+const toView = (data: { _id: string }) => {
|
|
|
+ router.push({ path: '/user/support/info', query: { id: data._id } });
|
|
|
+};
|
|
|
+// 修改
|
|
|
+const toEdit = (data: { _id: string }) => {
|
|
|
+ router.push({ path: '/user/support/add', query: { id: data._id } });
|
|
|
+};
|
|
|
+// 删除
|
|
|
+const toDel = async (data: { _id: string }) => {
|
|
|
+ const res: IQueryResult = await techolsupport.del(data._id);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ message: '删除信息成功', type: 'success' });
|
|
|
+ search({ skip, limit });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 选择
|
|
|
+const handleSelect = () => {};
|
|
|
+// 查询其他信息
|
|
|
+const searchOther = async () => {
|
|
|
+ // 字典表---审核状态
|
|
|
+ const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_status' });
|
|
|
+ statusList.value = p1.data as [];
|
|
|
+ // 角色
|
|
|
+ const p2: IQueryResult = await sysdictdata.query({ dict_type: 'sys_yes_no' });
|
|
|
+ isuseList.value = p2.data as [];
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.main {
|
|
|
+ .thr {
|
|
|
+ margin: 1vw 0 0 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|