Browse Source

修改用户管理,+科学家工作室--保留资质

YY 2 years ago
parent
commit
eb0dfdb8b2

+ 179 - 173
src/views/center/studio/flair/index.vue

@@ -3,198 +3,204 @@
     <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">
+          <component :is="partsSearch" :is_search="true" :fields="fields" @search="partSearch">
             <template #status>
               <el-option v-for="i in statusList" :key="i.model" :label="i.dict_label" :value="i.dict_value"></el-option>
             </template>
             <template #studio_id>
               <el-option v-for="i in studioList" :key="i.id" :label="i.name" :value="i.id"></el-option>
             </template>
-          </c-search>
+          </component>
         </el-col>
         <el-col :span="24" class="two">
-          <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @exam="toExam">
+          <component
+            :is="CTable"
+            :fields="fields"
+            :opera="opera"
+            :select="false"
+            :selected="selected"
+            @handleSelect="handleSelect"
+            @query="search"
+            :data="tableData"
+            :total="total"
+            @exam="toExam"
+          >
             <template #file="{ row, item }">
               <el-link v-for="(i, index) in row[item.model]" :key="index" :href="i.url" target="_blank">{{ i.name }}</el-link>
             </template>
-          </data-table>
+          </component>
         </el-col>
       </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-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>
   </div>
 </template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-const { mapActions } = createNamespacedHelpers('applyflair');
-const { mapActions: studio } = createNamespacedHelpers('studio');
-const { mapActions: sysdictdata } = createNamespacedHelpers('sysdictdata');
-const { mapActions: message } = createNamespacedHelpers('message');
-const { mapActions: unitStudioApply } = createNamespacedHelpers('unitStudioApply');
-const moment = require('moment');
-export default {
-  name: 'index',
-  props: {},
-  components: {},
-  data: function () {
-    return {
-      // 查询
-      searchInfo: {},
-      fields: [
-        { label: '序号', options: { type: 'index' } },
-        {
-          label: '工作室名称',
-          model: 'studio_id',
-          type: 'select',
-          format: (i) => {
-            let data = this.studioList.find((r) => r.id == i);
-            if (data) return data.name;
-          },
-          isSearch: true,
-        },
-        { label: '依托单位名称', model: 'company_name' },
-        { label: '申请时间', model: 'apply_time' },
-        { label: '评估文件', model: 'file', custom: true },
-        {
-          label: '审核状态',
-          model: 'status',
-          type: 'select',
-          format: (i) => {
-            let data = this.statusList.find((r) => r.dict_value == i);
-            if (data) return data.dict_label;
-          },
-          isSearch: true,
-        },
-      ],
-      opera: [{ label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' }],
-      list: [],
-      total: 0,
-      // 工作室列表
-      studioList: [],
-      // 审核状态
-      statusList: [],
-      dialog: { title: '信息审核', show: false, type: '1' },
-      form: {},
-      rules: {
-        status: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
-        remark: [{ required: true, message: '请输入审核意见', trigger: 'blur' }],
-      },
-    };
-  },
-  created() {
-    this.searchOther();
-    this.search();
-  },
-  methods: {
-    ...mapActions(['query', 'update']),
-    ...studio({ sQuery: 'query' }),
-    ...sysdictdata({ dQuery: 'query' }),
-    ...message({ mCreate: 'create' }),
-    ...unitStudioApply({ CFetch: 'fetch' }),
-    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
-      if (this.studio_id) info.studio_id = this.studio_id;
-      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();
-    },
-    // 信息审核
-    toExam({ data }) {
-      this.$set(this, `form`, data);
-      this.dialog = { title: '信息审核', show: true, type: '1' };
+<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';
+// #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 { useRoute } from 'vue-router';
+// #region 接口
+import { ApplyflairStore } from '@common/src/stores/studio/studios/applyflair'; // 列表
+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 applyflair = ApplyflairStore();
+const studio = StudioStore();
+const dictData = DictDataStore();
+const message = MessageStore();
+const unitStudioApply = UnitStudioApplyStore();
+const { proxy } = getCurrentInstance() as any;
+let route = useRoute();
+// #endregion
+// 列表数据
+let tableData: Ref<any[]> = ref([]);
+// 列表
+let fields: Ref<any[]> = ref([
+  { label: '序号', options: { type: 'index' } },
+  {
+    label: '工作室名称',
+    model: 'studio_id',
+    type: 'select',
+    format: (i) => {
+      let data = studioList.value.find((r) => r.id == i);
+      if (data) return data.name;
     },
-    // 提交审核
-    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 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_name, phone: res.data.phone }],
-          content: '您好,您所申请《' + data.studio_name + '》的保留资质,' + `${data.status == '1' ? '已通过审核' : '未通过审核'}` + ',原因:' + 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({ status: '7' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `studioList`, res.data);
-      }
-      // 审核状态
-      res = await this.dQuery({ dict_type: 'studio_status' });
-      if (this.$checkRes(res)) {
-        this.$set(this, `statusList`, res.data);
-      }
-    },
-  },
-  computed: {
-    ...mapState(['user']),
-    studio_id() {
-      return this.$route.query.studio_id;
-    },
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
+    isSearch: true,
   },
-  watch: {
-    test: {
-      deep: true,
-      immediate: true,
-      handler(val) {},
+  { label: '依托单位名称', model: 'company_name' },
+  { label: '申请时间', model: 'apply_time' },
+  { label: '评估文件', model: 'file', 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: 'exam', type: 'warning', display: (i) => i.status == '0' }]);
+// 多选
+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 studioList: 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, studio_id: '' };
+  if (route.query.studio_id) info.studio_id = route.query.studio_id;
+  const res: IQueryResult = await applyflair.query(info);
+  tableData.value = res.data as any[];
+  total.value = res.total;
+};
+// 查询
+const partSearch = (form: { [x: string]: any }) => {
+  searchForm.value = form;
+  search({ skip, limit });
+};
+
+// 审核
+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);
+  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);
+  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_name, phone: res.data.phone }],
+      content: '您好,您所申请《' + data.studio_name + '》的保留资质,' + `${data.status == '1' ? '已通过审核' : '未通过审核'}` + ',原因:' + data.remark,
+    };
+    let arr = await message.create(obj);
+    if (arr.errcode == 0) {
+      ElMessage({ type: 'success', message: '系统信息发送成功' });
+      handleClose();
+    }
+  }
 };
-</script>
 
-<style lang="less" scoped></style>
+// 关闭弹窗
+const handleClose = () => {
+  form.value = {};
+  search({ skip, limit });
+  dialog.value = { title: '信息管理', show: false, type: '' };
+};
+// 选择
+const handleSelect = () => {};
+// 查询其他信息
+const searchOther = async () => {
+  // 字典表---审核状态
+  const p1: IQueryResult = await dictData.query({ dict_type: 'studio_status' });
+  statusList.value = p1.data as [];
+  // 角色
+  const p2 = await studio.query({ status: '7' });
+  statusList.value = p2.data[0];
+};
+</script>
+<style lang="scss" scoped></style>

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

@@ -220,7 +220,7 @@ export default {
 };
 </script>
 
-<style lang="less" scoped>
+<style lang="scss" scoped>
 // .main {
 //   .two {
 //     box-shadow: 0 0 10px #f1f1f1;

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

@@ -187,4 +187,4 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="scss" scoped></style>

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

@@ -91,4 +91,4 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="scss" scoped></style>

+ 1 - 1
src/views/center/studio/year/index.vue

@@ -197,4 +197,4 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="scss" scoped></style>

+ 1 - 14
src/views/center/users/company/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,9 +23,6 @@
           @exam="toExam"
           @del="toDel"
         >
-          <!-- <template #unit_phone="{ row, item }">
-            {{ row[item.model].phone }}
-          </template> -->
         </component>
       </el-col>
     </el-col>
@@ -68,13 +62,6 @@ const role = RoleStore();
 const unit = UnitStore();
 const { proxy } = getCurrentInstance() as any;
 const router = useRouter();
-interface operaItem {
-  label: string;
-  method: string;
-  confirm?: boolean;
-  type?: string;
-  display?: any;
-}
 // #endregion
 // 列表数据
 let tableData: Ref<any[]> = ref([]);
@@ -160,7 +147,7 @@ const toExam = (data: object) => {
 };
 // 审核保存
 const toSave = async (data: { _id: string; status: string }) => {
-  let obj = { _id: data._id, status: data.status };
+  let obj = { id: data._id, status: data.status };
   let res: IQueryResult = await unitStudioApply.create(obj);
   if (obj.status == '1') updateRole(data);
   if (res.errcode == 0) {

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

@@ -16,9 +16,9 @@
 <script setup lang="ts">
 import partsSearch from '@/components/c-search.vue';
 import unitInfo from '@/components/common/unit/info.vue';
-import { useRouter, useRoute } from 'vue-router';
+import { useRoute } from 'vue-router';
 import type { Ref } from 'vue';
-import { ref, toRefs, onMounted } from 'vue';
+import { ref, onMounted } from 'vue';
 import { UnitStudioApplyStore } from '@common/src/stores/studio/role/unitStudioApply'; // 列表
 import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
@@ -38,11 +38,11 @@ const search = async () => {
     let id = route.query.id;
     const res: IQueryResult = await unitStudioApply.fetch(id);
     let data: { fields: any } = res.data as { fields: any };
-    if (data.fields && data.fields.length > 0) data.fields = searchDict(data.fields, 'fieldList');
+    if (data.fields && data.fields.length > 0) data.fields = searchDict(data.fields);
     info.value = res.data;
   }
 };
-const searchDict = (e, type) => {
+const searchDict = (e) => {
   let data = [];
   for (const val of e) {
     let value = fieldList.value.find((r) => r.dict_value == val);

+ 4 - 12
src/views/center/users/scientist/index.vue

@@ -5,7 +5,7 @@
         <component :is="partsSearch" :is_search="true" :fields="fields" @search="partSearch">
           <template #status>
             <el-option v-for="i in statusList" :key="i.model" :label="i.dict_label" :value="i.dict_value"></el-option>
-          </template> 
+          </template>
           <!-- <template #unit_phone>
             <el-input v-model="searchForm.unit_phone" placeholder="请输入单位联系电话" clearable size="small"></el-input>
           </template> -->
@@ -68,13 +68,7 @@ const role = RoleStore();
 const users = UsersStore();
 const { proxy } = getCurrentInstance() as any;
 const router = useRouter();
-interface operaItem {
-  label: string;
-  method: string;
-  confirm?: boolean;
-  type?: string;
-  display?: any;
-}
+
 // #endregion
 // 列表数据
 let tableData: Ref<any[]> = ref([]);
@@ -157,14 +151,12 @@ 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 obj = { id: data._id, status: data.status };
   let res: IQueryResult = await userStudioApply.create(obj);
   if (obj.status == '1') updateRole(data);
   if (res.errcode == 0) {
@@ -195,7 +187,7 @@ const createMess = async (data) => {
       title: '审核通知',
       send_time: moment().format('YYYY-MM-DD HH:mm:ss'),
       type: '3',
-      user: [{ id: data.unit_id, company: data.company, phone: data.phone }],
+      user: [{ id: data.user_id, company: data.name, phone: data.phone }],
       content: '您好,权限申请,' + `${data.status == '1' ? '已通过审核' : '未通过审核'}` + ',原因:' + data.remark,
     };
     let arr = await message.create(obj);

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

@@ -24,9 +24,9 @@
 <script setup lang="ts">
 import partsSearch from '@/components/c-search.vue';
 import scientistInfo from '@/components/common/scientist/info.vue';
-import { useRouter, useRoute } from 'vue-router';
+import { useRoute } from 'vue-router';
 import type { Ref } from 'vue';
-import { ref, toRefs, onMounted } from 'vue';
+import { ref, onMounted } from 'vue';
 import { UserStudioApplyStore } from '@common/src/stores/studio/role/userStudioApply'; // 列表
 import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
 import type { IQueryResult } from '@/util/types.util';
@@ -54,13 +54,13 @@ const search = async () => {
     let id = route.query.id;
     const res: IQueryResult = await userStudioApply.fetch(id);
     let data: { is_job: any; zc: any; fields: any } = res.data as { is_job: any; zc: any; fields: any };
-    data.is_job = searchDictsis_job(data.is_job, 'isjobList');
-    data.zc = searchDictszcList(data.zc, 'zcList');
-    if (data.fields && data.fields.length > 0) data.fields = searchDict(data.fields, 'fieldList');
+    data.is_job = searchDictsis_job(data.is_job);
+    data.zc = searchDictszcList(data.zc);
+    if (data.fields && data.fields.length > 0) data.fields = searchDict(data.fields);
     info.value = res.data;
   }
 };
-const searchDict = (e, type) => {
+const searchDict = (e) => {
   let data = [];
   if (e && e.length > 0) {
     for (const val of e) {
@@ -71,11 +71,11 @@ const searchDict = (e, type) => {
   }
 };
 
-const searchDictsis_job = (e, type) => {
+const searchDictsis_job = (e) => {
   let data = isjobList.value.find((r) => r.dict_value == e);
   if (data && data._id) return data.dict_label;
 };
-const searchDictszcList = (e, type) => {
+const searchDictszcList = (e) => {
   let data = zcList.value.find((r) => r.dict_value == e);
   if (data && data._id) return data.dict_label;
 };

+ 3 - 3
vite.config.ts

@@ -12,17 +12,17 @@ export default defineConfig({
         target: 'http://basic.waityou24.cn',
       },
       '/jcyjdtglpt/v1/api': {
-        target: 'http://192.168.230.1:13010',
+        target: 'http://192.168.1.113:13010',
         changeOrigin: true,
         ws: false,
       },
       '/semail/api': {
-        target: 'http://192.168.230.1:16001',
+        target: 'http://192.168.1.113:16001',
         changeOrigin: true,
         ws: false,
       },
       '/studioadmin/api': {
-        target: 'http://192.168.230.1:16001',
+        target: 'http://192.168.1.113:16001',
         changeOrigin: true,
         ws: false,
       },