|
@@ -7,49 +7,35 @@
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">组件名称</div>
|
|
|
- <el-input v-model="componentName" clearable placeholder="请输入组件名称"></el-input>
|
|
|
+ <el-input v-model="apiData.component_name" clearable placeholder="请输入组件名称"></el-input>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="6" class="left">
|
|
|
- <div class="searchBox">
|
|
|
- <div class="searchTitle">所属通栏</div>
|
|
|
- <el-input v-model="componentName" clearable placeholder="请输入通栏名称"></el-input>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6" class="left">
|
|
|
+ <el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
- <div class="searchTitle">所属风格</div>
|
|
|
- <el-select v-model="templateName" clearable placeholder="请选择风格">
|
|
|
- <el-option v-for="item in options" :key="item.id" :label="item.sector_name"
|
|
|
- :value="item.id">
|
|
|
+ <div class="searchTitle">组件类型</div>
|
|
|
+ <el-select v-model="apiData.type_id" clearable placeholder="请选择组件类型" @change="getTypeList">
|
|
|
+ <el-option v-for="item in type_options" :key="item.id" :label="item.com_typename" :value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <el-col :span="6" class="right">
|
|
|
- <div class="btnList">
|
|
|
- <button class="search" @click="goSearch">搜索</button>
|
|
|
- <button class="reset" @click="goReset">重置</button>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="rowMargin">
|
|
|
- <el-col :span="6" class="left">
|
|
|
- <div class="searchBox">
|
|
|
- <div class="searchTitle">组件名称</div>
|
|
|
- <el-input v-model="componentName" clearable placeholder="请输入组件名称"></el-input>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
<el-col :span="6" class="left">
|
|
|
<div class="searchBox">
|
|
|
<div class="searchTitle">尺寸</div>
|
|
|
<div class="sizeBox">
|
|
|
- <div class="sizeInput"><el-input v-model="plateName" clearable placeholder="宽"></el-input> </div>
|
|
|
- <div class="sizeInputSymbol">*</div>
|
|
|
- <div class="sizeInput"><el-input v-model="plateName" clearable placeholder="高"></el-input></div>
|
|
|
+ <div class="sizeInput"><el-input v-model="apiData.width" clearable placeholder="宽"></el-input> </div>
|
|
|
+ <div class="sizeInputSymbol sizeStar"> * </div>
|
|
|
+ <div class="sizeInput"><el-input v-model="apiData.height" clearable placeholder="高"></el-input></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
+ <el-col :span="6" class="right">
|
|
|
+ <div class="btnList">
|
|
|
+ <button class="search" @click="getData">搜索</button>
|
|
|
+ <button class="reset" @click="goReset">重置</button>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
|
|
|
|
|
@@ -60,13 +46,11 @@
|
|
|
<button class="btn" @click="addWebsite">添加组件</button>
|
|
|
<el-row>
|
|
|
<template>
|
|
|
- <el-table class="my-table" :data="tableData" style="width: 100%" v-loading="moduleLoading">
|
|
|
- <el-table-column fixed prop="id" label="编号" width="90"></el-table-column>
|
|
|
+ <el-table class="my-table" :data="tableData" style="width: 100%">
|
|
|
+ <el-table-column fixed prop="component_type" label="组件编号" width="90"></el-table-column>
|
|
|
<el-table-column prop="component_name" label="组件名称" width=""></el-table-column>
|
|
|
<el-table-column prop="component_size" label="尺寸" width=""></el-table-column>
|
|
|
- <el-table-column prop="component_skin" label="所属皮肤" width=""></el-table-column>
|
|
|
- <el-table-column prop="component_skin" label="所属风格" width=""></el-table-column>
|
|
|
- <el-table-column prop="component_page" label="所属页面" width=""></el-table-column>
|
|
|
+ <el-table-column prop="com_typename" label="组件分类" width=""></el-table-column>
|
|
|
<el-table-column prop="created_at" label="添加时间" width=""></el-table-column>
|
|
|
<el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
|
|
|
<el-table-column fixed="right" label="操作" width="200">
|
|
@@ -104,73 +88,132 @@
|
|
|
<!-- 弹出框 编辑 start----------------------------------------------------------->
|
|
|
<el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" top="8vh"
|
|
|
:close-on-click-modal="false">
|
|
|
- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
|
|
|
+ <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="160px" class="demo-ruleForm">
|
|
|
<div class="dialogText">
|
|
|
<el-form-item label="组件名称:" prop="component_name">
|
|
|
<el-input v-model="ruleForm.component_name" placeholder="请输入组件名称"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属页面:" prop="plateName">
|
|
|
- <el-select v-model="ruleForm.plateName" clearable placeholder="请选择所属页面">
|
|
|
- <el-option>首页</el-option>
|
|
|
- <el-option>列表页</el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="组件编号:" prop="component_type">
|
|
|
+ <el-input v-model="ruleForm.component_type" placeholder="输入组件编号"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属风格:" prop="plateName">
|
|
|
- <el-select v-model="ruleForm.plateName" clearable placeholder="请选择所属页面">
|
|
|
- <el-option>简约</el-option>
|
|
|
- <el-option>黑暗</el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="组件关键词:" prop="component_keyword" class="custom-align-right">
|
|
|
+ <template #label>
|
|
|
+ <span class="askBox">
|
|
|
+ 组件关键词:
|
|
|
+ <el-tooltip class="item" effect="dark" content="皮肤关键词,如:黑色、卡通、英雄。" placement="top">
|
|
|
+ <i class="el-icon-question"></i>
|
|
|
+ </el-tooltip>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <tagInput :initialTags="tags" @tags-updated="updateTags"></tagInput>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="风格id:" prop="component_name">
|
|
|
- <el-input v-model="ruleForm.component_name" placeholder="请输入组件名称" disabled></el-input>
|
|
|
+ <el-form-item label="组件展示图:" prop="component_img" :label-width="formLabelWidth"
|
|
|
+ :class="['custom-form-item']" class="custom-align-right">
|
|
|
+ <div class="uploaderBox">
|
|
|
+ <!--图片上传组件 start ------------------------------------------------------------>
|
|
|
+ <div class="avatar-upload-container" @mouseenter="hovering = true"
|
|
|
+ @mouseleave="hovering = false">
|
|
|
+ <!-- 上传组件 -->
|
|
|
+ <el-upload class="avatar-uploader" action="#" :show-file-list="false"
|
|
|
+ :before-upload="beforeAvatarUpload" >
|
|
|
+ <!-- 预览图片 -->
|
|
|
+ <img v-if="logoUrl" :src="logoUrl" class="avatar">
|
|
|
+ <!-- 上传图标 -->
|
|
|
+ <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
|
|
|
+ <div v-else class="chooseImgDiv">
|
|
|
+ <div>
|
|
|
+ <img src="@/assets/public/upload/noImage.png">
|
|
|
+ <div>选择图片</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <input type="hidden" name="logo" v-model="ruleForm.webLogo">
|
|
|
+ <!-- <input type="hidden" name="logo" v-model="logoUrl"> -->
|
|
|
+ </el-upload>
|
|
|
+ <!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
+ <div v-if="hovering && logoUrl" class="delete-button"
|
|
|
+ @click="handleDelete">
|
|
|
+ <i class="el-icon-delete"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--图片上传组件 end ------------------------------------------------------------>
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属皮肤:" prop="plateName">
|
|
|
- <el-select v-model="ruleForm.plateName" clearable placeholder="请选择所属皮肤">
|
|
|
- <el-option>简约</el-option>
|
|
|
- <el-option>黑暗</el-option>
|
|
|
+ <el-form-item label="组件分类:" prop="type_id">
|
|
|
+
|
|
|
+ <el-select v-model="ruleForm.type_id" placeholder="请选择组件分类" @change="getColumnType(ruleForm.type_id)">
|
|
|
+ <el-option v-for="item in type_options" :key="item.id"
|
|
|
+ :label="item.com_typename" :value="item.id">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="皮肤id:" prop="component_name">
|
|
|
- <el-input v-model="ruleForm.component_name" placeholder="请输入组件名称" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属通栏:" prop="plateName">
|
|
|
- <el-cascader v-model="ruleForm.plateName" :options="styleOptions" :props="cascaderProps"
|
|
|
- :disabled="this.dialogName === '编辑'" @change="handleChange" placeholder="请选择关联的版块名称"
|
|
|
- clearable>
|
|
|
- </el-cascader>
|
|
|
+ <el-form-item label="组件尺寸:" prop="component_width" v-if="ruleForm.type_id != 11">
|
|
|
+ <div class="sizeInput"><el-input v-model="ruleForm.component_width" clearable placeholder="宽"></el-input> </div>
|
|
|
+ <div class="sizeInputSymbol">*</div>
|
|
|
+ <div class="sizeInput"><el-input v-model="ruleForm.component_height" clearable placeholder="高"></el-input></div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="通栏id:" prop="component_name">
|
|
|
- <el-input v-model="ruleForm.component_name" placeholder="请输入组件名称" disabled></el-input>
|
|
|
+ <el-form-item label="组件展示字段:" prop="listType" class="custom-align-right" v-if="[1,2,3,4,5,6,7,8,9,14].includes(ruleForm.type_id)">
|
|
|
+ <!-- <div class="formLabelFloatBox"> -->
|
|
|
+ <!-- <div class="labelTitleStyle"> -->
|
|
|
+
|
|
|
+ <!-- <el-tooltip class="item" effect="dark" content="如需修改,请去其他设置-单页中进行修改/添加。" placement="top">
|
|
|
+ <i class="el-icon-question"></i>
|
|
|
+ </el-tooltip> -->
|
|
|
+ <!-- </div> -->
|
|
|
+ <el-checkbox-group v-model="ruleForm.listType">
|
|
|
+ <el-checkbox v-for="item in column_options" :key="item" value="item" disabled>{{item}}</el-checkbox>
|
|
|
+
|
|
|
+ </el-checkbox-group>
|
|
|
+ <!-- </div> -->
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="尺寸:" prop="plateName">
|
|
|
- <el-select v-model="ruleForm.plateName" clearable placeholder="请选择所属皮肤">
|
|
|
- <el-option>600x480</el-option>
|
|
|
- <el-option>300x200</el-option>
|
|
|
+ <!-- <el-form-item label="组件所需字段:" prop="listType">
|
|
|
+ <el-select v-model="ruleForm.listType" placeholder="请选择组件所需字段">
|
|
|
+ <el-option v-for="item in column_options" :key="item.id"
|
|
|
+ :label="item.column_name" :value="item.id">
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 组件分类:1:资讯-头条组件;2:资讯-轮播组件;3:资讯-推荐图类组件;4:资讯-最新类组件;5:资讯-推荐类;6:资讯-热点类组件;
|
|
|
+ 7:资讯-栏目类组件;8:列表类组件;9:详情类组件;10:二级导航栏类组件;11:广告类;12:静态资源类;13:底部导航类; -->
|
|
|
+ <el-form-item label="含有图片新闻数量:" prop="img_num" v-if="[1,2,3,4,5,6,7,14].includes(ruleForm.type_id)">
|
|
|
+ <el-input v-model="ruleForm.img_num" placeholder="请输入含有图片新闻数量"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="组件关键词:" prop="component_code">
|
|
|
- <el-input v-model="ruleForm.component_code" placeholder="请输入关键词"
|
|
|
- :disabled="this.dialogName === '编辑'"></el-input>
|
|
|
+ <el-form-item label="含有文字新闻数量:" prop="text_num" v-if="[1,2,3,4,5,6,7,14].includes(ruleForm.type_id)">
|
|
|
+ <el-input v-model="ruleForm.text_num" placeholder="请输入含有文字新闻数量"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="含有图片新闻数量:" prop="component_code">
|
|
|
- <el-input v-model="ruleForm.component_code" placeholder="请输入关键词"
|
|
|
- :disabled="this.dialogName === '编辑'"></el-input>
|
|
|
+ <el-form-item label="含有子级图片新闻数量:" prop="child_imgnum" v-if="ruleForm.type_id == 7 || ruleForm.type_id == 14">
|
|
|
+ <el-input v-model="ruleForm.child_imgnum" placeholder="请输入含有子级图片新闻数量"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="含有文字新闻数量:" prop="component_code">
|
|
|
- <el-input v-model="ruleForm.component_code" placeholder="请输入关键词"
|
|
|
- :disabled="this.dialogName === '编辑'"></el-input>
|
|
|
+ <el-form-item label="含有子级文字新闻数量:" prop="child_textnum" v-if="ruleForm.type_id == 7 || ruleForm.type_id == 14">
|
|
|
+ <el-input v-model="ruleForm.child_textnum" placeholder="请输入含有子级文字新闻数量"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="组件展示图:" prop="component_img" :label-width="formLabelWidth"
|
|
|
- :class="['custom-form-item']" class="custom-align-right">
|
|
|
+ <el-form-item label="每页新闻数量:" prop="pageSize" v-if="ruleForm.type_id == 8">
|
|
|
+ <el-input v-model="ruleForm.pageSize" placeholder="请输入每页新闻数量"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="广告类型:" prop="ad_type" v-if="ruleForm.type_id == 11 || ruleForm.type_id == 14">
|
|
|
+ <el-select v-model="ruleForm.ad_type" placeholder="请选择广告类型">
|
|
|
+ <el-option :value="1" label="文字类型">文字类型</el-option>
|
|
|
+ <el-option :value="2" label="图文类型">图文类型</el-option>
|
|
|
+ </el-select>
|
|
|
+ <!-- <el-input v-model="ruleForm.ad_type" placeholder="请输入广告类型"></el-input> -->
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="广告尺寸:" prop="" v-if="ruleForm.type_id == 11 || ruleForm.type_id == 14">
|
|
|
+ <div class="sizeInput"><el-input v-model="ruleForm.ad_width" clearable placeholder="宽" width="40px"></el-input> </div>
|
|
|
+ <div class="sizeInputSymbol">*</div>
|
|
|
+ <div class="sizeInput"><el-input v-model="ruleForm.ad_height" clearable placeholder="高"></el-input></div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="广告默认图:" prop="ad_img" :label-width="formLabelWidth"
|
|
|
+ :class="['custom-form-item']" class="custom-align-right" v-if="ruleForm.type_id == 11 || ruleForm.type_id == 14">
|
|
|
<div class="uploaderBox">
|
|
|
<!--图片上传组件 start ------------------------------------------------------------>
|
|
|
- <div class="avatar-upload-container" @mouseenter="hovering = true"
|
|
|
- @mouseleave="hovering = false">
|
|
|
+ <div class="avatar-upload-container" @mouseenter="adHovering = true"
|
|
|
+ @mouseleave="adHovering = false">
|
|
|
<!-- 上传组件 -->
|
|
|
<el-upload class="avatar-uploader" action="#" :show-file-list="false"
|
|
|
- :before-upload="beforeAvatarUpload" :disabled="this.dialogName === '编辑'">
|
|
|
+ :before-upload="beforeAdUpload">
|
|
|
<!-- 预览图片 -->
|
|
|
- <img v-if="logoUrl" :src="logoUrl" class="avatar">
|
|
|
+ <img v-if="adLogoUrl" :src="adLogoUrl" class="avatar">
|
|
|
<!-- 上传图标 -->
|
|
|
<!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
|
|
|
<div v-else class="chooseImgDiv">
|
|
@@ -179,18 +222,23 @@
|
|
|
<div>选择图片</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <input type="hidden" name="logo" v-model="ruleForm.webLogo">
|
|
|
+ <input type="hidden" name="logo" v-model="ruleForm.ad_img">
|
|
|
<!-- <input type="hidden" name="logo" v-model="logoUrl"> -->
|
|
|
</el-upload>
|
|
|
<!-- 删除按钮,当鼠标悬浮时显示 -->
|
|
|
- <div v-if="hovering && logoUrl && dialogName == '添加'" class="delete-button"
|
|
|
- @click="handleDelete">
|
|
|
+ <div v-if="adHovering && adLogoUrl" class="delete-button"
|
|
|
+ @click="handleAdDelete">
|
|
|
<i class="el-icon-delete"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--图片上传组件 end ------------------------------------------------------------>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="栏目数量:" prop="num" v-if="ruleForm.type_id == 10">
|
|
|
+ <el-input v-model="ruleForm.num" placeholder="请输入栏目数量"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
<div class="dialogBtn">
|
|
|
<el-button type="info" @click="cancelForm">取消</el-button>
|
|
@@ -208,12 +256,11 @@ import tableTitle from './components/tableTitle.vue';
|
|
|
|
|
|
//引入公用样式
|
|
|
import '@/styles/global.less';
|
|
|
-import { getComponentList, addComponent, delComponent, updateComponent, getComponentInfo } from '@/api/module'
|
|
|
-import { getSectorList } from '@/api/plate'
|
|
|
-import { getTemplateClass } from '@/api/style'
|
|
|
+import tagInput from '../../components/InputTag/index.vue';
|
|
|
export default {
|
|
|
components: {
|
|
|
tableTitle,//表格标题-
|
|
|
+ tagInput
|
|
|
},
|
|
|
data() {
|
|
|
const validateEmpty = (rule, value, callback) => {
|
|
@@ -223,20 +270,30 @@ export default {
|
|
|
callback()
|
|
|
}
|
|
|
}
|
|
|
+ const validateArray = (rule, value, callback) => {
|
|
|
+ if (value.length == 0) {
|
|
|
+ callback(new Error('该项不能为空!'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ }
|
|
|
return {
|
|
|
// 1.1 初始化数据
|
|
|
tableDivTitle: "组件列表", //列表标题
|
|
|
dialogTableVisible: false, //编辑弹框
|
|
|
dialogName: '编辑', //编辑弹窗名称
|
|
|
- moduleLoading: true, //表格数据加载中
|
|
|
+ // moduleLoading: true, //表格数据加载中
|
|
|
|
|
|
tableData: [],//表格数据
|
|
|
- options: [],//版块列表
|
|
|
+ // options: [],//版块列表
|
|
|
activeid: "", //活动id
|
|
|
- styleOptions: [],//关联版块
|
|
|
- plateOptions: [],//关联版块
|
|
|
+ // styleOptions: [],//关联版块
|
|
|
+ // plateOptions: [],//关联版块
|
|
|
selectedId: '',
|
|
|
- selectedOptions: [],
|
|
|
+ // selectedOptions: [],
|
|
|
+ type_options: [], //组件分类
|
|
|
+ column_options: [], //组件所需字段
|
|
|
+ tags: [], //组件关键词
|
|
|
cascaderProps: {
|
|
|
value: "id", // 指定实际表示值的字段为id
|
|
|
label: "name", // 指定实际表示显示文本的字段为name
|
|
@@ -245,10 +302,12 @@ export default {
|
|
|
children: 'children',
|
|
|
},
|
|
|
|
|
|
-
|
|
|
- // 1.2 搜索框相关
|
|
|
- templateName: '', //版块名称
|
|
|
- componentName: '', //组件名称
|
|
|
+ apiData: { //搜索框
|
|
|
+ component_name: '',
|
|
|
+ type_id: '',
|
|
|
+ width: '',
|
|
|
+ height: '',
|
|
|
+ },
|
|
|
|
|
|
|
|
|
//3.4 上传logo图片
|
|
@@ -256,7 +315,17 @@ export default {
|
|
|
hovering: false, // 鼠标悬浮状态 悬浮时显示删除
|
|
|
|
|
|
value: '',
|
|
|
-
|
|
|
+ //3.6 上传广告图片
|
|
|
+ adLogoUrl: '',
|
|
|
+ adHovering: false, // 鼠标悬浮状态 悬浮时显示删除
|
|
|
+ // 广告图存到静态资源
|
|
|
+ imageInfo: {
|
|
|
+ name: '',
|
|
|
+ img_alias: '',
|
|
|
+ img_size: '',
|
|
|
+ img_type: '',
|
|
|
+ img_url: '',
|
|
|
+ },
|
|
|
|
|
|
// 分页相关
|
|
|
page: 1,
|
|
@@ -265,77 +334,72 @@ export default {
|
|
|
|
|
|
|
|
|
formLabelWidth: '', //广告示例图相关
|
|
|
-
|
|
|
-
|
|
|
- template_id: '', //关联风格id
|
|
|
- sector_id: '', //关联版块id
|
|
|
-
|
|
|
ruleForm: {
|
|
|
- plateName: '', //关联版块名称
|
|
|
component_name: '', //组件名称
|
|
|
- component_code: '', //组件代码
|
|
|
- component_img: '',//组件展示
|
|
|
+ component_type: '', //组件编号
|
|
|
+ component_keyword: [], //组件关键词
|
|
|
+ component_width: '', //组件宽度
|
|
|
+ component_height: '', //组件高度
|
|
|
+ component_img: '',//组件展示图
|
|
|
+ type_id: '', //组件分类
|
|
|
+ listType: [] , //组件所需字段
|
|
|
+ img_num: '', //含有图片新闻数量
|
|
|
+ text_num: '', //含有文字新闻数量
|
|
|
+ child_imgnum: '', //含有子级图片新闻数量
|
|
|
+ child_textnum: '', //含有子级文字新闻数量
|
|
|
+ pageSize: '', //每页新闻数量
|
|
|
+ ad_type: '', //广告类型
|
|
|
+ ad_width: '', //广告宽度
|
|
|
+ ad_height: '', //广告高度
|
|
|
+ ad_img: '', //广告示例图
|
|
|
+ num: '', //栏目数量
|
|
|
},
|
|
|
|
|
|
rules: {
|
|
|
- plateName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
component_name: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- component_code: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_type: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_keyword: [{ required: true, trigger: 'blur', validator: validateArray }],
|
|
|
+ component_width: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_height: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
component_img: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
- }
|
|
|
+ type_id: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_width: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ component_height: [{ required: true, trigger: 'blur', validator: validateEmpty }],
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
//1.列表和分页相关 start ------------------------------------------------------------>
|
|
|
//1.1 开始请求列表信息方法
|
|
|
getData() {
|
|
|
- if (this.templateName != '' || this.componentName != '') {
|
|
|
- getComponentList({
|
|
|
- page: this.page,
|
|
|
- page_size: this.pageSize,
|
|
|
- template_class_id: '',
|
|
|
- component_name: this.componentName,
|
|
|
- sector_id: this.templateName,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- this.tableData = data.data.data
|
|
|
- this.total = data.data.total
|
|
|
- })
|
|
|
- } else {
|
|
|
- getComponentList({
|
|
|
- page: this.page,
|
|
|
- page_size: this.pageSize
|
|
|
- }).then(data => {
|
|
|
- console.log('组件', data);
|
|
|
- if (data.code == 200) {
|
|
|
- this.moduleLoading = false
|
|
|
- this.tableData = data.data.data
|
|
|
- this.total = data.data.total
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- //获取版块列表
|
|
|
- getList() {
|
|
|
- getSectorList({
|
|
|
+ const data = {
|
|
|
page: this.page,
|
|
|
- page_size: 1000,
|
|
|
- }).then(data => {
|
|
|
- console.log('获取版块', data.data.data);
|
|
|
- this.options = data.data.data
|
|
|
- })
|
|
|
-
|
|
|
- getTemplateClass().then(data => {
|
|
|
- console.log("风格", data.data);
|
|
|
- this.styleOptions = data.data
|
|
|
- for (let item of this.styleOptions) {
|
|
|
- item.children = []
|
|
|
+ page_size: this.pageSize,
|
|
|
+ component_name: this.apiData.component_name ?? '',
|
|
|
+ type_id: this.apiData.type_id ?? null,
|
|
|
+ width: this.apiData.width ?? null,
|
|
|
+ height: this.apiData.height ?? null,
|
|
|
+ }
|
|
|
+ this.$store.dispatch('module/getComponentList',data).then(res => {
|
|
|
+ // console.log('组件', res.code == 200);
|
|
|
+ if (res.code == 200) {
|
|
|
+ // this.moduleLoading = false
|
|
|
+ this.tableData = res.data.data
|
|
|
+ this.total = res.data.total
|
|
|
+ for (let i = 0; i < res.data.data.length; i++) {
|
|
|
+ const item = res.data.data[i];
|
|
|
+ this.tableData[i].component_size = item.component_width + ' * ' + item.component_height;
|
|
|
+ }
|
|
|
}
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: this.$message
|
|
|
+ });
|
|
|
})
|
|
|
},
|
|
|
//1.2 删除内容
|
|
|
deleteRow(id) {
|
|
|
- console.log(id);
|
|
|
let data = new FormData()
|
|
|
data.append('id', id)
|
|
|
this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
|
|
@@ -343,11 +407,7 @@ export default {
|
|
|
cancelButtonText: '取消',
|
|
|
}).then(() => {
|
|
|
console.log("当前删除:" + id)
|
|
|
-
|
|
|
- delComponent({
|
|
|
- id: id
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
+ this.$store.dispatch('module/delComponent',{id: id}).then(res => {
|
|
|
if (data.code = 200) {
|
|
|
this.$message({
|
|
|
message: '删除成功',
|
|
@@ -360,8 +420,12 @@ export default {
|
|
|
type: 'error'
|
|
|
})
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
}).catch(() => {
|
|
|
this.$message({
|
|
|
type: 'warning',
|
|
@@ -369,54 +433,6 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- //1.3 版块发生改变时 获取版块下的组件列表
|
|
|
-
|
|
|
- // handleMouseEnter(event) {
|
|
|
- // const currentValue = this.ruleForm.plateName[this.ruleForm.plateName.length - 1];
|
|
|
- // console.log('当前级的值:', currentValue);
|
|
|
- // console.log('当前级:', event);
|
|
|
- // },
|
|
|
-
|
|
|
- handleChange(value) {
|
|
|
- console.log('val', value);
|
|
|
- this.template_id = value[0]
|
|
|
- this.sector_id = value[1]
|
|
|
- console.log("当前选中的父级:", this.template_id);
|
|
|
- console.log("当前选中的子级:", this.sector_id);
|
|
|
- // 当选中的选项发生变化时触发
|
|
|
- if (value.length > 0) {
|
|
|
- const selectedValue = value[value.length - 1]; // 获取最后一级选中的值
|
|
|
- this.fetchChildren(selectedValue); // 请求对应的子选项
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
- fetchChildren(parentValue) {
|
|
|
- // 根据父级值请求子选项的接口
|
|
|
- getSectorList({
|
|
|
- page: this.page,
|
|
|
- page_size: 1000,
|
|
|
- template_class_id: parentValue
|
|
|
- }).then(data => {
|
|
|
- console.log('data', data.data.data);
|
|
|
- this.plateOptions = data.data.data
|
|
|
- this.styleOptions = this.styleOptions.map(item => {
|
|
|
- if (item.id === parentValue) {
|
|
|
- const children = []
|
|
|
- for (let item of this.plateOptions) {
|
|
|
- children.push({
|
|
|
- id: item.id,
|
|
|
- name: item.sector_name,
|
|
|
- })
|
|
|
- }
|
|
|
- item.children = children
|
|
|
- }
|
|
|
- return item
|
|
|
- })
|
|
|
- console.log(this.styleOptions);
|
|
|
-
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
//1.4 列表内容分页
|
|
|
//直接跳转
|
|
|
handleSizeChange(val) {
|
|
@@ -430,42 +446,46 @@ export default {
|
|
|
},
|
|
|
// 1.6 搜索按钮
|
|
|
goSearch() {
|
|
|
- getComponentList({
|
|
|
+ const data = {
|
|
|
page: this.page,
|
|
|
page_size: this.pageSize,
|
|
|
- template_class_id: '',
|
|
|
- component_name: this.componentName,
|
|
|
- sector_id: this.templateName,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- this.tableData = data.data.data
|
|
|
- this.total = data.data.total
|
|
|
+ component_name: this.apiData.component_name ?? '',
|
|
|
+ type_id: this.apiData.type_id ?? null,
|
|
|
+ width: this.apiData.width ?? null,
|
|
|
+ height: this.apiData.height ?? null,
|
|
|
+ }
|
|
|
+ this.$store.dispatch('module/getComponentList',data).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ // this.moduleLoading = false
|
|
|
+ this.tableData = res.data.data
|
|
|
+ this.total = res.data.total
|
|
|
+ for (let i = 0; i < res.data.data.length; i++) {
|
|
|
+ const item = res.data.data[i];
|
|
|
+ this.tableData[i].component_size = item.component_width + ' * ' + item.component_height;
|
|
|
+ // console.log("456",item.pagetype);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: this.$message
|
|
|
+ });
|
|
|
})
|
|
|
},
|
|
|
//1.7 重置按钮
|
|
|
goReset() {
|
|
|
- this.templateName = ""
|
|
|
- this.componentName = ""
|
|
|
+ this.apiData.component_name = ""
|
|
|
+ this.apiData.type_id = ""
|
|
|
+ this.apiData.width = ""
|
|
|
+ this.apiData.height = ""
|
|
|
this.page = 1
|
|
|
this.pageSize = 10
|
|
|
this.getData()
|
|
|
},
|
|
|
//列表和分页相关 end ------------------------------------------------------------>
|
|
|
|
|
|
- //1.8 添加
|
|
|
- addWebsite() {
|
|
|
- this.dialogTableVisible = true
|
|
|
- this.dialogName = "添加"
|
|
|
-
|
|
|
- //添加时清空回显回来的数据
|
|
|
- this.ruleForm.plateName = '' //关联版块
|
|
|
- this.ruleForm.component_name = '' //组件名称
|
|
|
- this.ruleForm.component_code = '' //组件代码
|
|
|
- this.ruleForm.component_img = '' //组件展示图
|
|
|
- this.logoUrl = '' //组件展示图
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//1.9 编辑
|
|
|
goEdit(id, val) {
|
|
@@ -473,19 +493,35 @@ export default {
|
|
|
this.activeid = id
|
|
|
this.dialogTableVisible = true
|
|
|
console.log(id, val);
|
|
|
- this.getList()
|
|
|
+ this.getData()
|
|
|
|
|
|
//数据回显
|
|
|
- this.template_id = val.template_class_id
|
|
|
- this.sector_id = val.sector_id
|
|
|
- this.ruleForm.plateName = val.template_class_name //关联版块
|
|
|
- this.ruleForm.plateName = [val.template_class_id, val.sector_id] // 组合成数组
|
|
|
- this.ruleForm.plateName = [this.template_id, this.sector_id] // 组合成数组
|
|
|
+ console.log("编辑回显",val);
|
|
|
// this.ruleForm.plateName = val.template_class_name+'/'+val.sector_name //组件名称
|
|
|
this.ruleForm.component_name = val.component_name //组件名称
|
|
|
- this.ruleForm.component_code = val.component_code //组件代码
|
|
|
+ this.ruleForm.component_type = val.component_type //组件编号
|
|
|
+ this.ruleForm.component_keyword = JSON.parse(val.component_keyword) || [] // 解析 JSON 字符串为数组,若解析失败则返回空数组
|
|
|
+ this.tags = JSON.parse(val.component_keyword) || []
|
|
|
+ this.columns = JSON.parse(val.component_column)
|
|
|
+ this.column_options = this.columns.listType
|
|
|
+ this.ruleForm.component_width = val.component_width //组件宽度
|
|
|
+ this.ruleForm.component_height = val.component_height //组件高度
|
|
|
this.ruleForm.component_img = val.component_img //组件展示图
|
|
|
+ this.ruleForm.type_id = val.type_id //组件分类
|
|
|
+ this.ruleForm.img_num = val.img_num //含有图片新闻数量
|
|
|
+ this.ruleForm.text_num = val.text_num //含有文字新闻数量
|
|
|
+ this.ruleForm.child_imgnum = val.child_imgnum //组件子级图片新闻数量
|
|
|
+ this.ruleForm.child_textnum = val.child_textnum //组件子级文字新闻数量
|
|
|
+ this.ruleForm.pageSize = val.pageSize //组件每页数量
|
|
|
+ this.ruleForm.ad_type = val.ad_type //广告类型
|
|
|
+ this.ruleForm.ad_width = val.ad_width //广告宽度
|
|
|
+ this.ruleForm.ad_height = val.ad_height //广告高度
|
|
|
+ this.ruleForm.ad_img = val.ad_img //广告示例图片
|
|
|
+ this.ruleForm.num = val.num //栏目数量
|
|
|
this.logoUrl = val.component_img //组件展示图
|
|
|
+ this.adLogoUrl = val.ad_img //广告示例图
|
|
|
+ this.ruleForm.ad_imgid = val.ad_imgid
|
|
|
+ this.imageInfo = JSON.parse(val.adimg_info)
|
|
|
},
|
|
|
|
|
|
|
|
@@ -501,76 +537,137 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
if (this.dialogName == "添加") {
|
|
|
- addComponent({
|
|
|
- template_id: this.template_id,
|
|
|
- sector_id: this.sector_id,
|
|
|
+ // console.log("添加", Array.isArray(this.imageInfo));
|
|
|
+ let img_info = JSON.stringify(this.imageInfo)
|
|
|
+ // console.log("添111加",img_info);
|
|
|
+ const data = {
|
|
|
component_name: this.ruleForm.component_name,
|
|
|
+ component_type: this.ruleForm.component_type,
|
|
|
+ component_keyword: JSON.stringify(this.ruleForm.component_keyword),
|
|
|
+ component_width: this.ruleForm.component_width,
|
|
|
+ component_height: this.ruleForm.component_height,
|
|
|
component_img: this.ruleForm.component_img,
|
|
|
- component_code: this.ruleForm.component_code,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code == 200) {
|
|
|
+ type_id: this.ruleForm.type_id,
|
|
|
+ num: this.ruleForm.listType,
|
|
|
+ img_num: this.ruleForm.img_num,
|
|
|
+ text_num: this.ruleForm.text_num,
|
|
|
+ child_imgnum: this.ruleForm.child_imgnum,
|
|
|
+ child_textnum: this.ruleForm.child_textnum,
|
|
|
+ pageSize: this.ruleForm.pageSize,
|
|
|
+ ad_type: this.ruleForm.ad_type,
|
|
|
+ ad_width: this.ruleForm.ad_width,
|
|
|
+ ad_height: this.ruleForm.ad_height,
|
|
|
+ ad_img: this.ruleForm.ad_img,
|
|
|
+ num: this.ruleForm.num,
|
|
|
+ ad_imgid: this.ruleForm.ad_imgid,
|
|
|
+ // 修正错误,使用之前定义的 img_info 变量
|
|
|
+ img_info: img_info,
|
|
|
+ }
|
|
|
+ // console.log("111111111",data);
|
|
|
+ this.$store.dispatch('module/addComponent',data).then(data => {
|
|
|
+ if (data.code == 200) {
|
|
|
this.$message({
|
|
|
message: '添加成功',
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.dialogTableVisible = false
|
|
|
this.getData()
|
|
|
- } else if (data.code == 0) {
|
|
|
- this.$message({
|
|
|
- message: data.message,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
- } else {
|
|
|
+ }else{
|
|
|
this.$message({
|
|
|
message: data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
- this.dialogTableVisible = true
|
|
|
- return
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- if (this.website_id == '') {
|
|
|
- this.$message({
|
|
|
- message: '请输入并选择网站名称',
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- this.dialogVisible = true
|
|
|
- }
|
|
|
if (this.dialogName == "编辑") {
|
|
|
- updateComponent({
|
|
|
+ let img_info = JSON.stringify(this.imageInfo)
|
|
|
+ const edit_data = {
|
|
|
id: this.activeid,
|
|
|
component_name: this.ruleForm.component_name,
|
|
|
- }).then(data => {
|
|
|
- console.log(data);
|
|
|
- if (data.code == 200) {
|
|
|
+ component_type: this.ruleForm.component_type,
|
|
|
+ component_keyword: JSON.stringify(this.ruleForm.component_keyword),
|
|
|
+ component_width: this.ruleForm.component_width,
|
|
|
+ component_height: this.ruleForm.component_height,
|
|
|
+ component_img: this.ruleForm.component_img,
|
|
|
+ type_id: this.ruleForm.type_id,
|
|
|
+ num: this.ruleForm.listType,
|
|
|
+ img_num: this.ruleForm.img_num,
|
|
|
+ text_num: this.ruleForm.text_num,
|
|
|
+ child_imgnum: this.ruleForm.child_imgnum,
|
|
|
+ child_textnum: this.ruleForm.child_textnum,
|
|
|
+ pageSize: this.ruleForm.pageSize,
|
|
|
+ ad_type: this.ruleForm.ad_type,
|
|
|
+ ad_width: this.ruleForm.ad_width,
|
|
|
+ ad_height: this.ruleForm.ad_height,
|
|
|
+ ad_img: this.ruleForm.ad_img,
|
|
|
+ num: this.ruleForm.num,
|
|
|
+ ad_imgid: this.ruleForm.ad_imgid,
|
|
|
+ // 修正错误,使用之前定义的 img_info 变量
|
|
|
+ img_info: img_info,
|
|
|
+ }
|
|
|
+ this.$store.dispatch('module/updateComponent',edit_data).then(data => {
|
|
|
+ if (data.code == 200) {
|
|
|
this.$message({
|
|
|
message: '编辑成功',
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.dialogTableVisible = false
|
|
|
- }
|
|
|
- if (data.code == 0) {
|
|
|
+ this.getData()
|
|
|
+ }else{
|
|
|
this.$message({
|
|
|
message: data.message,
|
|
|
type: 'error'
|
|
|
})
|
|
|
- this.dialogTableVisible = true
|
|
|
}
|
|
|
- this.getData()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
+ //1.8 添加
|
|
|
+ addWebsite() {
|
|
|
+ this.dialogTableVisible = true
|
|
|
+ this.dialogName = "添加"
|
|
|
+
|
|
|
+ //添加时清空回显回来的数据
|
|
|
+ // this.
|
|
|
+ this.ruleForm.component_name = '' //组件名称
|
|
|
+ this.ruleForm.component_type = '' //组件编号
|
|
|
+ this.ruleForm.component_keyword = [] //组件关键词
|
|
|
+ this.ruleForm.component_width = '' //组件宽度
|
|
|
+ this.ruleForm.component_height = '' //组件高度
|
|
|
+ this.ruleForm.component_img = '' //组件展示图
|
|
|
+ this.ruleForm.type_id = '' //组件分类
|
|
|
+ this.ruleForm.listType = [] //组件所需字段
|
|
|
+ this.ruleForm.img_num = '' //含有图片新闻数量
|
|
|
+ this.ruleForm.text_num = '' //含有文字新闻数量
|
|
|
+ this.ruleForm.child_imgnum = '' //组件子级图片新闻数量
|
|
|
+ this.ruleForm.child_textnum = '' //组件子级文字新闻数量
|
|
|
+ this.ruleForm.pageSize = '' //组件每页数量
|
|
|
+ this.ruleForm.ad_type = '' //广告类型
|
|
|
+ this.ruleForm.ad_width = '' //广告宽度
|
|
|
+ this.ruleForm.ad_height = '' //广告高度
|
|
|
+ this.ruleForm.ad_img = '' //广告示例图片
|
|
|
+ this.ruleForm.num = '' //栏目数量
|
|
|
+ this.column_options = [] // 栏目选项
|
|
|
+ this.tags = [] // 标签
|
|
|
+ this.logoUrl = ''
|
|
|
+ this.adLogoUrl = ''
|
|
|
+ this.ruleForm.ad_imgid = ''
|
|
|
+ this.imageInfo = {
|
|
|
+ name: '',
|
|
|
+ img_alias: '',
|
|
|
+ img_size: '',
|
|
|
+ img_type: '',
|
|
|
+ img_url: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
//取消添加或编辑
|
|
|
cancelForm() {
|
|
|
this.dialogTableVisible = false
|
|
|
},
|
|
|
- //3.6 上传图片操作
|
|
|
+ // 上传组件图片操作
|
|
|
beforeAvatarUpload(file) {
|
|
|
const isJPG = file.type === 'image/jpeg';
|
|
|
const isPNG = file.type === 'image/png';
|
|
@@ -606,26 +703,92 @@ export default {
|
|
|
// 删除图片
|
|
|
this.logoUrl = ''; // 清空图片 URL
|
|
|
},
|
|
|
+
|
|
|
+ //3.6 上传广告图片操作
|
|
|
+ beforeAdUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg';
|
|
|
+ const isPNG = file.type === 'image/png';
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
|
|
|
- //搜索部分的输入关键词下拉框
|
|
|
- selectWebSite(value) {
|
|
|
- this.webSiteName_id = value
|
|
|
+ if (!isJPG && !isPNG) {
|
|
|
+ this.$message.error('上传图片只能是 JPG 或 PNG 格式!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2MB!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // 解析图片信息
|
|
|
+ this.imageInfo.img_alias = file.name;
|
|
|
+ this.imageInfo.name = file.name;
|
|
|
+ this.imageInfo.img_size = this.formatFileSize(file.size); // 新增格式化方法
|
|
|
+ this.imageInfo.img_type = file.type.split('/')[1].toUpperCase(); // 获取文件类型(JPG/PNG)
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('file', file);
|
|
|
+ this.$store.dispatch('pool/uploadFile', formData).then(res => {
|
|
|
+ this.adLogoUrl = res.data.imgUrl;//显示缩略图
|
|
|
+ this.ruleForm.ad_img = res.data.imgUrl;//提供表单地址
|
|
|
+ this.imageInfo.img_url = res.data.imgUrl;
|
|
|
+ console.log(res.data.imgUrl)
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '网络错误,请重试!'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ console.log("图片信息",this.imageInfo);
|
|
|
+ // 阻止默认的上传行为
|
|
|
+ return false;
|
|
|
},
|
|
|
-
|
|
|
- //添加 / 编辑弹窗中输入关键词下拉框
|
|
|
- // 判断是否已经关联了网站
|
|
|
- detectionWebSite(value) {
|
|
|
- console.log(value);
|
|
|
- this.website_id = value
|
|
|
- console.log(this.website_id);
|
|
|
-
|
|
|
+ handleAdDelete() {
|
|
|
+ // 删除图片
|
|
|
+ this.adLogoUrl = ''; // 清空图片 URL
|
|
|
+ this.ruleForm.ad_imgid = '';
|
|
|
},
|
|
|
-
|
|
|
+ // 新增文件大小格式化方法
|
|
|
+ formatFileSize(bytes) {
|
|
|
+ if (bytes === 0) return '0 B';
|
|
|
+ const units = ['B', 'KB', 'MB', 'GB'];
|
|
|
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
|
+ return `${parseFloat((bytes / Math.pow(1024, i)).toFixed(2))} ${units[i]}`;
|
|
|
+ },
|
|
|
+ getColumnType(type_id){
|
|
|
+ this.$store.dispatch('module/getComponentType',{id:type_id}).then(res => {
|
|
|
+ console.log('组件所需字段',res.data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.column_options = res.data[0].all_code
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: this.$message
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getTypeList(){
|
|
|
+ this.$store.dispatch('module/getComponentType').then(res => {
|
|
|
+
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.type_options = res.data
|
|
|
+ }
|
|
|
+ console.log('组件类型',this.type_options);
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: this.$message
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 关键词标签
|
|
|
+ updateTags(newTags) {
|
|
|
+ this.tags = newTags;
|
|
|
+ this.ruleForm.component_keyword = newTags;
|
|
|
+ },
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getData()
|
|
|
- this.getList()
|
|
|
+ this.getTypeList()
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
@@ -922,4 +1085,14 @@ input[aria-hidden=true] {
|
|
|
.rowMargin {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
+
|
|
|
+.sizeInput {
|
|
|
+ width: 15%;
|
|
|
+ float: left;
|
|
|
+}
|
|
|
+.sizeInputSymbol{
|
|
|
+ width: 10px;
|
|
|
+ float: left;
|
|
|
+}
|
|
|
+
|
|
|
</style>
|