This commit is contained in:
2021-10-28 15:32:09 +08:00
commit 0a73304eea
475 changed files with 122605 additions and 0 deletions

61
src/views/common/404.vue Normal file
View File

@@ -0,0 +1,61 @@
<template>
<div class="site-wrapper site-page--not-found">
<div class="site-content__wrapper">
<div class="site-content">
<h2 class="not-found-title">400</h2>
<p class="not-found-desc">抱歉您访问的页面<em>失联</em> ...</p>
<el-button @click="$router.go(-1)">返回上一页</el-button>
<el-button type="primary" class="not-found-btn-gohome" @click="$router.push({ name: 'home' })">进入首页</el-button>
</div>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss">
.site-wrapper.site-page--not-found {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
.site-content__wrapper {
padding: 0;
margin: 0;
background-color: #fff;
}
.site-content {
position: fixed;
top: 15%;
left: 50%;
z-index: 2;
padding: 30px;
text-align: center;
transform: translate(-50%, 0);
}
.not-found-title {
margin: 20px 0 15px;
font-size: 10em;
font-weight: 400;
color: rgb(55, 71, 79);
}
.not-found-desc {
margin: 0 0 30px;
font-size: 26px;
text-transform: uppercase;
color: rgb(118, 131, 143);
> em {
font-style: normal;
color: #ee8145;
}
}
.not-found-btn-gohome {
margin-left: 30px;
}
}
</style>

View File

@@ -0,0 +1,699 @@
<template>
<div class='mod-demo-echarts' :style="`height: ${winHeight}px`">
<div :style="`font-size: ${60 * beilv}px`" style="margin-left:30%;color:white;margin-bottom:10px"><img :height="`${60 * beilv}px`" src="../../assets/img/title.png">&nbsp;奔一电气立体库展示屏</div>
<el-card class="titleClass">
<el-tag class="tagClass" :style="`font-size: ${30 * beilv}px`" type='success' color="#E9EAEF" effect="dark">一二层空余库位:{{firstPointList.notOccupy12}}</el-tag>
<el-tag class="tagClass" :style="`font-size: ${30 * beilv}px`" type='success' color="#E9EAEF" effect="dark">三四五六层空余库位:{{firstPointList.notOccupy3456}}</el-tag>
<el-tag class="tagClass" :style="`font-size: ${30 * beilv}px`" type='success' color="#E9EAEF" effect="dark">七八层空余库位:{{firstPointList.notOccupy78}}</el-tag>
<el-tag class="tagClass" :style="`font-size: ${30 * beilv}px`" type='warning' color="#E9EAEF" effect="dark">当前任务编码:{{sTaskInfo.taskDetCode}}&emsp;类型:{{sTaskInfo.taskType === 0 ? '出库' : sTaskInfo.taskType === 1 ?'入库' : '无'}}&emsp;</el-tag>
</el-card>
<hr />
<el-row>
<el-col :span='11' :offset='1'>
<div id='J_chartPieBox' class='chart-box'></div>
</el-col>
<el-col :span='11'>
<div id='J_chartScatterBox' class='chart-box'></div>
</el-col>
</el-row>
<el-row>
<el-col :span='6' :offset='1'>
<div id='J_category' class='chart-box'></div>
</el-col>
<el-col :span='16'>
<div id='J_axis' class='chart-box'></div>
</el-col>
</el-row>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
data () {
return {
chartCate: null,
chartAxis: null,
chartBar: null,
chartPie: null,
firstPointList: [],
secondPointList: [],
sTaskInfo: {},
coverList: [],
smallList: [],
winHeight: 0,
beilv: 1
}
},
mounted () {
this.init()
this.winHeight = window.innerHeight
this.beilv = window.innerWidth / 1920
console.log(this.beilv)
window.addEventListener('resize', () => {
this.winHeight = window.innerHeight
this.beilv = window.innerWidth / 1920
this.chartCate.dispose()
this.chartAxis.dispose()
this.chartBar.dispose()
this.chartPie.dispose()
this.initChartPie()
this.initChartScatter()
this.initCate()
this.initAxis()
})
setInterval(() => {
this.chartCate.dispose()
this.chartAxis.dispose()
this.chartBar.dispose()
this.chartPie.dispose()
this.init()
}, 60000)
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight }
}
},
activated () {
// 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
if (this.chartPie) {
this.chartPie.resize()
}
if (this.chartScatter) {
this.chartScatter.resize()
}
},
methods: {
init () {
this.$http({
url: this.$http.adornUrl('/generator/screen/countModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.secondPointList = data.data
this.initChartScatter()
} else {
this.secondPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/countPosition'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.firstPointList = data.data
this.initChartPie()
} else {
this.firstPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/coverAndBase'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.coverList = data.data
this.initCate()
} else {
this.coverList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/smallModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
let arr1 = []
let arr2 = []
let arr3 = []
data.data.forEach(item => {
arr1.push(item.categoryName)
arr2.push(item.quantity)
arr3.push(item.position)
})
let obj = {
categoryName: arr1,
quantity: arr2,
position: arr3
}
this.smallList = obj
this.initAxis()
} else {
this.smallList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/taskruninfodetlist'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.sTaskInfo = data.list[0]
if (!this.sTaskInfo.taskDetCode) {
this.sTaskInfo.taskDetCode = ''
}
}
})
},
// 饼状图
initChartPie () {
var option = {
title: {
text: `库位使用情况:共${this.firstPointList.all}`,
left: 'center',
top: 20 * this.beilv,
textStyle: {
color: '#fff',
fontSize: 25 * this.beilv
}
},
legend: {
orient: 'vertical',
left: 10 * this.beilv,
data: [
'已占用库位',
'未占用库位'
],
textStyle: {
fontSize: 16 * this.beilv,
color: '#fff'
}
},
color: ['#dd6b66', '#c23531'],
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)',
textStyle: {
fontSize: 20 * this.beilv,
lineHeight: 22 * this.beilv
}
},
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
series: [
{
name: '库位数',
type: 'pie',
radius: '65%',
center: ['50%', '50%'],
data: [
{ value: this.firstPointList.isOccupy, name: `已占用库位` },
{ value: this.firstPointList.notOccupy, name: `未占用库位` }
].sort(function (a, b) {
return a.value - b.value
}),
itemStyle: {
normal: {
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c|{c}} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
// shadowBlur:3,
// shadowOffsetX: 2,
// shadowOffsetY: 2,
// shadowColor: '#999',
// padding: [0, 7],
rich: {
a: {
color: '#999',
lineHeight: 22 * this.beilv,
align: 'center',
fontSize: 16 * this.beilv
},
abg: {
backgroundColor: '#333',
width: '100%',
align: 'right',
height: 22 * this.beilv,
borderRadius: [4, 4, 0, 0],
fontSize: 16 * this.beilv
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5 * this.beilv,
height: 0 * this.beilv,
fontSize: 16 * this.beilv
},
b: {
fontSize: 16 * this.beilv,
lineHeight: 33 * this.beilv
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2 * this.beilv, 4 * this.beilv],
borderRadius: 2 * this.beilv,
fontSize: 16 * this.beilv
},
c: {
fontSize: 16 * this.beilv
}
}
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
}
}
}
}
]
}
this.chartPie = echarts.init(document.getElementById('J_chartPieBox'))
this.chartPie.setOption(option)
window.addEventListener('resize', () => {
this.chartPie.resize()
})
},
initChartScatter () {
var option = {
backgroundColor: '#0079BA',
title: {
text: '大系列库位数量情况(外圈总量,内圈库存)',
left: 'center',
top: 0,
textStyle: {
color: '#fff',
fontSize: 25 * this.beilv
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)',
textStyle: {
fontSize: 20 * this.beilv,
lineHeight: 22 * this.beilv
}
},
legend: {
orient: 'vertical',
left: 10 * this.beilv,
data: [
'成品',
'半成品',
'原材料'
],
textStyle: {
fontSize: 16 * this.beilv,
color: '#fff'
}
},
series: [
{
name: '库位数',
type: 'pie',
radius: [0, '40%'],
itemStyle: {
normal: {
label: {
position: 'inner',
fontSize: 14 * this.beilv,
formatter: '{b}: {c}'
}
}
},
labelLine: {
show: false
},
data: [
{ value: this.secondPointList.countPositionFinishedProduct, name: `成品` },
{ value: this.secondPointList.countPositionSemiFinishedProduct, name: `半成品` },
{ value: this.secondPointList.countPositionRawMaterials, name: `原材料` }
]
},
{
name: '数量',
type: 'pie',
radius: ['50%', '75%'],
itemStyle: {
normal: {
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c|{c}} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
// shadowBlur:3,
// shadowOffsetX: 2,
// shadowOffsetY: 2,
// shadowColor: '#999',
// padding: [0, 7],
rich: {
a: {
color: '#999',
lineHeight: 22 * this.beilv,
align: 'center',
fontSize: 16 * this.beilv
},
abg: {
backgroundColor: '#333',
width: '100%',
align: 'right',
height: 22 * this.beilv,
borderRadius: [4, 4, 0, 0],
fontSize: 16 * this.beilv
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5 * this.beilv,
height: 0 * this.beilv,
fontSize: 16 * this.beilv
},
b: {
fontSize: 16 * this.beilv,
lineHeight: 33 * this.beilv
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2 * this.beilv, 4 * this.beilv],
borderRadius: 2 * this.beilv,
fontSize: 16 * this.beilv
},
c: {
fontSize: 16 * this.beilv
}
}
}
}
},
data: [
{ value: this.secondPointList.countQuantityFinishedProduct, name: `成品` },
{ value: this.secondPointList.countQuantitySemiFinishedProduct, name: `半成品` },
{ value: this.secondPointList.countQuantityRawMaterials, name: `原材料` }
]
}
]
}
this.chartBar = echarts.init(
document.getElementById('J_chartScatterBox')
)
this.chartBar.setOption(option)
window.addEventListener('resize', () => {
this.chartBar.resize()
})
},
initCate () {
let [max, beilv] = [0, 0]
const kwArr = [this.coverList.basePosition, this.coverList.coverPosition]
kwArr.map(item => {
if (max < item) {
beilv = Math.ceil(item / 50)
max = beilv * 50
}
})
let option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
},
label: {
textStyle: {
fontSize: 16 * this.beilv
}
}
},
textStyle: {
fontSize: 20 * this.beilv,
lineHeight: 22 * this.beilv
}
},
legend: {
data: [
'数量',
'库位数量'
],
textStyle: {
fontSize: 16 * this.beilv,
color: '#fff'
}
},
color: ['#c23531', '#ff7f50'],
xAxis: [
{
type: 'category',
data: ['盒底', '盒盖'],
axisPointer: {
type: 'shadow'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
nameTextStyle: {
fontSize: 20 * this.beilv,
color: '#fff'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff'
}
},
{
type: 'value',
name: '库位数量',
min: 0,
max,
nameTextStyle: {
fontSize: 20 * this.beilv,
color: '#fff'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff'
}
}
],
grid: {
left: '15%'
},
series: [
{
name: '数量',
type: 'bar',
itemStyle: {
normal: {
label: {
show: true,
position: 'inside',
fontSize: 12 * this.beilv
}
}
},
data: [this.coverList.baseQuantity, this.coverList.coverQuantity]
},
{
name: '库位数量',
type: 'bar',
data: [this.coverList.basePosition, this.coverList.coverPosition],
yAxisIndex: 1,
itemStyle: {
normal: {
label: {
show: true,
position: 'inside',
fontSize: 12 * this.beilv
}
}
}
}
]
}
this.chartCate = echarts.init(document.getElementById('J_category'))
this.chartCate.setOption(option)
window.addEventListener('resize', () => {
this.chartCate.resize()
})
},
initAxis () {
let [max, beilv] = [0, 0]
const kwArr = this.smallList.position
kwArr.map(item => {
if (max < item) {
beilv = Math.ceil(item / 50)
max = beilv * 50
}
})
let option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
},
label: {
textStyle: {
fontSize: 16 * this.beilv
}
}
},
textStyle: {
fontSize: 20 * this.beilv,
lineHeight: 22 * this.beilv
}
},
legend: {
data: [
'数量',
'库位数量'
],
textStyle: {
fontSize: 16 * this.beilv,
color: '#fff'
},
top: 27 * this.beilv
},
title: {
text: '成品小系列库位数量情况',
left: 'center',
top: 0,
textStyle: {
color: '#fff',
fontSize: 25 * this.beilv
}
},
grid: {
top: 60 * this.beilv,
left: '15%'
},
color: ['#FFCD42', '#87cefa'],
xAxis: [
{
type: 'category',
data: this.smallList.categoryName,
axisPointer: {
type: 'shadow'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff',
interval: 0
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
nameTextStyle: {
fontSize: 20 * this.beilv,
color: '#fff'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff'
}
},
{
type: 'value',
name: '库位数量',
min: 0,
max,
nameTextStyle: {
fontSize: 20 * this.beilv,
color: '#fff'
},
axisLabel: {
fontSize: 16 * this.beilv,
color: '#fff'
}
}
],
series: [
{
name: '数量',
type: 'bar',
itemStyle: {
normal: {
label: {
show: true,
position: 'top',
fontSize: 12 * this.beilv
}
}
},
data: this.smallList.quantity
},
{
name: '库位数量',
type: 'bar',
data: this.smallList.position,
yAxisIndex: 1,
itemStyle: {
normal: {
label: {
show: true,
position: 'top',
fontSize: 12 * this.beilv
}
}
}
}
]
}
this.chartAxis = echarts.init(document.getElementById('J_axis'))
this.chartAxis.setOption(option)
window.addEventListener('resize', () => {
this.chartAxis.resize()
})
}
}
}
</script>
<style lang='scss'>
.mod-demo-echarts {
background-color: #0079ba;
overflow:hidden;
> .el-alert {
margin-bottom: 10px;
}
> .el-row {
.el-col {
padding-top: 10px;
padding-bottom: 10px;
}
}
.chart-box {
min-height: 42vh;
}
}
.titleClass{
width: 90%;
margin-left: 5%;
height: 6vh;
line-height: 7vh;
background: #B8D4E9;
text-align: center;
.el-card__body{
padding: 0;
}
.tagClass{
height: 5vh;
line-height: 5vh;
}
}
</style>

View File

@@ -0,0 +1,473 @@
<template>
<div class='mod-demo-echarts' >
<el-card class="titleClass">
<el-tag class="tagClass" type='success' color="#E9EAEF" effect="dark">一二层空余库位:{{firstPointList.notOccupy12}}</el-tag>
<el-tag class="tagClass" type='success' color="#E9EAEF" effect="dark">七八层空余库位:{{firstPointList.notOccupy78}}</el-tag>
<el-tag class="tagClass" type='warning' color="#E9EAEF" effect="dark">任务编码:{{sTaskInfo.taskDetCode}}&emsp;类型:{{sTaskInfo.taskType === 0 ? '出库' : '入库'}}&emsp;</el-tag>
</el-card>
<hr />
<el-row :gutter='20'>
<el-col :span='11' :offset='1'>
<div id='J_chartPieBox' class='chart-box'></div>
</el-col>
<el-col :span='11'>
<div id='J_chartScatterBox' class='chart-box'></div>
</el-col>
</el-row>
<el-row :gutter='20'>
<el-col :span='6' :offset='1'>
<div id='J_category' class='chart-box'></div>
</el-col>
<el-col :span='16'>
<div id='J_axis' class='chart-box'></div>
</el-col>
</el-row>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
data () {
return {
chartCate: null,
chartAxis: null,
chartBar: null,
chartPie: null,
firstPointList: [],
secondPointList: [],
sTaskInfo: {},
coverList: [],
smallList: []
}
},
mounted () {
this.init()
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight }
}
},
activated () {
// 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
if (this.chartPie) {
this.chartPie.resize()
}
if (this.chartScatter) {
this.chartScatter.resize()
}
},
methods: {
init () {
this.$http({
url: this.$http.adornUrl('/generator/screen/countModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.secondPointList = data.data
this.initChartScatter()
} else {
this.secondPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/countPosition'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.firstPointList = data.data
this.initChartPie()
} else {
this.firstPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/coverAndBase'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.coverList = data.data
this.initCate()
} else {
this.coverList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/smallModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
let arr1 = []
let arr2 = []
let arr3 = []
data.data.forEach(item => {
arr1.push(item.categoryName)
arr2.push(item.quantity)
arr3.push(item.position)
})
let obj = {
categoryName: arr1,
quantity: arr2,
position: arr3
}
this.smallList = obj
this.initAxis()
} else {
this.smallList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/taskruninfodetlist'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.sTaskInfo = data.list[0]
}
})
},
// 饼状图
initChartPie () {
var option = {
backgroundColor: '#0079BA',
title: {
text: `库位使用情况:共${this.firstPointList.all}`,
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
series: [
{
name: '库位数',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [
{ value: this.firstPointList.isOccupy, name: `已占用库位${this.firstPointList.isOccupy}` },
{ value: this.firstPointList.notOccupy, name: `未占用库位${this.firstPointList.notOccupy}` }
].sort(function (a, b) {
return a.value - b.value
}),
roseType: 'radius',
label: {
normal: {
textStyle: {
color: 'rgba(255, 255, 255)'
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
}
},
itemStyle: {
normal: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200
}
}
]
}
this.chartPie = echarts.init(document.getElementById('J_chartPieBox'))
this.chartPie.setOption(option)
window.addEventListener('resize', () => {
this.chartPie.resize()
})
},
initChartScatter () {
var option = {
backgroundColor: '#0079BA',
title: {
text: '大系列库位数量情况',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 10,
data: [
'成品',
'半成品',
'原材料'
]
},
series: [
{
name: '库位数',
type: 'pie',
radius: [0, '28%'],
label: {
position: 'inner',
color: 'red',
fontSize: 22
},
labelLine: {
show: false
},
data: [
{ value: this.secondPointList.countPositionFinishedProduct, name: `成品${this.secondPointList.countPositionFinishedProduct}` },
{ value: this.secondPointList.countPositionSemiFinishedProduct, name: `半成品${this.secondPointList.countPositionSemiFinishedProduct}` },
{ value: this.secondPointList.countPositionRawMaterials, name: `原材料${this.secondPointList.countPositionRawMaterials}` }
]
},
{
name: '数量',
type: 'pie',
radius: ['50%', '75%'],
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
// shadowBlur:3,
// shadowOffsetX: 2,
// shadowOffsetY: 2,
// shadowColor: '#999',
// padding: [0, 7],
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
abg: {
backgroundColor: '#333',
width: '100%',
align: 'right',
height: 22,
borderRadius: [4, 4, 0, 0]
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 16,
lineHeight: 33
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
},
data: [
{ value: this.secondPointList.countQuantityFinishedProduct, name: `成品${this.secondPointList.countQuantityFinishedProduct}` },
{ value: this.secondPointList.countQuantitySemiFinishedProduct, name: `半成品${this.secondPointList.countQuantitySemiFinishedProduct}` },
{ value: this.secondPointList.countQuantityRawMaterials, name: `原材料${this.secondPointList.countQuantityRawMaterials}` }
]
}
]
}
this.chartBar = echarts.init(
document.getElementById('J_chartScatterBox')
)
this.chartBar.setOption(option)
window.addEventListener('resize', () => {
this.chartBar.resize()
})
},
initCate () {
var option = {
color: ['#17B3A3'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
title: {
text: '盒底盒盖库位数量情况',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
xAxis: {
type: 'category',
nameTextStyle: {
color: '#FFFFFF',
fontSize: '20'
},
data: ['盒底', '盒盖']
},
yAxis: {
type: 'value',
axisLabel: {
interval: 0,
rotate: 40
}
},
series: [
{
type: 'bar',
name: '数量',
stack: '总量',
label: {
show: true,
position: 'inside'
},
showBackground: true,
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
},
data: [this.coverList.baseQuantity, this.coverList.coverQuantity]
},
{
type: 'bar',
name: '库位数量',
stack: '总量',
label: {
show: true,
position: 'inside'
},
showBackground: true,
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
},
data: [this.coverList.basePosition, this.coverList.coverPosition]
}
]
}
this.chartCate = echarts.init(document.getElementById('J_category'))
this.chartCate.setOption(option)
window.addEventListener('resize', () => {
this.chartCate.resize()
})
},
initAxis () {
var option = {
color: ['#FFCD42'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
title: {
text: '小系列库位数量情况',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
xAxis: {
type: 'category',
data: this.smallList.categoryName
},
yAxis: {
type: 'value',
axisLabel: {
interval: 0,
rotate: 40
}
},
series: [
{
data: this.smallList.quantity,
type: 'bar',
name: '数量',
stack: '总量',
label: {
show: true,
position: 'inside'
},
showBackground: true,
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
}
},
{
type: 'bar',
name: '库位数量',
stack: '总量',
label: {
show: true,
position: 'inside'
},
showBackground: true,
backgroundStyle: {
color: 'rgba(220, 220, 220, 0.8)'
},
data: this.smallList.position
}]
}
this.chartAxis = echarts.init(document.getElementById('J_axis'))
this.chartAxis.setOption(option)
window.addEventListener('resize', () => {
this.chartAxis.resize()
})
}
}
}
</script>
<style lang='scss'>
.mod-demo-echarts {
background-color: #0079ba;
> .el-alert {
margin-bottom: 10px;
}
> .el-row {
margin-top: -10px;
margin-bottom: -10px;
.el-col {
padding-top: 10px;
padding-bottom: 10px;
}
}
.chart-box {
min-height: 600px;
}
}
.tagClass{
height: 6%;
font-size: 30px;
}
.titleClass{
width: 70%;
margin-left: 15%;
background: #B8D4E9;
}
</style>

View File

@@ -0,0 +1,604 @@
<template>
<div class='mod-demo-echarts' :style="`height: ${winHeight}px`">
<el-card class="titleClass">
<el-tag class="tagClass" type='success' color="#E9EAEF" effect="dark">一二层空余库位:{{firstPointList.notOccupy12}}</el-tag>
<el-tag class="tagClass" type='success' color="#E9EAEF" effect="dark">三四五六层空余库位:{{firstPointList.notOccupy3456}}</el-tag>
<el-tag class="tagClass" type='success' color="#E9EAEF" effect="dark">七八层空余库位:{{firstPointList.notOccupy78}}</el-tag>
<el-tag class="tagClass" type='warning' color="#E9EAEF" effect="dark">当前任务编码:{{sTaskInfo.taskDetCode}}&emsp;类型:{{sTaskInfo.taskType === 0 ? '出库' : '入库'}}&emsp;</el-tag>
</el-card>
<hr />
<el-row>
<el-col :span='11' :offset='1'>
<div id='J_chartPieBox' class='chart-box'></div>
</el-col>
<el-col :span='11'>
<div id='J_chartScatterBox' class='chart-box'></div>
</el-col>
</el-row>
<el-row>
<el-col :span='6' :offset='1'>
<div id='J_category' class='chart-box'></div>
</el-col>
<el-col :span='16'>
<div id='J_axis' class='chart-box'></div>
</el-col>
</el-row>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
data () {
return {
chartCate: null,
chartAxis: null,
chartBar: null,
chartPie: null,
firstPointList: [],
secondPointList: [],
sTaskInfo: {},
coverList: [],
smallList: [],
winHeight: 0
}
},
mounted () {
this.init()
this.winHeight = window.innerHeight
window.addEventListener('resize', () => {
this.winHeight = window.innerHeight
})
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight }
}
},
activated () {
// 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
if (this.chartPie) {
this.chartPie.resize()
}
if (this.chartBar) {
this.chartBar.resize()
}
if (this.chartAxis) {
this.chartAxis.resize()
}
if (this.chartCate) {
this.chartCate.resize()
}
},
methods: {
init () {
this.$http({
url: this.$http.adornUrl('/generator/screen/countModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.secondPointList = data.data
this.initChartScatter()
} else {
this.secondPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/countPosition'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.firstPointList = data.data
this.initChartPie()
} else {
this.firstPointList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/coverAndBase'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
this.coverList = data.data
this.initCate()
} else {
this.coverList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/screen/smallModel'),
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
let arr1 = []
let arr2 = []
let arr3 = []
data.data.forEach(item => {
arr1.push(item.categoryName)
arr2.push(item.quantity)
arr3.push(item.position)
})
let obj = {
categoryName: arr1,
quantity: arr2,
position: arr3
}
this.smallList = obj
this.initAxis()
} else {
this.smallList = []
}
})
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/taskruninfodetlist'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.sTaskInfo = data.list[0]
}
})
},
// 饼状图
initChartPie () {
var option = {
title: {
text: `库位使用情况:共${this.firstPointList.all}`,
left: 'center',
top: 20,
textStyle: {
color: '#fff'
}
},
legend: {
orient: 'vertical',
left: 10,
data: [
'已占用库位',
'未占用库位'
],
textStyle: {
fontSize: 14,
color: '#fff'
}
},
color: ['#dd6b66', '#c23531'],
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
series: [
{
name: '库位数',
type: 'pie',
radius: '65%',
center: ['50%', '50%'],
data: [
{ value: this.firstPointList.isOccupy, name: `已占用库位` },
{ value: this.firstPointList.notOccupy, name: `未占用库位` }
].sort(function (a, b) {
return a.value - b.value
}),
itemStyle: {
normal: {
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
// shadowBlur:3,
// shadowOffsetX: 2,
// shadowOffsetY: 2,
// shadowColor: '#999',
// padding: [0, 7],
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
abg: {
backgroundColor: '#333',
width: '100%',
align: 'right',
height: 22,
borderRadius: [4, 4, 0, 0]
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 16,
lineHeight: 33
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
}
}
}
}
]
}
this.chartPie = echarts.init(document.getElementById('J_chartPieBox'))
this.chartPie.setOption(option)
window.addEventListener('resize', () => {
this.chartPie.resize()
})
},
initChartScatter () {
var option = {
backgroundColor: '#0079BA',
title: {
text: '大系列库位数量情况(外圈总量,内圈库存)',
left: 'center',
top: 0,
textStyle: {
color: '#fff'
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 10,
data: [
'成品',
'半成品',
'原材料'
],
textStyle: {
fontSize: 14,
color: '#fff'
}
},
series: [
{
name: '库位数',
type: 'pie',
radius: [0, '40%'],
itemStyle: {
normal: {
label: {
position: 'inner',
fontSize: 14,
formatter: '{b}: {c}'
}
}
},
labelLine: {
show: false
},
data: [
{ value: this.secondPointList.countPositionFinishedProduct, name: `成品` },
{ value: this.secondPointList.countPositionSemiFinishedProduct, name: `半成品` },
{ value: this.secondPointList.countPositionRawMaterials, name: `原材料` }
]
},
{
name: '数量',
type: 'pie',
radius: ['50%', '75%'],
itemStyle: {
normal: {
label: {
formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}}{c} {per|{d}%} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
// shadowBlur:3,
// shadowOffsetX: 2,
// shadowOffsetY: 2,
// shadowColor: '#999',
// padding: [0, 7],
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
abg: {
backgroundColor: '#333',
width: '100%',
align: 'right',
height: 22,
borderRadius: [4, 4, 0, 0]
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 16,
lineHeight: 33
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
}
}
},
data: [
{ value: this.secondPointList.countQuantityFinishedProduct, name: `成品` },
{ value: this.secondPointList.countQuantitySemiFinishedProduct, name: `半成品` },
{ value: this.secondPointList.countQuantityRawMaterials, name: `原材料` }
]
}
]
}
this.chartBar = echarts.init(
document.getElementById('J_chartScatterBox')
)
this.chartBar.setOption(option)
window.addEventListener('resize', () => {
this.chartBar.resize()
})
},
initCate () {
let option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: [
'数量',
'库位数量'
],
textStyle: {
fontSize: 14,
color: '#fff'
}
},
color: ['#c23531', '#ff7f50'],
xAxis: [
{
type: 'category',
data: ['盒底', '盒盖'],
axisPointer: {
type: 'shadow'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
nameTextStyle: {
fontSize: 20,
color: '#fff'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
},
{
type: 'value',
name: '库位数量',
min: 0,
max: 50,
nameTextStyle: {
fontSize: 20,
color: '#fff'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
}
],
series: [
{
name: '数量',
type: 'bar',
itemStyle: {
normal: {
label: {
show: true,
position: 'inside'
}
}
},
data: [this.coverList.baseQuantity, this.coverList.coverQuantity]
},
{
name: '库位数量',
type: 'bar',
data: [this.coverList.basePosition, this.coverList.coverPosition],
yAxisIndex: 1,
itemStyle: {
normal: {
label: {
show: true,
position: 'inside'
}
}
}
}
]
}
this.chartCate = echarts.init(document.getElementById('J_category'))
this.chartCate.setOption(option)
window.addEventListener('resize', () => {
this.chartCate.resize()
})
},
initAxis () {
let option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: [
'数量',
'库位数量'
],
textStyle: {
fontSize: 14,
color: '#fff'
},
top: 20
},
title: {
text: '成品小系列库位数量情况',
left: 'center',
top: 0,
textStyle: {
color: '#fff'
}
},
color: ['#FFCD42', '#87cefa'],
xAxis: [
{
type: 'category',
data: this.smallList.categoryName,
axisPointer: {
type: 'shadow'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
}
],
yAxis: [
{
type: 'value',
name: '数量',
nameTextStyle: {
fontSize: 20,
color: '#fff'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
},
{
type: 'value',
name: '库位数量',
min: 0,
max: 100,
nameTextStyle: {
fontSize: 20,
color: '#fff'
},
axisLabel: {
fontSize: 16,
color: '#fff'
}
}
],
series: [
{
name: '数量',
type: 'bar',
itemStyle: {
normal: {
label: {
show: true,
position: 'top'
}
}
},
data: this.smallList.quantity
},
{
name: '库位数量',
type: 'bar',
data: this.smallList.position,
yAxisIndex: 1,
itemStyle: {
normal: {
label: {
show: true,
position: 'top'
}
}
}
}
]
}
this.chartAxis = echarts.init(document.getElementById('J_axis'))
this.chartAxis.setOption(option)
window.addEventListener('resize', () => {
this.chartAxis.resize()
})
}
}
}
</script>
<style lang='scss'>
.mod-demo-echarts {
background-color: #0079ba;
> .el-alert {
margin-bottom: 10px;
}
> .el-row {
.el-col {
padding-top: 10px;
padding-bottom: 10px;
}
}
.chart-box {
min-height: 44vh;
}
}
.tagClass{
height: 6%;
font-size: 30px;
}
.titleClass{
width: 70%;
margin-left: 15%;
background: #B8D4E9;
}
</style>

294
src/views/common/home.vue Normal file
View File

@@ -0,0 +1,294 @@
<template>
<div class="home" :style="siteContentViewHeight">
<div class="treeChart">
<vue2-org-tree
name="test"
:data="cardList"
:horizontal="horizontal"
:collapsable="collapsable"
:render-content="renderContent"
@on-expand="onExpand"
@on-node-click="onNodeClick"
/>
</div>
<div class="STaskInfo">
<div style="padding:15px 5px">
<label :style="styleSObj" @click="sTaskClick"><b>{{sText}}</b></label>
<label style="float:right">{{sTaskInfoNum}}</label>
</div>
<el-table
v-if="openSTask"
:data="sTaskInfo"
border
size=mini>
<el-table-column
prop="createTime"
label="创建日期"
width="150px"
header-align="center" align="center">
</el-table-column>
<el-table-column
prop="taskType"
label="任务类型"
width="50px"
header-align="center"
align="center">
<template slot-scope="scope">
{{ scope.row.taskType === 0 ? '出库' : '入库' }}
</template>
</el-table-column>
<el-table-column
prop="taskDetCode"
label="任务编码"
width="160px"
header-align="center" align="center">
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { isURL } from '@/utils/validate'
export default {
data () {
return {
cardHeight: null,
horizontal: false,
collapsable: false,
expandAll: false,
openSTask: true,
sTaskInfo: [],
sTaskInfoNum: 0,
sText: '等待中的子任务',
styleSObj: {marginLeft: '30%', cursor: 'pointer', fontSize: '18px'},
cardList: {
id: 0,
label: '流程图',
route: false,
children: [
{
id: 1,
label: '报表统计',
route: false,
children: [
{
id: 5,
label: '库位利用情况',
route: '/generator-mtccwarehouspositionrelat',
des: ''
}
]
},
{
id: 2,
label: '出入库任务',
route: false,
children: [
{
id: 6,
label: '当前任务',
route: '/generator-mtcctaskruninfo',
des: ''
},
{
id: 8,
label: '新增出库任务',
route: '/generator-mtcctaskruninfo?inout=1',
des: ''
},
{
id: 9,
label: '新增入库任务',
route: '/generator-mtcctaskruninfo?inout=2',
des: ''
}
]
},
{
id: 3,
label: '基础信息',
route: false,
children: [
{
id: 11,
label: '产品信息',
route: '/generator-mtccproduct',
des: ''
},
{
id: 7,
label: '硬件通讯信息',
route: '/generator-mtccencodingcontent',
des: ''
}
]
},
{
id: 4,
label: '操作日志',
route: false,
children: [
{
id: 12,
label: '硬件通讯信息日志',
route: '/generator-mtccdevicecommunlog',
des: ''
},
{
id: 13,
label: '出入库任务日志',
route: 'generator-mtcctaskruninfodetlog',
des: ''
}
]
}
]
},
showCardList: []
}
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight }
},
siteContentViewHeight () {
var height = this.documentClientHeight - 50 - 30 - 2 - 40 - 20
this.cardHeight = {minHeight: height / 2 - 20 + 'px', lineHeight: height / 2 - 60 + 'px'}
if (this.$route.meta.isTab) {
height -= 40
return isURL(this.$route.meta.iframeUrl) ? { height: height + 'px' } : { minHeight: height + 'px' }
}
return { minHeight: height + 'px' }
}
},
created () {
this.showSTaskInfo()
this.timer()
// this.init()
},
methods: {
// init () {
// var os = require('os')
// const obj = os.cpus()
// console.log('networkInterfaces : ' + obj)
// },
renderContent (h, data) {
return data.label
},
onExpand (data) {
if ('expand' in data) {
data.expand = !data.expand
if (!data.expand && data.children) {
this.collapse(data.children)
}
} else {
this.$set(data, 'expand', true)
}
},
onNodeClick (e, data) {
if (data.route) {
this.$router.push(data.route)
}
},
timer () {
return setInterval(() => {
this.showSTaskInfo()
}, 60000)
},
showSTaskInfo () {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/taskruninfodetlist'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
console.log(data)
this.sTaskInfo = data.list
this.sTaskInfoNum = this.sTaskInfo.length
}
})
},
sTaskClick () {
this.openSTask = !this.openSTask
if (this.openSTask) {
this.sText = '等待中的子任务'
this.styleSObj.marginLeft = '30%'
} else {
this.sText = '子任务'
this.styleSObj.marginLeft = '10%'
}
}
}
}
</script>
<style lang="scss" scoped>
.home{
width: 100%;
display: flex;
.pointclass{
cursor: pointer;
}
.treeChart{
width: 100%;
height: 100%;
position: relative;
.home-card {
width: 46%;
margin: 10px;
min-width: 330px;
display: inline-block;
background: #FF4C52;
color: #fff;
text-align: center;
cursor: pointer;
font-size: 28px;
}
}
.STaskInfo{
max-height: 400px;
overflow: auto;
position: absolute;
right: 80px;
bottom: 30px;
border-radius: 10px;
box-shadow: 0px 0px 10px;
}
}
</style>
<style lang="scss">
.help-detail{
.el-button+.el-button{
margin-left: 0
}
.help-detail-des{
text-indent: 2em;
line-height: 30px;
font-size: 18px;
}
}
.org-tree-node-children{
padding-top: 100px !important;
}
.org-tree-node-children:before {
height: 100px !important;
}
.org-tree-node{
.org-tree-node-children{
.org-tree-node{
.org-tree-node-children{
.org-tree-node-label{
cursor: pointer;
background: #1989fa;
opacity: .5;
color: #fff;
}
.org-tree-node-label:hover{
opacity: 1;
}
}
}
}
}
</style>

168
src/views/common/login.vue Normal file
View File

@@ -0,0 +1,168 @@
<template>
<div class="site-wrapper site-page--login">
<div class="site-content__wrapper">
<div class="site-content">
<div class="brand-info">
<h2 class="brand-info__text">奔一智能仓库</h2>
<p class="brand-info__intro"></p>
</div>
<div class="login-main">
<h3 class="login-title">管理员登录</h3>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
status-icon
>
<el-form-item prop="userName">
<el-input
v-model="dataForm.userName"
placeholder="帐号"
></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="dataForm.password"
type="password"
placeholder="密码"
></el-input>
</el-form-item>
<el-form-item>
<el-button
class="login-btn-submit"
type="primary"
@click="dataFormSubmit()"
>登录</el-button
>
</el-form-item>
</el-form>
</div>
</div>
</div>
</div>
</template>
<script>
// import { getUUID } from '@/utils'
export default {
data () {
return {
dataForm: {
userName: 'admin',
password: 'admin',
uuid: ''
},
dataRule: {
userName: [
{ required: true, message: '帐号不能为空', trigger: 'blur' }
],
password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
}
}
},
created () {
// this.dataFormSubmit()
},
methods: {
// 提交表单
dataFormSubmit () {
this.$http({
url: this.$http.adornUrl('/sys/login'),
method: 'post',
data: this.$http.adornData({
username: this.dataForm.userName,
password: this.dataForm.password,
uuid: this.dataForm.uuid
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$cookie.set('token', data.token)
this.$router.replace({ name: 'home' })
} else {
this.$message.error(data.msg)
}
})
}
}
}
</script>
<style lang="scss">
.site-wrapper.site-page--login {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(38, 50, 56, 0.3);
overflow: hidden;
&:before {
position: fixed;
top: 0;
left: 0;
z-index: -1;
width: 80%;
height: 100%;
content: "";
background-image: url(~@/assets/img/loginbg.png);
background-size: cover;
}
.site-content__wrapper {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: 0;
margin: 0;
overflow-x: hidden;
overflow-y: auto;
background-color: transparent;
}
.site-content {
min-height: 100%;
padding: 30px 500px 30px 30px;
}
.brand-info {
margin: 220px 100px 0 90px;
color: #fff;
}
.brand-info__text {
margin: 0 0 22px 30%;
font-size: 48px;
font-weight: 400;
text-transform: uppercase;
}
.brand-info__intro {
margin: 10px 0;
font-size: 16px;
line-height: 1.58;
opacity: 0.6;
}
.login-main {
position: absolute;
top: 0;
right: 0;
padding: 150px 60px 180px;
width: 470px;
min-height: 100%;
background-color: #fff;
}
.login-title {
font-size: 16px;
}
.login-captcha {
overflow: hidden;
> img {
width: 100%;
cursor: pointer;
}
}
.login-btn-submit {
width: 100%;
margin-top: 38px;
}
}
</style>

View File

@@ -0,0 +1,33 @@
<template>
<el-form>
<h2>布局设置</h2>
<el-form-item label="导航条类型">
<el-radio-group v-model="navbarLayoutType">
<el-radio label="default" border>default</el-radio>
<el-radio label="inverse" border>inverse</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="侧边栏皮肤">
<el-radio-group v-model="sidebarLayoutSkin">
<el-radio label="light" border>light</el-radio>
<el-radio label="dark" border>dark</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</template>
<script>
export default {
computed: {
navbarLayoutType: {
get () { return this.$store.state.common.navbarLayoutType },
set (val) { this.$store.commit('common/updateNavbarLayoutType', val) }
},
sidebarLayoutSkin: {
get () { return this.$store.state.common.sidebarLayoutSkin },
set (val) { this.$store.commit('common/updateSidebarLayoutSkin', val) }
}
}
}
</script>

472
src/views/demo/echarts.vue Normal file
View File

@@ -0,0 +1,472 @@
<template>
<div class="mod-demo-echarts">
<el-alert
title="提示:"
type="warning"
:closable="false">
<div slot-scope="description">
<p class="el-alert__description">1. 此Demo只提供ECharts官方使用文档入门部署和体验功能具体使用请参考http://echarts.baidu.com/index.html</p>
</div>
</el-alert>
<el-row :gutter="20">
<el-col :span="24">
<el-card>
<div id="J_chartLineBox" class="chart-box"></div>
</el-card>
</el-col>
<el-col :span="24">
<el-card>
<div id="J_chartBarBox" class="chart-box"></div>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div id="J_chartPieBox" class="chart-box"></div>
</el-card>
</el-col>
<el-col :span="12">
<el-card>
<div id="J_chartScatterBox" class="chart-box"></div>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
data () {
return {
chartLine: null,
chartBar: null,
chartPie: null,
chartScatter: null
}
},
mounted () {
this.initChartLine()
this.initChartBar()
this.initChartPie()
this.initChartScatter()
},
activated () {
// 由于给echart添加了resize事件, 在组件激活时需要重新resize绘画一次, 否则出现空白bug
if (this.chartLine) {
this.chartLine.resize()
}
if (this.chartBar) {
this.chartBar.resize()
}
if (this.chartPie) {
this.chartPie.resize()
}
if (this.chartScatter) {
this.chartScatter.resize()
}
},
methods: {
// 折线图
initChartLine () {
var option = {
'title': {
'text': '折线图堆叠'
},
'tooltip': {
'trigger': 'axis'
},
'legend': {
'data': [ '邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎' ]
},
'grid': {
'left': '3%',
'right': '4%',
'bottom': '3%',
'containLabel': true
},
'toolbox': {
'feature': {
'saveAsImage': { }
}
},
'xAxis': {
'type': 'category',
'boundaryGap': false,
'data': [ '周一', '周二', '周三', '周四', '周五', '周六', '周日' ]
},
'yAxis': {
'type': 'value'
},
'series': [
{
'name': '邮件营销',
'type': 'line',
'stack': '总量',
'data': [ 120, 132, 101, 134, 90, 230, 210 ]
},
{
'name': '联盟广告',
'type': 'line',
'stack': '总量',
'data': [ 220, 182, 191, 234, 290, 330, 310 ]
},
{
'name': '视频广告',
'type': 'line',
'stack': '总量',
'data': [ 150, 232, 201, 154, 190, 330, 410 ]
},
{
'name': '直接访问',
'type': 'line',
'stack': '总量',
'data': [ 320, 332, 301, 334, 390, 330, 320 ]
},
{
'name': '搜索引擎',
'type': 'line',
'stack': '总量',
'data': [ 820, 932, 901, 934, 1290, 1330, 1320 ]
}
]
}
this.chartLine = echarts.init(document.getElementById('J_chartLineBox'))
this.chartLine.setOption(option)
window.addEventListener('resize', () => {
this.chartLine.resize()
})
},
// 柱状图
initChartBar () {
var option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ['直接访问', '邮件营销', '联盟广告', '视频广告', '搜索引擎', '百度', '谷歌', '必应', '其他']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '直接访问',
type: 'bar',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '邮件营销',
type: 'bar',
stack: '广告',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '联盟广告',
type: 'bar',
stack: '广告',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '视频广告',
type: 'bar',
stack: '广告',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '搜索引擎',
type: 'bar',
data: [862, 1018, 964, 1026, 1679, 1600, 1570],
markLine: {
lineStyle: {
normal: {
type: 'dashed'
}
},
data: [
[{ type: 'min' }, { type: 'max' }]
]
}
},
{
name: '百度',
type: 'bar',
barWidth: 5,
stack: '搜索引擎',
data: [620, 732, 701, 734, 1090, 1130, 1120]
},
{
name: '谷歌',
type: 'bar',
stack: '搜索引擎',
data: [120, 132, 101, 134, 290, 230, 220]
},
{
name: '必应',
type: 'bar',
stack: '搜索引擎',
data: [60, 72, 71, 74, 190, 130, 110]
},
{
name: '其他',
type: 'bar',
stack: '搜索引擎',
data: [62, 82, 91, 84, 109, 110, 120]
}
]
}
this.chartBar = echarts.init(document.getElementById('J_chartBarBox'))
this.chartBar.setOption(option)
window.addEventListener('resize', () => {
this.chartBar.resize()
})
},
// 饼状图
initChartPie () {
var option = {
backgroundColor: '#2c343c',
title: {
text: 'Customized Pie',
left: 'center',
top: 20,
textStyle: {
color: '#ccc'
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
visualMap: {
show: false,
min: 80,
max: 600,
inRange: {
colorLightness: [0, 1]
}
},
series: [
{
name: '访问来源',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [
{ value: 335, name: '直接访问' },
{ value: 310, name: '邮件营销' },
{ value: 274, name: '联盟广告' },
{ value: 235, name: '视频广告' },
{ value: 400, name: '搜索引擎' }
].sort(function (a, b) { return a.value - b.value }),
roseType: 'radius',
label: {
normal: {
textStyle: {
color: 'rgba(255, 255, 255, 0.3)'
}
}
},
labelLine: {
normal: {
lineStyle: {
color: 'rgba(255, 255, 255, 0.3)'
},
smooth: 0.2,
length: 10,
length2: 20
}
},
itemStyle: {
normal: {
color: '#c23531',
shadowBlur: 200,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
animationType: 'scale',
animationEasing: 'elasticOut',
animationDelay: function (idx) {
return Math.random() * 200
}
}
]
}
this.chartPie = echarts.init(document.getElementById('J_chartPieBox'))
this.chartPie.setOption(option)
window.addEventListener('resize', () => {
this.chartPie.resize()
})
},
// 散点图
initChartScatter () {
var option = {
backgroundColor: new echarts.graphic.RadialGradient(0.3, 0.3, 0.8, [
{ offset: 0, color: '#f7f8fa' },
{ offset: 1, color: '#cdd0d5' }
]),
title: {
text: '1990 与 2015 年各国家人均寿命与 GDP'
},
legend: {
right: 10,
data: ['1990', '2015']
},
xAxis: {
splitLine: {
lineStyle: {
type: 'dashed'
}
}
},
yAxis: {
splitLine: {
lineStyle: {
type: 'dashed'
}
},
scale: true
},
series: [
{
name: '1990',
data: [
[28604, 77, 17096869, 'Australia', 1990],
[31163, 77.4, 27662440, 'Canada', 1990],
[1516, 68, 1154605773, 'China', 1990],
[13670, 74.7, 10582082, 'Cuba', 1990],
[28599, 75, 4986705, 'Finland', 1990],
[29476, 77.1, 56943299, 'France', 1990],
[31476, 75.4, 78958237, 'Germany', 1990],
[28666, 78.1, 254830, 'Iceland', 1990],
[1777, 57.7, 870601776, 'India', 1990],
[29550, 79.1, 122249285, 'Japan', 1990],
[2076, 67.9, 20194354, 'North Korea', 1990],
[12087, 72, 42972254, 'South Korea', 1990],
[24021, 75.4, 3397534, 'New Zealand', 1990],
[43296, 76.8, 4240375, 'Norway', 1990],
[10088, 70.8, 38195258, 'Poland', 1990],
[19349, 69.6, 147568552, 'Russia', 1990],
[10670, 67.3, 53994605, 'Turkey', 1990],
[26424, 75.7, 57110117, 'United Kingdom', 1990],
[37062, 75.4, 252847810, 'United States', 1990]
],
type: 'scatter',
symbolSize: function (data) {
return Math.sqrt(data[2]) / 5e2
},
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[3]
},
position: 'top'
}
},
itemStyle: {
normal: {
shadowBlur: 10,
shadowColor: 'rgba(120, 36, 50, 0.5)',
shadowOffsetY: 5,
color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
{ offset: 0, color: 'rgb(251, 118, 123)' },
{ offset: 1, color: 'rgb(204, 46, 72)' }
])
}
}
},
{
name: '2015',
data: [
[44056, 81.8, 23968973, 'Australia', 2015],
[43294, 81.7, 35939927, 'Canada', 2015],
[13334, 76.9, 1376048943, 'China', 2015],
[21291, 78.5, 11389562, 'Cuba', 2015],
[38923, 80.8, 5503457, 'Finland', 2015],
[37599, 81.9, 64395345, 'France', 2015],
[44053, 81.1, 80688545, 'Germany', 2015],
[42182, 82.8, 329425, 'Iceland', 2015],
[5903, 66.8, 1311050527, 'India', 2015],
[36162, 83.5, 126573481, 'Japan', 2015],
[1390, 71.4, 25155317, 'North Korea', 2015],
[34644, 80.7, 50293439, 'South Korea', 2015],
[34186, 80.6, 4528526, 'New Zealand', 2015],
[64304, 81.6, 5210967, 'Norway', 2015],
[24787, 77.3, 38611794, 'Poland', 2015],
[23038, 73.13, 143456918, 'Russia', 2015],
[19360, 76.5, 78665830, 'Turkey', 2015],
[38225, 81.4, 64715810, 'United Kingdom', 2015],
[53354, 79.1, 321773631, 'United States', 2015]
],
type: 'scatter',
symbolSize: function (data) {
return Math.sqrt(data[2]) / 5e2
},
label: {
emphasis: {
show: true,
formatter: function (param) {
return param.data[3]
},
position: 'top'
}
},
itemStyle: {
normal: {
shadowBlur: 10,
shadowColor: 'rgba(25, 100, 150, 0.5)',
shadowOffsetY: 5,
color: new echarts.graphic.RadialGradient(0.4, 0.3, 1, [
{ offset: 0, color: 'rgb(129, 227, 238)' },
{ offset: 1, color: 'rgb(25, 183, 207)' }
])
}
}
}
]
}
this.chartPie = echarts.init(document.getElementById('J_chartScatterBox'))
this.chartPie.setOption(option)
window.addEventListener('resize', () => {
this.chartPie.resize()
})
}
}
}
</script>
<style lang="scss">
.mod-demo-echarts {
> .el-alert {
margin-bottom: 10px;
}
> .el-row {
margin-top: -10px;
margin-bottom: -10px;
.el-col {
padding-top: 10px;
padding-bottom: 10px;
}
}
.chart-box {
min-height: 400px;
}
}
</style>

View File

@@ -0,0 +1,65 @@
<template>
<div class="mod-demo-ueditor">
<el-alert
title="提示:"
type="warning"
:closable="false">
<div slot-scope="description">
<p class="el-alert__description">1. 此Demo只提供UEditor官方使用文档入门部署和体验功能具体使用请参考http://fex.baidu.com/ueditor/</p>
<p class="el-alert__description">2. 浏览器控制台报错请求后台配置项http错误上传功能将不能正常使用此错需要后台提供上传接口方法赋值给serverUrl属性</p>
</div>
</el-alert>
<script :id="ueId" class="ueditor-box" type="text/plain" style="width: 100%; height: 260px;">hello world!</script>
<!-- 获取内容 -->
<p><el-button @click="getContent()">获得内容</el-button></p>
<el-dialog
title="内容"
:visible.sync="dialogVisible"
:append-to-body="true">
{{ ueContent }}
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import ueditor from 'ueditor'
export default {
data () {
return {
ue: null,
ueId: `J_ueditorBox_${new Date().getTime()}`,
ueContent: '',
dialogVisible: false
}
},
mounted () {
this.ue = ueditor.getEditor(this.ueId, {
// serverUrl: '', // 服务器统一请求接口路径
zIndex: 3000
})
},
methods: {
getContent () {
this.dialogVisible = true
this.ue.ready(() => {
this.ueContent = this.ue.getContent()
})
}
}
}
</script>
<style lang="scss">
.mod-demo-ueditor {
position: relative;
z-index: 510;
> .el-alert {
margin-bottom: 10px;
}
}
</style>

125
src/views/main-content.vue Normal file
View File

@@ -0,0 +1,125 @@
<template>
<main class="site-content" :class="{ 'site-content--tabs': $route.meta.isTab }">
<!-- 主入口标签页 s -->
<el-tabs
v-if="$route.meta.isTab"
v-model="mainTabsActiveName"
:closable="true"
@tab-click="selectedTabHandle"
@tab-remove="removeTabHandle">
<el-dropdown class="site-tabs__tools" :show-timeout="0">
<i class="el-icon-arrow-down el-icon--right"></i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="tabsCloseCurrentHandle">关闭当前标签页</el-dropdown-item>
<el-dropdown-item @click.native="tabsCloseOtherHandle">关闭其它标签页</el-dropdown-item>
<el-dropdown-item @click.native="tabsCloseAllHandle">关闭全部标签页</el-dropdown-item>
<el-dropdown-item @click.native="tabsRefreshCurrentHandle">刷新当前标签页</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-tab-pane
v-for="item in mainTabs"
:key="item.name"
:label="item.title"
:name="item.name">
<el-card :body-style="siteContentViewHeight">
<iframe
v-if="item.type === 'iframe'"
:src="item.iframeUrl"
width="100%" height="100%" frameborder="0" scrolling="yes">
</iframe>
<keep-alive v-else>
<router-view v-if="item.name === mainTabsActiveName" />
</keep-alive>
</el-card>
</el-tab-pane>
</el-tabs>
<!-- 主入口标签页 e -->
<el-card v-else :body-style="siteContentViewHeight">
<keep-alive>
<router-view />
</keep-alive>
</el-card>
</main>
</template>
<script>
import { isURL } from '@/utils/validate'
export default {
data () {
return {
}
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight }
},
menuActiveName: {
get () { return this.$store.state.common.menuActiveName },
set (val) { this.$store.commit('common/updateMenuActiveName', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
},
mainTabsActiveName: {
get () { return this.$store.state.common.mainTabsActiveName },
set (val) { this.$store.commit('common/updateMainTabsActiveName', val) }
},
siteContentViewHeight () {
var height = this.documentClientHeight - 50 - 30 - 2
if (this.$route.meta.isTab) {
height -= 40
return isURL(this.$route.meta.iframeUrl) ? { height: height + 'px' } : { minHeight: height + 'px' }
}
return { minHeight: height + 'px' }
}
},
methods: {
// tabs, 选中tab
selectedTabHandle (tab) {
tab = this.mainTabs.filter(item => item.name === tab.name)
if (tab.length >= 1) {
this.$router.push({ name: tab[0].name })
}
},
// tabs, 删除tab
removeTabHandle (tabName) {
this.mainTabs = this.mainTabs.filter(item => item.name !== tabName)
if (this.mainTabs.length >= 1) {
// 当前选中tab被删除
if (tabName === this.mainTabsActiveName) {
this.$router.push({ name: this.mainTabs[this.mainTabs.length - 1].name }, () => {
this.mainTabsActiveName = this.$route.name
})
}
} else {
this.menuActiveName = ''
this.$router.push({ name: 'home' })
}
},
// tabs, 关闭当前
tabsCloseCurrentHandle () {
this.removeTabHandle(this.mainTabsActiveName)
},
// tabs, 关闭其它
tabsCloseOtherHandle () {
this.mainTabs = this.mainTabs.filter(item => item.name === this.mainTabsActiveName)
},
// tabs, 关闭全部
tabsCloseAllHandle () {
this.mainTabs = []
this.menuActiveName = ''
this.$router.push({ name: 'home' })
},
// tabs, 刷新当前
tabsRefreshCurrentHandle () {
var tempTabName = this.mainTabsActiveName
this.removeTabHandle(tempTabName)
this.$nextTick(() => {
this.$router.push({ name: tempTabName })
})
}
}
}
</script>

View File

@@ -0,0 +1,112 @@
<template>
<el-dialog
title="修改密码"
:visible.sync="visible"
:append-to-body="true">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="账号">
<span>{{ userName }}</span>
</el-form-item>
<el-form-item label="原密码" prop="password">
<el-input type="password" v-model="dataForm.password"></el-input>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input type="password" v-model="dataForm.newPassword"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="confirmPassword">
<el-input type="password" v-model="dataForm.confirmPassword"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { clearLoginInfo } from '@/utils'
export default {
data () {
var validateConfirmPassword = (rule, value, callback) => {
if (this.dataForm.newPassword !== value) {
callback(new Error('确认密码与新密码不一致'))
} else {
callback()
}
}
return {
visible: false,
dataForm: {
password: '',
newPassword: '',
confirmPassword: ''
},
dataRule: {
password: [
{ required: true, message: '原密码不能为空', trigger: 'blur' }
],
newPassword: [
{ required: true, message: '新密码不能为空', trigger: 'blur' }
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
{ validator: validateConfirmPassword, trigger: 'blur' }
]
}
}
},
computed: {
userName: {
get () { return this.$store.state.user.name }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
}
},
methods: {
// 初始化
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/sys/user/password'),
method: 'post',
data: this.$http.adornData({
'password': this.dataForm.password,
'newPassword': this.dataForm.newPassword
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$nextTick(() => {
this.mainTabs = []
clearLoginInfo()
this.$router.replace({ name: 'login' })
})
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

102
src/views/main-navbar.vue Normal file
View File

@@ -0,0 +1,102 @@
<template>
<nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
<div class="site-navbar__header">
<h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
<a class="site-navbar__brand-lg" href="javascript:;">智能立体仓库</a>
<a class="site-navbar__brand-mini" href="javascript:;">仓库</a>
</h1>
</div>
<div class="site-navbar__body clearfix">
<el-menu
class="site-navbar__menu"
mode="horizontal">
<el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
<icon-svg name="zhedie"></icon-svg>
</el-menu-item>
</el-menu>
<el-menu
class="site-navbar__menu site-navbar__menu--right"
mode="horizontal">
<el-menu-item index="1" @click="$router.push({ name: 'theme' })">
<template slot="title">
<el-badge value="new">
<icon-svg name="shezhi" class="el-icon-setting"></icon-svg>
</el-badge>
</template>
</el-menu-item>
<el-menu-item class="site-navbar__avatar" index="3">
<el-dropdown :show-timeout="0" placement="bottom">
<span class="el-dropdown-link">
<img src="~@/assets/img/avatar.png" :alt="userName">{{ userName }}
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
<el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
</el-menu>
</div>
<!-- 弹窗, 修改密码 -->
<update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
</nav>
</template>
<script>
import UpdatePassword from './main-navbar-update-password'
import { clearLoginInfo } from '@/utils'
export default {
data () {
return {
updatePassowrdVisible: false
}
},
components: {
UpdatePassword
},
computed: {
navbarLayoutType: {
get () { return this.$store.state.common.navbarLayoutType }
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold },
set (val) { this.$store.commit('common/updateSidebarFold', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
},
userName: {
get () { return this.$store.state.user.name }
}
},
methods: {
// 修改密码
updatePasswordHandle () {
this.updatePassowrdVisible = true
this.$nextTick(() => {
this.$refs.updatePassowrd.init()
})
},
// 退出
logoutHandle () {
this.$confirm(`确定进行[退出]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/logout'),
method: 'post',
data: this.$http.adornData()
}).then(({data}) => {
if (data && data.code === 0) {
clearLoginInfo()
this.$router.push({ name: 'login' })
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,55 @@
<template>
<el-submenu
v-if="menu.list && menu.list.length >= 1"
:index="menu.menuId + ''"
:popper-class="'site-sidebar--' + sidebarLayoutSkin + '-popper'">
<template slot="title">
<icon-svg :name="menu.icon || ''" class="site-sidebar__menu-icon"></icon-svg>
<span>{{ menu.name }}</span>
</template>
<sub-menu
v-for="item in menu.list"
:key="item.menuId"
:menu="item"
:dynamicMenuRoutes="dynamicMenuRoutes">
</sub-menu>
</el-submenu>
<el-menu-item v-else :index="menu.menuId + ''" @click="gotoRouteHandle(menu)">
<icon-svg :name="menu.icon || ''" class="site-sidebar__menu-icon"></icon-svg>
<span>{{ menu.name }}</span>
</el-menu-item>
</template>
<script>
import SubMenu from './main-sidebar-sub-menu'
export default {
name: 'sub-menu',
props: {
menu: {
type: Object,
required: true
},
dynamicMenuRoutes: {
type: Array,
required: true
}
},
components: {
SubMenu
},
computed: {
sidebarLayoutSkin: {
get () { return this.$store.state.common.sidebarLayoutSkin }
}
},
methods: {
// 通过menuId与动态(菜单)路由进行匹配跳转至指定路由
gotoRouteHandle (menu) {
var route = this.dynamicMenuRoutes.filter(item => item.meta.menuId === menu.menuId)
if (route.length >= 1) {
this.$router.push({ name: route[0].name })
}
}
}
}
</script>

104
src/views/main-sidebar.vue Normal file
View File

@@ -0,0 +1,104 @@
<template>
<aside class="site-sidebar" :class="'site-sidebar--' + sidebarLayoutSkin">
<div class="site-sidebar__inner">
<el-menu
:default-active="menuActiveName || 'home'"
:collapse="sidebarFold"
:collapseTransition="false"
class="site-sidebar__menu">
<el-menu-item index="home" @click="$router.push({ name: 'home' })">
<icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
<span slot="title">首页</span>
</el-menu-item>
<el-menu-item index="bigScreen" @click="getUrl">
<icon-svg name="shouye" class="site-sidebar__menu-icon"></icon-svg>
<span slot="title">大屏</span>
</el-menu-item>
<sub-menu
v-for="menu in menuList"
:key="menu.menuId"
:menu="menu"
:dynamicMenuRoutes="dynamicMenuRoutes">
</sub-menu>
</el-menu>
</div>
</aside>
</template>
<script>
import SubMenu from './main-sidebar-sub-menu'
import { isURL } from '@/utils/validate'
export default {
data () {
return {
dynamicMenuRoutes: []
}
},
components: {
SubMenu
},
computed: {
sidebarLayoutSkin: {
get () { return this.$store.state.common.sidebarLayoutSkin }
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold }
},
menuList: {
get () { return this.$store.state.common.menuList },
set (val) { this.$store.commit('common/updateMenuList', val) }
},
menuActiveName: {
get () { return this.$store.state.common.menuActiveName },
set (val) { this.$store.commit('common/updateMenuActiveName', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
},
mainTabsActiveName: {
get () { return this.$store.state.common.mainTabsActiveName },
set (val) { this.$store.commit('common/updateMainTabsActiveName', val) }
}
},
watch: {
$route: 'routeHandle'
},
created () {
this.menuList = JSON.parse(sessionStorage.getItem('menuList') || '[]')
this.dynamicMenuRoutes = JSON.parse(sessionStorage.getItem('dynamicMenuRoutes') || '[]')
this.routeHandle(this.$route)
},
methods: {
getUrl () {
let routeData = this.$router.resolve({ path: '/bigScreen' })
window.open(routeData.href, '_blank')
},
// 路由操作
routeHandle (route) {
if (route.meta.isTab) {
// tab选中, 不存在先添加
var tab = this.mainTabs.filter(item => item.name === route.name)[0]
if (!tab) {
if (route.meta.isDynamic) {
route = this.dynamicMenuRoutes.filter(item => item.name === route.name)[0]
if (!route) {
return console.error('未能找到可用标签页!')
}
}
tab = {
menuId: route.meta.menuId || route.name,
name: route.name,
title: route.meta.title,
type: isURL(route.meta.iframeUrl) ? 'iframe' : 'module',
iframeUrl: route.meta.iframeUrl || ''
}
this.mainTabs = this.mainTabs.concat(tab)
}
this.menuActiveName = tab.menuId + ''
this.mainTabsActiveName = tab.name
}
}
}
}
</script>

128
src/views/main.vue Normal file
View File

@@ -0,0 +1,128 @@
<template>
<div
class="site-wrapper"
:class="{ 'site-sidebar--fold': sidebarFold }"
v-loading.fullscreen.lock="loading"
element-loading-text="拼命加载中">
<template v-if="!loading">
<main-navbar />
<main-sidebar />
<div class="site-content__wrapper" :style="{ 'min-height': documentClientHeight + 'px' }">
<main-content />
</div>
</template>
</div>
</template>
<script>
import MainNavbar from './main-navbar'
import MainSidebar from './main-sidebar'
import MainContent from './main-content'
export default {
data () {
return {
loading: true,
websock: ''
}
},
components: {
MainNavbar,
MainSidebar,
MainContent
},
computed: {
documentClientHeight: {
get () { return this.$store.state.common.documentClientHeight },
set (val) { this.$store.commit('common/updateDocumentClientHeight', val) }
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold }
},
userId: {
get () { return this.$store.state.user.id },
set (val) { this.$store.commit('user/updateId', val) }
},
userName: {
get () { return this.$store.state.user.name },
set (val) { this.$store.commit('user/updateName', val) }
}
},
created () {
this.getUserInfo()
this.initWebSocket()
},
mounted () {
this.resetDocumentClientHeight()
setInterval(this.websocketsend, 30000)
},
methods: {
// 重置窗口可视高度
resetDocumentClientHeight () {
this.documentClientHeight = document.documentElement['clientHeight']
window.onresize = () => {
this.documentClientHeight = document.documentElement['clientHeight']
}
},
// 获取当前管理员信息
getUserInfo () {
this.$http({
url: this.$http.adornUrl('/sys/user/info'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.loading = false
this.userId = data.user.userId
this.userName = data.user.username
}
})
},
initWebSocket () { // 初始化weosocket
var gFloor = localStorage.getItem('Floor')
let id = 0
switch (gFloor) {
case 'A1':
id = 1
break
case 'A2':
id = 2
break
case 'A3':
id = 3
break
case 'A4':
id = 4
break
case 'B1':
id = 5
break
}
const path = `ws://192.168.0.147:8083/benyi/websocket/${id}`
this.websock = new WebSocket(path)
this.websock.onmessage = this.websocketonmessage
this.websock.onopen = this.websocketonopen
this.websock.onerror = this.websocketonerror
this.websock.onclose = this.websocketclose
},
websocketonopen () { // 连接建立之后执行send方法发送数据
this.websocketsend(JSON.stringify())
},
websocketonerror () { // 连接建立失败重连
this.initWebSocket()
},
websocketonmessage (e) { // 数据接收
this.$notify.error({
title: '报警提示',
message: e.data,
duration: 15000
})
},
websocketsend () { // 数据发送
this.websock.send()
},
websocketclose (e) { // 关闭
console.log('断开连接', e)
}
}
}
</script>

View File

@@ -0,0 +1,93 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="状态" prop="status">
<el-input v-model="dataForm.status" placeholder="0表示写入设备1接受设备信息"></el-input>
</el-form-item>
<el-form-item label="内容集" prop="content">
<el-input v-model="dataForm.content" placeholder="内容集"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
status: '',
content: ''
},
dataRule: {
status: [
{ required: true, message: '状态不能为空', trigger: 'blur' }
],
content: [
{ required: true, message: '内容集不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccdevicecommunlog/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.status = data.mtccdevicecommunlog.status
this.dataForm.content = data.mtccdevicecommunlog.content
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccdevicecommunlog/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'status': this.dataForm.status,
'content': this.dataForm.content
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,175 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<!-- <el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item> -->
<el-form-item>
<el-button @click="getDataListShow()">刷新</el-button>
<!-- <el-button v-if="isAuth('generator:mtccdevicecommunlog:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
<!-- <el-button v-if="isAuth('generator:mtccdevicecommunlog:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="index"
width="50"
header-align="center" align="center"
label="序号">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
{{ scope.row.status === 0 ? '写入设备' : '接受设备信息' }}
</template>
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
label="内容集">
</el-table-column>
<!-- <el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtccdevicecommunlog-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataListShow()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccdevicecommunlog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
// selectionChangeHandle (val) {
// this.dataListSelections = val
// },
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtccdevicecommunlog/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,102 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="状态" prop="status">
<el-input v-model="dataForm.status" placeholder="0具体动作内容1报警信息"></el-input>
</el-form-item>
<el-form-item label="编码内容" prop="code">
<el-input v-model="dataForm.code" placeholder="编码内容"></el-input>
</el-form-item>
<el-form-item label="内容描述" prop="content">
<el-input v-model="dataForm.content" placeholder="内容描述"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
status: '',
code: '',
content: ''
},
dataRule: {
status: [
{ required: true, message: '状态不能为空', trigger: 'blur' }
],
code: [
{ required: true, message: '编码内容不能为空', trigger: 'blur' }
],
content: [
{ required: true, message: '内容描述不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccencodingcontent/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.status = data.mtccencodingcontent.status
this.dataForm.code = data.mtccencodingcontent.code
this.dataForm.content = data.mtccencodingcontent.content
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccencodingcontent/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'status': this.dataForm.status,
'code': this.dataForm.code,
'content': this.dataForm.content
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,206 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-autocomplete
class="inline-input"
v-model="dataForm.key"
placeholder="参数名"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
<el-button v-if="isAuth('generator:mtccencodingcontent:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<!-- <el-button v-if="isAuth('generator:mtccencodingcontent:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
type="index"
width="50"
header-align="center" align="center"
label="序号">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
</el-table-column>
<el-table-column
prop="code"
header-align="center"
align="center"
label="编码内容">
</el-table-column>
<el-table-column
prop="content"
header-align="center"
align="center"
label="内容描述">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtccencodingcontent-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataListShow()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtccencodingcontent/list'),
method: 'get',
params: this.$http.adornParams({
'page': 1,
'limit': 9999,
'key': queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
for (var i = 0; i < data.page.list.length; i++) {
var obj = { value: '' }
obj.value = data.page.list[i].content
results[i] = obj
}
}
cb(results)
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccencodingcontent/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
// selectionChangeHandle (val) {
// this.dataListSelections = val
// },
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtccencodingcontent/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,144 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="dataForm.productName" placeholder="产品名称"></el-input>
</el-form-item>
<el-form-item label="产品全名" prop="productAllName">
<el-input v-model="dataForm.productAllName" placeholder="产品全名"></el-input>
</el-form-item>
<el-form-item label="规格型号" prop="specModel">
<el-input v-model="dataForm.specModel" placeholder="规格型号"></el-input>
</el-form-item>
<el-form-item label="产品编码" prop="productCode">
<el-input v-model="dataForm.productCode" placeholder="产品编码,如果这个是对应没有明细产品对应的编码"></el-input>
</el-form-item>
<el-form-item label="产品类别" prop="productType">
<el-input v-model="dataForm.productType" placeholder="产品类别1:成品2:半成品3:原材料。"></el-input>
</el-form-item>
<!-- <el-form-item label="单位id" prop="unitId">
<el-input v-model="dataForm.unitId" placeholder="单位id"></el-input>
</el-form-item> -->
<el-form-item label="单位名称" prop="unitName">
<el-input v-model="dataForm.unitName" placeholder="单位名称"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
productName: '',
productAllName: '',
specModel: '',
productCode: '',
productType: '',
quantity: '',
unitId: '',
unitName: ''
},
dataRule: {
productName: [
{ required: true, message: '产品名称不能为空', trigger: 'blur' }
],
productAllName: [
{ required: true, message: '产品全名不能为空', trigger: 'blur' }
],
specModel: [
{ required: true, message: '规格型号不能为空', trigger: 'blur' }
],
productCode: [
{ required: true, message: '产品编码', trigger: 'blur' }
],
productType: [
{ required: true, message: '产品类别不能为空', trigger: 'blur' }
],
quantity: [
{ required: true, message: '货物数量不能为空', trigger: 'blur' }
],
unitId: [
{ required: true, message: '单位id不能为空', trigger: 'blur' }
],
unitName: [
{ required: true, message: '单位名称不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccproduct/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.productName = data.mtccproduct.productName
this.dataForm.productAllName = data.mtccproduct.productAllName
this.dataForm.specModel = data.mtccproduct.specModel
this.dataForm.productCode = data.mtccproduct.productCode
this.dataForm.productType = data.mtccproduct.productType
this.dataForm.quantity = data.mtccproduct.quantity
// this.dataForm.unitId = data.mtccproduct.unitId
this.dataForm.unitName = data.mtccproduct.unitName
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccproduct/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'productName': this.dataForm.productName,
'productAllName': this.dataForm.productAllName,
'specModel': this.dataForm.specModel,
'productCode': this.dataForm.productCode,
'productType': this.dataForm.productType,
'quantity': this.dataForm.quantity,
// 'unitId': this.dataForm.unitId,
'unitName': this.dataForm.unitName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,226 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-autocomplete
class="inline-input"
v-model="dataForm.key"
placeholder="产品名称或产品编码"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
<el-button v-if="isAuth('generator:mtccproduct:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<!-- <el-button v-if="isAuth('generator:mtccproduct:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="修改时间">
</el-table-column>
<el-table-column
prop="productName"
header-align="center"
align="center"
label="产品名称">
</el-table-column>
<el-table-column
prop="productAllName"
header-align="center"
align="center"
label="产品全名">
</el-table-column>
<el-table-column
prop="specModel"
header-align="center"
align="center"
label="规格型号">
</el-table-column>
<el-table-column
prop="productCode"
header-align="center"
align="center"
label="产品编码">
</el-table-column>
<el-table-column
prop="productType"
header-align="center"
align="center"
label="产品类别">
</el-table-column>
<el-table-column
prop="unitName"
header-align="center"
align="center"
label="单位名称">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtccproduct-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataListShow()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtccproduct/list'),
method: 'get',
params: this.$http.adornParams({
'page': 1,
'limit': 9999,
'key': queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
for (var i = 0; i < data.page.list.length; i++) {
var obj = { value: '' }
obj.value = data.page.list[i].productCode
results[i] = obj
}
}
cb(results)
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccproduct/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtccproduct/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,179 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px"
>
<el-form-item label="任务类型" prop="taskType">
<el-select
v-model="dataForm.taskType"
placeholder="任务类型0 出库1入库"
style="width:80%"
>
<el-option label="出库" :value="0"></el-option>
<el-option label="入库" :value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="产品编码" prop="model">
<el-autocomplete
class="inline-input"
v-model="dataForm.model"
placeholder="产品编码"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item label="起点" prop="startPoint">
<el-input v-model="dataForm.startPoint" placeholder="起点"></el-input>
</el-form-item>
<el-form-item label="终点" prop="endPoint">
<el-input v-model="dataForm.endPoint" placeholder="终点"></el-input>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="数量" oninput = "value=value.replace(/[^\d]/g,'')"></el-input>
</el-form-item>
<el-form-item label="批次号" prop="dateNum">
<el-input
v-model="dataForm.dateNum"
placeholder="请填写批次号"
></el-input>
<!-- oninput = "value=value.replace(/[^\d]/g,'')" -->
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="dataForm.remarks" placeholder="备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
taskType: '',
model: '',
startPoint: '',
endPoint: '',
num: '',
unit: '',
remarks: '',
dateNum: ''
},
dataRule: {
taskType: [
{ required: true, message: '任务类型不能为空', trigger: 'blur' }
],
model: [
{ required: true, message: '型号不能为空', trigger: 'blur' }
],
num: [
{ required: true, message: '数量不能为空', trigger: 'blur' }
],
startPoint: [
{ required: true, message: '起点不能为空', trigger: 'blur' }
],
endPoint: [
{ required: true, message: '终点不能为空', trigger: 'blur' }
]
}
}
},
props: {
inout: {
type: Number
}
},
methods: {
init (id) {
if (this.inout === 1) {
this.dataForm.taskType = 0
} else if (this.inout === 2) {
this.dataForm.taskType = 1
}
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfo/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm = data.mtCcTaskRunInfo
}
})
}
})
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/getLikeList'),
method: 'get',
params: this.$http.adornParams({
'key': queryString
})
}).then(({ data }) => {
for (var i = 0; i < data.length; i++) {
var obj = { value: '' }
obj.value = data[i]
results[i] = obj
}
cb(results)
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfo/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'taskType': this.dataForm.taskType,
'model': this.dataForm.model,
'num': this.dataForm.num,
'startPoint': this.dataForm.startPoint,
'endPoint': this.dataForm.endPoint,
'remarks': this.dataForm.remarks,
'dateNum': this.dataForm.dateNum
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,296 @@
<template>
<div>
<el-dialog title="子任务" :visible.sync="detVisible" width="80%" center>
<div class="mod-config">
<el-form :inline="true">
<el-form-item>
<label><b>主任务</b></label>
</el-form-item>
<el-form-item>
<label>编号:{{mainTask.taskCode}}</label>
</el-form-item>
<el-form-item>
<label>总数量:{{mainTask.num}}</label>
</el-form-item>
<el-form-item>
<label :style="styleSObj">剩余数量:{{surplus}}</label>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@click="addOrUpdateHandle()"
v-show="showAddBtn"
>新增</el-button>
</el-form-item>
<el-form-item>
<el-button
type="primary"
:disabled="mainTask.status == 0"
@click="autoRunSubTask()"
:loading="autoSubLoad"
v-show="!showAddBtn"
>自动执行</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column prop="createTime" header-align="center" align="center" label="添加时间"></el-table-column>
<el-table-column
prop="warehousRankName"
header-align="center"
align="center"
label="库位名称"
></el-table-column>
<el-table-column
header-align="center"
align="center"
label="任务类型"
>
<template slot-scope="scope">
{{ scope.row.taskType === 0 ? '出库' : '入库' }}
</template>
</el-table-column>
<el-table-column
prop="taskDetCode"
header-align="center"
align="center"
label="任务编码"
></el-table-column>
<el-table-column prop="model" header-align="center" align="center" label="产品编码"></el-table-column>
<el-table-column prop="num" header-align="center" align="center" label="数量"></el-table-column>
<el-table-column prop="unit" header-align="center" align="center" label="单位"></el-table-column>
<el-table-column prop="dateNum" header-align="center" align="center" label="批次号"></el-table-column>
<el-table-column prop="remarks" header-align="center" align="center" label="备注"></el-table-column>
<el-table-column
header-align="center"
align="center"
label="是否超高"
>
<template slot-scope="scope">
{{ scope.row.isHeight === '0' ? '否' : '是' }}
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="是否超重"
>
<template slot-scope="scope">
{{ scope.row.isWeight === '0' ? '否' : '是' }}
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="200"
label="操作"
>
<template slot-scope="scope">
<!-- <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> -->
<el-button type="danger" size="mini" :disabled="scope.row.status !== 0" @click="deleteHandle(scope.row.id)">删除</el-button>
<el-button type="primary" size="mini" :loading="subLoad===scope.row.id" :disabled="scope.row.status !== 0" @click="runSubTask(scope.row.id)" v-show="runTaskBol">{{scope.row.status === 0? '执行' : scope.row.status === 1? '执行中' : '执行完成'}}</el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="detVisible = false"> </el-button>
<el-button type="primary" @click="subBtn"> </el-button>
</span>
</el-dialog>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="shuaxin"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtcctaskruninfodet-add-or-update'
export default {
data () {
return {
detVisible: false,
mainTaskId: 0,
mainTask: {},
surplus: 0,
dataList: [],
styleSObj: {color: 'black'},
dataListLoading: false,
addOrUpdateVisible: false,
runTaskBol: false,
showAddBtn: true,
subLoad: '',
timer: '',
autoSubLoad: false
}
},
components: {
AddOrUpdate
},
mounted () {
this.timer = setInterval(this.shuaxin, 10000)
},
beforeDestroy () {
clearInterval(this.timer)
this.timer = null
},
methods: {
init (row, bol) {
this.runTaskBol = false
this.showAddBtn = true
this.autoSubLoad = false
if (row) {
this.mainTaskId = row.id
this.mainTask = row
}
if (row.status === 1 || bol) {
this.runTaskBol = true
}
if (row.taskType === 0) {
this.showAddBtn = false
}
this.detVisible = true
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/list'),
method: 'get',
params: this.$http.adornParams({
'id': this.mainTaskId
})
}).then(({ data }) => {
if (data && data.code === 0) {
var totalNum = parseInt(this.mainTask.num)
var uNum = 0
this.dataList = data.list
this.dataList.forEach(item => {
uNum = uNum + parseInt(item.num)
})
this.surplus = totalNum - uNum
if (this.surplus < 0) {
this.styleSObj.color = 'red'
} else {
this.styleSObj.color = 'black'
}
} else {
this.dataList = []
}
this.dataListLoading = false
})
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(this.mainTaskId, id, this.surplus)
})
},
// 删除
deleteHandle (id) {
this.$confirm(`确定对[id=${id}]进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/delete'),
method: 'post',
data: this.$http.adornData(id, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.shuaxin()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
shuaxin () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/list'),
method: 'get',
params: this.$http.adornParams({
'id': this.mainTaskId
})
}).then(({ data }) => {
if (data && data.code === 0) {
var totalNum = parseInt(this.mainTask.num)
var uNum = 0
this.dataList = data.list
this.dataList.forEach(item => {
uNum = uNum + parseInt(item.num)
})
this.surplus = totalNum - uNum
if (this.surplus < 0) {
this.styleSObj.color = 'red'
} else {
this.styleSObj.color = 'black'
}
} else {
this.dataList = []
}
this.dataListLoading = false
})
},
runSubTask (id) {
this.subLoad = id
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfodet/runTaskInfoDet/${id}`),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.subLoad = ''
this.shuaxin()
}
})
} else {
this.$message.error(data.msg)
}
})
},
autoRunSubTask () {
this.autoSubLoad = true
this.$http({
url: this.$http.adornUrl(`/work/controller/auto/run/out/task/${this.mainTaskId}`),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.autoSubLoad = false
this.shuaxin()
}
})
} else {
this.$message.error(data.msg)
}
})
},
subBtn () {
this.detVisible = false
this.$emit('infoDetBtn')
}
}
}
</script>

View File

@@ -0,0 +1,196 @@
<template>
<el-dialog
:title="'多物料入库'"
:close-on-click-modal="false"
:visible.sync="visible"
width=80%
>
<el-form
:model="InDataForm"
:rules="dataRule"
ref="dataFormRef"
:inline="true"
@keyup.enter.native="addTabData()"
label-width="80px"
>
<el-form-item label="产品编码" prop="model">
<el-autocomplete
class="inline-input"
v-model="InDataForm.model"
placeholder="产品编码"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model="InDataForm.num" placeholder="数量" oninput = "value=value.replace(/[^\d]/g,'')"></el-input>
</el-form-item>
<el-form-item label="批次号" prop="dateNum">
<el-input
v-model="InDataForm.dateNum"
placeholder="请填写批次号"
></el-input>
<!-- oninput = "value=value.replace(/[^\d]/g,'')" -->
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="InDataForm.remarks" placeholder="备注"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="addTabData()">添加</el-button>
</el-form-item>
</el-form>
<el-table
:data="tableData"
style="width: 100%"
border>
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column
prop="model"
label="产品编码">
</el-table-column>
<el-table-column
prop="num"
label="数量">
</el-table-column>
<el-table-column
prop="dateNum"
label="批次号">
</el-table-column>
<el-table-column prop="remarks" header-align="center" align="center" label="备注"></el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="200"
label="操作"
>
<template slot-scope="scope">
<!-- <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> -->
<el-button type="danger" size="mini" @click="deleteHandle(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
InDataForm: {
model: '',
num: '',
remarks: '',
dateNum: ''
},
tableData: [],
dataRule: {
model: [
{ required: true, message: '型号不能为空', trigger: 'blur' }
],
num: [
{ required: true, message: '数量不能为空', trigger: 'blur' }
],
remarks: [
{ required: true, message: '备注不能为空', trigger: 'blur' }
],
dateNum: [
{ required: true, message: '批次号不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataFormRef'].resetFields()
})
},
addTabData () {
console.log(this.InDataForm)
this.$refs['dataFormRef'].validate((valid) => {
if (valid) {
var arr = JSON.parse(JSON.stringify(this.InDataForm))
this.tableData.push(arr)
this.$nextTick(() => {
this.$refs['dataFormRef'].resetFields()
})
}
})
},
deleteHandle (i) {
this.tableData.splice(i, 1)
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/getLikeList'),
method: 'get',
params: this.$http.adornParams({
'key': queryString
})
}).then(({ data }) => {
for (var i = 0; i < data.length; i++) {
var obj = { value: '' }
obj.value = data[i]
results[i] = obj
}
cb(results)
})
},
// 表单提交
dataFormSubmit () {
if (this.tableData.length) {
var number = ''
var productCode = ''
var remarks = ''
var dateNum = ''
this.tableData.forEach((item, index) => {
if (index < this.tableData.length - 1) {
productCode += item.model + '+'
number += item.num + '+'
remarks += item.remarks + '+'
dateNum += item.dateNum + '+'
} else {
productCode += item.model
number += item.num
remarks += item.remarks
dateNum += item.dateNum
}
})
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfodet/save/products`),
method: 'post',
data: this.$http.adornData({
'productCode': productCode,
'number': number,
'remarks': remarks,
'dateNum': dateNum
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('infoInBtn')
}
})
} else {
this.$message.error(data.msg)
}
})
}
}
}
}
</script>

View File

@@ -0,0 +1,349 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<!-- <el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
</el-form-item> -->
<el-form-item>
<el-button @click="getDataListShow()">刷新</el-button>
<el-button
v-if="isAuth('generator:mtcctaskruninfo:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button>
<!-- <el-button type="danger" @click="resetTask()">重置任务</el-button>
<el-button type="success" @click="infoIn()">多物料入库</el-button> -->
<!-- <el-button
v-if="isAuth('generator:mtcctaskruninfo:delete')"
type="danger"
@click="deleteHandle()"
:disabled="dataListSelections.length <= 0"
>批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
row-key="id"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;"
>
<!-- <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> -->
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column prop="createTime" header-align="center" align="center" label="添加时间"></el-table-column>
<el-table-column prop="userName" header-align="center" align="center" label="操作员名称"></el-table-column>
<el-table-column header-align="center" align="center" label="任务类型">
<template slot-scope="scope">
{{ scope.row.taskType === 0 ? '出库' : '入库' }}
</template>
</el-table-column>
<el-table-column prop="taskCode" header-align="center" align="center" label="任务编码"></el-table-column>
<el-table-column prop="startPoint" header-align="center" align="center" label="起点"></el-table-column>
<el-table-column prop="endPoint" header-align="center" align="center" label="终点"></el-table-column>
<el-table-column prop="model" header-align="center" align="center" width="100" label="型号"></el-table-column>
<el-table-column prop="dateNum" header-align="center" align="center" label="批次号"></el-table-column>
<el-table-column prop="num" header-align="center" align="center" label="数量"></el-table-column>
<el-table-column prop="unit" header-align="center" align="center" label="单位"></el-table-column>
<el-table-column prop="remarks" header-align="center" align="center" label="备注"></el-table-column>
<!-- <el-table-column
prop="orderNum"
fixed="right"
header-align="center"
align="center"
label="任务顺序"
></el-table-column> -->
<el-table-column fixed="right" header-align="center" align="center" width="300" label="操作">
<template slot-scope="scope">
<div v-show="scope.row.status !== 4">
<!-- <el-button :disabled="scope.$index === 1" type="primary" round size="mini" @click="updateListOrder(scope.row,1,scope.$index)"></el-button> -->
<el-button type="primary" size="mini" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="danger" size="mini" @click="deleteHandle(scope.row.id)">删除</el-button>
<!-- <el-button type="success" size="mini" @click="infoDetShow(scope.row)">子任务</el-button> -->
<el-button type="warning" size="mini" :disabled="scope.row.status !== 0" @click="addList(scope.row)">{{scope.row.status === 0? '执行任务' : scope.row.status === 1? '执行中' : '执行完成'}}</el-button>
<!-- <el-button :disabled="scope.$index === dataList.length - 1" type="primary" round size="mini" @click="updateListOrder(scope.row,-1,scope.$index)"></el-button> -->
</div>
<!-- <div v-show="scope.$index === 0 && scope.row.status === 4">
<label style="color:blue">执行中</label>
</div>
<div v-show="scope.row.status === 4 && scope.$index !== 0">
<label style="color:blue">等待执行中</label>
<el-button type="text" size="small" @click="outList(scope.row.id)">退出队列</el-button>
</div> -->
</template>
</el-table-column>
</el-table>
<div class="STaskInfo">
<div style="padding:15px 5px">
<label :style="styleSObj" @click="sTaskClick"><b>{{sText}}</b></label>
<label style="float:right">{{sTaskInfoNum}}</label>
</div>
<el-table
v-if="openSTask"
:data="sTaskInfo"
border
size=mini>
<el-table-column
prop="createTime"
label="创建日期"
width="150px"
header-align="center" align="center">
</el-table-column>
<el-table-column
prop="taskType"
label="任务类型"
width="50px"
header-align="center"
align="center">
<template slot-scope="scope">
{{ scope.row.taskType === 0 ? '出库' : '入库' }}
</template>
</el-table-column>
<el-table-column
prop="taskDetCode"
label="任务编码"
width="160px"
header-align="center" align="center">
</el-table-column>
</el-table>
</div>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update :inout="inout" v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<info-det v-if="infoDetVisible" ref="infoDet" @infoDetBtn="getDataList"></info-det>
<info-in v-if="infoInVisible" ref="infoInRef" @infoInBtn="getDataList"></info-in>
</div>
</template>
<script>
import AddOrUpdate from './mtcctaskruninfo-add-or-update'
import mtcctaskruninfoDet from './mtcctaskruninfo-det'
import mtcctaskruninfoIn from './mtcctaskruninfo-in'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
btnText: '执行任务',
sTaskInfo: [],
sTaskInfoNum: 0,
sText: '等待中的子任务',
styleSObj: {marginLeft: '30%', cursor: 'pointer', fontSize: '18px'},
openSTask: true,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
infoDetVisible: false,
infoInVisible: false,
inout: 0
}
},
components: {
AddOrUpdate,
'info-det': mtcctaskruninfoDet,
'info-in': mtcctaskruninfoIn
},
mounted () {
this.getDataListShow()
if (this.$route.query.inout === '1') {
this.inout = 1
this.addOrUpdateHandle()
} else if (this.$route.query.inout === '2') {
this.inout = 2
this.addOrUpdateHandle()
}
},
created () {
this.showSTaskInfo()
this.timer()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/list'),
method: 'get',
params: this.$http.adornParams({
'key': this.dataForm.key
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.list
// this.dataList.forEach((item, index) => {
// item.orderNum = index
// })
} else {
this.dataList = []
}
this.dataListLoading = false
})
},
// 更新顺序
updateListOrder (item, n, i) {
const arr1 = this.dataList[i - n]
this.dataList.splice(i - n, 1, item)
this.dataList.splice(i, 1, arr1)
var idarr = []
var orderarr = []
this.dataList.forEach((item, index) => {
item.orderNum = index
idarr.push(item.id)
orderarr.push(item.orderNum)
})
const mtCcTaskRunInfoEntities = this.dataList
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/sort'),
method: 'post',
data: this.$http.adornData(
mtCcTaskRunInfoEntities
)
}).then(({ data }) => {
if (data.code === 0 && data) {
} else {
this.$message.error('调序失败!请重试')
this.getDataList()
}
})
},
infoDetShow (row, bol) {
this.infoDetVisible = true
this.$nextTick(() => {
this.$refs.infoDet.init(row, bol)
})
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
infoIn () {
this.infoInVisible = true
this.$nextTick(() => {
this.$refs.infoInRef.init()
})
},
// 删除
deleteHandle (id) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/delete'),
method: 'post',
data: this.$http.adornData(id, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
timer () {
return setInterval(() => {
this.showSTaskInfo()
}, 60000)
},
showSTaskInfo () {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodet/taskruninfodetlist'),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.sTaskInfo = data.list
this.sTaskInfoNum = this.sTaskInfo.length
}
})
},
sTaskClick () {
this.openSTask = !this.openSTask
if (this.openSTask) {
this.sText = '等待中的子任务'
this.styleSObj.marginLeft = '30%'
} else {
this.sText = '子任务'
this.styleSObj.marginLeft = '10%'
}
},
addList (row) {
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfo/runTask/${row.id}`),
method: 'post'
}).then(({data}) => {
if (data && data.code === 0) {
this.btnText = '执行中'
this.getDataList()
row.status = 1
this.infoDetShow(row, true)
} else if (data.code === 500) {
this.$notify.error({
title: '警告',
message: data.msg,
duration: 8000,
offset: 300
})
}
})
},
outList (id) {
this.$http({
url: this.$http.adornUrl('/exit/wait/queue'),
method: 'post',
data: this.$http.adornData(id)
}).then(({data}) => {
if (data && data.code === 0) {
this.getDataList()
}
})
},
resetTask () {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfo/resetTask'),
method: 'post',
data: this.$http.adornData()
}).then(({data}) => {
if (data && data.code === 0) {
this.getDataListShow()
}
})
}
}
}
</script>
<style scoped>
.STaskInfo{
max-height: 400px;
overflow: auto;
position: absolute;
background: white;
right: 50px;
bottom: 30px;
border-radius: 10px;
box-shadow: 0px 0px 10px;
z-index: 9999;
}
</style>

View File

@@ -0,0 +1,134 @@
<template>
<div>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px"
>
<el-form-item>
<label>剩余数量:{{surplus}}</label>
</el-form-item>
<el-form-item label="存放位置" prop="anotherName">
<el-input v-model="dataForm.anotherName" placeholder="系统自动分配" style="width:70%" readonly></el-input>
<el-button type="primary" @click="manageShowBtn">手动选择库位</el-button>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model.number="dataForm.num" type='number' placeholder="数量"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
<manage-info v-if="manageInfoShow" ref="manageRef" @refreshManage="setWareBox"></manage-info>
</div>
</template>
<script>
import manageInfo from '../manage/manageInfo.vue'
export default {
components: {
manageInfo
},
data () {
return {
manageInfoShow: false,
visible: false,
surplus: 0,
mainTaskId: 0,
dataForm: {
id: 0,
warehousRankId: '',
anotherName: '',
num: ''
},
dataRule: {
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
}
}
},
methods: {
init (mainTaskId, id, surplus) {
this.surplus = surplus
this.mainTaskId = mainTaskId
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(
`/generator/mtcctaskruninfodet/info/${this.dataForm.id}`
),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.warehousRankId =
data.mtcctaskruninfodet.warehousRankId
this.dataForm.num = data.mtcctaskruninfodet.num
}
})
}
})
},
manageShowBtn () {
this.manageInfoShow = true
this.$nextTick(() => {
this.$refs.manageRef.init()
})
},
setWareBox (item) {
this.dataForm.warehousRankId = item.id
this.dataForm.anotherName = item.anotherName
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate(valid => {
if (valid) {
if (!this.dataForm.warehousRankId) {
this.dataForm.warehousRankId = 0
}
this.$http({
url: this.$http.adornUrl(
`/generator/mtcctaskruninfodet/${
!this.dataForm.id ? 'save' : 'update'
}`
),
method: 'post',
data: this.$http.adornData({
warehousRankId: this.dataForm.warehousRankId,
num: this.dataForm.num,
id: this.mainTaskId
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
this.dataForm.warehousRankId = 0
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,165 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="库位code" prop="rankPositionCode">
<el-input v-model="dataForm.rankPositionCode" placeholder="库位code"></el-input>
</el-form-item>
<el-form-item label="操作员账号id" prop="userId">
<el-input v-model="dataForm.userId" placeholder="操作员账号id关联表sys_user"></el-input>
</el-form-item>
<el-form-item label="操作员名称" prop="userName">
<el-input v-model="dataForm.userName" placeholder="操作员名称"></el-input>
</el-form-item>
<el-form-item label="任务类型" prop="taskType">
<el-input v-model="dataForm.taskType" placeholder="任务类型"></el-input>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-input v-model="dataForm.status" placeholder="状态"></el-input>
</el-form-item>
<el-form-item label="任务编码" prop="taskCode">
<el-input v-model="dataForm.taskCode" placeholder="任务编码"></el-input>
</el-form-item>
<el-form-item label="型号" prop="model">
<el-input v-model="dataForm.model" placeholder="型号"></el-input>
</el-form-item>
<el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="数量"></el-input>
</el-form-item>
<el-form-item label="单位" prop="unit">
<el-input v-model="dataForm.unit" placeholder="单位"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input v-model="dataForm.remarks" placeholder="备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
rankPositionCode: '',
userId: '',
userName: '',
taskType: '',
status: '',
taskCode: '',
model: '',
num: '',
unit: '',
remarks: ''
},
dataRule: {
rankPositionCode: [
{ required: true, message: '库位code', trigger: 'blur' }
],
userId: [
{ required: true, message: '操作员账号id', trigger: 'blur' }
],
userName: [
{ required: true, message: '操作员名称', trigger: 'blur' }
],
taskType: [
{ required: true, message: '任务类型', trigger: 'blur' }
],
status: [
{ required: true, message: '状态', trigger: 'blur' }
],
taskCode: [
{ required: true, message: '任务编码不能为空', trigger: 'blur' }
],
model: [
{ required: true, message: '型号不能为空', trigger: 'blur' }
],
num: [
{ required: true, message: '数量不能为空', trigger: 'blur' }
],
unit: [
{ required: true, message: '单位不能为空', trigger: 'blur' }
],
remarks: [
{ required: true, message: '备注不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfolog/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.rankPositionCode = data.mtcctaskruninfolog.rankPositionCode
this.dataForm.userId = data.mtcctaskruninfolog.userId
this.dataForm.userName = data.mtcctaskruninfolog.userName
this.dataForm.taskType = data.mtcctaskruninfolog.taskType
this.dataForm.status = data.mtcctaskruninfolog.status
this.dataForm.taskCode = data.mtcctaskruninfolog.taskCode
this.dataForm.model = data.mtcctaskruninfolog.model
this.dataForm.num = data.mtcctaskruninfolog.num
this.dataForm.unit = data.mtcctaskruninfolog.unit
this.dataForm.remarks = data.mtcctaskruninfolog.remarks
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtcctaskruninfolog/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'rankPositionCode': this.dataForm.rankPositionCode,
'userId': this.dataForm.userId,
'userName': this.dataForm.userName,
'taskType': this.dataForm.taskType,
'status': this.dataForm.status,
'taskCode': this.dataForm.taskCode,
'model': this.dataForm.model,
'num': this.dataForm.num,
'unit': this.dataForm.unit,
'remarks': this.dataForm.remarks
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,332 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListShow()">
<el-form-item>
<el-date-picker
v-model="spanTime"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-select v-model="entryGate" filterable placeholder="请选择出入口" clearable>
<el-option
v-for="item in entryGateOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="oType" filterable placeholder="请选择出入操作" clearable>
<el-option
v-for="item in TypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.remarks" placeholder="请输入备注" clearable></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="dataForm.productCode" placeholder="请输入物料编码" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
<!-- <el-button v-if="isAuth('generator:mtcctaskruninfolog:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('generator:mtcctaskruninfolog:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="taskType"
header-align="center"
align="center"
label="任务类型">
<template slot-scope="scope">
{{ scope.row.taskType === 0 ? '出库' : '入库' }}
</template>
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
</el-table-column>
<el-table-column prop="dateNum" header-align="center" align="center" label="批次号"></el-table-column>
<el-table-column
prop="taskDetCode"
header-align="center"
align="center"
label="任务编码">
</el-table-column>
<el-table-column
prop="model"
header-align="center"
align="center"
label="型号">
</el-table-column>
<el-table-column
prop="num"
header-align="center"
align="center"
label="数量">
</el-table-column>
<el-table-column
prop="unit"
header-align="center"
align="center"
label="单位">
</el-table-column>
<el-table-column
prop="remarks"
header-align="center"
align="center"
label="备注">
</el-table-column>
<!-- <el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataListShow"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtcctaskruninfolog-add-or-update'
export default {
data () {
return {
pickerOptions: {
disabledDate (time) {
return time.getTime() > Date.now()
},
shortcuts: [{
text: '最近一周',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
},
dataForm: {
remarks: '',
productCode: ''
},
spanTime: [],
entryGate: '',
oType: '',
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
entryGateOptions: [
{
label: '1楼A1',
value: 'A1'
},
{
label: '1楼B1',
value: 'B1'
},
{
label: '2楼A2',
value: 'A2'
},
{
label: '3楼A3',
value: 'A3'
},
{
label: '4楼A4',
value: 'A4'
}
],
TypeOptions: [
{
value: 1,
label: '入库'
},
{
value: 0,
label: '出库'
}
]
}
},
components: {
AddOrUpdate
},
activated () {
this.spanTime[0] = ''
this.spanTime[1] = ''
this.getDataListShow()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
if (!this.spanTime) {
this.spanTime = ['', '']
}
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfodetlog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'startTime': this.spanTime[0],
'endTime': this.spanTime[1],
'entryGate': this.entryGate,
'oType': this.oType,
'productCode': this.dataForm.productCode,
'remarks': this.dataForm.remarks
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.dataList.forEach(item => {
switch (item.status) {
case 0:
item.status = '接收数据'
break
case 1:
item.status = '数据接收中'
break
case 2:
item.status = '数据接收完成'
break
case 3:
item.status = '取消执行'
break
case 4:
item.status = '等待接收数据'
break
}
})
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtcctaskruninfolog/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,93 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="产品名称" prop="productName">
<el-input v-model="dataForm.productName" placeholder="产品名称"></el-input>
</el-form-item>
<el-form-item label="货物数量" prop="quantity">
<el-input v-model="dataForm.quantity" placeholder="货物数量, 货物总的数量"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
productName: '',
quantity: '',
WarehousPositionId: ''
},
dataRule: {
quantity: [
{ required: true, message: '货物数量, 货物总的数量不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccwarehouspositionrelat/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.productName = data.mtccwarehouspositionrelat.productName
this.dataForm.quantity = data.mtccwarehouspositionrelat.quantity
this.dataForm.WarehousPositionId = data.mtccwarehouspositionrelat.WarehousPositionId
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccwarehouspositionrelat/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'productName': this.dataForm.productName,
'quantity': this.dataForm.quantity,
'WarehousPositionId': this.dataForm.WarehousPositionId
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,301 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-autocomplete
class="inline-input"
v-model="dataForm.key"
placeholder="产品名称"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
<el-button @click="getDataListAllShow()">查询汇总</el-button>
<!-- <el-button v-if="isAuth('generator:mtccwarehouspositionrelat:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button> -->
<!-- <el-button v-if="isAuth('generator:mtccwarehouspositionrelat:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="updateTime"
header-align="center"
align="center"
label="修改时间">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="库位状态">
</el-table-column>
<!-- <el-table-column
prop="isOccupy"
header-align="center"
align="center"
label="是否被占用">
<template slot-scope="scope">
{{ scope.row.isOccupy === 0 ? '可用' : '被占用' }}
</template>
</el-table-column> -->
<el-table-column
prop="productName"
header-align="center"
align="center"
label="产品名称">
</el-table-column>
<el-table-column
prop="productCode"
header-align="center"
align="center"
label="产品编码">
</el-table-column>
<el-table-column
prop="dateNum"
header-align="center"
align="center"
label="批次号">
</el-table-column>
<el-table-column
prop="quantity"
header-align="center"
align="center"
label="货物数量">
</el-table-column>
<el-table-column
prop="warehousPositionName"
header-align="center"
align="center"
label="库位名称">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<!-- <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button> -->
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtccwarehouspositionrelat-add-or-update'
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelat/list'),
method: 'get',
params: this.$http.adornParams({
'page': 1,
'limit': 9999,
'key': queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
for (var i = 0; i < data.page.list.length; i++) {
var obj = { value: '' }
obj.value = data.page.list[i].taskCode
results[i] = obj
}
}
cb(results)
})
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelat/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.dataList.forEach(item => {
switch (item.status) {
case 0:
item.status = '空库位'
break
case -1:
item.status = '不可用'
break
case 1:
item.status = '空货架'
break
case 2:
item.status = '货物正常'
break
case 3:
item.status = '货物预入库'
break
case 4:
item.status = '货物预出库'
break
}
})
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelat/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
},
getDataListAllShow () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelat/listCount'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.dataList.forEach(item => {
switch (item.status) {
case 0:
item.status = '空库位'
break
case -1:
item.status = '不可用'
break
case 1:
item.status = '空货架'
break
case 2:
item.status = '货物正常'
break
case 3:
item.status = '货物预入库'
break
case 4:
item.status = '货物预出库'
break
}
})
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
}
}
}
</script>

View File

@@ -0,0 +1,129 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="是否被占用0" prop="isOutIn">
<el-input v-model="dataForm.isOutIn" placeholder="是否被占用0 "></el-input>
</el-form-item>
<el-form-item label="产品id" prop="productId">
<el-input v-model="dataForm.productId" placeholder="产品id"></el-input>
</el-form-item>
<el-form-item label="车辆id" prop="vehicleId">
<el-input v-model="dataForm.vehicleId" placeholder="车辆id"></el-input>
</el-form-item>
<el-form-item label="货物数量" prop="quantity">
<el-input v-model="dataForm.quantity" placeholder="货物数量"></el-input>
</el-form-item>
<el-form-item label="库位id" prop="warehousPositionId">
<el-input v-model="dataForm.warehousPositionId" placeholder="库位id"></el-input>
</el-form-item>
<el-form-item label="" prop="remark">
<el-input v-model="dataForm.remark" placeholder=""></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
isOutIn: '',
productId: '',
vehicleId: '',
quantity: '',
warehousPositionId: '',
remark: ''
},
dataRule: {
isOutIn: [
{ required: true, message: '是否被占用0 ', trigger: 'blur' }
],
productId: [
{ required: true, message: '产品id不能为空', trigger: 'blur' }
],
vehicleId: [
{ required: true, message: '车辆id不能为空', trigger: 'blur' }
],
quantity: [
{ required: true, message: '货物数量', trigger: 'blur' }
],
warehousPositionId: [
{ required: true, message: '库位id', trigger: 'blur' }
],
remark: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccwarehouspositionrelatlog/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.isOutIn = data.mtccwarehouspositionrelatlog.isOutIn
this.dataForm.productId = data.mtccwarehouspositionrelatlog.productId
this.dataForm.vehicleId = data.mtccwarehouspositionrelatlog.vehicleId
this.dataForm.quantity = data.mtccwarehouspositionrelatlog.quantity
this.dataForm.warehousPositionId = data.mtccwarehouspositionrelatlog.warehousPositionId
this.dataForm.remark = data.mtccwarehouspositionrelatlog.remark
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/generator/mtccwarehouspositionrelatlog/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'isOutIn': this.dataForm.isOutIn,
'productId': this.dataForm.productId,
'vehicleId': this.dataForm.vehicleId,
'quantity': this.dataForm.quantity,
'warehousPositionId': this.dataForm.warehousPositionId,
'remark': this.dataForm.remark
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,284 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListShow()">
<el-form-item>
<el-autocomplete
class="inline-input"
v-model="dataForm.key"
placeholder="请输入库位"
:fetch-suggestions="querySearch"
popper-class="select-option"
clearable
></el-autocomplete>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="spanTime"
type="daterange"
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-select v-model="oType" filterable placeholder="请选择出入操作" clearable>
<el-option
v-for="item in TypeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<!-- <el-button v-if="isAuth('generator:mtccwarehouspositionrelatlog:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('generator:mtccwarehouspositionrelatlog:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column type="index" width="50" header-align="center" align="center" label="序号"></el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
label="添加时间">
</el-table-column>
<el-table-column
prop="isOutIn"
header-align="center"
align="center"
label="是否被占用">
<template slot-scope="scope">
{{ scope.row.isOutIn === 0 ? '可用' : '不可用' }}
</template>
</el-table-column>
<el-table-column prop="dateNum" header-align="center" align="center" label="批次号"></el-table-column>
<el-table-column
prop="productId"
header-align="center"
align="center"
label="产品id">
</el-table-column>
<el-table-column
prop="quantity"
header-align="center"
align="center"
label="货物数量">
</el-table-column>
<el-table-column
prop="warehousPositionId"
header-align="center"
align="center"
label="库位id">
</el-table-column>
<!-- <el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column> -->
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './mtccwarehouspositionrelatlog-add-or-update'
export default {
data () {
return {
pickerOptions: {
disabledDate (time) {
return time.getTime() > Date.now()
},
shortcuts: [{
text: '最近一周',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
picker.$emit('pick', [start, end])
}
}, {
text: '最近一个月',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
picker.$emit('pick', [start, end])
}
}, {
text: '最近三个月',
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
picker.$emit('pick', [start, end])
}
}]
},
spanTime: [],
oType: '',
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
TypeOptions: [
{
value: 1,
label: '入库'
},
{
value: 0,
label: '出库'
}
]
}
},
components: {
AddOrUpdate
},
activated () {
this.spanTime[0] = ''
this.spanTime[1] = ''
this.getDataList()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
querySearch (queryString, cb) {
var results = []
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelatlog/list'),
method: 'get',
params: this.$http.adornParams({
'page': 1,
'limit': 9999,
'key': queryString
})
}).then(({ data }) => {
if (data && data.code === 0) {
for (var i = 0; i < data.page.list.length; i++) {
var obj = { value: '' }
obj.value = data.page.list[i].warehousPositionName
results[i] = obj
}
}
cb(results)
})
},
// 获取数据列表
getDataList () {
if (!this.spanTime) {
this.spanTime = ['', '']
}
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelatlog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'startTime': this.spanTime[0],
'endTime': this.spanTime[1],
'oType': this.oType,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/generator/mtccwarehouspositionrelatlog/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
})
}
}
}
</script>

View File

@@ -0,0 +1,128 @@
<template>
<div class="help">
<div class="treeChart">
<!-- 出入库选择按钮 -->
<el-radio-group v-model="radio" @change="changeRadio">
<el-radio :label="1">出库流程</el-radio>
<el-radio :label="0">入库流程</el-radio>
</el-radio-group>
<!-- 步骤条 -->
<el-steps style="padding-top: 50px;" :active="active" finish-status="success" align-center>
<el-step class="pointclass" v-for="(item, index) in showData" :title="item.title" :description="item.description" :key="index" @click.native="changeSteps(index)"></el-step>
</el-steps>
<!-- 下一步 -->
<el-button class="treeChart-button" @click="next">下一步</el-button>
</div>
<!-- 右侧详细列表 -->
<div class="help-detail">
<div class="help-detail-tit">{{showDataActive.title}}</div>
<div class="help-detail-des">{{showDataActive.description}}</div>
<div class="help-detail-torouter pointclass" @click="toRouter(showDataActive.route)">前往操作</div>
</div>
</div>
</template>
<script>
export default {
data () {
return {
active: 0,
radio: 1,
outData: [
{title: '发起任务,等待执行', description: '由本系统或abc系统发布任务', route: '/task-task'},
{title: '开始执行', description: '开始执行任务', route: '/task-tasking'},
{title: '某托盘出库', description: '叉车运出某库位托盘', route: '/task-tasking'},
{title: '录入出库信息', description: '录入该托盘全部货物信息,全部进行出库(多余货物重新进行入库操作)', route: '/task-tasking'},
{title: '任务执行完成判断', description: '若目前出库货物已满足任务条件结束当前任务开始下一任务若任务未结束回到步骤3', route: '/task-tasking'}
],
inData: [
{title: '发起任务,等待执行', description: '由本系统或abc系统发布任务', route: '/task-task'},
{title: '开始执行', description: '开始执行任务', route: '/task-tasking'},
{title: '某托盘入库', description: '叉车运某托盘入库', route: '/task-tasking'},
{title: '录入入库信息', description: '录入该托盘入库货物信息', route: '/task-tasking'},
{title: '是否手动选择库位', description: '是:系统提示分配库位,否:手动选择库位入库', route: '/task-tasking'},
{title: '任务执行完成判断', description: '若目前出库货物已满足任务条件结束当前任务开始下一任务若任务未结束回到步骤3', route: '/task-tasking'}
],
showData: [],
showDataActive: []
}
},
mounted () {
this.showData = this.outData
this.showDataActive = this.outData[0]
},
methods: {
// 出入库帮助切换
changeRadio (v) {
if (v) {
this.showData = this.outData
} else {
this.showData = this.inData
}
this.active = 0
this.showDataActive = this.showData[this.active]
},
// 下一步
next () {
if (this.active >= 4 && this.radio) {
this.active = 0
} else if (this.active >= 5 && !this.radio) {
this.active = 0
} else {
this.active = this.active + 1
}
this.showDataActive = this.showData[this.active]
},
// 点击步骤
changeSteps (index) {
this.active = index
this.showDataActive = this.showData[this.active]
},
// 前往对应操作页
toRouter (route) {
this.$router.push(route)
}
}
}
</script>
<style lang="scss" scoped>
.help{
width: 100%;
display: flex;
.pointclass{
cursor: pointer;
}
.treeChart{
width: 80%;
height: 500px;
position: relative;
.treeChart-button{
position: absolute;
right: 100px;
bottom: 20px;
}
}
.help-detail{
flex: 1;
.help-detail-tit{
font-weight: bold;
font-size: 18px;
line-height: 36px;
}
.help-detail-des{
text-indent: 2em;
font-size: 12px;
line-height: 24px;
}
.help-detail-torouter{
text-align: right;
width: 100%;
font-size: 12px;
line-height: 24px;
margin-top: 50px;
color: #17B3A3;
}
}
}
</style>

View File

@@ -0,0 +1,117 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="100px">
<el-form-item label="bean名称" prop="beanName">
<el-input v-model="dataForm.beanName" placeholder="spring bean名称, 如: testTask"></el-input>
</el-form-item>
<el-form-item label="方法名称" prop="methodName">
<el-input v-model="dataForm.methodName" placeholder="方法名称"></el-input>
</el-form-item>
<el-form-item label="参数" prop="params">
<el-input v-model="dataForm.params" placeholder="参数"></el-input>
</el-form-item>
<el-form-item label="cron表达式" prop="cronExpression">
<el-input v-model="dataForm.cronExpression" placeholder="如: 0 0 12 * * ?"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
beanName: '',
methodName: '',
params: '',
cronExpression: '',
remark: '',
status: 0
},
dataRule: {
beanName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
methodName: [
{ required: true, message: '方法名称不能为空', trigger: 'blur' }
],
cronExpression: [
{ required: true, message: 'cron表达式不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.beanName = data.schedule.beanName
this.dataForm.methodName = data.schedule.methodName
this.dataForm.params = data.schedule.params
this.dataForm.cronExpression = data.schedule.cronExpression
this.dataForm.remark = data.schedule.remark
this.dataForm.status = data.schedule.status
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'jobId': this.dataForm.id || undefined,
'beanName': this.dataForm.beanName,
'methodName': this.dataForm.methodName,
'params': this.dataForm.params,
'cronExpression': this.dataForm.cronExpression,
'remark': this.dataForm.remark,
'status': !this.dataForm.id ? undefined : this.dataForm.status
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,162 @@
<template>
<el-dialog
title="日志列表"
:close-on-click-modal="false"
:visible.sync="visible"
width="75%">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.id" placeholder="任务ID" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
height="460"
style="width: 100%;">
<el-table-column
prop="logId"
header-align="center"
align="center"
width="80"
label="日志ID">
</el-table-column>
<el-table-column
prop="jobId"
header-align="center"
align="center"
width="80"
label="任务ID">
</el-table-column>
<el-table-column
prop="beanName"
header-align="center"
align="center"
label="bean名称">
</el-table-column>
<el-table-column
prop="methodName"
header-align="center"
align="center"
label="方法名称">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
label="参数">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small">成功</el-tag>
<el-tag v-else @click.native="showErrorInfo(scope.row.logId)" size="small" type="danger" style="cursor: pointer;">失败</el-tag>
</template>
</el-table-column>
<el-table-column
prop="times"
header-align="center"
align="center"
label="耗时(单位: 毫秒)">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="执行时间">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false
}
},
methods: {
init () {
this.visible = true
this.getDataList()
},
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/scheduleLog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'jobId': this.dataForm.id
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 失败信息
showErrorInfo (id) {
this.$http({
url: this.$http.adornUrl(`/sys/scheduleLog/info/${id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.$alert(data.log.error)
} else {
this.$message.error(data.msg)
}
})
}
}
}
</script>

View File

@@ -0,0 +1,311 @@
<template>
<div class="mod-schedule">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataListShow()">
<el-form-item>
<el-input v-model="dataForm.beanName" placeholder="bean名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataListShow()">查询</el-button>
<el-button v-if="isAuth('sys:schedule:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('sys:schedule:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
<el-button v-if="isAuth('sys:schedule:pause')" type="danger" @click="pauseHandle()" :disabled="dataListSelections.length <= 0">批量暂停</el-button>
<el-button v-if="isAuth('sys:schedule:resume')" type="danger" @click="resumeHandle()" :disabled="dataListSelections.length <= 0">批量恢复</el-button>
<el-button v-if="isAuth('sys:schedule:run')" type="danger" @click="runHandle()" :disabled="dataListSelections.length <= 0">批量立即执行</el-button>
<el-button v-if="isAuth('sys:schedule:log')" type="success" @click="logHandle()">日志列表</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="jobId"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="beanName"
header-align="center"
align="center"
label="bean名称">
</el-table-column>
<el-table-column
prop="methodName"
header-align="center"
align="center"
label="方法名称">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
label="参数">
</el-table-column>
<el-table-column
prop="cronExpression"
header-align="center"
align="center"
label="cron表达式">
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small">正常</el-tag>
<el-tag v-else size="small" type="danger">暂停</el-tag>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:schedule:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.jobId)">修改</el-button>
<el-button v-if="isAuth('sys:schedule:delete')" type="text" size="small" @click="deleteHandle(scope.row.jobId)">删除</el-button>
<el-button v-if="isAuth('sys:schedule:pause')" type="text" size="small" @click="pauseHandle(scope.row.jobId)">暂停</el-button>
<el-button v-if="isAuth('sys:schedule:resume')" type="text" size="small" @click="resumeHandle(scope.row.jobId)">恢复</el-button>
<el-button v-if="isAuth('sys:schedule:run')" type="text" size="small" @click="runHandle(scope.row.jobId)">立即执行</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!-- 弹窗, 日志列表 -->
<log v-if="logVisible" ref="log"></log>
</div>
</template>
<script>
import AddOrUpdate from './schedule-add-or-update'
import Log from './schedule-log'
export default {
data () {
return {
dataForm: {
beanName: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
logVisible: false
}
},
components: {
AddOrUpdate,
Log
},
activated () {
this.getDataList()
},
methods: {
getDataListShow () {
this.pageIndex = 1
this.getDataList()
},
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/schedule/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'beanName': this.dataForm.beanName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.jobId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/schedule/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 暂停
pauseHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.jobId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '暂停' : '批量暂停'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/schedule/pause'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 恢复
resumeHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.jobId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '恢复' : '批量恢复'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/schedule/resume'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 立即执行
runHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.jobId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '立即执行' : '批量立即执行'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/schedule/run'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 日志列表
logHandle () {
this.logVisible = true
this.$nextTick(() => {
this.$refs.log.init()
})
}
}
}
</script>

View File

@@ -0,0 +1,138 @@
<template>
<div class="in-log">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="用户名/用户操作" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%">
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="operation"
header-align="center"
align="center"
label="用户操作">
</el-table-column>
<el-table-column
prop="method"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求方法">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求参数">
</el-table-column>
<el-table-column
prop="time"
header-align="center"
align="center"
label="执行时长(毫秒)">
</el-table-column>
<el-table-column
prop="ip"
header-align="center"
align="center"
width="150"
label="IP地址">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
selectionDataList: []
}
},
created () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/log/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
}
}
}
</script>

View File

@@ -0,0 +1,138 @@
<template>
<div class="out-log">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="用户名/用户操作" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%">
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="operation"
header-align="center"
align="center"
label="用户操作">
</el-table-column>
<el-table-column
prop="method"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求方法">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求参数">
</el-table-column>
<el-table-column
prop="time"
header-align="center"
align="center"
label="执行时长(毫秒)">
</el-table-column>
<el-table-column
prop="ip"
header-align="center"
align="center"
width="150"
label="IP地址">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
selectionDataList: []
}
},
created () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/log/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
}
}
}
</script>

View File

@@ -0,0 +1,191 @@
<template>
<el-dialog
:title='"选择库位,当前货架第"+storey+"层"'
:visible="showManage"
:modal="false"
width="87%"
center
>
<div class="wareBody">
<div
v-for="(item,index) in shelfArrL"
:key="index"
class="shelfBox"
:class="[item.isOccupy === 0 ? 'normalShelfBox' : 'spareShelfBox']"
@click="wareDetails(item)"
>
<el-popover trigger="hover" placement="right" word-wrap>
<label style="margin-left:20px;">货位信息</label>
<br />
<label>编号{{item.positionCode}}</label>
<br />
<label>名称{{item.anotherName}}</label>
<br />
<div slot="reference">
<label style="font-size:12px">{{item.anotherName}}</label>
</div>
</el-popover>
<!-- <div class="ovr-btn">
<el-button
type="primary"
icon="el-icon-location"
style="width:55px;height:20px;font-size:8px;padding:3px 5px;margin-left:8px"
@click="wareDetails(item)"
>确定</el-button>
</div> -->
</div>
</div>
<div style="height:50px;font-size:45px;margin-left:45%;margin-top:25px"><label>通道</label></div>
<div class="wareBody">
<div
v-for="(item,index) in shelfArrR"
:key="index"
class="shelfBox"
:class="[item.isOccupy === 0 ? 'normalShelfBox' : 'spareShelfBox']"
@click="wareDetails(item)"
>
<el-popover trigger="hover" placement="right" word-wrap>
<label style="margin-left:20px;">货位信息</label>
<br />
<label>编号{{item.id}}</label>
<br />
<label>名称{{item.anotherName}}</label>
<br />
<div slot="reference">
<label style="font-size:12px">{{item.anotherName}}</label>
</div>
</el-popover>
<!-- <div class="ovr-btn">
<el-button
type="primary"
icon="el-icon-location"
style="width:55px;height:20px;font-size:8px;padding:3px 5px;margin-left:8px"
@click="wareDetails(item)"
>确定</el-button>
</div> -->
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="showManage = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
showManage: false,
shelfArrL: [],
shelfArrR: [],
storey: ''
}
},
methods: {
init (index) {
this.storey = index
this.showManage = true
this.$http({
url: this.$http.adornUrl('/rankInfo/rankInfo'),
method: 'post',
data: this.$http.adornData({index: index})
}).then(({data}) => {
this.shelfArrL = data.list.slice(0, 19)
this.shelfArrR = data.list.slice(19, 39)
})
},
wareDetails (item) {
this.$confirm(`确定选择位置[${item.anotherName}]?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.showManage = false
this.$nextTick(() => {
this.$emit('getOperation', item)
})
})
}
}
}
</script>
<style scoped="scoped">
body {
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-o-box-sizing: border-box;
/*Opera9.6*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
}
.wareBody {
margin: auto;
height: 90%;
background-color: #f0f0f0;
border: 2px solid #cdcdc5;
border-radius: 5px;
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.shelfBox {
margin: 5px;
height: 80px;
width: 75px;
padding: 10px;
border: 2px solid #cdcdc5;
border-radius: 5px;
color: white;
background-color:rgb(115, 248, 110);
overflow: hidden;
position: relative;
}
.shelfBox:hover {
background: linear-gradient(to left, deepskyblue, deepskyblue) left top
no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) left top no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right top no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) right top no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) left bottom no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) left bottom no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right bottom no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right bottom no-repeat;
background-size: 5px 30px, 30px 5px;
color: black;
border-radius: 5px;
background-color: rgb(190, 224, 241);
}
.spareShelfBox {
background-color: gray;
}
.normalShelfBox {
background-color: limegreen;
}
.ovr-btn {
position: absolute;
background: rgba(0, 0, 0, 0.5);
height: 100%;
left: 0;
top: 100%;
width: 100%;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.shelfBox:hover .ovr-btn {
top: 70%;
}
</style>

View File

@@ -0,0 +1,239 @@
<template>
<div>
<el-dialog title="库位货架选择" :visible.sync="showManageInfo" width="50%">
<div
v-for="(item, index) in WarehousRank"
:key="index"
class="boxClass"
@click="goDetail(index + 1)"
>
<div>
<label><b>{{ index + 1 }}</b>层货架</label>
<br />
</div>
</div>
<div class="demo-drawer-footer">
<el-button @click="showManageInfo = false"> </el-button>
</div>
</el-dialog>
<el-dialog
:title='"选择库位,当前货架第"+storey+"层"'
:visible="showManage"
:modal="false"
:show-close="false"
width="87%"
center
>
<div class="wareBody">
<div
v-for="(item,index) in shelfArrL"
:key="index"
class="shelfBox"
:class="[item.isOccupy === 0 ? 'normalShelfBox' : 'spareShelfBox']"
@click="wareDetails(item)"
>
<el-popover trigger="hover" placement="right" word-wrap>
<label style="margin-left:20px;">货位信息</label>
<br />
<label>编号{{item.positionCode}}</label>
<br />
<label>名称{{item.anotherName}}</label>
<br />
<div slot="reference">
<label style="font-size:12px">{{item.anotherName}}</label>
</div>
</el-popover>
</div>
</div>
<div style="height:50px;font-size:45px;margin-left:45%;margin-top:25px"><label>通道</label></div>
<div class="wareBody">
<div
v-for="(item,index) in shelfArrR"
:key="index"
class="shelfBox"
:class="[item.isOccupy === 0 ? 'normalShelfBox' : 'spareShelfBox']"
@click="wareDetails(item)"
>
<el-popover trigger="hover" placement="right" word-wrap>
<label style="margin-left:20px;">货位信息</label>
<br />
<label>编号{{item.id}}</label>
<br />
<label>名称{{item.anotherName}}</label>
<br />
<div slot="reference">
<label style="font-size:12px">{{item.anotherName}}</label>
</div>
</el-popover>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="showManage = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data () {
return {
showManageInfo: false,
WarehousRank: [],
showManage: false,
shelfArrL: [],
shelfArrR: [],
storey: ''
}
},
methods: {
init () {
this.showManageInfo = true
this.$http({
url: this.$http.adornUrl('/rankInfo/positionRelatInfo'),
method: 'post',
data: this.$http.adornData()
}).then(({ data }) => {
if (data && data.code === 0) {
this.WarehousRank = data.mtCcWarehousRankList.reverse()
}
})
},
goDetail (index) {
this.$confirm(`确定选择第[${index}]层?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.inita(index)
})
// this.$confirm(`已经存在货物,是否继续选择此[${item.anotherName}]?存放`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消'
// }).then(() => {
// this.showManageInfo = false
// this.$emit('getOperation', index)
// })
},
getWareBox (item) {
this.showManageInfo = false
this.$emit('refreshManage', item)
},
inita (index) {
this.storey = index
this.showManage = true
this.$http({
url: this.$http.adornUrl('/rankInfo/rankInfo'),
method: 'post',
data: this.$http.adornData({index: index})
}).then(({data}) => {
var arr1 = []
var arr2 = []
data.list.forEach(item => {
if (item.direction === 'R') {
arr1.push(item)
} else {
arr2.push(item)
}
})
this.shelfArrL = arr1
this.shelfArrR = arr2
})
},
wareDetails (item) {
this.$confirm(`确定选择位置[${item.anotherName}]?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.showManage = false
this.$nextTick(() => {
this.getWareBox(item)
})
})
}
}
}
</script>
<style scoped>
.demo-drawer-footer {
width: 100%;
margin-top: 20px;
border-top: 1px solid #e8e8e8;
padding: 10px 100px;
text-align: left;
background: #fff;
}
.boxClass {
padding: 20px 10px 10px;
margin: 5px 0;
box-shadow: 0px 1px 3px gray;
color: white;
background-color: rgb(90, 127, 248);
}
.wareBody {
margin: auto;
height: 90%;
background-color: #f0f0f0;
border: 2px solid #cdcdc5;
border-radius: 5px;
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.shelfBox {
margin: 5px;
height: 80px;
width: 75px;
padding: 10px;
border: 2px solid #cdcdc5;
border-radius: 5px;
color: white;
background-color:rgb(115, 248, 110);
overflow: hidden;
position: relative;
}
.shelfBox:hover {
background: linear-gradient(to left, deepskyblue, deepskyblue) left top
no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) left top no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right top no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) right top no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) left bottom no-repeat,
linear-gradient(to bottom, deepskyblue, deepskyblue) left bottom no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right bottom no-repeat,
linear-gradient(to left, deepskyblue, deepskyblue) right bottom no-repeat;
background-size: 5px 30px, 30px 5px;
color: black;
border-radius: 5px;
background-color: rgb(190, 224, 241);
}
.spareShelfBox {
background-color: gray;
}
.normalShelfBox {
background-color: limegreen;
}
.ovr-btn {
position: absolute;
background: rgba(0, 0, 0, 0.5);
height: 100%;
left: 0;
top: 100%;
width: 100%;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.shelfBox:hover .ovr-btn {
top: 70%;
}
</style>

View File

@@ -0,0 +1,133 @@
<template>
<el-dialog
title="云存储配置"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px">
<el-form-item size="mini" label="存储类型">
<el-radio-group v-model="dataForm.type">
<el-radio :label="1">七牛</el-radio>
<el-radio :label="2">阿里云</el-radio>
<el-radio :label="3">腾讯云</el-radio>
</el-radio-group>
</el-form-item>
<template v-if="dataForm.type === 1">
<el-form-item size="mini">
<a href="http://www.renren.io/open/qiniu.html" target="_blank">免费申请(七牛)10GB储存空间</a>
</el-form-item>
<el-form-item label="域名">
<el-input v-model="dataForm.qiniuDomain" placeholder="七牛绑定的域名"></el-input>
</el-form-item>
<el-form-item label="路径前缀">
<el-input v-model="dataForm.qiniuPrefix" placeholder="不设置默认为空"></el-input>
</el-form-item>
<el-form-item label="AccessKey">
<el-input v-model="dataForm.qiniuAccessKey" placeholder="七牛AccessKey"></el-input>
</el-form-item>
<el-form-item label="SecretKey">
<el-input v-model="dataForm.qiniuSecretKey" placeholder="七牛SecretKey"></el-input>
</el-form-item>
<el-form-item label="空间名">
<el-input v-model="dataForm.qiniuBucketName" placeholder="七牛存储空间名"></el-input>
</el-form-item>
</template>
<template v-else-if="dataForm.type === 2">
<el-form-item label="域名">
<el-input v-model="dataForm.aliyunDomain" placeholder="阿里云绑定的域名"></el-input>
</el-form-item>
<el-form-item label="路径前缀">
<el-input v-model="dataForm.aliyunPrefix" placeholder="不设置默认为空"></el-input>
</el-form-item>
<el-form-item label="EndPoint">
<el-input v-model="dataForm.aliyunEndPoint" placeholder="阿里云EndPoint"></el-input>
</el-form-item>
<el-form-item label="AccessKeyId">
<el-input v-model="dataForm.aliyunAccessKeyId" placeholder="阿里云AccessKeyId"></el-input>
</el-form-item>
<el-form-item label="AccessKeySecret">
<el-input v-model="dataForm.aliyunAccessKeySecret" placeholder="阿里云AccessKeySecret"></el-input>
</el-form-item>
<el-form-item label="BucketName">
<el-input v-model="dataForm.aliyunBucketName" placeholder="阿里云BucketName"></el-input>
</el-form-item>
</template>
<template v-else-if="dataForm.type === 3">
<el-form-item label="域名">
<el-input v-model="dataForm.qcloudDomain" placeholder="腾讯云绑定的域名"></el-input>
</el-form-item>
<el-form-item label="路径前缀">
<el-input v-model="dataForm.qcloudPrefix" placeholder="不设置默认为空"></el-input>
</el-form-item>
<el-form-item label="AppId">
<el-input v-model="dataForm.qcloudAppId" placeholder="腾讯云AppId"></el-input>
</el-form-item>
<el-form-item label="SecretId">
<el-input v-model="dataForm.qcloudSecretId" placeholder="腾讯云SecretId"></el-input>
</el-form-item>
<el-form-item label="SecretKey">
<el-input v-model="dataForm.qcloudSecretKey" placeholder="腾讯云SecretKey"></el-input>
</el-form-item>
<el-form-item label="BucketName">
<el-input v-model="dataForm.qcloudBucketName" placeholder="腾讯云BucketName"></el-input>
</el-form-item>
<el-form-item label="Bucket所属地区">
<el-input v-model="dataForm.qcloudRegion" placeholder="如sh可选值 华南gz 华北tj 华东sh"></el-input>
</el-form-item>
</template>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {},
dataRule: {}
}
},
methods: {
init (id) {
this.visible = true
this.$http({
url: this.$http.adornUrl('/sys/oss/config'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.dataForm = data && data.code === 0 ? data.config : []
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/sys/oss/saveConfig'),
method: 'post',
data: this.$http.adornData(this.dataForm)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,71 @@
<template>
<el-dialog
title="上传文件"
:close-on-click-modal="false"
@close="closeHandle"
:visible.sync="visible">
<el-upload
drag
:action="url"
:before-upload="beforeUploadHandle"
:on-success="successHandle"
multiple
:file-list="fileList"
style="text-align: center;">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只支持jpgpnggif格式的图片</div>
</el-upload>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
url: '',
num: 0,
successNum: 0,
fileList: []
}
},
methods: {
init (id) {
this.url = this.$http.adornUrl(`/sys/oss/upload?token=${this.$cookie.get('token')}`)
this.visible = true
},
// 上传之前
beforeUploadHandle (file) {
if (file.type !== 'image/jpg' && file.type !== 'image/jpeg' && file.type !== 'image/png' && file.type !== 'image/gif') {
this.$message.error('只支持jpg、png、gif格式的图片')
return false
}
this.num++
},
// 上传成功
successHandle (response, file, fileList) {
this.fileList = fileList
this.successNum++
if (response && response.code === 0) {
if (this.num === this.successNum) {
this.$confirm('操作成功, 是否继续操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).catch(() => {
this.visible = false
})
}
} else {
this.$message.error(response.msg)
}
},
// 弹窗关闭时
closeHandle () {
this.fileList = []
this.$emit('refreshDataList')
}
}
}
</script>

View File

@@ -0,0 +1,176 @@
<template>
<div class="mod-oss">
<el-form :inline="true" :model="dataForm">
<el-form-item>
<el-button type="primary" @click="configHandle()">云存储配置</el-button>
<el-button type="primary" @click="uploadHandle()">上传文件</el-button>
<el-button type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="url"
header-align="center"
align="center"
label="URL地址">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 云存储配置 -->
<config v-if="configVisible" ref="config"></config>
<!-- 弹窗, 上传文件 -->
<upload v-if="uploadVisible" ref="upload" @refreshDataList="getDataList"></upload>
</div>
</template>
<script>
import Config from './oss-config'
import Upload from './oss-upload'
export default {
data () {
return {
dataForm: {},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
configVisible: false,
uploadVisible: false
}
},
components: {
Config,
Upload
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/oss/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 云存储配置
configHandle () {
this.configVisible = true
this.$nextTick(() => {
this.$refs.config.init()
})
},
// 上传文件
uploadHandle () {
this.uploadVisible = true
this.$nextTick(() => {
this.$refs.upload.init()
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/oss/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,136 @@
<template>
<div class="tasking">
<el-form :inline="true">
<el-form-item>
<el-button v-if="isAuth('sys:user:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="name"
header-align="center"
align="center"
width="200"
label="暂存名">
</el-table-column>
<el-table-column
prop="dataList"
header-align="center"
align="center"
label="内容">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="200"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.id, scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
import moment from 'moment'
// import Vue from 'vue'
export default {
data () {
return {
dataList: [],
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
idArr: [],
list: [
{id: 1, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 2, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 3, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 4, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 5, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 6, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 7, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 8, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 9, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 10, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 11, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 12, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 13, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 14, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 15, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'},
{id: 16, name: moment(new Date()).format('YYYY年MM月DD日 HH:mm:ss'), dataList: '{"甲": 1, "乙": 1, "丙": 1}'}
]
}
},
mounted () {
// window.localStorage.setItem('cacheList', JSON.stringify(this.list))
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataList = JSON.parse(window.localStorage.getItem('cacheList')) || []
this.dataList.map((item, index) => {
this.idArr.push(item.id)
})
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
console.log(val)
},
// 删除
deleteHandle (id, index) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (index || index === 0) {
this.dataList.splice(index, 1)
} else if (ids.length === this.dataList.length) {
this.dataList = []
} else {
for (let i of ids) {
this.dataList.splice(this.idArr.indexOf(i), 1)
this.idArr.splice(this.idArr.indexOf(i), 1)
}
}
window.localStorage.setItem('cacheList', JSON.stringify(this.dataList))
this.$message({
message: '操作成功',
type: 'success',
duration: 500,
onClose: () => {
this.getDataList()
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,99 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="参数名" prop="paramKey">
<el-input v-model="dataForm.paramKey" placeholder="参数名"></el-input>
</el-form-item>
<el-form-item label="参数值" prop="paramValue">
<el-input v-model="dataForm.paramValue" placeholder="参数值"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
paramKey: '',
paramValue: '',
remark: ''
},
dataRule: {
paramKey: [
{ required: true, message: '参数名不能为空', trigger: 'blur' }
],
paramValue: [
{ required: true, message: '参数值不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/config/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.paramKey = data.config.paramKey
this.dataForm.paramValue = data.config.paramValue
this.dataForm.remark = data.config.remark
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/config/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'paramKey': this.dataForm.paramKey,
'paramValue': this.dataForm.paramValue,
'remark': this.dataForm.remark
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,176 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.paramKey" placeholder="参数名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="paramKey"
header-align="center"
align="center"
label="参数名">
</el-table-column>
<el-table-column
prop="paramValue"
header-align="center"
align="center"
label="参数值">
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './config-add-or-update'
export default {
data () {
return {
dataForm: {
paramKey: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/config/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'paramKey': this.dataForm.paramKey
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/config/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,138 @@
<template>
<div class="mod-log">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.key" placeholder="用户名/用户操作" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%">
<el-table-column
prop="id"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="operation"
header-align="center"
align="center"
label="用户操作">
</el-table-column>
<el-table-column
prop="method"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求方法">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="请求参数">
</el-table-column>
<el-table-column
prop="time"
header-align="center"
align="center"
label="执行时长(毫秒)">
</el-table-column>
<el-table-column
prop="ip"
header-align="center"
align="center"
width="150"
label="IP地址">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</div>
</template>
<script>
export default {
data () {
return {
dataForm: {
key: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
selectionDataList: []
}
},
created () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/log/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
}
}
}
</script>

View File

@@ -0,0 +1,251 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="类型" prop="type">
<el-radio-group v-model="dataForm.type">
<el-radio v-for="(type, index) in dataForm.typeList" :label="index" :key="index">{{ type }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="dataForm.typeList[dataForm.type] + '名称'" prop="name">
<el-input v-model="dataForm.name" :placeholder="dataForm.typeList[dataForm.type] + '名称'"></el-input>
</el-form-item>
<el-form-item label="上级菜单" prop="parentName">
<el-popover
ref="menuListPopover"
placement="bottom-start"
trigger="click">
<el-tree
:data="menuList"
:props="menuListTreeProps"
node-key="menuId"
ref="menuListTree"
@current-change="menuListTreeCurrentChangeHandle"
:default-expand-all="true"
:highlight-current="true"
:expand-on-click-node="false">
</el-tree>
</el-popover>
<el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" placeholder="点击选择上级菜单" class="menu-list__input"></el-input>
</el-form-item>
<el-form-item v-if="dataForm.type === 1" label="菜单路由" prop="url">
<el-input v-model="dataForm.url" placeholder="菜单路由"></el-input>
</el-form-item>
<el-form-item v-if="dataForm.type !== 0" label="授权标识" prop="perms">
<el-input v-model="dataForm.perms" placeholder="多个用逗号分隔, 如: user:list,user:create"></el-input>
</el-form-item>
<el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
<el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
</el-form-item>
<el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">
<el-row>
<el-col :span="22">
<el-popover
ref="iconListPopover"
placement="bottom-start"
trigger="click"
popper-class="mod-menu__icon-popover">
<div class="mod-menu__icon-list">
<el-button
v-for="(item, index) in iconList"
:key="index"
@click="iconActiveHandle(item)"
:class="{ 'is-active': item === dataForm.icon }">
<icon-svg :name="item"></icon-svg>
</el-button>
</div>
</el-popover>
<el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" placeholder="菜单图标名称" class="icon-list__input"></el-input>
</el-col>
<el-col :span="2" class="icon-list__tips">
<el-tooltip placement="top" effect="light">
<div slot="content">全站推荐使用SVG Sprite, 详细请参考:<a href="//github.com/daxiongYang/renren-fast-vue/blob/master/src/icons/index.js" target="_blank">icons/index.js</a>描述</div>
<i class="el-icon-warning"></i>
</el-tooltip>
</el-col>
</el-row>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { treeDataTranslate } from '@/utils'
import Icon from '@/icons'
export default {
data () {
var validateUrl = (rule, value, callback) => {
if (this.dataForm.type === 1 && !/\S/.test(value)) {
callback(new Error('菜单URL不能为空'))
} else {
callback()
}
}
return {
visible: false,
dataForm: {
id: 0,
type: 1,
typeList: ['目录', '菜单', '按钮'],
name: '',
parentId: 0,
parentName: '',
url: '',
perms: '',
orderNum: 0,
icon: '',
iconList: []
},
dataRule: {
name: [
{ required: true, message: '菜单名称不能为空', trigger: 'blur' }
],
parentName: [
{ required: true, message: '上级菜单不能为空', trigger: 'change' }
],
url: [
{ validator: validateUrl, trigger: 'blur' }
]
},
menuList: [],
menuListTreeProps: {
label: 'name',
children: 'children'
}
}
},
created () {
this.iconList = Icon.getNameList()
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/menu/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.menuList = treeDataTranslate(data.menuList, 'menuId')
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (!this.dataForm.id) {
// 新增
this.menuListTreeSetCurrentNode()
} else {
// 修改
this.$http({
url: this.$http.adornUrl(`/sys/menu/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.dataForm.id = data.menu.menuId
this.dataForm.type = data.menu.type
this.dataForm.name = data.menu.name
this.dataForm.parentId = data.menu.parentId
this.dataForm.url = data.menu.url
this.dataForm.perms = data.menu.perms
this.dataForm.orderNum = data.menu.orderNum
this.dataForm.icon = data.menu.icon
this.menuListTreeSetCurrentNode()
})
}
})
},
// 菜单树选中
menuListTreeCurrentChangeHandle (data, node) {
this.dataForm.parentId = data.menuId
this.dataForm.parentName = data.name
},
// 菜单树设置当前选中节点
menuListTreeSetCurrentNode () {
this.$refs.menuListTree.setCurrentKey(this.dataForm.parentId)
this.dataForm.parentName = (this.$refs.menuListTree.getCurrentNode() || {})['name']
},
// 图标选中
iconActiveHandle (iconName) {
this.dataForm.icon = iconName
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/menu/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'menuId': this.dataForm.id || undefined,
'type': this.dataForm.type,
'name': this.dataForm.name,
'parentId': this.dataForm.parentId,
'url': this.dataForm.url,
'perms': this.dataForm.perms,
'orderNum': this.dataForm.orderNum,
'icon': this.dataForm.icon
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>
<style lang="scss">
.mod-menu {
.menu-list__input,
.icon-list__input {
> .el-input__inner {
cursor: pointer;
}
}
&__icon-popover {
max-width: 370px;
}
&__icon-list {
max-height: 180px;
padding: 0;
margin: -8px 0 0 -8px;
> .el-button {
padding: 8px;
margin: 8px 0 0 8px;
> span {
display: inline-block;
vertical-align: middle;
width: 18px;
height: 18px;
font-size: 18px;
}
}
}
.icon-list__tips {
font-size: 18px;
text-align: center;
color: #e6a23c;
cursor: pointer;
}
}
</style>

View File

@@ -0,0 +1,152 @@
<template>
<div class="mod-menu">
<el-form :inline="true" :model="dataForm">
<el-form-item>
<el-button v-if="isAuth('sys:menu:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
row-key="menuId"
border
style="width: 100%; ">
<el-table-column
prop="name"
header-align="center"
min-width="150"
label="名称" >
</el-table-column>
<el-table-column
prop="parentName"
header-align="center"
align="center"
width="120"
label="上级菜单">
</el-table-column>
<el-table-column
header-align="center"
align="center"
label="图标">
<template slot-scope="scope">
<icon-svg :name="scope.row.icon || ''"></icon-svg>
</template>
</el-table-column>
<el-table-column
prop="type"
header-align="center"
align="center"
label="类型">
<template slot-scope="scope">
<el-tag v-if="scope.row.type === 0" size="small">目录</el-tag>
<el-tag v-else-if="scope.row.type === 1" size="small" type="success">菜单</el-tag>
<el-tag v-else-if="scope.row.type === 2" size="small" type="info">按钮</el-tag>
</template>
</el-table-column>
<el-table-column
prop="orderNum"
header-align="center"
align="center"
label="排序号">
</el-table-column>
<el-table-column
prop="url"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="菜单URL">
</el-table-column>
<el-table-column
prop="perms"
header-align="center"
align="center"
width="150"
:show-overflow-tooltip="true"
label="授权标识">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:menu:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.menuId)">修改</el-button>
<el-button v-if="isAuth('sys:menu:delete')" type="text" size="small" @click="deleteHandle(scope.row.menuId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './menu-add-or-update'
import { treeDataTranslate } from '@/utils'
export default {
data () {
return {
dataForm: {},
dataList: [],
dataListLoading: false,
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/menu/list'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.dataList = treeDataTranslate(data, 'menuId')
this.dataListLoading = false
})
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
this.$confirm(`确定对[id=${id}]进行[删除]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl(`/sys/menu/delete/${id}`),
method: 'post',
data: this.$http.adornData()
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,123 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="角色名称" prop="roleName">
<el-input v-model="dataForm.roleName" placeholder="角色名称"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
</el-form-item>
<el-form-item size="mini" label="授权">
<el-tree
:data="menuList"
:props="menuListTreeProps"
node-key="menuId"
ref="menuListTree"
:default-expand-all="true"
show-checkbox>
</el-tree>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { treeDataTranslate } from '@/utils'
export default {
data () {
return {
visible: false,
menuList: [],
menuListTreeProps: {
label: 'name',
children: 'children'
},
dataForm: {
id: 0,
roleName: '',
remark: ''
},
dataRule: {
roleName: [
{ required: true, message: '角色名称不能为空', trigger: 'blur' }
]
},
tempKey: -666666 // 临时key, 用于解决tree半选中状态项不能传给后台接口问题. # 待优化
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/menu/list'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.menuList = treeDataTranslate(data, 'menuId')
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.$refs.menuListTree.setCheckedKeys([])
})
}).then(() => {
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/role/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.roleName = data.role.roleName
this.dataForm.remark = data.role.remark
var idx = data.role.menuIdList.indexOf(this.tempKey)
if (idx !== -1) {
data.role.menuIdList.splice(idx, data.role.menuIdList.length - idx)
}
this.$refs.menuListTree.setCheckedKeys(data.role.menuIdList)
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/role/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'roleId': this.dataForm.id || undefined,
'roleName': this.dataForm.roleName,
'remark': this.dataForm.remark,
'menuIdList': [].concat(this.$refs.menuListTree.getCheckedKeys(), [this.tempKey], this.$refs.menuListTree.getHalfCheckedKeys())
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,177 @@
<template>
<div class="mod-role">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.roleName" placeholder="角色名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('sys:role:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('sys:role:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="roleId"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="roleName"
header-align="center"
align="center"
label="角色名称">
</el-table-column>
<el-table-column
prop="remark"
header-align="center"
align="center"
label="备注">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:role:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.roleId)">修改</el-button>
<el-button v-if="isAuth('sys:role:delete')" type="text" size="small" @click="deleteHandle(scope.row.roleId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './role-add-or-update'
export default {
data () {
return {
dataForm: {
roleName: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/role/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'roleName': this.dataForm.roleName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.roleId
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/role/delete'),
method: 'post',
data: this.$http.adornData(ids, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,180 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="用户名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="comfirmPassword" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="dataForm.email" placeholder="邮箱"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="角色" size="mini" prop="roleIdList">
<el-checkbox-group v-model="dataForm.roleIdList">
<el-checkbox v-for="role in roleList" :key="role.roleId" :label="role.roleId">{{ role.roleName }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="状态" size="mini" prop="status">
<el-radio-group v-model="dataForm.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { isEmail, isMobile } from '@/utils/validate'
export default {
data () {
var validatePassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('密码不能为空'))
} else {
callback()
}
}
var validateComfirmPassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('确认密码不能为空'))
} else if (this.dataForm.password !== value) {
callback(new Error('确认密码与密码输入不一致'))
} else {
callback()
}
}
var validateEmail = (rule, value, callback) => {
if (!isEmail(value)) {
callback(new Error('邮箱格式错误'))
} else {
callback()
}
}
var validateMobile = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式错误'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userName: '',
password: '',
comfirmPassword: '',
salt: '',
email: '',
mobile: '',
roleIdList: [],
status: 1
},
dataRule: {
userName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
password: [
{ validator: validatePassword, trigger: 'blur' }
],
comfirmPassword: [
{ validator: validateComfirmPassword, trigger: 'blur' }
],
email: [
{ required: true, message: '邮箱不能为空', trigger: 'blur' },
{ validator: validateEmail, trigger: 'blur' }
],
mobile: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ validator: validateMobile, trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 0 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.userName = data.user.username
this.dataForm.salt = data.user.salt
this.dataForm.email = data.user.email
this.dataForm.mobile = data.user.mobile
this.dataForm.roleIdList = data.user.roleIdList
this.dataForm.status = data.user.status
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'userId': this.dataForm.id || undefined,
'username': this.dataForm.userName,
'password': this.dataForm.password,
'salt': this.dataForm.salt,
'email': this.dataForm.email,
'mobile': this.dataForm.mobile,
'status': this.dataForm.status,
'roleIdList': this.dataForm.roleIdList
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,193 @@
<template>
<div class="mod-user">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="userId"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
label="邮箱">
</el-table-column>
<el-table-column
prop="mobile"
header-align="center"
align="center"
label="手机号">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small" type="danger">禁用</el-tag>
<el-tag v-else size="small">正常</el-tag>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:user:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">修改</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.userId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './user-add-or-update'
export default {
data () {
return {
dataForm: {
userName: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/user/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'username': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var userIds = id ? [id] : this.dataListSelections.map(item => {
return item.userId
})
this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/user/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,180 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="用户名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="comfirmPassword" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="dataForm.email" placeholder="邮箱"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="角色" size="mini" prop="roleIdList">
<el-checkbox-group v-model="dataForm.roleIdList">
<el-checkbox v-for="role in roleList" :key="role.roleId" :label="role.roleId">{{ role.roleName }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="状态" size="mini" prop="status">
<el-radio-group v-model="dataForm.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { isEmail, isMobile } from '@/utils/validate'
export default {
data () {
var validatePassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('密码不能为空'))
} else {
callback()
}
}
var validateComfirmPassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('确认密码不能为空'))
} else if (this.dataForm.password !== value) {
callback(new Error('确认密码与密码输入不一致'))
} else {
callback()
}
}
var validateEmail = (rule, value, callback) => {
if (!isEmail(value)) {
callback(new Error('邮箱格式错误'))
} else {
callback()
}
}
var validateMobile = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式错误'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userName: '',
password: '',
comfirmPassword: '',
salt: '',
email: '',
mobile: '',
roleIdList: [],
status: 1
},
dataRule: {
userName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
password: [
{ validator: validatePassword, trigger: 'blur' }
],
comfirmPassword: [
{ validator: validateComfirmPassword, trigger: 'blur' }
],
email: [
{ required: true, message: '邮箱不能为空', trigger: 'blur' },
{ validator: validateEmail, trigger: 'blur' }
],
mobile: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ validator: validateMobile, trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 0 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.userName = data.user.username
this.dataForm.salt = data.user.salt
this.dataForm.email = data.user.email
this.dataForm.mobile = data.user.mobile
this.dataForm.roleIdList = data.user.roleIdList
this.dataForm.status = data.user.status
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'userId': this.dataForm.id || undefined,
'username': this.dataForm.userName,
'password': this.dataForm.password,
'salt': this.dataForm.salt,
'email': this.dataForm.email,
'mobile': this.dataForm.mobile,
'status': this.dataForm.status,
'roleIdList': this.dataForm.roleIdList
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,193 @@
<template>
<div class="task">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="userId"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
label="邮箱">
</el-table-column>
<el-table-column
prop="mobile"
header-align="center"
align="center"
label="手机号">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small" type="danger">禁用</el-tag>
<el-tag v-else size="small">正常</el-tag>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:user:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">修改</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.userId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './task-add-or-update'
export default {
data () {
return {
dataForm: {
userName: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/user/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'username': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var userIds = id ? [id] : this.dataListSelections.map(item => {
return item.userId
})
this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/user/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
}
}
}
</script>

View File

@@ -0,0 +1,180 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="用户名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
</el-form-item>
<el-form-item label="确认密码" prop="comfirmPassword" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.comfirmPassword" type="password" placeholder="确认密码"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="dataForm.email" placeholder="邮箱"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="角色" size="mini" prop="roleIdList">
<el-checkbox-group v-model="dataForm.roleIdList">
<el-checkbox v-for="role in roleList" :key="role.roleId" :label="role.roleId">{{ role.roleName }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="状态" size="mini" prop="status">
<el-radio-group v-model="dataForm.status">
<el-radio :label="0">禁用</el-radio>
<el-radio :label="1">正常</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
import { isEmail, isMobile } from '@/utils/validate'
export default {
data () {
var validatePassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('密码不能为空'))
} else {
callback()
}
}
var validateComfirmPassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
callback(new Error('确认密码不能为空'))
} else if (this.dataForm.password !== value) {
callback(new Error('确认密码与密码输入不一致'))
} else {
callback()
}
}
var validateEmail = (rule, value, callback) => {
if (!isEmail(value)) {
callback(new Error('邮箱格式错误'))
} else {
callback()
}
}
var validateMobile = (rule, value, callback) => {
if (!isMobile(value)) {
callback(new Error('手机号格式错误'))
} else {
callback()
}
}
return {
visible: false,
roleList: [],
dataForm: {
id: 0,
userName: '',
password: '',
comfirmPassword: '',
salt: '',
email: '',
mobile: '',
roleIdList: [],
status: 1
},
dataRule: {
userName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
password: [
{ validator: validatePassword, trigger: 'blur' }
],
comfirmPassword: [
{ validator: validateComfirmPassword, trigger: 'blur' }
],
email: [
{ required: true, message: '邮箱不能为空', trigger: 'blur' },
{ validator: validateEmail, trigger: 'blur' }
],
mobile: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
{ validator: validateMobile, trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 0 ? data.list : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
})
}).then(() => {
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.userName = data.user.username
this.dataForm.salt = data.user.salt
this.dataForm.email = data.user.email
this.dataForm.mobile = data.user.mobile
this.dataForm.roleIdList = data.user.roleIdList
this.dataForm.status = data.user.status
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'userId': this.dataForm.id || undefined,
'username': this.dataForm.userName,
'password': this.dataForm.password,
'salt': this.dataForm.salt,
'email': this.dataForm.email,
'mobile': this.dataForm.mobile,
'status': this.dataForm.status,
'roleIdList': this.dataForm.roleIdList
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,29 @@
<template>
<el-dialog
title="修改顺序"
:close-on-click-modal="false"
:visible.sync="visible">
<el-select>
<el-option></el-option>
</el-select>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false
}
},
methods: {
init () {
console.log(1)
}
}
}
</script>

View File

@@ -0,0 +1,187 @@
<template>
<div class="tasking">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.userName" placeholder="用户名" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
@selection-change="selectionChangeHandle"
style="width: 100%;">
<el-table-column
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column
prop="userId"
header-align="center"
align="center"
width="80"
label="ID">
</el-table-column>
<el-table-column
prop="username"
header-align="center"
align="center"
label="用户名">
</el-table-column>
<el-table-column
prop="email"
header-align="center"
align="center"
label="邮箱">
</el-table-column>
<el-table-column
prop="mobile"
header-align="center"
align="center"
label="手机号">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small" type="danger">禁用</el-tag>
<el-tag v-else size="small">正常</el-tag>
</template>
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="创建时间">
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="200"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:user:update') && scope.$index === 0" type="text" size="small" @click="handleNext(scope.row.userId)">下一步</el-button>
<el-button v-if="isAuth('sys:user:update') && scope.$index !== 0" type="text" size="small" @click="changeIndex(scope.$index)">修改顺序</el-button>
<el-button v-if="isAuth('sys:user:update') && scope.$index !== 0" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">修改</el-button>
<el-button v-if="isAuth('sys:user:delete') && scope.$index !== 0" type="text" size="small" @click="deleteHandle(scope.row.userId)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!-- 弹窗, 修改顺序 -->
<update-index :totalPage="totalPage" v-if="showIndex" ref="updateIndex" @refreshDataList="getDataList"></update-index>
<!-- 弹窗, 下一步 -->
<!-- <next-step v-if="showNext" ref="nextStep" @refreshDataList="getDataList"></next-step> -->
</div>
</template>
<script>
import AddOrUpdate from './tasking-add-or-update'
import updateIndex from './tasking-update-index'
export default {
data () {
return {
dataForm: {
userName: ''
},
dataList: [],
totalPage: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
showNext: false,
showIndex: false,
indexIndex: null
}
},
components: {
AddOrUpdate,
updateIndex
},
activated () {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/user/list'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 多选
selectionChangeHandle (val) {
this.dataListSelections = val
},
// 新增 / 修改
addOrUpdateHandle (id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
// 删除
deleteHandle (id) {
var userIds = id ? [id] : this.dataListSelections.map(item => {
return item.userId
})
this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/user/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {})
},
// 下一步
handleNext () {
this.showNext = true
},
// 调整任务顺序
changeIndex (index) {
this.showIndex = true
this.indexIndex = index
}
}
}
</script>