Commit c6b521d6 authored by W_Y's avatar W_Y

废弃

parent 04446c1b
import request from '@/utils/request'
// 查询数量根据修改时间
// 折线图
export function findCountIdByUpdateDate(query) {
return request({
url: '/WeHomePage/findCountIdByUpdateDate',
......@@ -9,7 +9,7 @@ export function findCountIdByUpdateDate(query) {
})
}
// 查询数量根据修改时间
// 柱状图
export function findCountIdByFqYy(query) {
return request({
url: '/WeHomePage/findCountIdByFqYy',
......@@ -17,3 +17,12 @@ export function findCountIdByFqYy(query) {
params: query
})
}
// 饼图1
export function findCountIdByPtype(query) {
return request({
url: '/WeHomePage/findCountIdByPtype',
method: 'get',
params: query
})
}
......@@ -88,9 +88,6 @@
<div class="controlSpan_middle">
访客数据(今日)
</div>
<div>
当前院内访客: <span style="color: #333333;font-size: 16px;font-weight: bold">20</span>
</div>
</div>
<el-divider class="chosenOne-divider"/>
<div id="echarts-visitor" class="span_1" style="margin-top: -20px">
......@@ -104,9 +101,6 @@
<div class="controlSpan_middle">
访客数据(今日)
</div>
<div>
当前院内访客: <span style="color: #333333;font-size: 16px;font-weight: bold">20</span>
</div>
</div>
<el-divider class="chosenOne-divider"/>
<div id="echarts-visitor" class="span_1" style="margin-top: -20px">
......@@ -126,39 +120,10 @@
<div class="controlSpan_middle">数据统计</div>
</el-col>
<el-col :span="12">
<!-- <div style="float: right">-->
<!-- <el-button style="padding-right: 0;padding-top: 0; color: #666" type="text" @click="$router.push({path:'/dataStatistics/createCaseStatistics'})">查看更多-->
<!-- <i class="el-icon-arrow-right" />-->
<!-- </el-button>-->
<!-- </div>-->
</el-col>
</el-row>
<el-divider class="controlDivider"/>
<!-- <div>-->
<!-- <el-row>-->
<!-- &lt;!&ndash; <el-col :span="6">&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; <el-select v-model="caseType" placeholder="请选择" @change="handleGetStatisticsData">&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; <el-option&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; v-for="item in options"&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; :key="item.value"&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; :label="item.label"&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; :value="item.value"&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; />&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash;&lt;!&ndash; </el-select>&ndash;&gt;&ndash;&gt;-->
<!-- &lt;!&ndash; </el-col>&ndash;&gt;-->
<!-- <el-col :span="24">-->
<!-- <div style="float: right">-->
<!-- <el-radio-group v-model="range" @change="handleGetStatisticsData">-->
<!-- <el-radio :label="0"></el-radio>-->
<!-- <el-radio :label="1"></el-radio>-->
<!-- <el-radio :label="2"></el-radio>-->
<!-- <el-radio :label="3"></el-radio>-->
<!-- <el-radio :label="4"></el-radio>-->
<!-- </el-radio-group>-->
<!-- </div>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </div>-->
<div id="echarts-data" class="span_1">
<div id="dataCharts_data" ref="chart_data" style="height: 40vh"/>
</div>
......@@ -170,23 +135,9 @@
<el-col :span="12">
<div class="controlSpan_middle">废弃详情</div>
</el-col>
<!-- <el-col :span="12">-->
<!-- <div style="float: right">-->
<!-- <el-button style="padding-right: 0;padding-top: 0; color: #666" type="text" @click="$router.push({path:'/sf/lawer/LeaveMessage/index'})">查看更多-->
<!-- <i class="el-icon-arrow-right" />-->
<!-- </el-button>-->
<!-- </div>-->
<!-- </el-col>-->
</el-row>
<el-divider class="controlDivider"/>
<el-row>
<!-- <div style="float: right">-->
<!-- <el-button size="mini" :class="isShow ? 'active' : 'btn1'" @click="leaveMessageBtnMonth">本月-->
<!-- </el-button>-->
<!-- <el-button size="mini" :class="isShow2 ? 'active' : 'btn1'" style="margin-left: 3px!important;"-->
<!-- @click="leaveMessageBtnYear">本年-->
<!-- </el-button>-->
<!-- </div>-->
</el-row>
<div id="echarts-leaveMessage" class="span_1">
<div id="dataCharts_leaveMessage" ref="chart_leaveMessage" style="height: 40vh"/>
......@@ -203,15 +154,19 @@ import * as echarts from 'echarts'
import judgeLeaveMessage from 'svg-sprite-loader/examples/custom-runtime-generator/build/main'
// import { controlData } from './apis'
// import { judgeLeaveMessage } from '@/views/judgeMessageManage/apis'
import { findCountIdByUpdateDate, findCountIdByFqYy } from '@/api/controlPlatform'
import { findCountIdByUpdateDate, findCountIdByFqYy, findCountIdByPtype } from '@/api/controlPlatform'
export default {
name: 'Control',
data() {
return {
// 图表
//折线图
myChartRegistrationTime: undefined,
// 柱状图
myChartAverage: undefined,
// 饼图1
myChartGender:undefined,
stopTimer: false,
sumUpdateList: [],
dataList: [],
......@@ -222,6 +177,12 @@ export default {
YyList: [],
// 数量
FqNumList: [],
// 饼图1
PtypeList:[{
value:'',
name:''
}],
isShow: true,
isShow2: false,
judgeMessageData: 0,
......@@ -299,6 +260,7 @@ export default {
this.handleGetJudgeMessageData()
this.handleGetStatisticsData()
this.startInterval()
this.getPtypeList()
// 通过监听内容部分的宽度让图表resize
var elementResizeDetectorMaker = require('element-resize-detector')
var erd = elementResizeDetectorMaker()
......@@ -309,7 +271,6 @@ export default {
self.tableHeight = height // 将监听到的宽高进行赋值
self.tableWidth = width
that.$nextTick(function() {
console.log('Size: ' + width + 'x' + height)
// 使echarts尺寸重置
echarts.init(document.getElementById('dataCharts_data')).resize()
})
......@@ -320,7 +281,6 @@ export default {
self.tableHeight = height // 将监听到的宽高进行赋值
self.tableWidth = width
that.$nextTick(function() {
console.log('Size: ' + width + 'x' + height)
// 使echarts尺寸重置
echarts.init(document.getElementById('dataCharts_leaveMessage')).resize()
})
......@@ -331,7 +291,6 @@ export default {
self.tableHeight = height // 将监听到的宽高进行赋值
self.tableWidth = width
that.$nextTick(function() {
console.log('Size: ' + width + 'x' + height)
// 使echarts尺寸重置
echarts.init(document.getElementById('dataCharts_visitor')).resize()
})
......@@ -348,18 +307,21 @@ export default {
startInterval() {
this.getSumUpdateList() // 先立刻执行一次
this.getSumList()
this.getPtypeList()
this.intervalId = setInterval(() => {
if (this.stopTimer === true) {
clearInterval(this.intervalId)
} else {
this.getSumUpdateList()
this.getSumList()
this.getPtypeList()
}
}, 2000) // 间隔 2 秒调用一次,根据实际需求调整间隔时间
}, 10000) // 间隔 2 秒调用一次,根据实际需求调整间隔时间
},
stopInterval() {
clearInterval(this.intervalId) // 清除计时器
},
// 折线图
getSumUpdateList() {
findCountIdByUpdateDate().then(res => {
this.sumUpdateList = res.data
......@@ -372,18 +334,50 @@ export default {
this.updateRegistrationTime()
})
},
// 柱状图
getSumList() {
findCountIdByFqYy().then(res => {
this.sumFqYyList = res.data
this.YyList = []
this.FqNumList = []
this.sumFqYyList.forEach(item => {
this.YyList.push(item.fqYy)
this.YyList.push(item.fq_yy)
this.FqNumList.push(item.sum)
})
this.updateChartsLeaveMessage()
})
},
// 饼图
getPtypeList() {
findCountIdByPtype().then(res => {
this.PtypeList=[]
// let name=''
// console.log('res', res.data)
// res.data.forEach(item =>{
//
// if (item.ptype === '1'){
// name='设备库'
// }
// if (item.ptype === '2'){
// name='工序库'
// }
// console.log('item.sum', item.sum)
// this.PtypeList.push({
// name: name,
// value: item.sum
// })
// })
// console.log('this.PtypeList', this.PtypeList)
const renamedData = res.data.map(item => ({
...item,
name: item.ptype === '1' ? '设备库' : (item.ptype === '2' ? '工序库' : item.ptype),
value: item.sum,
}));
this.PtypeList = renamedData
this.updateVisitorData()
})
},
handleClick(row) {
this.$router.push({
path: '/sf/message/messageBack',
......@@ -531,7 +525,10 @@ export default {
/** 访客数据(饼状图)
* */
getVisitorData() {
const myChartGender = echarts.init(document.getElementById('dataCharts_visitor'))
this.myChartGender = echarts.init(document.getElementById('dataCharts_visitor'))
this.updateVisitorData()
},
updateVisitorData() {
const optionEnter = {
tooltip: {
trigger: 'item'
......@@ -560,11 +557,7 @@ export default {
{
type: 'pie',
radius: '50%',
data: [
{ value: '10', name: '离院' },
{ value: '30', name: '来访' }
],
data: this.PtypeList,
emphasis: {
itemStyle: {
shadowBlur: 10,
......@@ -575,7 +568,7 @@ export default {
}
]
}
myChartGender.setOption(optionEnter)
this.myChartGender.setOption(optionEnter)
}
}
}
......
<template>
<div>
工序库盘点记录
<div class="app-container">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true">
<el-form-item label="pn" prop="pn">
<el-input
v-model="queryParams.pn"
placeholder="请输入pn"
clearable
:maxlength="30"
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="lot" prop="lot">
<el-input
v-model="queryParams.lot"
placeholder="请输入设备lot"
clearable
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="plocation" prop="plocation">
<el-input
v-model="queryParams.plocation"
placeholder="请输入plocation"
clearable
size="small"
style="width: 150px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" style="padding: 8px 7px;" size="small" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item>
<!-- <div style="float: right">-->
<!-- <el-form-item>-->
<!-- <el-button style="padding: 8px 7px;" :type="typePrimary" :size="smallSize" :icon="addIcon" @click="checkType">开始盘点 </el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button style="padding: 8px 7px;" type="danger" :size="smallSize" icon="el-icon-minus" @click="deleteByType">结束盘点 </el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-button style="padding: 8px 7px;" :type="'warning'" :size="smallSize" icon="el-icon-view" @click="checkInventory">查看盘点 </el-button>-->
<!-- </el-form-item>-->
<!-- </div>-->
</el-form>
<div class="placeholder" />
<div style="padding:5px 10px">
<div class="mb12 font-small-bold">库存盘点列表</div>
<el-table v-loading="loading" border :data="equipmentList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column type="index" label="序号" width="80" />
<el-table-column label="pn" prop="pn" width="220">
<template slot-scope="scope">
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="lot" prop="lot" width="220">
<template slot-scope="scope">
{{ scope.row.lot || '-' }}
</template>
</el-table-column>
<el-table-column label="plocation" prop="plocation" width="220">
<template slot-scope="scope">
{{ scope.row.plocation || '-' }}
</template>
</el-table-column>
<el-table-column label="厚度" prop="phd" width="220">
<template slot-scope="scope">
{{ scope.row.phd || '-' }}
</template>
</el-table-column>
<el-table-column label="操作员" prop="createName">
<template slot-scope="scope">
{{ scope.row.createName || '-' }}
</template>
</el-table-column>
<el-table-column label="操作时间" :show-overflow-tooltip="true" align="center" prop="updateDate">
<template slot-scope="scope">
<span>{{ scope.row.updateDate | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="80px">
<template slot-scope="scope">
<el-button :type="typeParent" :size="size" @click="handleDetail(scope.row)">
详情
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.rows"
@pagination="getList"
/>
<!-- 添加或修改设备配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="名称" prop="roleName">
<el-input v-model.trim="form.roleName" show-word-limit :maxlength="30" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备来源" prop="roleKey">
<el-input v-model.trim="form.roleKey" show-word-limit :maxlength="30" placeholder="请输入设备来源" />
</el-form-item>
<el-form-item label="排序" prop="roleSort">
<el-input-number v-model="form.roleSort" style="width: 100%" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="设备批次">
<!-- <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>-->
<!-- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>-->
<!-- <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>-->
<el-tree
ref="menu"
class="tree-border"
:data="menuOptions"
show-checkbox
node-key="id"
check-strictly
empty-text="加载中,请稍后"
:props="defaultProps"
@check-change="handleMenuCheckChange"
/>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model.trim="form.remark"
maxlength="200"
show-word-limit
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div>
</el-dialog>
<!-- 弹出框。。。。。。。。。。。。。。。。。。。。。。。 -->
<el-dialog class="aboutSingleDetails" :title="title" :visible.sync="openDetails" width="700px" append-to-body :close-on-click-modal="false">
<el-form ref="formDetails" :model="singleDetails" size="small" label-width="90px">
<el-row>
<el-col :span="12">
<el-form-item label="pn:" prop="pn">
<el-input v-model.trim="singleDetails.pn" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="lot:" prop="workshop">
<el-input v-model.trim="singleDetails.lot" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="plocation:" prop="plocation">
<el-input v-model.trim="singleDetails.plocation" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="prank:" prop="prank">
<el-input v-model.trim="singleDetails.prank" :readonly="true" :maxlength="100"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="psm:" prop="psm">
<el-input v-model.trim="singleDetails.psm" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="pzl:" prop="pzl">
<el-input v-model.trim="singleDetails.pzl" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="厚度:" prop="phd">
<el-input v-model.trim="singleDetails.phd" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12" />
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="操作员:" prop="createName">
<el-input v-model.trim="singleDetails.createName" :readonly="true" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label=" 操作时间:" prop="updateDate">
<el-input v-model.trim="singleDetails.updateDate" :readonly="true" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
<el-dialog
title="库存盘点列表"
:visible.sync="table"
direction="rtl"
size="50%"
:close-on-click-modal="false"
>
<el-table v-loading="loading" border :data="tableList" style="padding: 0 10px;" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="80" />
<el-table-column label="pn" prop="pn">
<template slot-scope="scope">
{{ scope.row.pn || '-' }}
</template>
</el-table-column>
<el-table-column label="lot" prop="lot">
<template slot-scope="scope">
{{ scope.row.lot || '-' }}
</template>
</el-table-column>
<el-table-column label="位置" prop="plocation">
<template slot-scope="scope">
{{ scope.row.plocation || '-' }}
</template>
</el-table-column>
<el-table-column label="厚度" prop="phd">
<template slot-scope="scope">
{{ scope.row.phd || '-' }}
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import {
addRole,
changeRoleStatus,
dataScope,
delRole,
exportRole,
getRole,
updateRole
} from '@/api/system/role'
import {checkType, listCheck, addList, deleteByType, checkInventory, ListAllWarehose} from '@/api/equipment/check'
import { roleMenuTreeselect, roleMenuTreeselectMC, treeselect as menuTreeselect } from '@/api/system/menu'
import { roleDeptTreeselect, treeselect as deptTreeselect } from '@/api/system/dept'
export default {
name: 'Index'
name: 'Index',
data() {
return {
// 需要盘点的list
checkFrom: {
Ptype: '',
checkList: []
},
table: false,
tableList: [],
// 选中的列表
selectList: [],
// TODO: 表单里的单项详情参数
singleDetails: {
equipmentName: '',
equipmentCode: '',
lot: '',
location: '',
thickness: '',
createBy: '',
updateDate: ''
},
// 是否显示弹出层(数据详情)
openDetails: false,
// // TODO: 模拟测试数据
// equipmentList: [{ equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '002', lot: 'xxx', location: '位置02', thickness: '70', createBy: '操作员02', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }, { equipmentCode: '001', lot: 'xxx', location: '位置01', thickness: '50', createBy: '操作员01', createTime: new Date() }],
// check: '开始盘点',
typeParent: 'text',
typePrimary: 'primary',
typeSuccess: 'success',
nameParent: '删除',
resetName: '重置',
addName: '新增',
exportName: '导出',
updataName: '修改',
size: 'mini',
smallSize: 'small',
delicon: 'el-icon-delete',
addIcon: 'el-icon-plus',
exportIcon: 'el-icon-download',
resetIcon: '',
haspermi: ['sys:user:delete'],
resetHaspermi: ['sys:user:resetPwd'],
updateHaspermi: ['sys:role:update'],
addHaspermi: ['sys:role:add'],
exportHaspermi: ['sys:role:export'],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 角色表格数据
roleList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 是否显示弹出层(数据权限)
openDataScope: false,
// 日期范围
// dateRange: [],
// 菜单表格数据
menuList: [],
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
// 状态数据字典
statusOptions: [
{
dictLabel: '启用',
dictValue: '1'
},
{
dictLabel: '停用',
dictValue: '0'
}
],
// 数据范围选项
dataScopeOptions: [
{
value: '1',
label: '全部数据权限'
},
{
value: '2',
label: '自定数据权限'
},
{
value: '3',
label: '本部门数据权限'
},
{
value: '4',
label: '本部门及以下数据权限'
},
{
value: '5',
label: '仅本人数据权限'
}
],
check: [],
// 菜单列表
menuOptions: [],
equipmentList: [],
// 部门列表
tOptions: [],
// 查询参数
queryParams: {
page: 1,
rows: 10,
ptype: 2,
pstatus: 0,
pn: '',
lot: '',
plocation: ''
},
// 表单参数
form: {
},
defaultProps: {
children: 'children',
label: 'label'
},
// 表单校验
rules: {
roleName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' }
],
roleKey: [
{ required: true, message: '请输入权限字符', trigger: 'blur' }
],
roleSort: [
{ required: true, message: '请输入角色排序', trigger: 'blur' }
]
},
deptOptions: [],
formData: {}
}
},
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
// this.getDicts(dictCons['NORMAL_DISABLE']).then(response => {
// this.statusOptions = response.data;
// });
},
methods: {
// checkInventory() {
// this.table = true
// checkInventory(2)
// .then(response => {
// // 处理返回的数据
// this.tableList = response.data
// console.log(response)
// })
// .catch(error => {
// // 处理请求错误
// console.error(error)
// })
// },
// TODO: 获取所选行详情信息操作
handleDetail(row) {
this.singleDetails = this.formReset
this.singleDetails = row
this.title = '详情信息'
this.openDetails = !this.openDetails
},
// deleteByType() {
// // 添加二次确认对话框
// this.$confirm('确认要结束盘点吗?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// // 用户点击确定按钮时执行的回调函数
// deleteByType(2).then(flag => {
// if (flag.data > 0) {
// this.$message.success('结束盘点成功')
// } else {
// this.$message.error('当前未开始盘点')
// }
// })
// })
// .catch(() => {
// // 用户点击取消按钮时执行的回调函数,可以忽略这里的实现
// })
// },
// checkType() {
// checkType(2).then(total => {
// if (total.data !== 0) {
// this.$message.error('请先结束盘点')
// } else {
// let data = []
// if (this.selectList.length === 0) {
// ListAllWarehose(this.queryParams).then(res => {
// if (res.code === 200) {
// data = res.data
// }
// })
// } else {
// data = this.selectList
// }
// // 添加二次确认对话框
// this.$confirm('确认要进行盘点吗?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// // 用户点击确定按钮时执行的回调函数
// addList(data).then(flag => {
// if (flag.data.influence > 0) {
// this.$message.success('盘点成功')
// } else {
// this.$message.error('盘点失败')
// }
// })
// })
// .catch(() => {
// // 用户点击取消按钮时执行的回调函数,可以忽略这里的实现
// })
// }
// })
// },
handelTab(i, e) {
const that = this
if (!that.$refs['input' + i]) {
return
}
that.$nextTick(() => {
e.target.blur()
const index = i + 1
that.$refs['input' + index].focus()
})
},
/** 查询角色列表 */
getList() {
this.loading = true
listCheck(this.queryParams).then(
response => {
console.log('list',response)
this.equipmentList = response.rows
this.total = response.total
this.loading = false
}
)
},
/** 查询菜单树结构 */
getMenuTreeselect() {
menuTreeselect().then(response => {
this.menuOptions = response.data
})
},
/** 查询菜单列表 */
getMenuList(roleId) {
roleMenuTreeselectMC(roleId).then(response => {
this.menuList = this.handleTree(response.data.menus, 'businessId')
this.loading = false
})
},
/** 查询部门树结构 */
getDeptTreeselect() {
deptTreeselect().then(response => {
this.deptOptions = response.data
})
},
// 树状图节点点击选中事件
handleMenuCheckChange(data, check, subCheck) { // data为选中节点信息,check选中状态
if (data.children !== undefined && data.children !== null) { // 是否包含子节点
this.checkNode(data.children, check) // 调用checkNode方法
}
// // 获取所有被选中的节点信息
// const nodes = this.$refs.menu.getCheckedNodes(false, false)
// // 将获取到的信息赋值(根据自己的需求)
// this.custGroupDesc = nodes.map(item => item.CN_NAME)
// this.searchForm.custGroup = nodes.map(item => item.code)
},
// 选中所有下级节点
checkNode(data, check) {
// 遍历所有下级节点信息
data.forEach(item => {
// 通过节点信息设置选中状态
this.$refs.menu.setChecked(item, check, false)
// 是否包含下级节点,包含下级节点则选中所有下级节点
if (item.children !== undefined) {
this.checkNode(item.children, check)
}
})
},
// 所有菜单节点数据
getMenuAllCheckedKeys() {
// 目前被选中的菜单节点
const checkedKeys = this.$refs.menu.getHalfCheckedKeys()
// 半选中的菜单节点
const halfCheckedKeys = this.$refs.menu.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys
},
// 所有部门节点数据
getDeptAllCheckedKeys() {
// 目前被选中的部门节点
const checkedKeys = this.$refs.dept.getHalfCheckedKeys()
// // 半选中的部门节点
const halfCheckedKeys = this.$refs.dept.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return this.$refs.dept.getCheckedKeys()
},
/** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.data.menus
return response
})
},
/** 根据角色ID和菜单ID查询部门树结构 */
getRoleDeptTreeselect(roleId, menuId) {
return roleDeptTreeselect(roleId, menuId).then(response => {
this.form.deptCheckStrictly = response.data.deptCheckStrictly
this.deptOptions = response.data.depts
this.form.dataScope = this.dataScopeOptions[response.data.dataScope - 1].value
return response
})
},
// 角色状态修改
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return changeRoleStatus(row.businessId, row.flag)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 取消按钮(数据权限)
cancelDataScope() {
this.openDataScope = false
this.reset()
},
// 表单重置
reset() {
if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([])
}
this.menuExpand = false
this.menuNodeAll = false
this.deptExpand = true
this.deptNodeAll = false
this.form = {
roleId: undefined,
businessId: undefined,
roleName: undefined,
roleKey: undefined,
roleSort: 0,
flag: '1',
menuIds: [],
menuName: undefined,
deptIds: [],
menuCheckStrictly: false,
deptCheckStrictly: false,
remark: undefined
}
this.resetForm('form')
},
/** 查询按钮操作 */
handleQuery() {
this.queryParams.page = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
page: 1,
rows: 10,
ptype: 2,
pstatus: 0,
pn: '',
lot: '',
plocation: ''
}
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roleId)
this.selectList = selection
this.single = selection.length !== 1
this.multiple = !selection.length
},
// // 树权限(父子联动)
// handleCheckedTreeConnect(value, type) {
// if (type === 'menu') {
// this.form.menuCheckStrictly = !!value
// } else if (type === 'dept') {
// this.form.deptCheckStrictly = !!value
// }
// },
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
} else if (type === 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === 'menu') {
const treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
}
} else if (type === 'dept') {
const treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
}
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.getMenuTreeselect()
this.open = true
this.title = '添加角色'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const roleId = row.businessId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId)
getRole(roleId).then(response => {
this.form = response.data
this.open = true
this.getMenuTreeselect(roleId)
this.$nextTick(() => {
roleMenu.then(res => {
this.$refs.menu.setCheckedKeys(res.data.checkedKeys)
})
})
this.title = '修改角色'
})
},
/** 分配数据权限操作 选择菜单 */
handleMenu(row) {
this.reset()
const roleId = row.businessId || this.ids
this.getMenuList(roleId) // 查询菜单列表树形显示
getRole(roleId).then(response => {
this.form = response.data
this.openDataScope = true
this.title = '分配数据权限'
})
},
/** 分配数据权限操作 */
handleDataScope(row) {
this.deptOptions = []
this.form.dataScope = undefined
const roleId = this.form.businessId
this.form.menuId = row.businessId
this.form.menuName = row.menuName
const roleDeptTreeselect = this.getRoleDeptTreeselect(roleId, this.form.menuId)
this.$nextTick(() => {
roleDeptTreeselect.then(res => {
this.$refs.dept.setCheckedKeys(res.data.checkedKeys)
})
})
this.title = '分配数据权限'
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.form.menuCheckStrictly = false
if (this.form.businessId !== undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => {
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => {
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
})
},
/** 提交按钮(数据权限) */
submitDataScope: function() {
if (this.form.businessId !== undefined && this.form.menuId !== undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys()
dataScope(this.form).then(response => {
this.msgSuccess('修改成功')
this.openDataScope = false
this.getList()
})
}
},
/** 删除按钮操作 */
handleDelete(row) {
const roleIds = row.businessId || this.ids
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delRole(roleIds)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function() {
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportRole(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '角色信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
})
}
}
}
</script>
<style lang="scss" scoped>
.aboutSingleDetails{
.el-form-item{
.el-input >>> .el-input__inner {
-webkit-appearance: none;
background-color: #FFF;
background-image: none;
border-radius: 4px;
border: 0;
width: 100%;
}
}
}
.app-container {
font-size: 18px;
padding: 0;
<style scoped>
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
.table-drop {
vertical-align: 2px;
line-height: 20px;
margin-left: 15px
}
.el-switch {
margin-left: 15px;
}
}
.el-divider--vertical {
height: 12em;
width: 4px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment