<template>
|
<div class="authorityManagement_box">
|
<My-bread :list="[
|
`${$t('dataManage.dataManage')}`,
|
`${$t('dataManage.colorTableManagement')}`,
|
]"></My-bread>
|
<el-divider />
|
<div
|
class="searchComp subpage_Div"
|
ref="container"
|
>
|
<el-form
|
ref="ruleForm"
|
:model="ruleForm"
|
:inline="true"
|
>
|
<div class="flex_box">
|
<div style="margin-right: auto">
|
<el-form-item :label="$t('userManage.authorityM.name')">
|
<el-input
|
style="width:200px"
|
size="small"
|
v-model="listData.name"
|
:placeholder="$t('userManage.authorityM.nameHolder')"
|
>
|
<i
|
slot="suffix"
|
class="el-icon-search"
|
@click="setSearchTable"
|
></i>
|
</el-input>
|
</el-form-item>
|
</div>
|
<div>
|
|
<el-form-item>
|
<el-button
|
v-if="btnStatus.insert"
|
icon="el-icon-edit"
|
type="success"
|
size="small"
|
@click="setTableInsert"
|
>{{ $t('common.append') }}</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="btnStatus.delete"
|
icon="el-icon-delete"
|
type="danger"
|
size="small"
|
@click="setTableDelete"
|
>{{ $t('common.delete') }}</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
icon="el-icon-refresh"
|
type="info"
|
size="small"
|
@click="setTableRefresh"
|
>{{ $t('common.empty') }}</el-button>
|
</el-form-item>
|
</div>
|
</div>
|
|
</el-form>
|
</div>
|
<div class="dividing-line"></div>
|
<div
|
class="table_box"
|
:style="styleVar"
|
>
|
<el-table
|
:data="tableData"
|
style="width: 100%"
|
border
|
height="calc(100% - 55px)"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column
|
type="selection"
|
width="55"
|
/>
|
<el-table-column
|
align="center"
|
type="index"
|
:label="$t('dataManage.styleObj.index')"
|
width="70px"
|
/>
|
<el-table-column
|
align="center"
|
prop="name"
|
:label="$t('dataManage.styleObj.name')"
|
/>
|
<el-table-column
|
align="center"
|
prop="type"
|
:label="$t('common.type')"
|
:formatter="formatType"
|
/>
|
<el-table-column
|
align="center"
|
prop="bak"
|
:label="$t('common.bak')"
|
/>
|
<el-table-column
|
align="center"
|
prop="createUser"
|
:label="$t('operatManage.BWL.creator')"
|
/>
|
<el-table-column
|
align="center"
|
prop="createTime"
|
:label="$t('operatManage.BWL.creationTime')"
|
:formatter="formatData"
|
/>
|
<el-table-column
|
align="center"
|
prop="updateUser"
|
:label="$t('operatManage.BWL.update')"
|
/>
|
<el-table-column
|
align="center"
|
prop="updateTime"
|
:label="$t('operatManage.BWL.UpdateTime')"
|
:formatter="formatData"
|
/>
|
<el-table-column
|
min-width="100"
|
:label="$t('dataManage.dictionaryManageObj.operation')"
|
>
|
<template slot-scope="scope">
|
<el-button
|
v-if="btnStatus.select"
|
type="primary"
|
plain
|
size="small"
|
@click="handleShowDetial(scope.$index, scope.row)"
|
>{{ $t('dataManage.dictionaryManageObj.lookOver') }}</el-button>
|
<el-button
|
v-if="btnStatus.update"
|
type="warning"
|
plain
|
size="small"
|
@click="handleEdit(scope.$index, scope.row)"
|
>{{ $t('dataManage.dictionaryManageObj.revamp') }}</el-button>
|
|
</template>
|
</el-table-column>
|
</el-table>
|
<div style="margin-top:10px">
|
<el-pagination
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
:current-page="listData.pageIndex"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="listData.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="listData.count"
|
>
|
</el-pagination>
|
</div>
|
</div>
|
<!-- 新增 -->
|
<el-dialog
|
:title="
|
behavior == '新增'
|
? `${$t('dataManage.colorTableObj.append')}`
|
: `${$t('dataManage.colorTableObj.update')}`
|
"
|
:visible.sync="dialogVisible"
|
>
|
<el-form
|
ref="formInline"
|
:model="formInline"
|
label-width="100px"
|
:rules="rules"
|
>
|
<el-form-item
|
:label="$t('dataManage.colorTableObj.labe11')"
|
prop="name"
|
>
|
<el-input
|
style="width: 100%;"
|
size="small"
|
v-model="formInline.name"
|
></el-input>
|
</el-form-item>
|
<el-form-item :label="$t('dataManage.colorTableObj.labe12')">
|
<el-row>
|
<el-col :span="10">
|
<div>
|
<el-input-number
|
style="width: 100%;"
|
:step="1"
|
controls-position="right"
|
size="small"
|
v-model="formInline.low"
|
@blur="setformInlineNumberChange()"
|
@change="setformInlineNumberChange()"
|
></el-input-number>
|
</div>
|
</el-col>
|
<el-col :span="2">
|
<div style="display: flex; align-items: center;justify-content: center;color: white;">——</div>
|
</el-col>
|
<el-col :span="12">
|
<div><el-input-number
|
size="small"
|
controls-position="right"
|
:step="1"
|
style="width: 100%;"
|
v-model="formInline.height"
|
@blur="setformInlineNumberChange()"
|
@change="setformInlineNumberChange()"
|
></el-input-number></div>
|
</el-col>
|
</el-row>
|
</el-form-item>
|
<el-row>
|
<el-col :span="11">
|
<el-form-item :label="$t('dataManage.colorTableObj.labe13')">
|
<el-select
|
style="width: 100%;"
|
v-model="formInline.level"
|
placeholder="请选择"
|
size="small"
|
@change="setLevelChange"
|
>
|
<el-option
|
v-for="item in leveloptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="2">
|
<div style="width: 100%;"> </div>
|
</el-col>
|
<el-col :span="13">
|
<el-form-item :label="$t('dataManage.colorTableObj.labe14')">
|
<el-select
|
style="width: 100%;"
|
v-model="formInline.type"
|
placeholder="请选择"
|
size="small"
|
>
|
<el-option
|
v-for="item in typeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
</el-col>
|
</el-row>
|
<el-form-item :label="$t('common.bak')">
|
<el-input
|
style="width: 100%;"
|
size="small"
|
v-model="formInline.bak"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
<div class="dialogContent">
|
<div v-for="(item,index) in listOption">
|
<div class="content">
|
<div>
|
<label>{{ $t('dataManage.colorTableObj.labe15')}} : </label>
|
</div>
|
<div>
|
<el-input-number
|
:disabled="index ==0"
|
style="width: 100%;"
|
:step="0.001"
|
controls-position="right"
|
size="small"
|
v-model="item.low"
|
@blur="setLowNumberChange(item)"
|
@change="setLowNumberChange(item)"
|
></el-input-number>
|
</div>
|
<div>-</div>
|
<div>
|
<el-input-number
|
:disabled="index ==listOption.length-1"
|
style="width: 100%;"
|
:step="0.001"
|
controls-position="right"
|
size="small"
|
v-model="item.height"
|
@blur="setHeightNumberChange(item)"
|
@change="setHeightNumberChange(item)"
|
></el-input-number>
|
</div>
|
<div>
|
<el-color-picker
|
size="small"
|
v-model="item.start"
|
show-alpha
|
@change="setColorStartChange(item)"
|
></el-color-picker>
|
</div>
|
<div
|
v-show="formInline.type == 0"
|
class="contentBackground"
|
:style="{background: item.start}"
|
>
|
</div>
|
<div
|
v-show="formInline.type == 1"
|
class="contentBackground"
|
:style="{ background: `linear-gradient(to right,${ item.start},${item.end}`,}"
|
>
|
</div>
|
<div v-show="formInline.type == 1">
|
<el-color-picker
|
size="small"
|
v-model="item.end"
|
show-alpha
|
@change="setColorEndChange(item)"
|
></el-color-picker>
|
</div>
|
</div>
|
</div>
|
|
</div>
|
<div style="padding-top: 10px;width: 100%; display: flex; justify-content: end;">
|
<el-button
|
size="mini"
|
@click="resetForm('formInline')"
|
>{{ $t('common.cancel') }}</el-button>
|
<el-button
|
size="mini"
|
type="primary"
|
@click="submitForm('formInline')"
|
>{{ $t('common.confirm') }}</el-button>
|
</div>
|
</el-dialog>
|
<!-- 查看 -->
|
<el-dialog
|
:title=" `${$t('dataManage.colorTableObj.label6')}` "
|
:visible.sync="showDialogVisible"
|
>
|
<el-form
|
ref="formInline"
|
:model="fromDetial"
|
label-width="100px"
|
:rules="rules"
|
>
|
<el-form-item :label="$t('dataManage.colorTableObj.labe11')">
|
<el-input
|
style="width: 100%;"
|
size="small"
|
v-model="fromDetial.name"
|
disabled
|
></el-input>
|
</el-form-item>
|
<el-form-item :label="$t('dataManage.colorTableObj.labe12')">
|
<el-row>
|
<el-col :span="10">
|
<div>
|
<el-input-number
|
style="width: 100%;"
|
:step="1"
|
controls-position="right"
|
size="small"
|
v-model="fromDetial.low"
|
disabled
|
></el-input-number>
|
</div>
|
</el-col>
|
<el-col :span="2">
|
<div style="display: flex; align-items: center;justify-content: center;color: white;">——</div>
|
</el-col>
|
<el-col :span="12">
|
<div><el-input-number
|
size="small"
|
controls-position="right"
|
:step="1"
|
style="width: 100%;"
|
v-model="fromDetial.height"
|
disabled
|
></el-input-number></div>
|
</el-col>
|
</el-row>
|
</el-form-item>
|
<el-row>
|
<el-col :span="11">
|
<el-form-item :label="$t('dataManage.colorTableObj.labe13')">
|
<el-select
|
style="width: 100%;"
|
v-model="fromDetial.level"
|
placeholder="请选择"
|
size="small"
|
disabled
|
>
|
<el-option
|
v-for="item in leveloptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="2">
|
<div style="width: 100%;"> </div>
|
</el-col>
|
<el-col :span="13">
|
<el-form-item :label="$t('dataManage.colorTableObj.labe14')">
|
<el-select
|
style="width: 100%;"
|
v-model="fromDetial.type"
|
placeholder="请选择"
|
size="small"
|
disabled
|
>
|
<el-option
|
v-for="item in typeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
|
</el-col>
|
</el-row>
|
<el-form-item :label="$t('common.bak')">
|
<el-input
|
style="width: 100%;"
|
size="small"
|
disabled
|
v-model="fromDetial.bak"
|
></el-input>
|
</el-form-item>
|
</el-form>
|
<div class="dialogContent">
|
<div v-for="(item,index) in listOption">
|
<div class="content">
|
<div>
|
<label>{{ $t('dataManage.colorTableObj.labe15')}} : </label>
|
</div>
|
<div>
|
<el-input-number
|
:disabled="index ==0"
|
style="width: 100%;"
|
:step="0.001"
|
controls-position="right"
|
size="small"
|
v-model="item.low"
|
disabled
|
></el-input-number>
|
</div>
|
<div>-</div>
|
<div>
|
<el-input-number
|
:disabled="index ==listOption.length-1"
|
style="width: 100%;"
|
:step="0.001"
|
controls-position="right"
|
size="small"
|
v-model="item.height"
|
disabled
|
></el-input-number>
|
</div>
|
<div>
|
<el-color-picker
|
size="small"
|
v-model="item.start"
|
show-alpha
|
disabled
|
></el-color-picker>
|
</div>
|
<div
|
v-show="fromDetial.type == 0"
|
class="contentBackground"
|
:style="{background: item.start}"
|
>
|
</div>
|
<div
|
v-show="fromDetial.type == 1"
|
class="contentBackground"
|
:style="{ background: `linear-gradient(to right,${ item.start},${item.end}`,}"
|
>
|
</div>
|
<div v-show="fromDetial.type == 1">
|
<el-color-picker
|
size="small"
|
v-model="item.end"
|
show-alpha
|
disabled
|
></el-color-picker>
|
</div>
|
</div>
|
</div>
|
|
</div>
|
<div style="padding-top: 10px;width: 100%; display: flex; justify-content: end;">
|
|
</div>
|
</el-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import MyBread from "../../components/MyBread.vue";
|
import {
|
colortab_selectByPageAndCount,
|
colortab_insert,
|
colortab_update,
|
colortab_deletes
|
} from "../../api/api.js";
|
import { getToken } from "@/utils/auth";
|
import { helper } from 'echarts';
|
import { sector } from '@turf/turf';
|
export default {
|
name: "templateManage",
|
components: { MyBread },
|
data() {
|
return {
|
|
behavior: "新增",
|
|
editForm: {
|
|
},
|
multipleSelection: [],
|
dialogVisible: false,
|
tableData: [],
|
ruleForm: {
|
|
},
|
formInline: {
|
name: '',
|
low: 0,
|
height: 2000,
|
level: 1,
|
type: 0,
|
bak: ''
|
},
|
rules: {
|
name: [
|
{ required: true, message: '请输入活动名称', trigger: 'blur' },
|
],
|
|
},
|
listData: {
|
pageIndex: 1,
|
pageSize: 10,
|
name: "",
|
count: 0,
|
},
|
btnStatus: {
|
select: false,
|
delete: false,
|
upload: false,
|
download: false,
|
insert: false,
|
update: false,
|
},
|
tableHeight: 0,
|
timer: 0,
|
styleVar: {
|
height: "calc(100% - 109px)",
|
},
|
typeOption: [],
|
itemdetail: {},
|
showinfoBox: false,
|
leveloptions: [],
|
typeOptions: [],
|
listOption: [],
|
showDialogVisible: false,
|
fromDetial: {},
|
multipleSelection: []
|
};
|
},
|
created() {
|
this.showPermsBtn();
|
this.setDataStart();
|
this.setSearchTable();
|
},
|
beforeDestroy() {
|
this.timer && clearTimeout(this.timer);
|
window.removeEventListener("resize", this.onResize);
|
},
|
mounted() {
|
window.addEventListener("resize", this.onResize);
|
this.calHeight();
|
},
|
methods: {
|
handleSelectionChange(val) {
|
this.multipleSelection = val;
|
},
|
//详情关闭
|
handleShowDetial(index, row) {
|
|
var val = JSON.parse(JSON.stringify(row))
|
var json = JSON.parse(val.json)
|
var length = json.levels.length;
|
var level = json.levels;
|
this.fromDetial = {
|
name: val.name,
|
low: level[0].low,
|
height: level[length - 1].height,
|
level: length,
|
type: val.type,
|
id: val.id,
|
bak: val.bak
|
}
|
this.listOption = [];
|
var color = "rgba(255,0,0,1)"
|
for (var i = 0; i < length; i++) {
|
var color1, color2
|
if (val.type == 0) {
|
var start = [level[i].r, level[i].g, level[i].b, 1]
|
color1 = 'rgba(' + start.toString() + ')'
|
color2 = color;
|
} else if (val.type == 1) {
|
var start = [level[i].r_start, level[i].g_start, level[i].b_start, 1]
|
var end = [level[i].r_end, level[i].g_end, level[i].b_end, 1]
|
color1 = 'rgba(' + start.toString() + ')';
|
color2 = 'rgba(' + end.toString() + ')';
|
}
|
this.listOption.push({
|
low: level[i].low,
|
height: level[i].height,
|
start: color1,
|
end: color2,
|
id: i + 1,
|
})
|
}
|
this.showDialogVisible = true;
|
},
|
handleEdit(index, row) {
|
var val = JSON.parse(JSON.stringify(row))
|
var json = JSON.parse(val.json)
|
var length = json.levels.length;
|
var level = json.levels;
|
this.formInline = {
|
name: val.name,
|
low: level[0].low,
|
height: level[length - 1].height,
|
level: length,
|
type: val.type,
|
id: val.id,
|
bak: val.bak
|
}
|
this.listOption = [];
|
var color = "rgba(255,0,0,1)"
|
for (var i = 0; i < length; i++) {
|
var color1, color2
|
if (val.type == 0) {
|
var start = [level[i].r, level[i].g, level[i].b, 1]
|
color1 = 'rgba(' + start.toString() + ')'
|
color2 = color;
|
} else if (val.type == 1) {
|
var start = [level[i].r_start, level[i].g_start, level[i].b_start, 1]
|
var end = [level[i].r_end, level[i].g_end, level[i].b_end, 1]
|
color1 = 'rgba(' + start.toString() + ')';
|
color2 = 'rgba(' + end.toString() + ')';
|
}
|
this.listOption.push({
|
low: level[i].low,
|
height: level[i].height,
|
start: color1,
|
end: color2,
|
id: i + 1,
|
})
|
}
|
this.behavior = '修改';
|
this.dialogVisible = true;
|
},
|
submitForm(formName) {
|
this.$refs[formName].validate((valid) => {
|
if (valid) {
|
if (this.behavior == '新增') {
|
this.setInsertColorTable();
|
} else if (this.behavior == '修改') {
|
this.setEditColorTable();
|
}
|
|
} else {
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
},
|
resetForm(formName) {
|
this.dialogVisible = false;
|
},
|
async setEditColorTable() {
|
this.dialogVisible = false;
|
var obj = this.getColorLevels();
|
var updateObj = {
|
name: this.formInline.name,
|
type: this.formInline.type,
|
json: JSON.stringify(obj),
|
id: this.formInline.id,
|
bak: this.formInline.bak
|
}
|
|
colortab_update(updateObj).then((res) => {
|
if (res.code != 200) {
|
this.$message({
|
message: "颜色表修改失败 !",
|
type: "warning",
|
});
|
return
|
}
|
this.$message({
|
message: "颜色表修改成功!",
|
type: "success",
|
});
|
this.setSearchTable();
|
})
|
|
|
},
|
setInsertColorTable() {
|
this.dialogVisible = false;
|
var obj = this.getColorLevels();
|
var insertObj = {
|
name: this.formInline.name,
|
type: this.formInline.type,
|
json: JSON.stringify(obj),
|
bak: this.formInline.bak
|
}
|
colortab_insert(insertObj).then((res) => {
|
if (res.code != 200) {
|
this.$message({
|
message: "颜色表添加失败 !",
|
type: "warning",
|
});
|
return
|
}
|
this.$message({
|
message: "颜色表添加成功!",
|
type: "success",
|
});
|
this.setSearchTable();
|
})
|
|
|
},
|
|
getColorLevels() {
|
var levels = [];
|
for (var i in this.listOption) {
|
levels.push(this.getRgbaColor(this.listOption[i]))
|
}
|
var obj = {}
|
if (this.formInline.type == 0) {//普通
|
obj = {
|
default: {
|
r: -1,
|
g: -1,
|
b: -1
|
},
|
levels: levels,
|
type: this.formInline.type
|
}
|
} else if (this.formInline.type == 1) {//渐变
|
obj = {
|
gradation: 'visibility',
|
default: {
|
r: -1,
|
g: -1,
|
b: -1
|
},
|
levels: levels,
|
type: this.formInline.type
|
}
|
}
|
return obj
|
},
|
|
getRgbaColor(res) {
|
|
var start = this.setColorToString(res.start)
|
var end = this.setColorToString(res.end)
|
if (this.formInline.type == 0) {
|
return {
|
r: start.r,
|
g: start.g,
|
b: start.b,
|
height: res.height,
|
low: res.low,
|
}
|
} else if (this.formInline.type == 1) {
|
return {
|
r_start: start.r,
|
g_start: start.g,
|
b_start: start.b,
|
r_end: end.r,
|
g_end: end.g,
|
b_end: end.b,
|
height: res.height,
|
low: res.low,
|
}
|
}
|
},
|
setColorToString(res) {
|
var val = res.slice(5).slice(0, -1).split(',')
|
return {
|
r: val[0],
|
g: val[1],
|
b: val[2],
|
}
|
},
|
//格式化时间
|
add0(m) {
|
return m < 10 ? "0" + m : m;
|
},
|
//格式化时间
|
format(shijianchuo) {
|
//shijianchuo是整数,否则要parseInt转换
|
var time = new Date(shijianchuo);
|
var y = time.getFullYear();
|
var m = time.getMonth() + 1;
|
var d = time.getDate();
|
var h = time.getHours();
|
var mm = time.getMinutes();
|
var s = time.getSeconds();
|
return (
|
y + "-" + this.add0(m) + "-" + this.add0(d)
|
|
);
|
},
|
formatType(row, column) {
|
|
let data = row[column.property];
|
if (data == null) {
|
return data;
|
}
|
if (data == 0) {
|
return '普通'
|
} else if (data == 1) {
|
return '渐变'
|
}
|
},
|
//格式化列表
|
formatData(row, column) {
|
let data = row[column.property];
|
if (!data) {
|
return data;
|
}
|
return this.format(data);
|
},
|
setColorEndChange(res) {
|
if (res.id == this.listOption.length) return;
|
for (var i = 0; i < this.listOption.length; i++) {
|
if (this.listOption[i].id == res.id) {
|
this.listOption[i + 1].start = res.end;
|
}
|
}
|
},
|
setColorStartChange(res) {
|
if (this.formInline.type == 0) return
|
if (res.id == 1) return;
|
for (var i = 0; i < this.listOption.length; i++) {
|
if (this.listOption[i].id == res.id) {
|
this.listOption[i - 1].end = res.start;
|
}
|
}
|
},
|
setLowNumberChange(res) {
|
for (var i = 0; i < this.listOption.length; i++) {
|
if (this.listOption[i].id == res.id) {
|
this.listOption[i - 1].height = res.low;
|
}
|
}
|
},
|
setHeightNumberChange(res) {
|
for (var i = 0; i < this.listOption.length; i++) {
|
if (this.listOption[i].id == res.id) {
|
this.listOption[i + 1].low = res.height;
|
}
|
}
|
},
|
setformInlineNumberChange() {
|
var step = ((this.formInline.height - this.formInline.low) / this.formInline.level).toFixed(3);
|
for (var i = 0; i < this.listOption.length; i++) {
|
if (i == 0) {
|
this.listOption[i].low = this.formInline.low;
|
this.listOption[i].height = (parseFloat(this.formInline.low) + parseFloat(step)).toFixed(3);
|
} else {
|
var val = this.listOption[i - 1]
|
this.listOption[i].low = val.height;
|
this.listOption[i].height = (parseFloat(val.height) + parseFloat(step)).toFixed(3);
|
}
|
}
|
|
this.listOption[this.listOption.length - 1].height = this.formInline.height
|
},
|
|
//级别切换
|
setLevelChange(res) {
|
this.listOption = [];
|
var step = ((this.formInline.height - this.formInline.low) / res).toFixed(3);
|
var color = "rgba(255,0,0,1)"
|
for (var i = 0; i < res; i++) {
|
if (i == 0) {
|
this.listOption.push({
|
low: this.formInline.low,
|
height: (parseFloat(this.formInline.low) + parseFloat(step)).toFixed(3),
|
start: color,
|
end: color,
|
id: i + 1,
|
})
|
} else {
|
var val = this.listOption[i - 1]
|
|
this.listOption.push({
|
low: val.height,
|
height: (parseFloat(val.height) + parseFloat(step)).toFixed(3),
|
start: color,
|
end: color,
|
id: i + 1,
|
})
|
}
|
}
|
this.listOption[res - 1].height = this.formInline.height
|
},
|
//新增下拉框初始化
|
setDataStart() {
|
for (var i = 1; i < 31; i++) {
|
this.leveloptions.push({
|
value: i,
|
label: i
|
})
|
}
|
this.typeOptions = [{
|
value: 0,
|
label: '普通'
|
}, {
|
value: 1,
|
label: '渐变'
|
}]
|
},
|
//分页切换
|
handleSizeChange(res) {
|
this.listData.pageSize = res;
|
this.listData.pageIndex = 1;
|
this.setSearchTable();
|
},
|
//分页切换
|
handleCurrentChange(res) {
|
this.listData.pageIndex = res;
|
this.setSearchTable();
|
},
|
//新增
|
setTableInsert() {
|
this.formInline = {
|
name: '',
|
low: 0,
|
height: 2000,
|
level: 1,
|
type: 0,
|
bak: ''
|
}
|
this.setLevelChange(this.formInline.level);
|
this.behavior = '新增';
|
this.dialogVisible = true;
|
|
|
},
|
|
|
//删除
|
async setTableDelete() {
|
if (this.multipleSelection.length <= 0) {
|
this.$message({
|
message: '请选择要删除的颜色表',
|
type: 'warning'
|
});
|
return
|
}
|
var std = [];
|
for (var i in this.multipleSelection) {
|
std.push(this.multipleSelection[i].id)
|
}
|
colortab_deletes({ ids: std.toString() }).then((res) => {
|
if (res.code != 200) {
|
this.$message({
|
message: "颜色表删除失败 !",
|
type: "warning",
|
});
|
return
|
}
|
this.$message({
|
message: "颜色表删除成功!",
|
type: "success",
|
});
|
this.setSearchTable();
|
})
|
},
|
//重置
|
setTableRefresh() {
|
this.listData = {
|
pageIndex: 1,
|
pageSize: 10,
|
name: "",
|
count: 0,
|
}
|
this.setSearchTable();
|
},
|
//查询
|
async setSearchTable() {
|
const data = await colortab_selectByPageAndCount(this.listData)
|
if (data.code != 200) return;
|
this.tableData = data.result;
|
this.listData.count = data.count;
|
},
|
|
onResize() {
|
this.timer && clearTimeout(this.timer);
|
this.timer = setTimeout(() => {
|
this.calHeight();
|
}, 500);
|
},
|
calHeight() {
|
this.$nextTick(() => {
|
const rect = this.$refs.container.getBoundingClientRect();
|
this.tableHeight = `${rect.height + 97}px`;
|
this.styleVar["height"] = `calc(100% - ${rect.height + 30}px)`;
|
|
});
|
},
|
//权限配置
|
showPermsBtn() {
|
let currentPerms = this.$store.state.currentPerms;
|
let permsEntity = this.$store.state.permsEntity;
|
permsEntity
|
.filter((item) => item.perms == currentPerms)
|
.map((item) => (this.btnStatus[item.tag.substr(1)] = true));
|
},
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.authorityManagement_box {
|
height: 98%;
|
width: 98%;
|
padding: 0.5%;
|
|
.el-input {
|
width: 730px;
|
}
|
|
.searchComp {
|
//padding: 8px;
|
//margin-top: 20px;
|
|
border-radius: 5px;
|
|
//margin-bottom: 20px;
|
|
.el-form-item {
|
margin: 5px;
|
}
|
.el-input {
|
width: 467px;
|
}
|
}
|
.leftTree {
|
position: absolute;
|
z-index: 10;
|
z-index: 9999;
|
top: 100px;
|
left: 800px;
|
width: 400px;
|
height: 600px;
|
|
.treeBox {
|
height: 550px;
|
overflow: auto;
|
}
|
.btnBox {
|
width: 160px;
|
margin: 10px auto 0;
|
}
|
}
|
.bottom {
|
width: 100%;
|
height: 85%;
|
.rightTable {
|
height: 100%;
|
width: 100%;
|
.table_box {
|
width: 100%;
|
height: 80%;
|
margin: 0 auto;
|
overflow: auto;
|
}
|
}
|
}
|
.dialogContent {
|
width: calc(100% - 20px);
|
height: 40vh;
|
background: rgba(104, 156, 255, 0.1);
|
.content {
|
padding: 10px;
|
display: flex;
|
align-items: center;
|
justify-content: space-around;
|
div {
|
margin-right: 10px;
|
}
|
|
.contentBackground {
|
min-height: 1.66667vw;
|
flex: 1;
|
}
|
label {
|
color: white;
|
}
|
}
|
}
|
}
|
</style>
|