Ver código fonte

1、厦门海嘉成-关于我们企业文化

41235 1 ano atrás
pai
commit
c8462049f4

+ 66 - 0
src/api/XMHJC/aboutUs.js

@@ -104,3 +104,69 @@ export function deleteAboutUsHonor(data) {
         data: data
     })
 }
+
+
+
+/**
+ * 企业文化分页
+ * @param data
+ * @returns {*}
+ */
+export function findAboutUsCultureList(data) {
+    return request({
+        url: '/aboutUsCulture/page',
+        method: 'post',
+        data: data
+    })
+}
+
+
+/**
+ * 企业文化明细
+ * @param data
+ * @returns {*}
+ */
+export function getAboutUsCulture(data) {
+    return request({
+        url: '/aboutUsCulture/detail',
+        method: 'post',
+        data: data
+    })
+}
+
+/**
+ * 企业文化新增
+ * @param data
+ * @returns {*}
+ */
+export function addAboutUsCulture(data) {
+    return request({
+        url: '/aboutUsCulture/add',
+        method: 'post',
+        data: data
+    })
+}
+/**
+ * 企业文化编辑
+ * @param data
+ * @returns {*}
+ */
+export function editAboutUsCulture(data) {
+    return request({
+        url: '/aboutUsCulture/edit',
+        method: 'post',
+        data: data
+    })
+}
+/**
+ * 企业文化删除
+ * @param data
+ * @returns {*}
+ */
+export function deleteAboutUsCulture(data) {
+    return request({
+        url: '/aboutUsCulture/delete',
+        method: 'post',
+        data: data
+    })
+}

+ 1 - 13
src/components/TreeSelect/index.vue

@@ -80,19 +80,7 @@ const valueTitle = ref('');
 const defaultExpandedKey = ref([]);
 
 function initHandle() {
-  nextTick(() => {
-    const selectedValue = valueId.value;
-    if(selectedValue !== null && typeof (selectedValue) !== 'undefined') {
-      const node = proxy.$refs.selectTree.getNode(selectedValue)
-      if (node) {
-        valueTitle.value = node.data[props.objMap.label]
-        proxy.$refs.selectTree.setCurrentKey(selectedValue) // 设置默认选中
-        defaultExpandedKey.value = [selectedValue] // 设置默认展开
-      }
-    } else {
-      clearHandle()
-    }
-  })
+
 }
 function handleNodeClick(node) {
   valueTitle.value = node[props.objMap.label]

+ 420 - 0
src/views/XMHJC/aboutUs/culture/index.vue

@@ -0,0 +1,420 @@
+<template>
+  <div class="tenant">
+    <byTable
+        :source="sourceList.data"
+        :pagination="sourceList.pagination"
+        :config="config"
+        :loading="loading"
+        highlight-current-row
+        :selectConfig="selectConfig"
+        :table-events="{
+        select: select,
+      }"
+        :action-list="[
+        {
+          text: '添加企业文化',
+          action: () => openModal('add'),
+        },
+      ]"
+        @get-list="getList">
+    </byTable>
+    <el-dialog :title="modalType == 'add' ? '添加企业文化' : '编辑企业文化'" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
+        <template #subtitle>
+          <el-row style="width: 100%;margin-bottom: 10px"   v-for="(row, index) in formData.data.subTitleList" ref="sort">
+            <el-col :span="13" >
+              <el-form-item
+                  :prop="'subTitleList.' + index + '.value'"
+                  :rules="rules.value"
+                  prop="value"
+                  style="margin: 8px 0 8px 0">
+                <el-input v-model="row.value" placeholder="请输入子标题" :precision="0" :controls="false" :min="3" />
+              </el-form-item>
+            </el-col>
+            <el-col :span="5" >
+              <el-icon style="margin-left: 8px; color: red; cursor: pointer; transform: translateY(10px)" @click="clickDelete(index)"><Delete /></el-icon>
+            </el-col>
+          </el-row>
+          <el-row style="width: 100%">
+              <el-row>
+                <el-button type="primary" @click="clickAddSubTitle()">添加</el-button>
+              </el-row>
+          </el-row>
+        </template>
+
+        <template #detailsContent>
+          <div style="width: 100%" v-if="dialogVisible">
+            <TinymceEditor
+                :value="formData.data.detailsContent"
+                @updateValue="updateHandover"
+                ref="contentEditor"
+            />
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
+        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">确 定</el-button>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { ElMessage, ElMessageBox } from "element-plus";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import {computed, nextTick, reactive, ref} from "vue";
+import {
+  addAboutUsCulture,
+  editAboutUsCulture,
+  findAboutUsCultureList,
+  getAboutUsCulture,
+  deleteAboutUsCulture
+} from "@/api/XMHJC/aboutUs";
+import TinymceEditor from "@/components/Editor/TinymceEditor.vue";
+import {getDictOneByXmhjc, getFileList,getFileStr} from "@/api/XMHJC/common";
+
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+});
+let dialogVisible = ref(false);
+let modalType = ref("add");
+
+let rules = ref({
+  title: [{ required: true, message: "请输入企业文化标题", trigger: "blur" }],
+  status: [{ required: true, message: "请选择启用状态", trigger: "change" }],
+  type: [{ required: true, message: "请输入跳转类型", trigger: "change" }],
+  toUrl: [{ required: true, message: "请输入第三方链接", trigger: "blur" }],
+  sort: [{ required: true, message: "请输入排序", trigger: "blur" }],
+  value: [{ required: true, message: "请输入子标题", trigger: "blur" }],
+});
+const { proxy } = getCurrentInstance();
+const toUrlType = ref([]);
+const enableStatus = ref([]);
+const selectConfig = [];
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "标题",
+        prop: "title",
+      },
+    },
+    {
+      attrs: {
+        label: "跳转类型",
+        prop: "type",
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, toUrlType.value);
+      },
+    },
+    {
+      attrs: {
+        label: "排序",
+        prop: "sort",
+      },
+    },
+    {
+      attrs: {
+        label: "状态",
+        prop: "status",
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, enableStatus.value);
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "修改",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+          {
+            attrs: {
+              label: "删除",
+              type: "danger",
+              text: true,
+            },
+            el: "button",
+            click() {
+              ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
+                deleteAboutUsCulture({
+                  id: row.id,
+                })
+                    .then((res) => {
+                      ElMessage({
+                        message: "删除成功",
+                        type: "success",
+                      });
+                      getList();
+                    });
+              });
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+let formData = reactive({
+  data: {
+    subTitleList:[],
+    subTitleListReslut:[]
+  },
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const byform = ref(null);
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "title",
+      label: "标题",
+      required: true,
+    },
+    {
+      type: "slot",
+      slotName: "subtitle",
+      prop: "subtitle",
+      label: "子标题",
+    },
+    {
+      type: "input",
+      prop: "sort",
+      label: "排序",
+      itemType: "number",
+      precision: 0,
+      max: 999,
+      controls: false,
+      required: true,
+    },
+    {
+      label: "启用状态",
+      prop: "status",
+      type: "select",
+      data: enableStatus.value,
+      required: true,
+    },
+    {
+      type: "select",
+      prop: "type",
+      label: "跳转类型",
+      data: toUrlType.value,
+      required: true,
+    },
+    {
+      type: "input",
+      prop: "toUrl",
+      label: "第三方链接",
+      required: true,
+      isShow: formData.data.type == "2"
+    },
+    {
+      type: "slot",
+      slotName: "detailsContent",
+      prop: "detailsContent",
+      label: "详情内容",
+      isShow: formData.data.type == "3"
+    },
+  ];
+});
+
+const getDictlist = async () => {
+
+  const res = await getDictOneByXmhjc(["to_url_type","enable_status"]);
+  toUrlType.value = res["to_url_type"].map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+  enableStatus.value = res["enable_status"].map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+};
+
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+
+  const res = await findAboutUsCultureList(sourceList.value.pagination);
+  sourceList.value.data = res.data.rows;
+  sourceList.value.pagination.total = res.data.total;
+  setTimeout(() => {
+    loading.value = false;
+  }, 200);
+
+};
+
+const openModal = () => {
+  dialogVisible.value = true;
+  modalType.value = "add";
+  formData.data = {
+    detailsContent:'',
+    subtitleList:[],
+    subTitleListReslut:[]
+  };
+
+};
+const selection = ref({
+  data: [],
+});
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+};
+const submitForm = () => {
+  byform.value.handleSubmit(() => {
+    if (!(formData.data.subTitleList && formData.data.subTitleList.length > 0)) {
+      return ElMessage({message:"请添加子标题",type: "error"});
+    }else {
+
+      var subTitleListReslut = JSON.parse(JSON.stringify(formData.data.subTitleList)).map(x =>{
+        return x.value
+      })
+      formData.data.subTitleListReslut = subTitleListReslut;
+
+    }
+
+    if (formData.data.type == '3' &&
+        !formData.data.detailsContent) {
+      ElMessage({message: "请填写详情内容",type: "error",});
+      return
+    }
+
+    submitLoading.value = true;
+    if (modalType.value === 'add'){
+      addAboutUsCulture(formData.data).then(response => {
+        ElMessage({
+          message: "添加成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      }).catch(()=>{
+        submitLoading.value = false;
+      });
+    }else {
+      editAboutUsCulture(formData.data).then(response => {
+        ElMessage({
+          message: "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      }).catch(()=>{
+        submitLoading.value = false;
+      });
+
+
+    }
+  });
+};
+
+const getDtl = async (row) => {
+  modalType.value = "edit";
+  const response = await getAboutUsCulture({ id: row.id })
+  formData.data = response.data;
+
+  var subTitleList = JSON.parse(JSON.stringify(formData.data.subTitleListReslut)).map(x =>{
+    return {value:x}
+  })
+  formData.data.subTitleList = subTitleList
+
+  dialogVisible.value = true;
+};
+
+
+const updateHandover = (val) => {
+  formData.data.detailsContent = val;
+};
+
+
+const clickAddSubTitle = () => {
+    if (formData.data.subTitleList && formData.data.subTitleList.length > 0) {
+      formData.data.subTitleList.push({
+        value: ""
+      });
+    } else {
+      formData.data.subTitleList = [
+        {
+          value: "",
+        },
+      ];
+    }
+};
+
+const clickDelete = (index) => {
+  formData.data.subTitleList.splice(index, 1);
+};
+
+getDictlist()
+getList()
+
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+  .delete-btn{
+    margin-top: 10px;
+    margin-left: 25px;
+  }
+}
+.avatar-uploader .avatar {
+  width: 110px;
+  height: 110px;
+  display: block;
+  background-color: black;
+}
+.avatar-uploader .el-upload {
+  border: 1px dashed var(--el-border-color);
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+  transition: var(--el-transition-duration-fast);
+}
+.avatar-uploader .el-upload:hover {
+  border-color: var(--el-color-primary);
+}
+.el-icon.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 110px;
+  height: 110px;
+  text-align: center;
+  border: 1px dashed var(--el-border-color);
+}
+</style>

+ 7 - 5
src/views/XMHJC/aboutUs/honor/index.vue

@@ -12,13 +12,13 @@
       }"
         :action-list="[
         {
-          text: '添加荣誉',
+          text: '添加荣誉资质',
           action: () => openModal('add'),
         },
       ]"
         @get-list="getList">
     </byTable>
-    <el-dialog :title="modalType == 'add' ? '添加荣誉' : '编辑荣誉'" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loading">
+    <el-dialog :title="modalType == 'add' ? '添加荣誉资质' : '编辑荣誉资质'" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loading">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
         <template #honorCover>
           <el-row style="width: 100%">
@@ -42,8 +42,8 @@
                 <el-button
                     class="delete-btn"
                     type="danger"
-                    v-if="formData.data.companyCoverList && formData.data.companyCoverList.length > 0"
-                    @click="formData.data.companyCoverList = []">
+                    v-if="formData.data.honorCoverList && formData.data.honorCoverList.length > 0"
+                    @click="formData.data.honorCoverList = []">
                   删除
                 </el-button>
               </el-form-item>
@@ -218,9 +218,11 @@ const formConfig = computed(() => {
     },
 
     {
-      type: "number",
+
+      type: "input",
       prop: "sort",
       label: "排序",
+      itemType: "number",
       precision: 0,
       max: 999,
       controls: false,