|
@@ -0,0 +1,157 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
|
|
|
+ <el-col :span="24" class="container">
|
|
|
+ <el-col :span="24" class="add">
|
|
|
+ <el-button type="primary" size="mini" @click="back()">返回</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" v-if="loading">
|
|
|
+ <data-form :data="form" :fields="Fields" :rules="{}" @save="turnSave">
|
|
|
+ <template #options="{item}">
|
|
|
+ <template v-if="item.model == 'column_id'">
|
|
|
+ <el-option v-for="(item, index) in columnList" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.model == 'infotype'">
|
|
|
+ <el-option label="就业指导" value="就业指导"></el-option>
|
|
|
+ <el-option label="工作顾问" value="工作顾问"></el-option>
|
|
|
+ <el-option label="新闻" value="新闻"></el-option>
|
|
|
+ <el-option label="简历" value="简历"></el-option>
|
|
|
+ <el-option label="面试" value="面试"></el-option>
|
|
|
+ <el-option label="其他" value="其他"></el-option>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template #custom="{item,form}">
|
|
|
+ <template v-if="item.model == 'content'">
|
|
|
+ <wang-editor v-model="form.content" placeholder="请输入信息内容"></wang-editor>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import WangEditor from '@c/frame/wang-editor.vue';
|
|
|
+import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
+import dataForm from '@c/frame/form.vue';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: mapColumn } = createNamespacedHelpers('talentColumn');
|
|
|
+const { mapActions: mapNews } = createNamespacedHelpers('talentInformation');
|
|
|
+export default {
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ name: 'detail',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ breadcrumb,
|
|
|
+ dataForm,
|
|
|
+ WangEditor,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ Fields: [
|
|
|
+ { label: '信息名称', model: 'name' },
|
|
|
+ { label: '发布人', model: 'user_name' },
|
|
|
+ { label: '所属栏目', model: 'column_id', type: 'select' },
|
|
|
+ { label: '信息类型', model: 'infotype', type: 'select' },
|
|
|
+ { label: '信息内容', model: 'content', custom: true },
|
|
|
+ ],
|
|
|
+ loading: true,
|
|
|
+ // 栏目列表
|
|
|
+ columnList: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.searchcol();
|
|
|
+ await this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapColumn({ colquery: 'query' }),
|
|
|
+ ...mapNews({ newfetch: 'fetch', newcreate: 'create', newupdate: 'update' }),
|
|
|
+ // 查询详情
|
|
|
+ async search() {
|
|
|
+ if (this.id) {
|
|
|
+ this.loading = false;
|
|
|
+ const res = await this.newfetch(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
+ this.loading = true;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存信息
|
|
|
+ async turnSave({ data }) {
|
|
|
+ if (data.id) {
|
|
|
+ const res = await this.newupdate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.back();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.user_id = '1';
|
|
|
+ const res = await this.newcreate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.back();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 返回
|
|
|
+ back() {
|
|
|
+ this.form = {};
|
|
|
+ this.$router.push({ path: '/informate' });
|
|
|
+ },
|
|
|
+ // 查询栏目
|
|
|
+ async searchcol() {
|
|
|
+ let res = await this.colquery();
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ this.$set(this, `columnList`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 上传图片
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.add {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|