|
@@ -0,0 +1,170 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main animate__animated animate__backInRight">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <c-search></c-search>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <data-form :fields="fields" :form="form" :rules="{}" @save="toSave" :span="24">
|
|
|
+ <template #logo_url="{ item }">
|
|
|
+ <c-upload v-model="form[item.model]" url="/files/projectadmin/imgurl/upload" accept="" listType="text" :limit="1"></c-upload>
|
|
|
+ </template>
|
|
|
+ <template #advantage="{ item }">
|
|
|
+ <el-button type="primary" size="small" @click="toAdd('1')">添加</el-button>
|
|
|
+ <data-table :fields="adfields" :opera="adopera" :data="form[item.model]" @del="diaDel" :usePage="false">
|
|
|
+ <template #img_url="{ row, item }">
|
|
|
+ <el-image class="image" @click="imgView(row[item.model][0])" :src="row[item.model][0].uri"></el-image>
|
|
|
+ </template>
|
|
|
+ </data-table>
|
|
|
+ </template>
|
|
|
+ <template #programme="{ item }">
|
|
|
+ <el-button type="primary" size="small" @click="toAdd('2')">添加</el-button>
|
|
|
+ <data-table :fields="adfields" :opera="adopera" :data="form[item.model]" @del="diaDel" :usePage="false">
|
|
|
+ <template #img_url="{ row, item }">
|
|
|
+ <el-image class="image" @click="imgView(row[item.model][0])" :src="row[item.model][0].uri"></el-image>
|
|
|
+ </template>
|
|
|
+ </data-table>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </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'">
|
|
|
+ <data-form :fields="otherFields" :form="otherForm" :rules="{}" @save="dialogSave" :span="24">
|
|
|
+ <template #img_url="{ item }">
|
|
|
+ <c-upload v-model="otherForm[item.model]" url="/files/projectadmin/imgurl/upload" accept="" listType="text" :limit="1"></c-upload>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ </c-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('company');
|
|
|
+const moment = require('moment');
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ form: { advantage: [], programme: [] },
|
|
|
+ fields: [
|
|
|
+ { label: '公司名称', model: 'name' },
|
|
|
+ { label: '联系地址', model: 'address' },
|
|
|
+ { label: '公司logo', model: 'logo_url', custom: true },
|
|
|
+ { label: '联系人', model: 'contact' },
|
|
|
+ { label: '联系电话', model: 'phone' },
|
|
|
+ { label: 'qq', model: 'qq' },
|
|
|
+ { label: '电子邮箱', model: 'email' },
|
|
|
+ { label: '座机', model: 'mobile' },
|
|
|
+ { label: '公司优势', model: 'advantage', custom: true },
|
|
|
+ { label: '解决方案', model: 'programme', custom: true },
|
|
|
+ { label: '品牌理念', model: 'idea', type: 'textarea' },
|
|
|
+ { label: '独特优势', model: 'unique', type: 'textarea' },
|
|
|
+ { label: '加入我们', model: 'join', type: 'textarea' },
|
|
|
+ ],
|
|
|
+ dialog: { title: '信息审核', show: false, type: '1' },
|
|
|
+ otherForm: {},
|
|
|
+ otherFields: [
|
|
|
+ { label: '名称', model: 'name' },
|
|
|
+ { label: '简介', model: 'brief', type: 'textarea' },
|
|
|
+ { label: '图片', model: 'img_url', custom: true },
|
|
|
+ ],
|
|
|
+ // 添加数据类型
|
|
|
+ type: '',
|
|
|
+ // 公司优势
|
|
|
+ adfields: [
|
|
|
+ { label: '名称', model: 'name' },
|
|
|
+ { label: '简介', model: 'brief' },
|
|
|
+ { label: '图片', model: 'img_url', custom: true },
|
|
|
+ ],
|
|
|
+ adopera: [{ label: '删除', method: 'del', confirm: true, type: 'danger' }],
|
|
|
+ // 解决方案
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['query', 'create', 'update']),
|
|
|
+ async search() {
|
|
|
+ let res = await this.query();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let data = res.data;
|
|
|
+ if (!data.advantage) data.advantage = [];
|
|
|
+ if (!data.programme) data.programme = [];
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存信息
|
|
|
+ async toSave({ data }) {
|
|
|
+ let res;
|
|
|
+ if (data.id) res = await this.update(data);
|
|
|
+ else res = await this.create(data);
|
|
|
+ if (this.$checkRes(res, '维护信息成功', res.errmsg)) this.search();
|
|
|
+ },
|
|
|
+ // 添加公司优势,解决方案
|
|
|
+ toAdd(e) {
|
|
|
+ this.$set(this, `type`, e);
|
|
|
+ this.dialog = { title: e == '1' ? '公司优势' : '解决方案', show: true, type: '1' };
|
|
|
+ },
|
|
|
+ // 保存
|
|
|
+ dialogSave({ data }) {
|
|
|
+ if (!data.id) data.id = moment().valueOf();
|
|
|
+ data.type = this.type;
|
|
|
+ if (this.type == '1') {
|
|
|
+ this.form.advantage = [...this.form.advantage, data];
|
|
|
+ } else if (this.type == '2') {
|
|
|
+ this.form.programme = [...this.form.programme, data];
|
|
|
+ }
|
|
|
+ this.toClose();
|
|
|
+ },
|
|
|
+ // 删除
|
|
|
+ diaDel({ data }) {
|
|
|
+ if (data.type == '1') {
|
|
|
+ let advantage = this.form.advantage.filter((i) => i.id != data.id);
|
|
|
+ this.$set(this.form, `advantage`, advantage);
|
|
|
+ } else if (data.type == '2') {
|
|
|
+ let programme = this.form.programme.filter((i) => i.id != data.id);
|
|
|
+ this.$set(this.form, `programme`, programme);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 预览图片
|
|
|
+ imgView(e) {
|
|
|
+ window.open(e.uri);
|
|
|
+ },
|
|
|
+ // 关闭弹框
|
|
|
+ toClose() {
|
|
|
+ this.otherForm = {};
|
|
|
+ this.dialog = { title: '公司优势', show: false, type: '1' };
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ test: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {},
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.image {
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+}
|
|
|
+</style>
|