|
@@ -0,0 +1,305 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container">
|
|
|
|
+ <el-button size="small" type="primary" @click="openDialog(false, null)" :loading="loading">添加</el-button>
|
|
|
|
+ <el-button size="small" type="primary" @click="openDialog1()" :loading="loading">编辑文案</el-button>
|
|
|
|
+ <div>
|
|
|
|
+ <h3>客户说文案</h3>
|
|
|
|
+ <p>{{copywriting}}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <el-table :data="cooperations" style="width: 100%">
|
|
|
|
+ <el-table-column type="index" width="50"></el-table-column>
|
|
|
|
+ <el-table-column label="客户图片" width="200">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-image :src="scope.row.picUrl"></el-image>
|
|
|
|
+ <!-- style="width: 200px; height: 200px" -->
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column prop="companyName" label="客户名称" width="150"></el-table-column>
|
|
|
|
+ <el-table-column prop="clientName" label="客户负责人" width="150"></el-table-column>
|
|
|
|
+ <el-table-column prop="description" label="客户评价"></el-table-column>
|
|
|
|
+ <el-table-column label="操作" width="180">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button size="small" @click="openDialog(true, scope.$index)" :loading="loading">编辑</el-button>
|
|
|
|
+ <el-button size="small" type="danger" @click="deleteCooperation(scope.row.id)" :loading="loading">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+
|
|
|
|
+ <!-- 添加和编辑的dialog -->
|
|
|
|
+ <el-dialog title="客户说" :visible.sync="addDialogVisible" width="500px">
|
|
|
|
+ <el-form ref="form" :model="cooperationsForm" :rules="rules" label-width="100px">
|
|
|
|
+ <el-form-item label="客户名称" prop="title">
|
|
|
|
+ <el-input v-model="cooperationsForm.title" placeholder="请输入客户名称" clearable></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="客户负责人" prop="title1">
|
|
|
|
+ <el-input v-model="cooperationsForm.title1" placeholder="请输入客户负责人" clearable></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="客户评价" prop="introduction">
|
|
|
|
+ <el-input type="textarea" rows="5" v-model="cooperationsForm.introduction" placeholder="请输入客户评价" clearable></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-upload ref="upload" action="customize" :http-request="uploadDiscardFile" :limit="1" :before-remove="beforeRemove">
|
|
|
|
+ <el-button size="small" type="primary" :loading="loading">上传一张图片</el-button>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="addDialogVisible = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="addCooperation()" :loading="loading">提交</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- 添加和编辑的dialog -->
|
|
|
|
+ <el-dialog title="客户说文案" :visible.sync="addDialogVisible1" width="500px">
|
|
|
|
+ <el-form ref="form" :model="cooperationsForm" :rules="rules" label-width="80px">
|
|
|
|
+ <el-form-item label="客户名称" prop="copywriting">
|
|
|
|
+ <el-input type="textarea" rows="5" v-model="cooperationsForm.copywriting" placeholder="请输入产品名称" clearable></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="addDialogVisible1 = false">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="addCooperation1()" :loading="loading">提交</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ import request from "@/utils/request";
|
|
|
|
+ export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ editing: false,
|
|
|
|
+ loading: false,
|
|
|
|
+
|
|
|
|
+ addDialogVisible: false,
|
|
|
|
+ cooperations: [],
|
|
|
|
+ cooperationsForm: {
|
|
|
|
+ id: null,
|
|
|
|
+ title: null,
|
|
|
|
+ title1: null,
|
|
|
|
+ introduction: null,
|
|
|
|
+ address: null,
|
|
|
|
+ image: null,
|
|
|
|
+ copywriting: null
|
|
|
|
+ },
|
|
|
|
+ rules: {
|
|
|
|
+ title: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
|
|
|
|
+ title1: [{ required: true, message: "请输入客户负责人", trigger: "blur" }],
|
|
|
|
+ introduction: [{ required: true, message: "请输入客户评价", trigger: "blur"}],
|
|
|
|
+ copywriting: [{ required: true, message: "请输入客户说文案", trigger: "blur"}],
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ addDialogVisible1: false,
|
|
|
|
+ copywriting: '',
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ //打开对话框
|
|
|
|
+ openDialog(isEdit, index) {
|
|
|
|
+ this.editing = isEdit;
|
|
|
|
+ if (this.editing) {
|
|
|
|
+ this.cooperationsForm.id = this.cooperations[index].id;
|
|
|
|
+ this.cooperationsForm.title = this.cooperations[index].companyName;
|
|
|
|
+ this.cooperationsForm.title1 = this.cooperations[index].companyName;
|
|
|
|
+ this.cooperationsForm.introduction = this.cooperations[index].description;
|
|
|
|
+ this.cooperationsForm.image = null;
|
|
|
|
+ } else {
|
|
|
|
+ this.cooperationsForm.id = null;
|
|
|
|
+ this.cooperationsForm.title = "";
|
|
|
|
+ this.cooperationsForm.title1 = "";
|
|
|
|
+ this.cooperationsForm.introduction = "";
|
|
|
|
+ this.cooperationsForm.image = null;
|
|
|
|
+ }
|
|
|
|
+ this.addDialogVisible = true;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ openDialog1() {
|
|
|
|
+ this.addDialogVisible1 = true;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getFeedbackTitle() {
|
|
|
|
+ request({
|
|
|
|
+ url: "/feedback/getFeedbackTitle",
|
|
|
|
+ method: "post",
|
|
|
|
+ params: {}
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.copywriting = response.data.parameterValue;
|
|
|
|
+ this.cooperationsForm.copywriting = response.data.parameterValue;
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ addCooperation1() {
|
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ request({
|
|
|
|
+ url: "/feedback/list",
|
|
|
|
+ method: "post",
|
|
|
|
+ params: {content: this.cooperationsForm.copywriting}
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "编辑成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.addDialogVisible1 = false;
|
|
|
|
+ this.getFeedbackTitle();
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //获取合作信息
|
|
|
|
+ getCooperations() {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ request({
|
|
|
|
+ url: "/feedback/listFeedback",
|
|
|
|
+ method: "post",
|
|
|
|
+ params: {pageIndex:1,pageSize: 9999999}
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.cooperations = response.data;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //删除合作信息
|
|
|
|
+ deleteCooperation(id) {
|
|
|
|
+ request({
|
|
|
|
+ url: "/feedback/deleteFeedback",
|
|
|
|
+ method: "post",
|
|
|
|
+ params: { id: id }
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "删除成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.getCooperations();
|
|
|
|
+ this.addDialogVisible = false;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //添加/编辑合作信息
|
|
|
|
+ addCooperation() {
|
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.loading = true;
|
|
|
|
+ var form = new FormData();
|
|
|
|
+ form.append("companyName", this.cooperationsForm.title);
|
|
|
|
+ form.append("clientName", this.cooperationsForm.title1);
|
|
|
|
+ form.append("description", this.cooperationsForm.introduction);
|
|
|
|
+ //新增记录 并且 没有图片时
|
|
|
|
+ if (this.cooperationsForm.image == null && this.editing == false) {
|
|
|
|
+ //如果没上传文件的话
|
|
|
|
+ this.loading =false;
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "尚未上传图片",
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ //有图片时
|
|
|
|
+ } else if (this.cooperationsForm.image != null) {
|
|
|
|
+ form.append("file", this.cooperationsForm.image);
|
|
|
|
+ }
|
|
|
|
+ if (this.cooperationsForm.id != null) {
|
|
|
|
+ form.append("id", this.cooperationsForm.id);
|
|
|
|
+ }
|
|
|
|
+ request({
|
|
|
|
+ url: "/feedback/insertOrUpdateFeedback",
|
|
|
|
+ method: "post",
|
|
|
|
+ data: form
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
+ this.getCooperations();
|
|
|
|
+ this.addDialogVisible = false;
|
|
|
|
+ this.loading = false;
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "添加成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ this.loading = false;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //切换置顶
|
|
|
|
+ switchSticky(id) {
|
|
|
|
+ request({
|
|
|
|
+ url: "/cooperations/switchCooperationSticky",
|
|
|
|
+ method: "post",
|
|
|
|
+ params: { id: id }
|
|
|
|
+ })
|
|
|
|
+ .then(response => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "操作成功",
|
|
|
|
+ type: "success"
|
|
|
|
+ });
|
|
|
|
+ this.getCooperations();
|
|
|
|
+ })
|
|
|
|
+ .catch(error => {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: error,
|
|
|
|
+ type: "error"
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //文件上传的部分操作
|
|
|
|
+ uploadDiscardFile(params) {
|
|
|
|
+ this.cooperationsForm.image = params.file;
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //文件上传的移除操作
|
|
|
|
+ beforeRemove(params) {
|
|
|
|
+ this.cooperationsForm.image = null;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.getFeedbackTitle();
|
|
|
|
+ this.getCooperations();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+</style>
|
|
|
|
+
|