558 lines
18 KiB
Vue
558 lines
18 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||
<el-form-item label="品牌名称" prop="name">
|
||
<el-input
|
||
v-model="queryParams.name"
|
||
placeholder="品牌名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<!-- <el-form-item label="" prop="code">
|
||
<el-input
|
||
v-model="queryParams.name"
|
||
placeholder="品牌编码"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item> -->
|
||
<el-form-item>
|
||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<xd-table
|
||
size="mini"
|
||
v-loading="loading" border stripe
|
||
:data="emisBrandList"
|
||
:showSearch.sync="showSearch"
|
||
:total="total"
|
||
@queryTable="getList"
|
||
:queryParams="queryParams"
|
||
@selection-change="handleSelectionChange"
|
||
@sort-change="handleSortChange"
|
||
>
|
||
|
||
<div slot="toolbar">
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
plain
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="handleAdd"
|
||
v-hasPermi="['emis:emisBrand:add']"
|
||
>新增品牌</el-button>
|
||
</el-col>
|
||
<!--
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
plain
|
||
icon="el-icon-edit"
|
||
size="mini"
|
||
:disabled="single"
|
||
@click="handleUpdate"
|
||
v-hasPermi="['emis:emisBrand:edit']"
|
||
>修改</el-button>
|
||
</el-col> -->
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
plain
|
||
icon="el-icon-delete"
|
||
size="mini"
|
||
:disabled="multiple"
|
||
@click="handleDelete"
|
||
v-hasPermi="['emis:emisBrand:remove']"
|
||
>删除</el-button>
|
||
</el-col>
|
||
<!-- <el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="handleExport"
|
||
v-hasPermi="['emis:emisBrand:export']"
|
||
>导出</el-button>
|
||
</el-col> -->
|
||
</el-row>
|
||
|
||
</div>
|
||
<!-- <el-table v-loading="loading" :data="emisBrandList" border @selection-change="handleSelectionChange"> -->
|
||
<el-table-column type="selection" width="55" align="center" />
|
||
<!-- <el-table-column label="序号" align="center" min-width="60">
|
||
<template slot-scope="scope">
|
||
<span v-text="getIndex(scope.$index)"> </span>
|
||
</template>
|
||
</el-table-column>
|
||
-->
|
||
<!-- <el-table-column label="品牌编码" align="left" prop="code" min-width="100">
|
||
<template slot-scope="scope">
|
||
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.code}}</div>
|
||
</template>
|
||
</el-table-column> -->
|
||
<el-table-column label="品牌名称" align="left" prop="name" min-width="100">
|
||
<template slot-scope="scope">
|
||
<div class="link-type" @click="handleUpdate(scope.row)">{{scope.row.name}}</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="英文名称" align="center" prop="nameEn" min-width="100" />
|
||
<el-table-column label="logo" align="left" prop="logo" min-width="130" >
|
||
<template slot-scope="scope">
|
||
<div style="height:30px">
|
||
<img style="height: 100%;max-width:100%;cursor: pointer;" :src="scope.row.logo" onerror="onerror=null;src='@../../../assets/images/plus.jpg'">
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="url" align="center" prop="url" min-width="100" />
|
||
<el-table-column label="备注" align="center" prop="remark" min-width="100" />
|
||
<!-- <el-table-column label="启用" align="center" prop="status" min-width="100" >
|
||
<template slot-scope="scope">
|
||
<el-switch
|
||
v-model="scope.row.status"
|
||
:active-value="1"
|
||
:inactive-value="0"
|
||
@change="handleStatusChange(scope.row)"
|
||
></el-switch>
|
||
</template>
|
||
</el-table-column> -->
|
||
<el-table-column label="启用状态" align="center" prop="status" min-width="100" >
|
||
<template slot-scope="scope">
|
||
<el-tag v-if="scope.row.status==1" type="success">启用</el-tag>
|
||
<el-tag v-if="scope.row.status==0" type="danger">停用</el-tag>
|
||
<!-- <dict-tag :options="dict.type.sys_biz_enable_status" :value="scope.row.status"/> -->
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="创建人" align="center" prop="createBy" width="80" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="创建网点" align="center" prop="createSite" width="80" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
|
||
<el-table-column label="修改人" align="center" prop="updateBy" width="80" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="修改网点" align="center" prop="updateSite" width="80" :show-overflow-tooltip="true"/>
|
||
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
|
||
|
||
|
||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||
<template slot-scope="scope">
|
||
<el-button
|
||
size="mini"
|
||
type="text"
|
||
icon="el-icon-edit"
|
||
@click="handleUpdate(scope.row)"
|
||
v-hasPermi="['emis:emisBrand:edit']"
|
||
>修改</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</xd-table>
|
||
|
||
<!-- 添加或修改品牌对话框 -->
|
||
<el-dialog :title="title" :visible.sync="open" width="500px" :close-on-click-modal="false" v-dialogDrag append-to-body>
|
||
<el-row :gutter="0">
|
||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||
<el-col :span="12">
|
||
<el-form-item label="品牌名称" prop="name">
|
||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="英文名称" prop="nameEn">
|
||
<el-input v-model="form.nameEn" placeholder="请输入英文名称" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<!-- <el-col :span="12">
|
||
<el-form-item label="品牌编码" prop="code">
|
||
<el-input v-model="form.code" placeholder="品牌编码" />
|
||
</el-form-item>
|
||
</el-col> -->
|
||
<el-col :span="24">
|
||
<el-form-item label="官方网址" prop="url">
|
||
<el-input v-model="form.url" placeholder="url" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="24">
|
||
<el-form-item label="logo" prop="logo">
|
||
<ImageOneUpload v-model="form.logo" ></ImageOneUpload>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="24">
|
||
<el-form-item label="是否启用" prop="status">
|
||
<el-radio-group v-model="form.status">
|
||
<el-radio label="1">是</el-radio>
|
||
<el-radio label="0">否</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="24">
|
||
<el-form-item label="备注" prop="note">
|
||
<el-input v-model="form.note" type="textarea" placeholder="备注" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-form>
|
||
</el-row>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||
<el-button @click="cancel">取 消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
|
||
<el-dialog :title="titleForm" :visible.sync="openForm" width="500px" v-dialogDrag append-to-body>
|
||
<emisBrandForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisBrandForm>
|
||
</el-dialog>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { listEmisBrand, getEmisBrand, delEmisBrand, addEmisBrand, updateEmisBrand,changeBrandStatus } from "@/api/emis/emisBrand";
|
||
|
||
export default {
|
||
name: "emisBrand",
|
||
components: { },
|
||
dicts: ['sys_normal_disable'],
|
||
data() {
|
||
return {
|
||
dialogVisible1:false,
|
||
dialogVisible2:false,
|
||
dialogImageUrl:"",
|
||
dialogImageUrls:"",
|
||
currentId:null,
|
||
// 遮罩层
|
||
sendbackitem:{
|
||
package_id:'',
|
||
detail:'',
|
||
mobile:'',
|
||
consignee:'',
|
||
img:'',
|
||
city:'',
|
||
district:'',
|
||
detail1:'',
|
||
zipcode:'',
|
||
yd_sn:'',
|
||
img1:[],
|
||
fileList:[],
|
||
},
|
||
loading: true,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 创建时间搜索
|
||
dateTimeRange:[],
|
||
// 总条数
|
||
total: 0,
|
||
// 品牌表格数据
|
||
emisBrandList: [],
|
||
// 弹出层标题
|
||
title: "",
|
||
// 是否显示弹出层
|
||
open: false,
|
||
|
||
openForm: false,
|
||
titleForm: "",
|
||
|
||
titleEmisBrand: "",
|
||
openEmisBrand: false,
|
||
|
||
// 显示编辑框更多
|
||
moreInputVisible: false,
|
||
|
||
// 弹出展示层
|
||
id:null,
|
||
titleView:"",
|
||
openView: false,
|
||
// 删除标志(0代表存在时间范围
|
||
daterangeCreateTime: [],
|
||
// 删除标志(0代表存在时间范围
|
||
daterangeUpdateTime: [],
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 20,
|
||
name: null,
|
||
nameEn: null,
|
||
logo: null,
|
||
url: null,
|
||
sortOrder: null,
|
||
status: null,
|
||
brandImg: null,
|
||
remark: null,
|
||
delFlag: null,
|
||
},
|
||
// 表单参数
|
||
form: {},
|
||
// 表单校验
|
||
rules: {
|
||
code: [
|
||
{ required: true, message: "编码不能为空", trigger: "blur" }
|
||
],
|
||
name: [
|
||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||
],
|
||
nameEn: [
|
||
{ required: true, message: "英文名称不能为空", trigger: "blur" }
|
||
],
|
||
logo: [
|
||
{ required: true, message: "logo不能为空", trigger: "blur" }
|
||
],
|
||
status: [
|
||
{ required: true, message: "0-未开放不能为空", trigger: "blur" }
|
||
],
|
||
}
|
||
};
|
||
},
|
||
created() {
|
||
this.getList();
|
||
},
|
||
computed: {
|
||
uploadDisabled:function() {
|
||
return this.sendbackitem.fileList.length >0
|
||
},
|
||
imgUploadHeaders(){return { }},
|
||
},
|
||
methods: {
|
||
// 角色状态修改
|
||
handleStatusChange(row) {
|
||
|
||
let text = row.status == "1" ? "启用" : "停用";
|
||
this.$modal.confirm('确认要"' + text + '"' + row.name + '品牌吗?').then(function() {
|
||
return changeBrandStatus(row.id, row.status);
|
||
}).then(() => {
|
||
this.$modal.msgSuccess(text + "成功");
|
||
}).catch(function() {
|
||
// row.status = row.status === "0" ? "1" : "0";
|
||
});
|
||
|
||
},
|
||
// 排序 查询字段是表格中字段名字 动态取值排序顺序
|
||
handleSortChange(column) {
|
||
this.queryParams.orderByColumn = column.prop;
|
||
this.queryParams.isAsc = column.order;
|
||
this.getList();
|
||
},
|
||
|
||
/** 查询品牌列表 */
|
||
getList() {
|
||
this.loading = true;
|
||
this.queryParams.params = {};
|
||
listEmisBrand(this.addDateRange(this.queryParams, this.dateTimeRange)).then(response => {
|
||
response.rows.forEach(item =>{
|
||
response.rows.status = item.status+"";
|
||
});
|
||
this.emisBrandList = response.rows;
|
||
this.total = response.total;
|
||
this.loading = false;
|
||
});
|
||
},
|
||
// 取消按钮
|
||
cancel() {
|
||
this.open = false;
|
||
this.dialogVisible1 = false;
|
||
this.reset();
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {
|
||
id: null,
|
||
name: null,
|
||
nameEn: null,
|
||
logo: null,
|
||
url: null,
|
||
sortOrder: null,
|
||
status: null,
|
||
brandImg: null,
|
||
remark: null,
|
||
tenantId: null,
|
||
delFlag: null,
|
||
createBy: null,
|
||
createTime: null,
|
||
updateBy: null,
|
||
updateTime: null
|
||
};
|
||
this.resetForm("form");
|
||
},
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1;
|
||
this.getList();
|
||
},
|
||
/** 重置按钮操作 */
|
||
resetQuery() {
|
||
this.resetForm("queryForm");
|
||
this.handleQuery();
|
||
},
|
||
// 多选框选中数据
|
||
handleSelectionChange(selection) {
|
||
this.ids = selection.map(item => item.id)
|
||
this.single = selection.length!==1
|
||
this.multiple = !selection.length
|
||
},
|
||
/** 新增按钮操作 */
|
||
handleAdd(row) {
|
||
this.reset();
|
||
this.open = true;
|
||
this.title = "新增";
|
||
|
||
// 子组件打开模式
|
||
// if(row != undefined){
|
||
// this.currentParentId = row.id
|
||
// }
|
||
// this.openEmisBrand = true;
|
||
// this.titleEmisBrand = "新增";
|
||
},
|
||
handleShowMoreInput(){
|
||
this.moreInputVisible = !this.moreInputVisible;
|
||
},
|
||
/** 修改按钮操作 */
|
||
handleUpdate(row) {
|
||
this.reset();
|
||
const id = row.id || this.ids
|
||
getEmisBrand(id).then(response => {
|
||
response.data.status = response.data.status+"";
|
||
this.form = response.data;
|
||
console.log(this.form);
|
||
this.open = true;
|
||
this.title = "修改";
|
||
if(this.form.brandImg != null){
|
||
this.dialogVisible1 = true;
|
||
this.dialogImageUrl = this.form.brandImg;
|
||
}else{
|
||
this.dialogVisible1 = false;
|
||
this.dialogImageUrl = '';
|
||
}
|
||
});
|
||
|
||
// 子组件打开模式
|
||
// this.currentId= row.id || this.ids;
|
||
// this.openEmisBrand = true;
|
||
// this.titleEmisBrand = "修改";
|
||
|
||
},
|
||
handleView(row) {
|
||
this.id=row.id;
|
||
this.titleView="查看";
|
||
this.openView=true;
|
||
// this.router.push({ path: '/emis/emisBrand/viewDetail', query: { id: row.id }})
|
||
},
|
||
/** 提交按钮 */
|
||
submitForm() {
|
||
this.$refs["form"].validate(valid => {
|
||
if (valid) {
|
||
console.log(this.form);
|
||
if (this.form.id != null) {
|
||
updateEmisBrand(this.form).then(response => {
|
||
this.$modal.msgSuccess("修改成功");
|
||
this.open = false;
|
||
this.dialogVisible1 = false;
|
||
this.getList();
|
||
});
|
||
} else {
|
||
addEmisBrand(this.form).then(response => {
|
||
this.$modal.msgSuccess("新增成功");
|
||
this.open = false;
|
||
this.dialogVisible1 = false;
|
||
this.getList();
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
handleFormChanged(){
|
||
this.openForm = false;
|
||
this.dialogVisible1 = false;
|
||
this.getList();
|
||
},
|
||
cancelForm(){
|
||
this.openForm = false;
|
||
this.dialogVisible1 = false;
|
||
},
|
||
/** 删除按钮操作 */
|
||
handleDelete(row) {
|
||
const ids = row.id || this.ids;
|
||
this.$modal.confirm('是否确认删除').then(function() {
|
||
return delEmisBrand(ids);
|
||
}).then(() => {
|
||
this.getList();
|
||
this.$modal.msgSuccess("删除成功");
|
||
}).catch(() => {});
|
||
},
|
||
/** 导出按钮操作 */
|
||
handleExport() {
|
||
// this.download('emis/emisBrand/export', {
|
||
// ...this.queryParams
|
||
// }, `emisBrand_${new Date().getTime()}.xlsx`)
|
||
const loadingInstance = this.$loading({
|
||
text: '正在导出...'
|
||
})
|
||
var qParam = {...this.queryParams};
|
||
qParam.pageNum=1;
|
||
qParam.pageSize=5000;
|
||
|
||
listEmisBrand(this.addDateRange(qParam, this.dateTimeRange)).then(response => {
|
||
this.downloadLoading = false
|
||
if (response.code === 200) {
|
||
const curList = response.rows
|
||
import('@/vendor/Export2Excel').then(excel => {
|
||
const tHeader = ['id','名称','英文名称','logo','url','排序','0-未开放','品牌图片(多图;号隔开)','备注','租户ID','删除标志(0代表存在','创建者','创建时间','更新者','更新时间',];
|
||
const filterVal = ['id','name','nameEn','logo','url','sortOrder','status','brandImg','remark','tenantId','delFlag','createBy','createTime','updateBy','updateTime',];
|
||
const data = this.formatJson(filterVal, curList, response.rows)
|
||
excel.export_json_to_excel({
|
||
header: tHeader,
|
||
data,
|
||
filename: '品牌',
|
||
autoWidth: true
|
||
})
|
||
loadingInstance.close()
|
||
})
|
||
}
|
||
});
|
||
},
|
||
formatJson(filterVal, jsonData, resData) {
|
||
let index = 0
|
||
return jsonData.map(v => filterVal.map(j => {
|
||
if (j === 'index') {
|
||
return ++index
|
||
}
|
||
if (j === 'status') {
|
||
var statusStr='xxx'
|
||
if(v[j] == 10){
|
||
statusStr='xxx'
|
||
}
|
||
return statusStr;
|
||
}
|
||
return v[j]
|
||
}))
|
||
},
|
||
/** 列索引函数 */
|
||
getIndex($index) {
|
||
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
|
||
},
|
||
/** 时间搜索响应函数 */
|
||
dateTimeChange(value){
|
||
this.dateTimeRange=value;
|
||
},
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<style scoped>
|
||
.el-divider{
|
||
margin-top: 0px;
|
||
background: 0 0;
|
||
border-top: 1px solid #E6EBF5;
|
||
}
|
||
.el-divider__text {
|
||
color: #0955ee;
|
||
cursor: pointer;
|
||
}
|
||
</style>
|