23 changed files with 1592 additions and 963 deletions
@ -0,0 +1,339 @@ |
|||
var res = [ |
|||
{ value: 20, name: "交通事故" }, |
|||
{ value: 1, name: "" }, |
|||
{ value: 20, name: "车辆故障" }, |
|||
{ value: 1, name: "" }, |
|||
{ value: 15, name: "路障清除" }, |
|||
{ value: 1, name: "" }, |
|||
{ value: 10, name: "交通管制" }, |
|||
{ value: 1, name: "" }, |
|||
{ value: 5, name: "道路拥堵" }, |
|||
{ value: 1, name: "" }, |
|||
{ value: 5, name: "异常天气" }, |
|||
]; |
|||
let angle = 0; //角度,用来做简单的动画效果的
|
|||
|
|||
//获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
|
|||
function getCirlPoint(x0, y0, r, angle) { |
|||
let x1 = x0 + r * Math.cos((angle * Math.PI) / 180); |
|||
let y1 = y0 + r * Math.sin((angle * Math.PI) / 180); |
|||
return { |
|||
x: x1, |
|||
y: y1, |
|||
}; |
|||
} |
|||
|
|||
let color = [ |
|||
"#4278F8F9", |
|||
"transparent", |
|||
"#5372C4", |
|||
"transparent", |
|||
"#0046FFF9", |
|||
"transparent", |
|||
"#FB9434F9", |
|||
"transparent", |
|||
"#854101F9", |
|||
"transparent", |
|||
"#05E599F9", |
|||
"transparent", |
|||
"#219F73F9", |
|||
"transparent", |
|||
"#7CEDD5F9", |
|||
"transparent", |
|||
]; |
|||
let colorend = [ |
|||
"#4278F800", |
|||
"transparent", |
|||
"#5372C400", |
|||
"transparent", |
|||
"#0046FF00", |
|||
"transparent", |
|||
"#FB943400", |
|||
"transparent", |
|||
"#85410100", |
|||
"transparent", |
|||
"#05E59900", |
|||
"transparent", |
|||
"#219F7300", |
|||
"transparent", |
|||
"#7CEDD500", |
|||
"transparent", |
|||
]; |
|||
|
|||
// var res = this.evaluatedCountList;
|
|||
var data1 = [], |
|||
data2 = [], |
|||
data3 = [], |
|||
legendData = []; |
|||
var curIndex = 0; |
|||
var index = 0; |
|||
|
|||
for (var i = 0; i < res.length; i++) { |
|||
// data1.push({
|
|||
// value: res[i].value,
|
|||
// name: res[i].name,
|
|||
// });
|
|||
// data2.push({
|
|||
// value: res[i].value,
|
|||
// name: res[i].name,
|
|||
// itemStyle: {
|
|||
// opacity: 0.4,
|
|||
// },
|
|||
// });
|
|||
|
|||
// data3.push({
|
|||
// value: res[i].value,
|
|||
// name: res[i].name,
|
|||
// itemStyle: {
|
|||
// opacity: 0.1,
|
|||
// },
|
|||
// });
|
|||
if (res[i].name != "") legendData.push(res[i].name); |
|||
} |
|||
|
|||
var options = { |
|||
color: [ |
|||
"#2867FF", |
|||
"transparent", |
|||
"#58C3FF", |
|||
"transparent", |
|||
"#FF6A3B", |
|||
"transparent", |
|||
"#FDA474", |
|||
"transparent", |
|||
"#FEE58F", |
|||
"transparent", |
|||
"#8DFEBF", |
|||
"transparent", |
|||
"#66F4DC", |
|||
"transparent", |
|||
"#33E27D", |
|||
"transparent", |
|||
"#5D8CFE", |
|||
"transparent", |
|||
], |
|||
title: [ |
|||
{ |
|||
text: "999", |
|||
top: "25%", |
|||
textAlign: "center", |
|||
left: "48%", |
|||
textStyle: { |
|||
color: "#ffffff", |
|||
fontSize: 30, |
|||
fontFamily: "SourceHanSansCN", |
|||
}, |
|||
}, |
|||
{ |
|||
text: "总数", |
|||
top: "38%", |
|||
textAlign: "center", |
|||
left: "48%", |
|||
textStyle: { |
|||
color: "rgba(242, 252, 253, 0.84)", |
|||
fontSize: 16, |
|||
fontFamily: "SourceHanSansCN", |
|||
}, |
|||
}, |
|||
], |
|||
grid: { |
|||
top: "38%", |
|||
left: "6%", |
|||
right: "6%", |
|||
bottom: "3%", |
|||
containLabel: true, |
|||
}, |
|||
tooltip: { |
|||
show: false, |
|||
trigger: "item", |
|||
formatter: "{b} : {c}:{d}", |
|||
}, |
|||
legend: { |
|||
orient: "", |
|||
left: "10%", |
|||
top: "68%", |
|||
itemWidth: 10, |
|||
itemHeight: 10, |
|||
icon: "circle", |
|||
textStyle: { |
|||
color: "#ffffff", |
|||
fontSize: 14, |
|||
lineHeight: 22, |
|||
rich: { |
|||
text: { |
|||
marginLeft: 32, |
|||
fontSize: 14, |
|||
}, |
|||
number: { |
|||
fontSize: 14, |
|||
color: "#37E7FF", |
|||
marginLeft: 32, |
|||
fontWeight: "bold", |
|||
}, |
|||
unit: { |
|||
fontSize: 14, |
|||
}, |
|||
}, |
|||
}, |
|||
data: legendData, |
|||
// formatter(name) {
|
|||
// const newData = res;
|
|||
// let tarValue = 0;
|
|||
// let total = 0;
|
|||
// for (let i = 0; i < newData.length; i++) {
|
|||
// total += newData[i].value;
|
|||
// if (newData[i].name === name) {
|
|||
// tarValue = newData[i].value;
|
|||
// }
|
|||
// }
|
|||
// var percert = total == 0 ? 0 : ((tarValue / total) * 100).toFixed(2);
|
|||
// const arr = name + " " + tarValue;
|
|||
// return `{text|${name}} {number|${percert}%}`;
|
|||
// },
|
|||
}, |
|||
series: [ |
|||
/** 饼图上刻度 */ |
|||
{ |
|||
type: "gauge", |
|||
center: ["50%", "35%"], |
|||
radius: "46%", // 错位调整此处
|
|||
startAngle: 0, |
|||
endAngle: 360, |
|||
splitNumber: 52, |
|||
axisLine: { show: false }, |
|||
splitLine: { |
|||
// length: 39,
|
|||
length: "2", |
|||
lineStyle: { |
|||
width: 5, |
|||
color: "#5CC5FF", |
|||
}, |
|||
}, |
|||
axisTick: { show: false }, |
|||
axisLabel: { show: false }, |
|||
}, |
|||
{ |
|||
name: "中心效果圆", |
|||
type: "gauge", |
|||
radius: "30%", |
|||
center: ["50%", "35%"], |
|||
startAngle: 0, |
|||
endAngle: 360, |
|||
axisLine: { |
|||
lineStyle: { |
|||
color: [[1, "#0AFFE950"]], |
|||
width: 1, |
|||
}, |
|||
}, |
|||
axisTick: { |
|||
show: false, |
|||
}, |
|||
splitLine: { |
|||
show: false, |
|||
}, |
|||
axisLabel: { |
|||
show: false, |
|||
}, |
|||
detail: { |
|||
show: false, |
|||
}, |
|||
pointer: { |
|||
show: false, |
|||
}, |
|||
progress: { |
|||
show: true, |
|||
width: 80, |
|||
itemStyle: { |
|||
color: { |
|||
type: "radial", |
|||
x: 0.5, |
|||
y: 0.5, |
|||
r: 0.5, |
|||
colorStops: [ |
|||
{ |
|||
offset: 0, |
|||
color: "rgb(0, 224, 205, 0)", |
|||
}, |
|||
{ |
|||
offset: 0.7, |
|||
color: "rgba(0, 224, 205, 0)", |
|||
}, |
|||
{ |
|||
offset: 1, |
|||
color: "rgba(10, 255, 233, 0.5)", |
|||
}, |
|||
], |
|||
}, |
|||
}, |
|||
}, |
|||
data: [ |
|||
{ |
|||
value: 100, |
|||
}, |
|||
], |
|||
}, |
|||
{ |
|||
type: "pie", |
|||
radius: ["50%", "40%"], |
|||
center: ["50%", "35%"], |
|||
z: 10, |
|||
label: { |
|||
show: false, |
|||
position: "center", |
|||
formatter: (params) => { |
|||
return params.name + "\r\n" + params.value; |
|||
}, |
|||
rich: { |
|||
total: { |
|||
fontSize: 16, |
|||
color: "#04F5FE", |
|||
}, |
|||
efficiency: { |
|||
fontSize: 12, |
|||
color: "#00FD6D", |
|||
}, |
|||
}, |
|||
color: "#FFFFFF", |
|||
fontSize: 12, |
|||
lineHeight: 16, |
|||
}, |
|||
data: res, |
|||
labelLine: { |
|||
show: false, |
|||
}, |
|||
itemStyle: { |
|||
normal: { |
|||
borderRadius: "5", |
|||
borderWidth: 0, |
|||
borderType: "solid", |
|||
borderCap: "round", |
|||
borderJoin: "round", |
|||
borderColor: "#064258", |
|||
borderMiterLimit: "20", |
|||
color: function (params) { |
|||
return { |
|||
type: "linear", |
|||
x: 0, |
|||
y: 0, |
|||
x2: 1, |
|||
y2: 1, |
|||
colorStops: [ |
|||
{ |
|||
offset: 0, |
|||
color: color[params.dataIndex], // 0% 处的颜色
|
|||
}, |
|||
{ |
|||
offset: 1, |
|||
color: colorend[params.dataIndex], // 100% 处的颜色
|
|||
}, |
|||
], |
|||
globalCoord: false, // 缺省为 false
|
|||
}; |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
], |
|||
}; |
|||
|
|||
export default options; |
Before Width: | Height: | Size: 403 KiB After Width: | Height: | Size: 403 KiB |
@ -1,108 +1,107 @@ |
|||
const sxnja = [ |
|||
293.67, 493.44, 694.34, 894.5, 697.82, 895.09, 495.79, 497.49, 393.72, 293.52 |
|||
]; |
|||
const minNumber = 0; |
|||
const minArray = []; |
|||
sxnja.map((value) => { |
|||
minArray.push(parseFloat((value - minNumber).toFixed(2))) |
|||
}) |
|||
console.log(minArray) |
|||
let xaxisData = [ |
|||
]; |
|||
293.67, 493.44, 694.34, 894.5, 697.82, 895.09, 495.79, 497.49, 393.72, 293.52, |
|||
]; |
|||
const minNumber = 0; |
|||
const minArray = []; |
|||
sxnja.map((value) => { |
|||
minArray.push(parseFloat((value - minNumber).toFixed(2))); |
|||
}); |
|||
console.log(minArray); |
|||
let xaxisData = []; |
|||
|
|||
var options = { |
|||
title: { |
|||
var options = { |
|||
title: { |
|||
// text: '单位/%',
|
|||
top: '0%', |
|||
left: '0%', |
|||
textStyle: { |
|||
fontSize: '10px', |
|||
fontWeight: 300, |
|||
color: '#B5C5D4', |
|||
opacity: 0.8 |
|||
} |
|||
}, |
|||
tooltip: { |
|||
valueFormatter: function (value) { |
|||
return (value + minNumber).toFixed(2); |
|||
} |
|||
}, |
|||
grid: { |
|||
left: '1%', |
|||
right: '0%', |
|||
top: '16%', |
|||
bottom: '5%', |
|||
containLabel: true |
|||
}, |
|||
xAxis: { |
|||
type: 'category', |
|||
data: xaxisData, |
|||
axisLine: { |
|||
show: true, |
|||
lineStyle: { |
|||
width: 1, |
|||
color: '#545454' |
|||
} |
|||
}, |
|||
axisTick: { |
|||
show: false |
|||
}, |
|||
axisLabel: { |
|||
color: '#B5C5D4', |
|||
fontSize: '10px', |
|||
interval: 0 |
|||
} |
|||
}, |
|||
yAxis: [ |
|||
{ |
|||
// type: 'value',
|
|||
// min: function (value) {
|
|||
// return value.min*0.9;
|
|||
// },
|
|||
type: 'value', |
|||
// max: yAxisMax,
|
|||
axisLine: { |
|||
show: false, |
|||
lineStyle: { |
|||
width: 1, |
|||
color: '#545454' |
|||
} |
|||
}, |
|||
splitLine: { |
|||
show: true, |
|||
lineStyle: { |
|||
color: '#B2C2D3', |
|||
opacity: 0.3, |
|||
type: 'dotted' |
|||
} |
|||
}, |
|||
axisTick: { |
|||
show: false |
|||
}, |
|||
axisLabel: { |
|||
color: '#B5C5D4', |
|||
fontSize: '12px', |
|||
formatter: (value) => { |
|||
return value + minNumber |
|||
} |
|||
} |
|||
} |
|||
], |
|||
series: [ |
|||
{ |
|||
top: "0%", |
|||
left: "0%", |
|||
textStyle: { |
|||
fontSize: "10px", |
|||
fontWeight: 300, |
|||
color: "#B5C5D4", |
|||
opacity: 0.8, |
|||
}, |
|||
}, |
|||
tooltip: { |
|||
valueFormatter: function (value) { |
|||
return value + minNumber; |
|||
}, |
|||
}, |
|||
grid: { |
|||
left: "1%", |
|||
right: "0%", |
|||
top: "16%", |
|||
bottom: "5%", |
|||
containLabel: true, |
|||
}, |
|||
xAxis: { |
|||
type: "category", |
|||
data: xaxisData, |
|||
axisLine: { |
|||
show: true, |
|||
lineStyle: { |
|||
width: 1, |
|||
color: "#545454", |
|||
}, |
|||
}, |
|||
axisTick: { |
|||
show: false, |
|||
}, |
|||
axisLabel: { |
|||
color: "#B5C5D4", |
|||
fontSize: "10px", |
|||
interval: 0, |
|||
}, |
|||
}, |
|||
yAxis: [ |
|||
{ |
|||
// type: 'value',
|
|||
// min: function (value) {
|
|||
// return value.min*0.9;
|
|||
// },
|
|||
type: "value", |
|||
// max: yAxisMax,
|
|||
axisLine: { |
|||
show: false, |
|||
lineStyle: { |
|||
width: 1, |
|||
color: "#545454", |
|||
}, |
|||
}, |
|||
splitLine: { |
|||
show: true, |
|||
lineStyle: { |
|||
color: "#B2C2D3", |
|||
opacity: 0.3, |
|||
type: "dotted", |
|||
}, |
|||
}, |
|||
axisTick: { |
|||
show: false, |
|||
}, |
|||
axisLabel: { |
|||
color: "#B5C5D4", |
|||
fontSize: "12px", |
|||
formatter: (value) => { |
|||
return value + minNumber; |
|||
}, |
|||
}, |
|||
}, |
|||
], |
|||
series: [ |
|||
{ |
|||
// name: '审限内结案率',
|
|||
data: minArray, |
|||
type: 'pictorialBar', |
|||
symbol: 'roundRect', |
|||
symbolRepeat: true, |
|||
symbolSize: [13, 4], |
|||
// symbolOffset: symbolOffset,
|
|||
// barWidth:'40%',
|
|||
itemStyle: { |
|||
color: '#20E7FF' |
|||
} |
|||
} |
|||
] |
|||
}; |
|||
data: minArray, |
|||
type: "pictorialBar", |
|||
symbol: "roundRect", |
|||
symbolRepeat: true, |
|||
symbolSize: [13, 4], |
|||
// symbolOffset: symbolOffset,
|
|||
// barWidth:'40%',
|
|||
itemStyle: { |
|||
color: "#20E7FF", |
|||
}, |
|||
}, |
|||
], |
|||
}; |
|||
|
|||
export default options; |
|||
export default options; |
|||
|
@ -1,133 +1,155 @@ |
|||
|
|||
/* 数据 */ |
|||
let nameList = ["大学城", "长清", "孝里", "安城", "平阴北", "平阴南", "东平", "梁山东", "嘉祥西"]; // 类别
|
|||
let nameList = [ |
|||
"大学城", |
|||
"长清", |
|||
"孝里", |
|||
"安城", |
|||
"平阴北", |
|||
"平阴南", |
|||
"东平", |
|||
"梁山东", |
|||
"嘉祥西", |
|||
]; // 类别
|
|||
let valueList = [800, 520, 650, 950, 420, 600, 450, 720, 303]; // 人数
|
|||
// var yList = [ "1000","800","轻度拥堵","基本畅通","畅通"]
|
|||
/* 数据整合 */ |
|||
const minNumber = 0; |
|||
let dataList = []; |
|||
nameList.map((item, index) => { |
|||
if (index === 3) { |
|||
dataList.push({ |
|||
name: item, |
|||
value: valueList[index], |
|||
itemStyle: { |
|||
color: { |
|||
type: 'linear', |
|||
x: 0, |
|||
y: 0, |
|||
x2: 0, |
|||
y2: 1, |
|||
colorStops: [{ |
|||
offset: 0, color: '#0469FF' // 0% 处的颜色
|
|||
}, { |
|||
offset: 1, color: '#699CFF' // 100% 处的颜色
|
|||
}], |
|||
global: false // 缺省为 false
|
|||
if (index === 3) { |
|||
dataList.push({ |
|||
name: item, |
|||
value: valueList[index], |
|||
itemStyle: { |
|||
color: { |
|||
type: "linear", |
|||
x: 0, |
|||
y: 0, |
|||
x2: 0, |
|||
y2: 1, |
|||
colorStops: [ |
|||
{ |
|||
offset: 0, |
|||
color: "#0469FF", // 0% 处的颜色
|
|||
}, |
|||
{ |
|||
offset: 1, |
|||
color: "#699CFF", // 100% 处的颜色
|
|||
}, |
|||
borderRadius: 6 |
|||
}, |
|||
label: { show: false } |
|||
}) |
|||
} else { |
|||
dataList.push({ |
|||
name: item, |
|||
value: valueList[index], |
|||
itemStyle: { |
|||
borderRadius: 6 |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
], |
|||
global: false, // 缺省为 false
|
|||
}, |
|||
borderRadius: 6, |
|||
}, |
|||
label: { show: false }, |
|||
}); |
|||
} else { |
|||
dataList.push({ |
|||
name: item, |
|||
value: valueList[index], |
|||
itemStyle: { |
|||
borderRadius: 6, |
|||
}, |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
var options = { |
|||
grid: { |
|||
top: '5%',//上边距
|
|||
right: '0',//右边距
|
|||
left: '0',//左边距
|
|||
bottom: "0%",//下边距
|
|||
containLabel: true, |
|||
}, |
|||
tooltip: { |
|||
valueFormatter: function (value) { |
|||
return (value + minNumber).toFixed(2); |
|||
} |
|||
grid: { |
|||
top: "5%", //上边距
|
|||
right: "0", //右边距
|
|||
left: "0", //左边距
|
|||
bottom: "0%", //下边距
|
|||
containLabel: true, |
|||
}, |
|||
tooltip: { |
|||
valueFormatter: function (value) { |
|||
return value + minNumber; |
|||
}, |
|||
xAxis: { |
|||
type: 'category', |
|||
data: nameList, |
|||
axisTick: { |
|||
show: false //隐藏X轴刻度
|
|||
}, |
|||
axisLine: { |
|||
lineStyle: { |
|||
color: "rgba(49, 217, 255, 0.8)" |
|||
} |
|||
}, |
|||
axisLabel: { |
|||
show: true, |
|||
color: '#B6E6FF', |
|||
fontSize: 8, |
|||
fontFamily: 'Source Han Sans CN-Regular', |
|||
}, |
|||
xAxis: { |
|||
type: "category", |
|||
data: nameList, |
|||
axisTick: { |
|||
show: false, //隐藏X轴刻度
|
|||
}, |
|||
axisLine: { |
|||
lineStyle: { |
|||
color: "rgba(49, 217, 255, 0.8)", |
|||
}, |
|||
}, |
|||
yAxis: [{ |
|||
type: 'value', |
|||
}, |
|||
axisLabel: { |
|||
show: true, |
|||
color: "#B6E6FF", |
|||
fontSize: 8, |
|||
fontFamily: "Source Han Sans CN-Regular", |
|||
}, |
|||
}, |
|||
yAxis: [ |
|||
{ |
|||
type: "value", |
|||
name: "", |
|||
|
|||
nameTextStyle: { |
|||
color: '#B6E6FF', |
|||
fontSize: 13, |
|||
fontFamily: 'Source Han Sans CN-Regular', |
|||
align: "left", |
|||
verticalAlign: "center", |
|||
color: "#B6E6FF", |
|||
fontSize: 13, |
|||
fontFamily: "Source Han Sans CN-Regular", |
|||
align: "left", |
|||
verticalAlign: "center", |
|||
}, |
|||
axisLabel: { |
|||
fontSize: 13, |
|||
color: '#B6E6FF', |
|||
fontFamily: 'HarmonyOS Sans-Regular', |
|||
// formatter:function(value,index){
|
|||
// return yList[index]
|
|||
// }
|
|||
fontSize: 13, |
|||
color: "#B6E6FF", |
|||
fontFamily: "HarmonyOS Sans-Regular", |
|||
// formatter:function(value,index){
|
|||
// return yList[index]
|
|||
// }
|
|||
}, |
|||
axisLine: { |
|||
show: false, |
|||
show: false, |
|||
}, |
|||
axisTick: { |
|||
show: false |
|||
show: false, |
|||
}, |
|||
splitLine: { |
|||
lineStyle: { |
|||
color: 'rgba(49, 217, 255, 0.5)', |
|||
} |
|||
lineStyle: { |
|||
color: "rgba(49, 217, 255, 0.5)", |
|||
}, |
|||
}, |
|||
}], |
|||
series: [{ |
|||
type: 'bar', |
|||
}, |
|||
], |
|||
series: [ |
|||
{ |
|||
type: "bar", |
|||
data: dataList, |
|||
z: 4, |
|||
itemStyle: { |
|||
color: { |
|||
type: 'linear', |
|||
x: 0, |
|||
y: 0, |
|||
x2: 0, |
|||
y2: 1, |
|||
colorStops: [{ |
|||
offset: 0, color: '#0BA7DA' // 0% 处的颜色
|
|||
}, { |
|||
offset: 1, color: '#61D8FF' // 100% 处的颜色
|
|||
}], |
|||
global: false // 缺省为 false
|
|||
}, |
|||
borderRadius: [4, 4, 0, 0] |
|||
color: { |
|||
type: "linear", |
|||
x: 0, |
|||
y: 0, |
|||
x2: 0, |
|||
y2: 1, |
|||
colorStops: [ |
|||
{ |
|||
offset: 0, |
|||
color: "#0BA7DA", // 0% 处的颜色
|
|||
}, |
|||
{ |
|||
offset: 1, |
|||
color: "#61D8FF", // 100% 处的颜色
|
|||
}, |
|||
], |
|||
global: false, // 缺省为 false
|
|||
}, |
|||
borderRadius: [4, 4, 0, 0], |
|||
}, |
|||
barWidth: 10, |
|||
label: { |
|||
show: false, |
|||
} |
|||
}, |
|||
] |
|||
} |
|||
show: false, |
|||
}, |
|||
}, |
|||
], |
|||
}; |
|||
|
|||
export default options; |
|||
|
@ -0,0 +1,118 @@ |
|||
<template> |
|||
<Dialog v-model="modelVisible" :title="data ? '修改' : '新增'"> |
|||
<div class='AddNEditDialog'> |
|||
<Form :value="formData" class="form" ref="FormConfigRef" :formList="formList" column="1" labelWidth="120px" /> |
|||
</div> |
|||
|
|||
<template #footer> |
|||
<Button style="background-color: rgba(0, 179, 204, .3);" @click.native="modelVisible = false, submitting = false"> |
|||
取消 |
|||
</Button> |
|||
<Button @click.native="handleSubmit" :loading="submitting"> |
|||
确定 |
|||
</Button> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import Dialog from "@screen/components/Dialog/index.vue"; |
|||
import Button from "@screen/components/Buttons/Button.vue" |
|||
import Form from '@screen/components/FormConfig'; |
|||
|
|||
import request from "@/utils/request"; |
|||
import { Message } from "element-ui"; |
|||
import { addEditFormList } from "./../data" |
|||
import { stakeMarkToArray, findPathIdByTreeId } from "@screen/utils/index.js" |
|||
|
|||
export default { |
|||
name: 'AddNEditDialog', |
|||
components: { |
|||
Dialog, |
|||
Button, |
|||
Form |
|||
}, |
|||
model: { |
|||
prop: 'visible', |
|||
event: "update:value" |
|||
}, |
|||
props: { |
|||
visible: Boolean, |
|||
data: Object |
|||
}, |
|||
data() { |
|||
return { |
|||
submitting: false, |
|||
formData: {}, |
|||
formList: addEditFormList |
|||
} |
|||
}, |
|||
computed: { |
|||
modelVisible: { |
|||
get() { |
|||
return this.visible |
|||
}, |
|||
set(val) { |
|||
this.$emit('update:value', val) |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
modelVisible: { |
|||
immediate: true, |
|||
handler(bool) { |
|||
if (!bool) return; |
|||
|
|||
this.formData = !this.data ? {} : { |
|||
...this.data |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
handleSubmit() { |
|||
this.$refs.FormConfigRef.validate() |
|||
.then((data) => { |
|||
this.submitting = true; |
|||
|
|||
if (this.data) data.id = this.data.id; |
|||
|
|||
request({ |
|||
url: `/business/dcInfoBoardVocabulary`, |
|||
method: this.data ? 'PUT' : 'POST', |
|||
data |
|||
}) |
|||
.then(result => { |
|||
if (result.code != 200) return Message.error(`提交失败!`); |
|||
|
|||
Message.success(`提交成功!`); |
|||
this.$emit("afterSubmit"); |
|||
|
|||
this.modelVisible = false; |
|||
|
|||
}) |
|||
.catch((err) => { |
|||
console.log("%c [ err ]-110-「DeviceControlDialog.vue」", "font-size:15px; background:#547bf2; color:#98bfff;", err); |
|||
Message.error(`提交失败!`); |
|||
}) |
|||
.finally(() => { |
|||
this.submitting = false; |
|||
}) |
|||
}) |
|||
} |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style lang='scss' scoped> |
|||
.AddNEditDialog { |
|||
width: 450px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 15px; |
|||
|
|||
.tips { |
|||
font-size: 12px; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,17 @@ |
|||
import { cloneDeep, merge } from "lodash"; |
|||
import * as PresetFormItems from "@screen/pages/control/event/event/FormEvent/PresetFormItems.js"; |
|||
|
|||
export const searchFormList = [ |
|||
{ |
|||
label: "关键词:", |
|||
key: "word", |
|||
} |
|||
]; |
|||
|
|||
export const addEditFormList = [ |
|||
{ |
|||
label: "关键词:", |
|||
key: "word", |
|||
required: true, |
|||
} |
|||
]; |
@ -0,0 +1,205 @@ |
|||
<template> |
|||
<div class='sensitiveWord'> |
|||
<div class="filter"> |
|||
<div> |
|||
<ButtonGradient @click.native="handleAddEdit(true)"> |
|||
<template #prefix> |
|||
<img src="@screen/images/insert.svg" /> |
|||
</template> |
|||
新增 |
|||
</ButtonGradient> |
|||
<ButtonGradient @click.native="handleExport"> |
|||
<template #prefix> |
|||
<img src="@screen/images/export.svg" /> |
|||
</template> |
|||
导出 |
|||
</ButtonGradient> |
|||
<ButtonGradient @click.native="getData"> |
|||
<template #prefix> |
|||
<img src="@screen/images/refresh.svg" /> |
|||
</template> |
|||
刷新 |
|||
</ButtonGradient> |
|||
</div> |
|||
|
|||
<InputSearch style="width: 402px;" :formList="searchFormList" :formConfigOptions="{ labelWidth: '90px' }" |
|||
@handleSearch="handleSearch" /> |
|||
</div> |
|||
|
|||
|
|||
<div class="body"> |
|||
<Empty v-if="!data.length && !isFirst" class="no-data" style="position: absolute">暂无数据</Empty> |
|||
<template v-else> |
|||
<div class="cardBox" v-for="(item, index) in data" :key="index"> |
|||
<Card :buttonIcon="null" :keyMap="keyMap" :cardData="item" class="card" |
|||
buttonText="详情"> |
|||
<template #form-word="{ data }"> |
|||
<div class="keyword"> |
|||
{{ data.word }} |
|||
</div> |
|||
</template> |
|||
<template #button> |
|||
<Button @click.native="() => handleAddEdit(true, item)"> |
|||
修改 |
|||
</Button> |
|||
<Button style="background-color: #FF5F5F;" @click.native="handleDelete(item)"> |
|||
删除 |
|||
</Button> |
|||
</template> |
|||
</Card> |
|||
</div> |
|||
</template> |
|||
</div> |
|||
<AddNEditDialog v-model="isShowDialog" :data="dialogData" @afterSubmit = "getData" />; |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Card from "@screen/components/Card1/index.vue" |
|||
import AddNEditDialog from "./components/AddNEditDialog.vue" |
|||
import InputSearch from '@screen/components/InputSearch/index.vue'; |
|||
import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue'; |
|||
import Button from '@screen/components/Buttons/Button.vue'; |
|||
|
|||
import { searchFormList } from "./data"; |
|||
import request from "@/utils/request"; |
|||
import { setLoading } from "@screen/utils/index.js" |
|||
import { delay, exportFile, confirm } from "@screen/utils/common"; |
|||
import { Message } from "element-ui"; |
|||
|
|||
// 辖段管理 |
|||
export default { |
|||
name: 'sensitiveWord', |
|||
components: { |
|||
Card, |
|||
ButtonGradient, |
|||
InputSearch, |
|||
AddNEditDialog, |
|||
Button |
|||
}, |
|||
data() { |
|||
return { |
|||
searchFormList, |
|||
keyMap: [ |
|||
{ |
|||
key: "word", |
|||
label: "关键词" |
|||
}, |
|||
{ |
|||
key: "id", |
|||
label: "id" |
|||
}, |
|||
{ |
|||
key: "createTime", |
|||
label: "创建时间" |
|||
} |
|||
], |
|||
data: [], |
|||
dialogData: null, |
|||
isShowDialog: false, |
|||
isFirst: true |
|||
} |
|||
}, |
|||
created() { |
|||
this.getData(); |
|||
// this.getSearchOptions(); |
|||
}, |
|||
methods: { |
|||
getSearchData() { |
|||
let result = { |
|||
...this.searchData, |
|||
}; |
|||
if(!result.word){ |
|||
result = {}; |
|||
} |
|||
return result |
|||
}, |
|||
async handleDelete(data) { |
|||
await confirm({ message: "是否要删除该辖段信息?" }); |
|||
|
|||
request({ |
|||
url: `/business/dcInfoBoardVocabulary/${data.id}`, |
|||
method: "DELETE", |
|||
data: {} |
|||
}) |
|||
.then(result => { |
|||
if (result.code != 200) return Message.error("删除失败"); |
|||
Message.success("删除成功") |
|||
this.getData(); |
|||
}) |
|||
.catch(() => { |
|||
Message.error("删除失败") |
|||
}) |
|||
}, |
|||
handleAddEdit(bool, data) { |
|||
this.isShowDialog = bool; |
|||
this.dialogData = data; |
|||
}, |
|||
handleExport() { |
|||
exportFile({ |
|||
url: "/business/dcInfoBoardVocabulary/export", |
|||
filename: "管辖路段", |
|||
data: this.getSearchData() |
|||
}); |
|||
}, |
|||
handleSearch(data) { |
|||
this.searchData = data; |
|||
this.getData(); |
|||
}, |
|||
async getData() { |
|||
const closeLoading = setLoading(); |
|||
|
|||
await delay(150); |
|||
|
|||
request({ |
|||
url: `/business/dcInfoBoardVocabulary/list`, |
|||
method: "get", |
|||
params: this.getSearchData() |
|||
}).then(result => { |
|||
if (result.code != 200) return; |
|||
this.data = result.rows; |
|||
// this.data = [ |
|||
// ...result.rows,...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows |
|||
// , ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows, ...result.rows |
|||
// ]; |
|||
Array.from(result.rows); |
|||
}).finally(() => { |
|||
this.isFirst = false; |
|||
closeLoading(); |
|||
}) |
|||
} |
|||
} |
|||
|
|||
} |
|||
</script> |
|||
|
|||
<style lang='scss' scoped> |
|||
.sensitiveWord { |
|||
padding: 20px; |
|||
display: flex; flex-direction: column; |
|||
.filter { |
|||
height: 60px; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
|
|||
div { |
|||
display: flex; |
|||
gap: 6px; |
|||
} |
|||
} |
|||
|
|||
.body { |
|||
height: 0; flex: 1; overflow-y: scroll; |
|||
display: flex; flex-wrap: wrap; align-content: flex-start; |
|||
.cardBox{ |
|||
flex-basis: percentage(1/7); width: 0; padding-right: 10px; padding-bottom: 10px; |
|||
} |
|||
.keyword { |
|||
font-size: 14px; |
|||
font-weight: bold; |
|||
color: #00B3CC; |
|||
} |
|||
} |
|||
} |
|||
</style> |
Loading…
Reference in new issue