Commit afaac2d9 authored by 姬鋆屾's avatar 姬鋆屾

pref:提交产品模块所修改内容,轮播图改为多图上传,富文本等修改

parent 790d23a8
#开发环境
NODE_ENV = "development"
VUE_APP_API_BASE_URL= http://192.168.0.98:11086
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
height: 100% !important; height: 100% !important;
} }
.layout-menu-wrapper { .layout-menu-wrapper {
padding: 0 24px;
height: 64px !important; height: 64px !important;
line-height: 64px !important; line-height: 64px !important;
background: linear-gradient(90deg, #1845c6, #2999ff) !important; background: linear-gradient(90deg, #1845c6, #2999ff) !important;
...@@ -9,6 +10,13 @@ ...@@ -9,6 +10,13 @@
.layout-menu-wrapper .layout-logo { .layout-menu-wrapper .layout-logo {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
width: 200px;
}
.layout-menu-wrapper .menu-list {
margin-left: 50px;
}
.layout-menu-wrapper .menu-list li {
padding: 0 20px;
} }
.layout-menu-wrapper .menu-list li a { .layout-menu-wrapper .menu-list li a {
display: block; display: block;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
} }
.layout-menu-wrapper { .layout-menu-wrapper {
padding: 0 24px;
height: 64px !important; height: 64px !important;
line-height: 64px !important; line-height: 64px !important;
background: linear-gradient(90deg, #1845c6, #2999ff) !important; background: linear-gradient(90deg, #1845c6, #2999ff) !important;
...@@ -10,16 +11,19 @@ ...@@ -10,16 +11,19 @@
.layout-logo { .layout-logo {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
width: 200px;
} }
.menu-list { .menu-list {
margin-left: 50px;
li { li {
padding: 0 20px;
a { a {
display: block; display: block;
padding: 0 12px; padding: 0 12px;
height: 100%; height: 100%;
font-size: 14px !important; font-size: 14px !important;
color: rgba(254, 254, 254, .65) !important; color: rgba(254, 254, 254, 0.65) !important;
text-align: center !important; text-align: center !important;
i { i {
...@@ -33,7 +37,6 @@ ...@@ -33,7 +37,6 @@
&:hover { &:hover {
color: #fff !important; color: #fff !important;
} }
&.router-link-active, &.router-link-active,
...@@ -47,10 +50,7 @@ ...@@ -47,10 +50,7 @@
} }
} }
} }
} }
} }
.layout-header .layout-submenu-wrapper { .layout-header .layout-submenu-wrapper {
......
// 表单节点封装,支持 input textarea select radio checkbox 及slot方式 // 表单节点封装,支持 input textarea select radio checkbox 及slot方式
<template> <template>
<el-col :span='span'> <el-col :span="span">
<el-form-item :label="label" :prop="prop" class="my-form-field">
<el-form-item :label="label" :prop="prop" class='my-form-field'>
<slot> <slot>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" v-if='type === "text"' :class="inputClass" :clearable='clearable'></el-input> <el-input
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" @input="emit" type='password' v-if='type === "password"'></el-input> :disabled="disabled"
:placeholder="placeholder"
<el-input-number :disabled='disabled' v-model="field" size="small" :placeholder='placeholder' @change="emit" @input="emit" v-if='type === "num"'></el-input-number> v-model="field"
@change="emit"
@input="emit"
v-if="type === 'text'"
:class="inputClass"
:clearable="clearable"
></el-input>
<el-input
:disabled="disabled"
:placeholder="placeholder"
v-model="field"
@change="emit"
@input="emit"
type="password"
v-if="type === 'password'"
></el-input>
<el-input-number
:disabled="disabled"
v-model="field"
size="small"
:placeholder="placeholder"
@change="emit"
@input="emit"
v-if="type === 'num'"
></el-input-number>
<el-input :disabled='disabled' :placeholder='placeholder' v-model="field" @change="emit" :rows='rows' @input="emit" v-if='type === "textarea"' type='textarea' :autosize="textareaSize" :class="inputClass"></el-input> <el-input
:disabled="disabled"
:placeholder="placeholder"
v-model="field"
@change="emit"
:rows="rows"
@input="emit"
v-if="type === 'textarea'"
type="textarea"
:autosize="textareaSize"
:class="inputClass"
></el-input>
<el-select :disabled='disabled' v-model="field" @change="emit" :multiple='multiple' :filterable='filterable' :clearable='clearable' v-if='type === "select"'> <el-select
:disabled="disabled"
v-model="field"
@change="emit"
:multiple="multiple"
:filterable="filterable"
:clearable="clearable"
v-if="type === 'select'"
>
<el-option <el-option
v-for="($label, $value) in enumData" v-for="($label, $value) in enumData"
:key="$value" :key="$value"
...@@ -21,25 +63,54 @@ ...@@ -21,25 +63,54 @@
></el-option> ></el-option>
</el-select> </el-select>
<el-radio-group :disabled='disabled' v-model="field" @change="emit" v-if='type === "radio"'> <el-radio-group
:disabled="disabled"
v-model="field"
@change="emit"
v-if="type === 'radio'"
>
<el-radio <el-radio
v-for='($label, $value) in enumData' v-for="($label, $value) in enumData"
:key='$value' :key="$value"
:label="$value" :label="$value"
>{{$label}}</el-radio> >{{ $label }}</el-radio
>
</el-radio-group> </el-radio-group>
<el-checkbox-group :disabled='disabled' v-model="field" @change="emit" v-if='type === "checkbox"'> <el-checkbox-group
:disabled="disabled"
v-model="field"
@change="emit"
v-if="type === 'checkbox'"
>
<el-checkbox <el-checkbox
v-for='($label, $value) in enumData' v-for="($label, $value) in enumData"
:key='$value' :key="$value"
:label="$value" :label="$value"
>{{$label}}</el-checkbox> >{{ $label }}</el-checkbox
>
</el-checkbox-group> </el-checkbox-group>
<el-date-picker :disabled='disabled' type="date" value-format="yyyy-MM-dd HH:mm:ss" v-model="field" @change="emit" @input="emit" placeholder="选择日期" v-if='type === "date"'></el-date-picker> <el-date-picker
<el-date-picker :disabled='disabled' type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="field" @change="emit" @input="emit" placeholder="选择日期" v-if='type === "datetime"'></el-date-picker> :disabled="disabled"
type="date"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="field"
@change="emit"
@input="emit"
placeholder="选择日期"
v-if="type === 'date'"
></el-date-picker>
<el-date-picker
:disabled="disabled"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="field"
@change="emit"
@input="emit"
placeholder="选择日期"
v-if="type === 'datetime'"
></el-date-picker>
</slot> </slot>
</el-form-item> </el-form-item>
</el-col> </el-col>
...@@ -60,17 +131,17 @@ export default { ...@@ -60,17 +131,17 @@ export default {
// 字段类型: text,password,textarea,select,radio,checkbox,date,datetime // 字段类型: text,password,textarea,select,radio,checkbox,date,datetime
type: { type: {
type: String, type: String,
default: 'text', default: "text",
}, },
// 字段name // 字段name
prop: { prop: {
type: String, type: String,
default: '', default: "",
}, },
// 字段中文标题 // 字段中文标题
label: { label: {
type: String, type: String,
default: '', default: "",
}, },
// 是否禁用 // 是否禁用
disabled: { disabled: {
...@@ -80,18 +151,18 @@ export default { ...@@ -80,18 +151,18 @@ export default {
// 是否提示 // 是否提示
placeholder: { placeholder: {
type: String, type: String,
default: '', default: "",
}, },
// 字段所需的枚举类型 // 字段所需的枚举类型
enumData: { enumData: {
type: Object, type: Object,
default: ()=>{}, default: () => {},
}, },
// textarea专用-自适应内容高度 // textarea专用-自适应内容高度
textareaSize: { textareaSize: {
type: Object, type: Object,
default: ()=>{}, default: () => {},
}, },
// select专用-是否可搜索 // select专用-是否可搜索
filterable: { filterable: {
...@@ -111,38 +182,39 @@ export default { ...@@ -111,38 +182,39 @@ export default {
// 字段所需的枚举类型 // 字段所需的枚举类型
options: { options: {
type: Array, type: Array,
default: ()=>[], default: () => [],
}, },
children: { children: {
type: Array, type: Array,
default: ()=>[], default: () => [],
}, },
inputClass: { inputClass: {
type: String, type: String,
default: '', default: "",
} },
}, },
methods: { methods: {
emit() { emit() {
this.$emit('input', this.newVal) this.$emit("input", this.newVal);
this.$emit('change', this.newVal) this.$emit("change", this.newVal);
} console.log(this.newVal);
},
}, },
computed: { computed: {
field: { field: {
get() { get() {
return this.value return this.value;
}, },
set(val) { set(val) {
this.newVal = val; this.newVal = val;
} },
} },
}, },
data() { data() {
return { return {
newVal: this.value, newVal: this.value,
} };
} },
} };
</script> </script>
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
<router-link to="/"> <router-link to="/">
<img <img
:src="sysLogo ? sysLogo : require('../assets/images/logo.png')" :src="sysLogo ? sysLogo : require('../assets/images/logo.png')"
style="margin-bottom:5px" style="margin-bottom: 5px"
height="40" height="40"
alt="" alt=""
/> />
<b style="color:white;font-size:18px;" <b style="color: white; font-size: 18px"
>&nbsp;&nbsp;&nbsp; >&nbsp;&nbsp;&nbsp;
{{ sysName ? sysName : "企业服务平台" }} {{ sysName ? sysName : "企业服务平台" }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</span> --> </span> -->
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color:white"> <span class="el-dropdown-link" style="color: white">
{{ userData.currUserName }} {{ userData.currUserName }}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
...@@ -249,9 +249,7 @@ export default { ...@@ -249,9 +249,7 @@ export default {
} }
} }
} }
.layout-profile {
padding-right: 30px;
}
} }
.layout-submenu-wrapper { .layout-submenu-wrapper {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<template> <template>
<div class="component-upload-image"> <div class="component-upload-image">
<el-upload <el-upload
:action="uploadImgUrl+'?prePath=' +prePath" :action="uploadImgUrl + '?prePath=' + prePath"
list-type="picture-card" list-type="picture-card"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
...@@ -11,14 +11,22 @@ ...@@ -11,14 +11,22 @@
:show-file-list="false" :show-file-list="false"
:headers="headers" :headers="headers"
style="display: inline-block; vertical-align: top" style="display: inline-block; vertical-align: top"
v-if="!isList"
>
<el-image
v-if="!value"
:src="value.indexOf('http') == -1 ? baseUrl + value : value"
> >
<el-image v-if="!value" :src="value">
<div slot="error" class="image-slot"> <div slot="error" class="image-slot">
<i class="el-icon-plus" /> <i class="el-icon-plus" />
</div> </div>
</el-image> </el-image>
<div v-else class="image"> <div v-else class="image">
<el-image :src="value" :style="`width:150px;height:150px;`" fit="fill"/> <el-image
:src="value.indexOf('http') == -1 ? baseUrl + value : value"
:style="`width:150px;height:150px;`"
fit="fill"
/>
<div class="mask"> <div class="mask">
<div class="actions"> <div class="actions">
<span title="预览" @click.stop="dialogVisible = true"> <span title="预览" @click.stop="dialogVisible = true">
...@@ -31,8 +39,36 @@ ...@@ -31,8 +39,36 @@
</div> </div>
</div> </div>
</el-upload> </el-upload>
<el-dialog :visible.sync="dialogVisible" title="预览" width="800" append-to-body> <el-upload
<img :src="value" style="display: block; max-width: 100%; margin: 0 auto;"> :action="uploadImgUrl + '?prePath=' + prePath"
list-type="picture-card"
:on-remove="handleRemove"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
:on-preview="handlePictureCardPreview"
:file-list="imgList"
accept=".jpeg,.png,.jpg,.bmp,.gif"
:headers="headers"
v-else
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog
:visible.sync="dialogVisible"
title="预览"
width="800"
append-to-body
>
<img
:src="dialogImageUrl"
style="display: block; max-width: 100%; margin: 0 auto"
v-if="isList"
/>
<img
:src="value"
style="display: block; max-width: 100%; margin: 0 auto"
v-else
/>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
...@@ -41,8 +77,11 @@ ...@@ -41,8 +77,11 @@
export default { export default {
data() { data() {
return { return {
baseUrl: process.env.VUE_APP_API_BASE_URL + "/",
dialogVisible: false, dialogVisible: false,
uploadImgUrl: "/enterprise/file/commonupload", // 上传的图片服务器地址 uploadImgUrl: "/enterprise/file/commonupload", // 上传的图片服务器地址
imgList: [],
dialogImageUrl: "",
}; };
}, },
props: { props: {
...@@ -53,16 +92,52 @@ export default { ...@@ -53,16 +92,52 @@ export default {
//保存服务器路径前缀地址 //保存服务器路径前缀地址
prePath: { prePath: {
type: String, type: String,
default: '', default: "",
},
isList: {
type: Boolean,
default: false,
},
},
mounted() {
// 判断是否为多图上传
if (this.isList) {
if (this.value && this.value != "") {
this.imgList = [];
let arr = [];
arr = this.value?.split(",");
arr.forEach((v) => {
let obj = {};
obj.name = "轮播图";
obj.uid = parseInt(Math.random(0, 100));
v.indexOf("http") == -1
? (obj.url = this.baseUrl + v)
: (obj.url = v);
this.imgList.push(obj);
});
}
} }
}, },
methods: { methods: {
handleRemove(file, fileList) {
console.log(fileList);
this.imgList = fileList;
},
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
removeImage() { removeImage() {
this.$emit("input", ""); this.$emit("input", "");
}, },
handleUploadSuccess(res) { handleUploadSuccess(res, file, fileList) {
if (this.isList) {
this.loading.close();
this.imgList = fileList;
} else {
this.$emit("input", res.url); this.$emit("input", res.url);
this.loading.close(); this.loading.close();
}
}, },
handleBeforeUpload() { handleBeforeUpload() {
this.loading = this.$loading({ this.loading = this.$loading({
......
...@@ -5,50 +5,115 @@ ...@@ -5,50 +5,115 @@
:visible.sync="open" :visible.sync="open"
:direction="direction" :direction="direction"
:destroy-on-close="true" :destroy-on-close="true"
size="100%"> size="100%"
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<div class="form"> <div class="form">
<div class="formleft"> <div class="formleft">
<Field label="标题" :span="24" prop="title" v-model="form.title" placeholder="请输入标题"/> <Field
<Field :span="24" label="内容"><editor v-model="form.content" :min-height="256"/></Field> label="标题"
:span="24"
prop="title"
v-model="form.title"
placeholder="请输入标题"
/>
<Field :span="24" label="内容"
><editor v-model="form.content" :min-height="256"
/></Field>
</div> </div>
<div class="formright"> <div class="formright">
<el-row> <el-row>
<Field label="类型" :span="20" prop="categoryId" v-model="form.categoryId" type="radio" :enum-data="dict.categoryId" placeholder="请输入分类id"/> <Field
<Field :span="20" label="封面"><imageUpload v-model="form.titleLogoPath" prePath="/file/preview"/></Field> label="类型"
:span="20"
prop="categoryId"
v-model="form.categoryId"
type="radio"
:enum-data="dict.categoryId"
placeholder="请输入分类id"
/>
<Field :span="20" label="封面">
<imageUpload
v-model="form.titleLogoPath"
prePath="/file/preview"
:isList="true"
ref="imgList"
/>
</Field>
<Field :span="20" label="责任编辑" prop="editor" v-model="form.editor" placeholder="请输入责任编辑"/> <Field
:span="20"
label="责任编辑"
prop="editor"
v-model="form.editor"
placeholder="请输入责任编辑"
/>
<Field :span="20" label="发布部门" prop="deptId" v-model="form.deptId" type="select" :enum-data="dict.deptId" placeholder="请输入发布部门"/> <Field
:span="20"
label="发布部门"
prop="deptId"
v-model="form.deptId"
type="select"
:enum-data="dict.deptId"
placeholder="请输入发布部门"
/>
<Field :span="20" label="文章来源" prop="source" v-model="form.source" placeholder="请输入文章来源"/> <Field
:span="20"
label="文章来源"
prop="source"
v-model="form.source"
placeholder="请输入文章来源"
/>
<Field label="发布时间" prop="publishTime" v-model="form.publishTime" type="date" /> <Field
label="发布时间"
<Field :span="20" label="声明" prop="statement" v-model="form.statement" type="textarea" placeholder="请输入声明"/> prop="publishTime"
v-model="form.publishTime"
type="date"
/>
<Field
:span="20"
label="声明"
prop="statement"
v-model="form.statement"
type="textarea"
placeholder="请输入声明"
/>
</el-row> </el-row>
</div> </div>
</div> </div>
<el-form-item class="footerbtns"> <el-form-item class="footerbtns">
<el-button type="primary" @click='submitForm' icon='el-icon-circle-check-outline'>发布</el-button> <el-button
<el-button @click='()=>{open = false}' icon='el-icon-circle-close-outline'>取消</el-button> type="primary"
@click="submitForm"
icon="el-icon-circle-check-outline"
>发布</el-button
>
<el-button
@click="
() => {
open = false;
}
"
icon="el-icon-circle-close-outline"
>取消</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import form from "@/assets/mixins/formdialog"; import form from "@/assets/mixins/formdialog";
export default { export default {
name: "NewsDetail", name: "NewsDetail",
mixins: [form], mixins: [form],
components: { components: {},
},
created() { created() {
this.changePath("news") this.changePath("news");
}, },
data() { data() {
return { return {
...@@ -58,59 +123,51 @@ ...@@ -58,59 +123,51 @@
title: "新闻", title: "新闻",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
direction:"rtl", direction: "rtl",
toString:[ toString: ["top", "viewNums", "categoryId"],
"top", toDate: ["publishTime"],
"viewNums",
"categoryId"
],
toDate:[
"publishTime",
],
// 表单校验 // 表单校验
rules: { rules: {
categoryId: [ categoryId: [
{required: true,message: "请选择频道类型", trigger: "blur" }, { required: true, message: "请选择频道类型", trigger: "blur" },
], ],
title: [ title: [
{required: true,message: "请输入标题", trigger: "blur" }, { required: true, message: "请输入标题", trigger: "blur" },
{max: 512,message: "最多只能录入512个字符",trigger: "blur",}, { max: 512, message: "最多只能录入512个字符", trigger: "blur" },
], ],
titleLogoPath: [ titleLogoPath: [
{required: true,message: "请输入标题logo", trigger: "blur" }, { required: true, message: "请输入标题logo", trigger: "blur" },
], ],
publishTime: [ publishTime: [{ required: true, message: "请选择发布时间" }],
{required: true,message: "请选择发布时间" }, },
]
}
}; };
}, },
methods: { methods: {
/** 编辑 */ /** 编辑 */
edit(row) { edit(row) {
this.reset() this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl ="news/edit"; this.urls.currUrl = "news/edit";
this.getData(); this.getData();
this.pageInfo.type="edit" this.pageInfo.type = "edit";
this.title = "修改新闻"; this.title = "修改新闻";
}, },
/** 新增 */ /** 新增 */
add(row) { add(row) {
this.reset() this.reset();
this.urls.currUrl = "news/add"; this.urls.currUrl = "news/add";
this.getData(); this.getData();
this.pageInfo.type="add" this.pageInfo.type = "add";
this.title = "新增新闻"; this.title = "新增新闻";
}, },
/** 查看*/ /** 查看*/
view(row) { view(row) {
this.reset() this.reset();
this.query = { id: row.id }; this.query = { id: row.id };
this.urls.currUrl ="news/view"; this.urls.currUrl = "news/view";
this.getData(); this.getData();
this.pageInfo.type="view" this.pageInfo.type = "view";
this.title = "新闻详细"; this.title = "新闻详细";
}, },
/**取消按钮 */ /**取消按钮 */
...@@ -121,7 +178,16 @@ ...@@ -121,7 +178,16 @@
afterRender(data) { afterRender(data) {
this.open = true; this.open = true;
}, },
// 提交前数据处理
beforeSubmit(data) {
console.log(data, "123");
let arr = [];
arr = this.$refs.imgList.imgList.map((v) => {
return v.response ? v.response.url : v.url.substr(v.url.indexOf("f"));
});
data.titleLogoPath = arr.join(",");
return data;
},
afterSubmit(data) { afterSubmit(data) {
this.open = false; this.open = false;
this.$emit("ok"); this.$emit("ok");
...@@ -130,14 +196,14 @@ ...@@ -130,14 +196,14 @@
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
categoryId : null, categoryId: null,
categoryName : "", categoryName: "",
title : "", title: "",
titleLogoPath : "", titleLogoPath: "",
content : "", content: "",
top : 0, top: 0,
viewNums : 0, viewNums: 0,
publishTime : null, publishTime: null,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -147,10 +213,10 @@ ...@@ -147,10 +213,10 @@
} }
}, },
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.footerbtns{ .footerbtns {
margin-top: 20px; margin-top: 20px;
padding-top: 20px; padding-top: 20px;
border-top: 1px solid gainsboro; border-top: 1px solid gainsboro;
...@@ -158,16 +224,16 @@ ...@@ -158,16 +224,16 @@
justify-content: center; justify-content: center;
align-content: center; align-content: center;
} }
.form{ .form {
display: flex; display: flex;
width: 100%; width: 100%;
.formleft{ .formleft {
flex:1; flex: 1;
width: 60%; width: 60%;
height: calc(100vh - 200px); height: calc(100vh - 200px);
overflow: auto; overflow: auto;
} }
.formright{ .formright {
width: 40%; width: 40%;
flex-shrink: 0; flex-shrink: 0;
flex-grow: 0; flex-grow: 0;
......
<template> <template>
<div class="page"> <div class="page">
<LayoutTable ref="layouttable" :data="tableData" :config="tableConfig" notDel > <LayoutTable
ref="layouttable"
:data="tableData"
:config="tableConfig"
notDel
>
<!-- 热门0为非热门1为热门 --> <!-- 热门0为非热门1为热门 -->
<div slot="table-search-left" class="onlyhot"> <div slot="table-search-left" class="onlyhot">
<el-checkbox <el-checkbox
...@@ -9,33 +14,30 @@ ...@@ -9,33 +14,30 @@
:checked="ishot" :checked="ishot"
@change="changeIshot" @change="changeIshot"
> >
</el-checkbox> </el-checkbox>
只看热门 只看热门
</div> </div>
</LayoutTable> </LayoutTable>
<drawer-show ref="drawerform" @ok="getData" /> <drawer-show ref="drawerform" @ok="getData" />
</div> </div>
</template> </template>
<script> <script>
/** 表单弹出框模式需引入 */ /** 表单弹出框模式需引入 */
import drawerShow from "./drawershow"; import drawerShow from "./drawershow";
import table from "@/assets/mixins/table"; import table from "@/assets/mixins/table";
export default { export default {
name: "ProductList", name: "ProductList",
components: { components: {
drawerShow drawerShow,
}, },
mixins: [table], mixins: [table],
mounted() { mounted() {
// 重写查询 // 重写查询
this.$refs.layouttable.$refs.searchform.onSubmit = this.onSearch this.$refs.layouttable.$refs.searchform.onSubmit = this.onSearch;
// 重写搜索清除 // 重写搜索清除
this.$refs.layouttable.$refs.searchform.cleanForm = this.cleanForm this.$refs.layouttable.$refs.searchform.cleanForm = this.cleanForm;
}, },
methods: { methods: {
renderTable(tableData) { renderTable(tableData) {
...@@ -52,8 +54,7 @@ ...@@ -52,8 +54,7 @@
label={options.label} label={options.label}
width={options.width} width={options.width}
formatter={options.formatter} formatter={options.formatter}
> ></el-table-column>
</el-table-column>
); );
}, },
/** 重写新增方法 */ /** 重写新增方法 */
...@@ -69,46 +70,51 @@ ...@@ -69,46 +70,51 @@
this.$refs.drawerform.view(row); this.$refs.drawerform.view(row);
}, },
// 重写查询 // 重写查询
onSearch(){ onSearch() {
if(this.ishot){ if (this.ishot) {
this.$refs.layouttable.$refs.searchform.form = Object.assign({}, this.$refs.layouttable.$refs.searchform.form, {hot:1}) this.$refs.layouttable.$refs.searchform.form = Object.assign(
{},
this.$refs.layouttable.$refs.searchform.form,
{ hot: 1 }
);
} }
let { path, query } = this.$refs.layouttable.$refs.searchform.$route; let { path, query } = this.$refs.layouttable.$refs.searchform.$route;
let data = this.$refs.layouttable.$refs.searchform.decode(this.$refs.layouttable.$refs.searchform.form); let data = this.$refs.layouttable.$refs.searchform.decode(
this.$refs.layouttable.$refs.searchform.form
);
this.$refs.layouttable.$refs.searchform.$router.push({ this.$refs.layouttable.$refs.searchform.$router.push({
path: path, path: path,
query: Object.assign({}, query, data), query: Object.assign({}, query, data),
}); });
}, },
// 重写搜索清除 // 重写搜索清除
cleanForm(){ cleanForm() {
this.ishot = false this.ishot = false;
this.$refs.layouttable.$refs.searchform.form.hot = undefined this.$refs.layouttable.$refs.searchform.form.hot = undefined;
this.$forceUpdate() this.$forceUpdate();
this.$refs.layouttable.$refs.searchform.clean(); this.$refs.layouttable.$refs.searchform.clean();
this.$refs.layouttable.$refs.searchform.onSubmit(); this.$refs.layouttable.$refs.searchform.onSubmit();
}, },
changeIshot(val){ changeIshot(val) {
this.ishot = val this.ishot = val;
} },
}, },
data() { data() {
return { return {
ishot:false, ishot: false,
config: { config: {
search: [ search: [
{ {
name: "categoryId", name: "categoryId",
type: "select", type: "select",
placeholder:"请选择产品分类", placeholder: "请选择产品分类",
label: "产品分类" label: "产品分类",
}, },
{ {
name: "companyId", name: "companyId",
type: "select", type: "select",
placeholder:"请选择所属企业", placeholder: "请选择所属企业",
label: "所属企业" label: "所属企业",
}, },
{ {
name: "productName", name: "productName",
...@@ -118,42 +124,67 @@ ...@@ -118,42 +124,67 @@
}, },
], ],
columns: [ columns: [
{type: "index",label: "序号",width: 50}, { type: "index", label: "序号", width: 50 },
{label: "产品名称", prop: "productName"}, { label: "产品名称", prop: "productName" },
{label: "产品分类", prop: "categoryId",formatter: this.formatters}, { label: "产品分类", prop: "categoryId", formatter: this.formatters },
{label: "所属企业", prop: "companyId",formatter: this.formatters}, { label: "所属企业", prop: "companyId", formatter: this.formatters },
{label: "产品介绍", prop: "productIntroduction" , width: 500,formatter: this.formatters}, {
label: "产品介绍",
prop: "productIntroduction",
width: 500,
formatter: this.formatters,
},
{label: "发布时间", prop: "publishTime", formatter: this.formatterDate}, {
label: "发布时间",
prop: "publishTime",
formatter: this.formatterDate,
},
{label: "热门", prop: "hot",formatter: this.formatterYES, width: 50}, {
label: "热门",
prop: "hot",
formatter: this.formatterYES,
width: 50,
},
{label: "最近更新时间", prop: "updateTime", formatter: this.formatterDate}, {
label: "最近更新时间",
prop: "updateTime",
formatter: this.formatterDate,
},
{ {
label: "操作", label: "操作",
width: 240, width: 240,
formatter: row => { formatter: (row) => {
return ( return (
<table-buttons noAdd noView row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} /> <table-buttons
noAdd
noView
row={row}
onEdit={this.toEdit}
onView={this.toView}
onDel={this.toDel}
/>
); );
} },
} },
] ],
} },
};
}
}; };
},
};
</script> </script>
<style lang="less" > <style lang="less" >
.table-form{ .table-form {
display: flex ; display: flex;
} }
.onlyhot{ .onlyhot {
margin-right: 20px; margin-right: 20px;
line-height: 30px; line-height: 30px;
font-size: 14px; font-size: 14px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment