家里的样式

This commit is contained in:
zhangdingyu
2019-09-18 09:34:02 +08:00
commit 02d1678fff
681 changed files with 133918 additions and 0 deletions

View File

@@ -0,0 +1,305 @@
<template>
<div class="app-container">
<el-card>
<span>设备名称</span>
<el-input v-model="equipmentName" clearable size="small" style="width:200px;margin:10px;"/>
<el-button type="success" class="el-icon-search" size="small" @click="pageCurrent=1;pageSize=10;searchTable()">查询</el-button>
<el-button type="primary" class="el-icon-circle-plus-outline" size="small" @click="handleAdd('form');param = 0">新增</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" height="580" style="width: 100%;" border highlight-current-row>
<el-table-column
label=" "
align="center"
type="index"
width="50"/>
<el-table-column label="设备名称" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.设备名称 }}
</template>
</el-table-column>
<el-table-column label="设备编号" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.设备编号 }}
</template>
</el-table-column>
<el-table-column label="设备型号" align="center" width="280px">
<template slot-scope="scope">
{{ scope.row.设备型号 }}
</template>
</el-table-column>
<el-table-column label="设备性能指标" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.设备性能指标 }}
</template>
</el-table-column>
<el-table-column label="设备加工能力" align="center" width="140px">
<template slot-scope="scope">
{{ scope.row.设备加工能力工时 }}
</template>
</el-table-column>
<el-table-column label="设备工时系数" align="center" width="120px">
<template slot-scope="scope">
{{ scope.row.设备工时系数 }}
</template>
</el-table-column>
<el-table-column label="设备加工工艺" align="center" width="230px">
<template slot-scope="scope">
{{ scope.row.工艺属性 }}
</template>
</el-table-column>
<el-table-column label="班次类型" align="center" width="110px">
<template slot-scope="scope">
{{ scope.row.班次类型 }}
</template>
</el-table-column>
<el-table-column label="整改工时系数" align="center">
<template slot-scope="scope">
{{ scope.row.整改工时比例 }}
</template>
</el-table-column>
<el-table-column label="预留工时系数" align="center" width="150px">
<template slot-scope="scope">
{{ scope.row.设备预留工时系数 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200px" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
class="el-icon-edit"
@click="handleEdit(scope.row);param = 1">编辑</el-button>
<el-button
size="mini"
type="danger"
class="el-icon-delete"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center width="800px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm" style="margin: auto">
<el-row>
<el-col :span="12">
<el-form-item label="设备名称" prop="设备名称">
<el-input v-model="form.设备名称" placeholder="设备名称" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备型号" prop="设备型号">
<el-input v-model="form.设备型号" placeholder="设备型号" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="性能指标" prop="设备性能指标">
<el-input v-model="form.设备性能指标" placeholder="性能指标" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="加工能力" prop="设备加工能力工时">
<el-input v-model="form.设备加工能力工时" placeholder="加工能力" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="整改工时系数" prop="整改工时比例">
<el-input v-model="form.整改工时比例" placeholder="设备整改工时系数" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编号" prop="设备编号">
<el-input v-model="form.设备编号" placeholder="设备编号" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工艺" prop="工艺属性代码">
<el-select v-model="form.工艺属性代码" filterable size="small" style="width:230px;">
<el-option
v-for="item in Technology"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班次类型" prop="班次类型">
<el-select v-model="form.班次类型" filterable size="small" style="width:230px;">
<el-option
v-for="item in ClassType"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工时系数" prop="设备工时系数">
<el-input v-model="form.设备工时系数" placeholder="工时系数" clearable size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预留工时系数" prop="设备预留工时系数">
<el-input v-model="form.设备预留工时系数" placeholder="设备预留工时系数" clearable size="small" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()">取消</el-button>
<el-button v-show="title==='增加'" type="primary" @click="submitAdd()">确定</el-button>
<el-button v-show="title==='编辑'" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getTechnology, searchtable, edittype, handlechange, handledelete } from '@/api/BasicData/EquipmentCapabilitySetting'
export default {
data() {
return {
equipmentNum: '',
num1: '',
equipmentName: '',
loading: false,
tableData: [], // 表格数据
pageSize: 10,
pageCurrent: 1,
total: 0,
dialogFormVisible: false,
title: '',
Technology: [],
ClassType: [{
value: 0,
label: 0
}, {
value: 1,
label: 1
}, {
value: 2,
label: 2
}, {
value: 3,
label: 3
}, {
value: 4,
label: 4
}],
form: {
设备名称: '', // 设备名称
设备型号: '', // 设备型号
设备性能指标: '', // 性能指标
设备加工能力工时: '', // 加工能力
整改工时比例: '', // 设备整改工时指数
设备编号: '', // 设备编号
工艺属性代码: '', // 工艺
班次类型: '', // 班次类型
设备工时系数: '', // 工时系数
设备预留工时系数: '' // 设备预留工时系数
},
rules: {
设备名称: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
设备型号: [{ required: true, message: '请输入设备型号', trigger: 'blur' }],
设备性能指标: [{ required: true, message: '请输入性能指标', trigger: 'blur' }],
设备加工能力工时: [{ required: true, message: '请输入加工能力', trigger: 'blur' }],
整改工时比例: [{ required: true, message: '请输入设备整改工时指数', trigger: 'blur' }],
设备编号: [{ required: true, message: '请输入设备编号', trigger: 'blur' }],
工艺属性代码: [{ required: true, message: '请选择工艺', trigger: 'change' }],
班次类型: [{ required: true, message: '请选择班次类型', trigger: 'change' }],
设备工时系数: [{ required: true, message: '请输入工时系数', trigger: 'blur' }],
设备预留工时系数: [{ required: true, message: '请输入设备预留工时系数', trigger: 'blur' }]
}
}
},
created() {
this.searchTable()
this.fetchData()
},
methods: {
// 初始化获取工艺
fetchData() {
this.getSelect(getTechnology, ['工艺名称', '工艺编号'], 'Technology')
},
// 查询
searchTable() {
this.loading = true
this.equipmentName ? this.num1 = 1 : this.num1 = 0
this.getTable(searchtable, [this.pageCurrent, this.pageSize, this.num1, this.equipmentName], ['tableData', 'total', 'loading'])
},
// 点击增加
handleAdd() {
this.dialogFormVisible = true
this.title = '增加'
this.addForm('form')
},
// 增加确定
submitAdd() {
this.addTable(edittype, [this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备工时系数, this.form.工艺属性代码, this.form.班次类型, this.form.设备加工能力工时, this.form.整改工时比例, this.form.设备编号, this.form.设备预留工时系数], 'form', function() { this.searchTable(); this.dialogFormVisible = false })
},
// 编辑打开
handleEdit(row) {
this.dialogFormVisible = true
this.title = '编辑'
this.equipmentNum = row.设备流水号
this.editForm(row, 'form')
},
// 编辑确定
submitEdit() {
this.editTable(handlechange, [this.equipmentNum, this.form.设备名称, this.form.设备型号, this.form.设备性能指标, this.form.设备工时系数, this.form.工艺属性代码, this.form.班次类型, this.form.设备加工能力工时, this.form.整改工时比例, this.form.设备编号, this.form.设备预留工时系数], 'form', function() { this.searchTable(); this.dialogFormVisible = false })
},
// 重置表单
callOff() {
this.dialogFormVisible = false
},
// 删除
handleDelete(index, row) {
this.deleteRow(handledelete, row.设备流水号, function() { this.searchTable() })
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom: 15px;
}
.el-input{
width: 200px!important;
}
</style>

View File

@@ -0,0 +1,257 @@
<template>
<div style="width: 100%;">
<el-card style="width: 400px;margin: auto;margin-top: 20px">
<div class="flex">
<div>
<calendar :events="calendar1.events" :value="calendar1.value" :begin="calendar1.begin" :end="calendar1.end" :weeks="calendar1.weeks" :months="calendar1.months" @search="search" @select="select" />
</div>
</div>
</el-card>
<el-card style="width: 400px;text-align: center;margin: auto">
<el-button type="primary" plain @click="setWork">上班</el-button>
<el-button type="success" plain @click="setRest">休息</el-button>
<el-button type="warning" plain @click="setToday">返回今天</el-button>
</el-card>
</div>
</template>
<script>
import { initClendar, changeState } from '@/api/BasicData/FactoryCalendar'
import calendar from '@/components/Calendar/calendar.vue'
export default {
components: {
calendar
},
data() {
return {
year: '', // 年
month: '', // 月
selectDate: '', // 选择的日期
time: '',
serNum: [], // 工作日流水号
serNumValue: '', // 工作日流水号值
arr: [], // 日期数组
arr1: [], // 日期数组
calendar1: {
value: [],
weeks: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], // 周的显示
months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], // 月的显示
events: {} // 上不上班
}
}
},
created() {
this.fetchData()
},
methods: {
select(val) { // 选择
this.selectDate = val[0] + '-' + val[1] + '-' + val[2]
},
setToday() { // 返回今天
this.fetchData()
},
fetchData() { // 日历初始化
var date = new Date()
this.year = date.getFullYear()
this.month = date.getMonth() + 1
this.day = date.getDate()
this.calendar1.value = [this.year, this.month, this.day] // 当前日期!
var events = Object() // 声明events是object对象
initClendar(this.year, this.month).then(response => {
for (let i = 0; i < response.data.length; i++) { // 这个循环是将时间1900-01-01转成1900-1-1型
var str = response.data[i].工作日期
var str1 = str.substr(0, 10)
var nian = str.substr(0, 4)
var yue = str.substr(5, 2)
var ri = str.substr(8, 2)
if (str.substr(5, 1) === '0') {
yue = yue.replace('0', '')
}
if (str.substr(8, 1) === '0') {
ri = ri.replace('0', '')
}
var x = nian + '-' + yue + '-' + ri
events[x] = response.data[i].是否工作
this.arr.push(x)
this.arr1.push(str1)
}
this.calendar1.events = events
})
},
search(year1, month1) { // !子组件的,上下月,改变年
var events = Object() // 声明events是object对象
initClendar(year1, month1).then(response => {
this.serNum = []
this.arr = []
this.arr1 = []
for (let i = 0; i < response.data.length; i++) { // 这个循环是将时间1900-01-01转成1900-1-1型
var str = response.data[i].工作日期
var str1 = str.substr(0, 10)
var nian = str.substr(0, 4)
var yue = str.substr(5, 2)
var ri = str.substr(8, 2)
if (str.substr(5, 1) === '0') {
yue = yue.replace('0', '')
}
if (str.substr(8, 1) === '0') {
ri = ri.replace('0', '')
}
var x = nian + '-' + yue + '-' + ri
this.arr.push(x)
this.arr1.push(str1)
events[x] = response.data[i].是否工作
}
this.calendar1.events = events
})
},
setWork() { // 上班
this.code = 1
for (let i = 0; i < this.arr.length; i++) {
if (this.arr[i] === this.selectDate) {
this.time = this.arr1[i]
break
}
}
changeState(this.time, this.code).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
this.$message.success('更改状态成功')
} else {
this.$message.error('更改状态失败')
}
})
},
setRest() { // 休息
this.code = 0
for (let i = 0; i < this.arr.length; i++) {
if (this.arr[i] === this.selectDate) {
this.time = this.arr1[i]
break
}
}
changeState(this.time, this.code).then(response => {
if (response.data[0].result === '1') {
this.fetchData()
this.$message.success('更改状态成功')
} else {
this.$message.error('更改状态失败')
}
})
}
}
}
</script>
<style>
/*demo*/
.flex{
box-sizing: border-box;
display: -webkit-box;
-webkit-box-pack: start;
-webkit-box-align: start;
display: -webkit-flex;
-webkit-justify-content: space-between;
-webkit-align-items: top;
display: flex;
justify-content: space-between;
align-items: top;
flex-flow:row wrap
}
.flex>div{
margin:10px;
padding:20px;
width:25%;
min-width:300px;
border-radius: 2px;
position: relative;
}
.flex>div>span{
position: absolute;
left:0px;
top:0px;
padding:2px 10px;
font-size:10px;
border-radius:0 0 2px 0;
background:#ea6151;
color:#fff;
}
.flex>div>input{
box-sizing: border-box;
width:100%;
margin-top:20px;
border-radius: 2px;
border:1px solid #dedede;
padding:10px;
font-size: 16px;
background:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWwpAZm9udC1mYWNlIHsgZm9udC1mYW1pbHk6IGlmb250OyBzcmM6IHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xNDQyMzczODk2XzQ3NTQ0NTUuZW90PyNpZWZpeCIpIGZvcm1hdCgiZW1iZWRkZWQtb3BlbnR5cGUiKSwgdXJsKCIvL2F0LmFsaWNkbi5jb20vdC9mb250XzE0NDIzNzM4OTZfNDc1NDQ1NS53b2ZmIikgZm9ybWF0KCJ3b2ZmIiksIHVybCgiLy9hdC5hbGljZG4uY29tL3QvZm9udF8xNDQyMzczODk2XzQ3NTQ0NTUudHRmIikgZm9ybWF0KCJ0cnVldHlwZSIpLCB1cmwoIi8vYXQuYWxpY2RuLmNvbS90L2ZvbnRfMTQ0MjM3Mzg5Nl80NzU0NDU1LnN2ZyNpZm9udCIpIGZvcm1hdCgic3ZnIik7IH0KCl1dPjwvc3R5bGU+PC9kZWZzPjxnIGNsYXNzPSJ0cmFuc2Zvcm0tZ3JvdXAiPjxnIHRyYW5zZm9ybT0ic2NhbGUoMC4wMTU2MjUsIDAuMDE1NjI1KSI+PHBhdGggZD0iTTcxMS4zMDYyIDI5MC42OTcyYzI0LjI4MjEgMCA0NS4zNzY1LTE5LjcwNjkgNDUuMzc2NS00NC4wMzJWNDYuNTYwMjU1OTk5OTk5OTk1YzAtMjQuMzI1MS0yMS4wOTU0LTQ0LjA1MzUtNDUuMzc2NS00NC4wNTM1LTI0LjMwMjYgMC00My45ODggMTkuNzI4NC00My45ODggNDQuMDUzNXYyMDAuMTA0OTZDNjY3LjMxODMgMjcwLjk5MDMgNjg3LjAwMzYgMjkwLjY5NzIgNzExLjMwNjIgMjkwLjY5NzJ6TTYyMy40ODA4IDExMy40MjAzSDQwMC43NjQ5Mjh2NjYuNTEzOTJoMjIyLjcxNTkwNDAwMDAwMDAyVjExMy40MjAyODh6TTg4NC4wNTMgMTEzLjQyMDNoLTgyLjc3NDAxNnY2Ni4xNDUyOGg4NS45NDAyMjRjMjUuMjc4NSAwIDQ2LjYxMTUgMjEuMzc2IDQ2LjYxMTUgNDYuNjc3djE1My45Mjc2OEg5MC40Mzg2NTYwMDAwMDAwMXYtMTUzLjkyNzY4YzAtMjUuMyAyMS4zMzMtNDYuNjc3IDQ2LjYxMTUtNDYuNjc3aDg2LjUwMzQyNFYxMTMuNDIwMjg4aC04Mi42NDI5NDRjLTY0LjA4NiAwLTExNi41MDc2IDUyLjUwODctMTE2LjUwNzYgMTE2LjcwMzJ2Njc2LjgwMTUzNTk5OTk5OTljMCA2NC4xNzQxIDUwLjQ5MTQgMTE2LjY4MDcgMTE0LjU3NzQgMTE2LjY4MDdIODg0LjA1Mjk5MmM2NC4wNjI1IDAgMTE2LjUwNjYtNTIuNTA2NiAxMTYuNTA2Ni0xMTYuNjgwN1YyMzAuMTIzNTE5OTk5OTk5OThDMTAwMC41NTk2IDE2NS45MjkgOTQ4LjExNDQgMTEzLjQyMDMgODg0LjA1MyAxMTMuNDIwM3pNOTMzLjgyOTYgOTEwLjM1MTRjMCAyNS4zLTIxLjMzMyA0Ni42NzYtNDYuNjExNSA0Ni42NzZIMTM3LjA1MDExMTk5OTk5OTk4Yy0yNS4yNzg1IDAtNDYuNjExNS0yMS4zNzYtNDYuNjExNS00Ni42NzZWNDQ2LjQ0NTU2OEg5MzMuODI5NjMyVjkxMC4zNTEzNnpNMjY3LjEwODQgNjQ2LjE4MTljMzYuODc3MyAwIDY2Ljc1MjUtMjkuOTM5NyA2Ni43NTI1LTY2Ljg4MTUgMC0zNi45MjI0LTI5Ljg3NTItNjYuODYxMS02Ni43NTI1LTY2Ljg2MTEtMzYuODU0OCAwLTY2Ljc1MjUgMjkuOTM5Ny02Ni43NTI1IDY2Ljg2MTFDMjAwLjM1NTggNjE2LjI0MjIgMjMwLjI1MjUgNjQ2LjE4MTkgMjY3LjEwODQgNjQ2LjE4MTl6TTUxMS41NDg0IDY0Ni4xODE5YzM2Ljg1NTggMCA2Ni43NTI1LTI5LjkzOTcgNjYuNzUyNS02Ni44ODE1IDAtMzYuOTIyNC0yOS44OTU3LTY2Ljg2MTEtNjYuNzUyNS02Ni44NjExLTM2Ljg3NzMgMC02Ni43NTI1IDI5LjkzOTctNjYuNzUyNSA2Ni44NjExQzQ0NC43OTU5IDYxNi4yNDIyIDQ3NC42NzExIDY0Ni4xODE5IDUxMS41NDg0IDY0Ni4xODE5ek0yNjUuOTE2NCA4OTAuNzA5YzM2Ljg3NzMgMCA2Ni43NTE1LTI5LjkzOTcgNjYuNzUxNS02Ni44NjExIDAtMzYuOTQyOC0yOS44NzQyLTY2Ljg4MjYtNjYuNzUxNS02Ni44ODI2LTM2Ljg1NTggMC02Ni43NTI1IDI5LjkzOTctNjYuNzUyNSA2Ni44ODI2QzE5OS4xNjM5IDg2MC43NjkzIDIyOS4wNTk2IDg5MC43MDkgMjY1LjkxNjQgODkwLjcwOXpNNTExLjU0ODQgODkwLjcwOWMzNi44NTU4IDAgNjYuNzUyNS0yOS45Mzk3IDY2Ljc1MjUtNjYuODYxMSAwLTM2Ljk0MjgtMjkuODk1Ny02Ni44ODI2LTY2Ljc1MjUtNjYuODgyNi0zNi44NzczIDAtNjYuNzUyNSAyOS45Mzk3LTY2Ljc1MjUgNjYuODgyNkM0NDQuNzk1OSA4NjAuNzY5MyA0NzQuNjcxMSA4OTAuNzA5IDUxMS41NDg0IDg5MC43MDl6TTc1NS42NDEzIDY0Ni4xODE5YzM2Ljg1NjggMCA2Ni43NTM1LTI5LjkzOTcgNjYuNzUzNS02Ni44ODE1IDAtMzYuOTIyNC0yOS44OTY3LTY2Ljg2MTEtNjYuNzUzNS02Ni44NjExLTM2Ljg3NzMgMC02Ni43NTI1IDI5LjkzOTctNjYuNzUyNSA2Ni44NjExQzY4OC44ODk5IDYxNi4yNDIyIDcxOC43NjQgNjQ2LjE4MTkgNzU1LjY0MTMgNjQ2LjE4MTl6TTMxMS43MDM2IDI5MC42OTcyYzI0LjI4MTEgMCA0NS4zNzY1LTE5LjcwNjkgNDUuMzc2NS00NC4wMzJWNDYuNTYwMjU1OTk5OTk5OTk1YzAtMjQuMzI1MS0yMS4wOTQ0LTQ0LjA1MzUtNDUuMzc2NS00NC4wNTM1LTI0LjMwMTYgMC00My45ODkgMTkuNzI4NC00My45ODkgNDQuMDUzNXYyMDAuMTA0OTZDMjY3LjcxNDYgMjcwLjk5MDMgMjg3LjQwMiAyOTAuNjk3MiAzMTEuNzAzNiAyOTAuNjk3MnoiIGZpbGw9IiM1ZTdhODgiPjwvcGF0aD48L2c+PC9nPjwvc3ZnPg==) no-repeat 8px 10px;
padding-left: 36px;
color:#666;
}
/*transition*/
.fade-enter-active,
.fade-leave-active {
transition: all .5s ease-in-out;
}
.fade-enter,.fade-leave-active{
opacity: 0;
transform: translateY(-10px);
}
/*下拉框*/
.calendar-dropdown{
background: #fff;
position: absolute;
left:0;
top:0;
padding:20px;
border: 1px solid #eee;
border-radius: 2px;
}
.calendar-dropdown:before {
position: absolute;
left:30px;
top: -10px;
content: "";
border:5px solid rgba(0, 0, 0, 0);
border-bottom-color: #DEDEDE;
}
.calendar-dropdown:after {
position: absolute;
left:30px;
top: -9px;
content: "";
border:5px solid rgba(0, 0, 0, 0);
border-bottom-color: #fff;
}
/*弹出框*/
.calendar-dialog{
position: absolute;
left:0;
top:0;
right:0;
bottom:0;
}
.calendar-dialog-mask{
background:rgba(255,255,255,.5);
width:100%;
height:100%;
}
.calendar-dialog-body{
background: #fff;
position: absolute;
left:50%;
top:50%;
transform: translate(-50%,-50%);
padding:20px;
border: 1px solid #eee;
border-radius: 2px;
}
</style>

View File

@@ -0,0 +1,251 @@
<template>
<div class="app-container">
<el-card>
<span>设备名称:</span>
<el-select v-model="equipmentNameValue" placeholder="设备名称" style="width:200px" size="small" clearable filterable>
<el-option
v-for="item in equipmentName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>操作者:</span>
<el-input v-model="operator" placeholder="操作者" size="small" clearable style="width:200px" @dblclick.native="getOperator();param = 0"/>
<el-button type="success" size="mini" icon="el-icon-search" style="margin-left:10px" @click="getTableData">查询</el-button>
<el-button type="primary" size="mini" icon="el-icon-circle-plus-outline" @click="handleAdd">增加</el-button>
</el-card>
<el-card>
<el-table v-loading="loading" :data="tableData" highlight-current-row border style="height: 500px">
<el-table-column label="设备名称" align="center" >
<template slot-scope="scope">
{{ scope.row.设备名称 }}
</template>
</el-table-column>
<el-table-column label="班次" align="center" >
<template slot-scope="scope">
{{ scope.row.班次 }}
</template>
</el-table-column>
<el-table-column label="操作者" align="center" >
<template slot-scope="scope">
{{ scope.row.操作者 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" >
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" style="margin-left:10px" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="选择人员" center style="min-height: 300px">
<span>部门名称:</span>
<el-select v-model="departmentValue" placeholder="部门名称" size="small" clearable style="width:180px" @change="getTablePeople">
<el-option
v-for="item in department"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-table
:data="tablePeople"
style="width:100%;max-height: 300px;margin-top: 20px"
height="300"
highlight-current-row
@row-click="currentPeople">
<el-table-column align="center" label="考勤编号">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column align="center" label="性别">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column align="center" label="工作岗位">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogFormVisible = false">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="title" :visible.sync="dialogFormVisible_form" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="设备名称" prop="设备名称">
<el-select v-model="form.设备流水号" placeholder="设备名称" style="width:200px" size="small" clearable filterable>
<el-option
v-for="item in equipmentName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="班次" prop="班次" >
<el-select v-model="form.班次代码" placeholder="班次" style="width:200px" size="small" clearable filterable>
<el-option
v-for="item in staff"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="操作者" prop="操作者" >
<el-input v-model="form.操作者" placeholder="操作者" size="small" style="width:200px" clearable @dblclick.native="getOperator();param = 1"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel">取消</el-button>
<el-button v-show="title === '增加'" type="primary" @click="submitAdd()">确定</el-button>
<el-button v-show="title === '编辑'" type="primary" @click="submitEdit()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getEquipment, getDepartment, getTablePeople, getTableData, deleteTable, getStaff, addTable, editTable } from '@/api/BasicData/MaintenanceEquipmentPerson'
import { SectionToChinese } from '@/utils/tool'
export default {
data() {
return {
equipmentNameValue: '',
equipmentNameCheck: null,
equipmentName: [],
operator: '',
operatorNum: '',
operatorCheck: null,
dialogFormVisible: false,
tablePeople: [],
departmentValue: '',
department: [],
tableData: [],
pageCurrent: 1,
pageSize: 10,
total: 0,
loading: false,
title: '',
dialogFormVisible_form: false,
param: null,
form: {
设备流水号: '',
班次代码: '',
操作者: '',
操作者编号: null
},
rules: {
设备流水号: [{ required: true, message: '请选择设备名称', trigger: 'blur' }],
操作者: [{ required: true, message: '请选择操作者', change: 'blur' }]
},
staff: [],
No: null
}
},
created() {
this.fetchData()
this.getTableData()
},
methods: {
fetchData() {
this.getSelect(getEquipment, ['设备名称', '设备流水号'], 'equipmentName', [0, this.equipmentNameValue]) // 获取设备名称
getStaff().then(res => { // 获取班次
res.data.map(row => {
this.staff.push({
label: `${SectionToChinese(row.班次代码)}`,
value: row.班次代码
})
})
})
},
getOperator() {
this.dialogFormVisible = true
this.getSelect(getDepartment, ['部门', '考核部门编号'], 'department')
},
getTablePeople() {
this.getData(getTablePeople, 'tablePeople', this.departmentValue)
},
currentPeople(row) {
if (this.param === 0) {
this.operator = row.姓名
this.operatorNum = row.人员编号
} else if (this.param === 1) {
this.form.操作者 = row.姓名
this.form.操作者编号 = row.人员编号
} else {
console.log(`err`)
}
},
getTableData() {
console.log(typeof (this.equipmentName))
this.equipmentNameValue ? this.equipmentNameCheck = 1 : this.equipmentNameCheck = 0
this.operator ? this.operatorCheck = 1 : this.operatorCheck = 0
this.loading = true
this.getTable(getTableData, [this.equipmentNameCheck, this.equipmentNameValue, this.operatorCheck, this.operatorNum, this.pageCurrent, this.pageSize], ['tableData', 'total', 'loading'])
},
handleAdd() {
this.addForm('form', [this.dialogFormVisible_form = true, this.title = '增加'])
},
handleEdit(row) {
this.No = row.设备人员关系流水号
this.editForm(row, 'form', [this.dialogFormVisible_form = true, this.title = '编辑'])
console.log(this.form, 111)
},
submitAdd() {
for (let i = 0; i < this.equipmentName.length; i++) {
if (this.form.设备流水号 === this.equipmentName[i].value) {
this.form.设备名称 = this.equipmentName[i].label
break
}
}
this.addTable(addTable, [this.form.设备流水号, this.form.班次代码, this.form.操作者, this.form.操作者编号], 'form', function() { this.getTableData(); this.dialogFormVisible_form = false })
},
submitEdit() {
console.log(this.form, 222)
this.editTable(editTable, [this.form.设备流水号, this.form.班次代码, this.form.操作者, this.form.操作者编号, this.No], 'form', function() { this.getTableData(); this.dialogFormVisible_form = false })
},
cancel() {
this.dialogFormVisible_form = false
},
handleDelete(row) {
this.deleteRow(deleteTable, row.设备人员关系流水号, function() { this.getTableData() })
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
}
}
}
</script>
<style scoped>
span{
margin: 20px;
}
</style>

View File

@@ -0,0 +1,201 @@
<template>
<div class="app-container">
<el-card>
<span>材料名称:</span>
<el-input v-model="Material" placeholder="请输材料名称" size="small" style="width:200px" clearable/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="pageCurrent = 1;pageSize = 10;featchMaterial()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="add()">增加</el-button>
</el-card>
<el-card>
<el-table
v-loading="listLoading"
:data="tableData"
style="width: 100%"
height="580"
highlight-current-row
border>
<el-table-column align="center" label="材料名称">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
<el-table-column align="center" label="变更日期">
<template slot-scope="scope">
{{ scope.row.操作日期 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="Edit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
icon="el-icon-delete"
@click="delMaterial(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible" title="新增材料" center style="min-height: 200px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px">
<el-form-item label="材料名称" prop="MaterialName" style="display: inline-block">
<el-input v-model="form.MaterialName" clearable size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff()">取消</el-button>
<el-button type="primary" size="small" @click="addMaterial('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="编辑材料" center style="min-height: 200px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules1" label-position="left" label-width="110px">
<el-form-item label="材料名称" prop="MaterialName2" style="display: inline-block">
<el-input v-model="form2.MaterialName2" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="callOff()">取消</el-button>
<el-button type="primary" size="small" @click="editMaterial('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { featchMaterial, addMaterial, delMaterial, editMaterial } from '@/api/BasicData/Materialmaintenance'
export default {
data() {
return {
ID: '',
dialogFormVisible: false,
dialogFormVisible2: false,
tableData: [],
Material: '', // 材质名称
listLoading: false,
pageCurrent: 1,
pageSize: 10,
total: null,
form: {
MaterialName: ''
},
form2: {
MaterialName2: ''
},
rules: {
MaterialName: [{ required: true, message: '请输入材料名称', trigger: 'blur' }]
},
rules1: {
MaterialName2: [{ required: true, message: '请输入材料名称', trigger: 'blur' }]
}
}
},
created() {
this.featchMaterial()
},
methods: {
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.featchMaterial()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.featchMaterial()
},
featchMaterial() {
featchMaterial(this.Material, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
},
callOff() {
this.dialogFormVisible = false
this.dialogFormVisible2 = false
},
add() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.form.MaterialName = ''
this.dialogFormVisible = true
},
addMaterial(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
addMaterial(this.form.MaterialName).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.dialogFormVisible = false
this.form = {}
this.featchMaterial()
} else {
this.$message.error('添加失败')
this.form = {}
}
})
}
})
},
delMaterial(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delMaterial(row.材料流水号).then(response => {
if (response.data[0].result === '1') {
this.form.MaterialName = ''
this.featchMaterial()
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
})
},
Edit(row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.dialogFormVisible2 = true
this.form2.MaterialName2 = row.材料
this.ID = row.材料流水号
},
editMaterial(form2) {
this.$refs[form2].validate((valid) => {
if (valid) {
this.dialogFormVisible2 = false
editMaterial(this.ID, this.form2.MaterialName2).then(response => {
if (response.data[0].result === '1') {
this.featchMaterial()
this.$message.success('编辑成功')
this.form = {}
} else {
this.$message.error('编辑失败')
this.form = {}
}
})
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,396 @@
<template>
<div class="app-container">
<el-row>
<el-col :span="7">
<el-card style="margin-bottom: 20px">
<el-button size="small" type="primary" @click="addFisrtLevel">创建一级菜单</el-button>
</el-card>
<el-card>
<div slot="header">
<el-input v-model="filterTextLeft" size="small" placeholder="输入关键字进行过滤" clearable/>
</div>
<el-table
ref="multipleTableLeft"
:data="fisrtLevelFilter"
stripe
highlight-current-row
size="mini"
height="calc(100vh - 330px)"
style="height:calc(100vh - 330px);"
@selection-change="handleSelectionChangeLeft">
<el-table-column
:selectable="selectable"
align="center"
type="selection"
width="55"/>
<el-table-column align="center" label="模块名称">
<template slot-scope="scope">
{{ scope.row.title }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="1">
<el-tooltip class="item" effect="dark" content="将选中一级菜单分配给该角色" placement="top-start">
<el-button :disabled="!roleName || selectLeft.length === 0" size="mini" type="primary" icon="el-icon-right" style="margin: 300px auto 0 auto;display: block" @click="giveFirstLevel"/>
</el-tooltip>
</el-col>
<el-col :span="8">
<el-card style="margin-bottom: 20px">
<span>角色:</span>
<el-select v-model="roleName" placeholder="请选择" size="small" style="width:200px;margin-left:10px" filterable @change="getModule">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-card>
<el-card style="height:calc(100vh - 220px);overflow: auto">
<div slot="header">
<el-input v-model="filterText" size="small" placeholder="输入关键字进行过滤" clearable/>
</div>
<el-tree
ref="moduleTree"
:data="moduleTree"
:filter-node-method="filterNode"
check-strictly
class="moduleTree"
show-checkbox
node-key="id"
default-expand-all
@check-change="treeCheck">
<span slot-scope="{ node, data }" class="custom-tree-node">
<span>{{ node.label }}</span>
<span>
<el-button
:disabled="data.children && data.children.length!==0"
type="text"
size="mini"
@click="() => returnModule(node, data)">
移除
</el-button>
</span>
</span>
</el-tree>
</el-card>
</el-col>
<el-col :span="1">
<el-tooltip class="item" effect="dark" content="将选中二级菜单分配给该角色选中的一级菜单" placement="top-start">
<el-button :disabled="treeCheckList.length !== 1 || selectRight.length === 0 || treeCheckListJudge" size="mini" type="primary" icon="el-icon-back" style="margin: 300px auto 0 auto;display: block" @click="giveSecondLevel"/>
</el-tooltip>
</el-col>
<el-col :span="7">
<el-card style="margin-bottom: 20px">
<el-button size="small" type="primary" @click="addSecondLevel">创建二级菜单</el-button>
</el-card>
<el-card>
<div slot="header">
<el-input v-model="filterTextRight" size="small" placeholder="输入关键字进行过滤" clearable/>
</div>
<el-table
ref="multipleTableRight"
:data="secondLevelFilter"
stripe
highlight-current-row
size="mini"
height="calc(100vh - 330px)"
style="height:calc(100vh - 330px);"
@selection-change="handleSelectionChangeRight">
<el-table-column
:selectable="selectable"
align="center"
type="selection"
width="55"/>
<el-table-column align="center" label="模块名称">
<template slot-scope="scope">
{{ scope.row.title }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-dialog :visible.sync="dialogVisible1" title="新增一级模块" center style="min-height: 300px" width="400px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="模块名称" prop="moduleName">
<el-input
v-model="form1.moduleName"
size="small"
style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible1=false">取消</el-button>
<el-button type="primary" @click="submitAdd()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getRole, getModule, initFisrtLevel, initSecondLevel, returnModule, giveFirstLevel, giveSecondLevel, submitAdd } from '@/api/BasicData/MenuManagement'
export default {
name: 'MenuManagement',
data() {
return {
roleName: null,
roleNames: [],
filterText: '',
filterTextLeft: '',
filterTextRight: '',
allModuleId: [],
moduleTree: [],
fisrtLevel: [],
fisrtLevelFilter: [],
secondLevel: [],
secondLevelFilter: [],
selectLeft: [],
selectRight: [],
treeCheckList: [],
treeCheckListJudge: null,
dialogVisible1: false,
form1: {
moduleName: ''
},
rules1: {
moduleName: [{ required: true, message: '请输入', trigger: ['blur', 'change'] }]
}
}
},
watch: {
filterText(val) {
this.$refs.moduleTree.filter(val)
},
filterTextLeft(val) {
this.fisrtLevelFilter = this.fisrtLevel.filter(v => {
return v.title.indexOf(val) > -1
})
},
filterTextRight(val) {
this.secondLevelFilter = this.secondLevel.filter(v => {
return v.title.indexOf(val) > -1
})
}
},
created() {
this.getRoleName()
this.initFisrtLevel()
this.initSecondLevel()
},
methods: {
// 撤回分配模块
returnModule(node, data) {
this.$confirm('确定撤回分配模块?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
returnModule(data.id, this.roleName).then(response => {
if (response.data[0].result === '1') {
this.filterText = ''
this.filterTextLeft = ''
this.filterTextRight = ''
this.getModule()
this.initFisrtLevel()
this.initSecondLevel()
this.$message.success('操作成功')
} else { this.$message.error('操作失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
// 分配一级
giveFirstLevel() {
this.$confirm('确定将选中的一级模块分配给选中角色?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
giveFirstLevel(this.selectLeft, this.roleName).then(response => {
if (response.data[0].result === '1') {
this.filterText = ''
this.filterTextLeft = ''
this.filterTextRight = ''
this.getModule()
this.initFisrtLevel()
this.initSecondLevel()
this.$message.success('操作成功')
} else { this.$message.error('操作失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
// 分配二级
giveSecondLevel() {
if (this.$refs.moduleTree.getCheckedKeys().length === 1) {
this.$confirm('确定将选中的二级模块分配给选中角色的选中一级模块?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
giveSecondLevel(this.selectRight, this.roleName, this.$refs.moduleTree.getCheckedKeys()).then(response => {
if (response.data[0].result === '1') {
this.filterText = ''
this.filterTextLeft = ''
this.filterTextRight = ''
this.getModule()
this.initFisrtLevel()
this.initSecondLevel()
this.$message.success('操作成功')
} else { this.$message.error('操作失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
} else {
this.$message.error('只可以分配给一个一级菜单')
}
},
// 控制某行是否可选
selectable(row) {
return !this.allModuleId.includes(row.id)
},
// 树checkChange
treeCheck() {
const param = []
this.treeCheckList = this.$refs.moduleTree.getCheckedKeys()
this.fisrtLevel.map(v => {
param.push(v.id)
})
this.treeCheckListJudge = !param.includes(parseInt(this.treeCheckList))
},
// leftChange
handleSelectionChangeLeft(val) {
this.selectLeft = []
val.map(v => {
this.selectLeft.push(v.id)
})
},
// rightChange
handleSelectionChangeRight(val) {
this.selectRight = []
val.map(v => {
this.selectRight.push(v.id)
})
},
// 初始化一级
initFisrtLevel() {
initFisrtLevel().then(res => {
this.fisrtLevel = res.data
this.fisrtLevelFilter = res.data
})
},
// 初始化二级
initSecondLevel() {
initSecondLevel().then(res => {
this.secondLevel = res.data
this.secondLevelFilter = res.data
})
},
// 新增一级
addFisrtLevel() {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1.moduleName = ''
this.dialogVisible1 = true
},
// 确认新增一级
submitAdd() {
this.$refs['form1'].validate((valid) => {
if (valid) {
this.dialogVisible1 = false
submitAdd(this.form1.moduleName).then(response => {
if (response.data[0].result === '1') {
this.$message.success('操作成功')
this.dialogVisible1 = false
this.initFisrtLevel()
} else {
this.$message.error('操作失败')
}
})
} else {
console.log('error submit!!')
return false
}
})
},
// 新增二级
addSecondLevel() {
console.log(1)
},
// 递归
fn(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].pid === pid) {
const obj = {
'id': data[i].id,
'label': data[i].title
}
temp = this.fn(data, data[i].id)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
// 初始化角色
getRoleName() {
getRole().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.roleNames.push({
value: response.data[i].角色编号,
label: response.data[i].角色功能
})
}
})
},
// 根据角色查模块
getModule() {
this.$refs.multipleTableLeft.clearSelection()
this.$refs.multipleTableRight.clearSelection()
getModule(this.roleName).then(response => {
this.allModuleId = []
response.data.map(v => {
this.allModuleId.push(v.id)
})
this.moduleTree = this.fn(response.data, 0)
})
},
// 筛选节点
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
}
}
}
</script>
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-right: 8px;
}
</style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,914 @@
<template>
<div class="app-container">
<el-row>
<el-col :span="6">
<el-card>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd('department_Form')">新增</el-button>
<el-button type="warning" icon="el-icon-edit" size="small" @click="handleEdit()">编辑</el-button>
<el-button type="danger" icon="el-icon-delete" size="small" @click="deleteTable()">删除</el-button>
</el-card>
</el-col>
<el-col :span="18">
<el-card>
<span>人员名称:</span>
<el-input v-model="Name" placeholder="请输入人员名称" class="input-with-select" size="small" style="width: 200px; margin-right: 15px" clearable>
<el-button slot="append" icon="el-icon-search" @click="fetchPeopleForName"/>
</el-input>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="addPeople()">新增</el-button>
<el-button type="danger" icon="el-icon-circle-close-outline" size="small" @click="Quit()">离职</el-button>
<el-button type="text" size="small" style="float: right" @click="searchLeavingList">离职名单</el-button>
<el-button v-popover:popover4 :disabled="disabledMove" type="success" icon="el-icon-sort" size="small" @click="moveGroup">移动
</el-button>
<!--<el-button size="small" @click="postMaintain()">岗位维护</el-button>-->
<el-popover
ref="popover4"
width="178"
placement="right"
trigger="click"
@hide="hide()">
<el-dropdown size="small" placement="bottom-start" style="margin-right: 0">
<el-input
v-model="nodeName1"
:disabled="true"
size="small"
placeholder="请选择部门"/>
<el-button type="text" size="small" style="margin-left: 60px; margin-top: 15px" @click="moveGroupConfim">
确认
</el-button>
<el-dropdown-menu slot="dropdown">
<el-tree
ref="treeForm"
:data="departmentData"
:props="defaultProps"
style="width: 150px"
node-key="id"
accordion
@node-click="NodeClick"/>
</el-dropdown-menu>
</el-dropdown>
</el-popover>
</el-card>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-card class="box-card" style="min-height: 700px; max-height: 743px">
<div slot="header" class="clearfix">
<span>部门维护</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="expandALL()">展开</el-button>
</div>
<div style="height: 650px">
<el-tree
ref="treeForm"
:data="departmentData"
:props="defaultProps"
show-checkbox
node-key="id"
check-strictly
default-expand-all
@check-change="handleClick"/>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card>
<el-table
ref="multipleTable"
:data="List"
stripe
tooltip-effect="dark"
style="width: 100%"
height="659"
highlight-current-row
border
size="mini"
@selection-change="handleSelectionChange">
<el-table-column
align="center"
type="selection"
width="50"/>
<el-table-column align="center" label="照片" width="50">
<template slot-scope="scope">
<el-popover
v-if="scope.row.文件标识 && scope.row.文件标识 !== 'null'"
placement="top-start"
width="200"
trigger="hover">
<el-button type="text" style="float:right" @click="deletePhoto(scope.row)">删除</el-button>
<el-image :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"/>
</div>
</el-image>
<el-image slot="reference" :src="scope.row.文件标识 && scope.row.文件标识 !== 'null' ? (readFile + scope.row.文件标识 + '.' + scope.row.文件后缀) : readFile + '123.jpg'" style="width:23px;">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"/>
</div>
</el-image>
</el-popover>
<span v-else></span>
</template>
</el-table-column>
<el-table-column align="center" label="部门名称" width="100">
<template slot-scope="scope">
{{ scope.row.节点名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="考勤编号" width="100">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="密码" width="100">
<template slot-scope="scope">
{{ scope.row.密码 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名" width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column align="center" label="性别" width="100">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column align="center" label="身份证号" width="165">
<template slot-scope="scope">
{{ scope.row.身份证号 }}
</template>
</el-table-column>
<el-table-column align="center" label="学历" width="100">
<template slot-scope="scope">
{{ scope.row.学历名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="入职时间" width="100">
<template slot-scope="scope">
{{ scope.row.入公司时间 !== '' && scope.row.入公司时间 !== null ? scope.row.入公司时间 = scope.row.入公司时间.split(' ')[0]: scope.row.入公司时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="出生日期" width="100">
<template slot-scope="scope">
{{ scope.row.出生日期 !== '' && scope.row.出生日期 !== null ? scope.row.出生日期 = scope.row.出生日期.split(' ')[0]: scope.row.出生日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="联系方式" width="110">
<template slot-scope="scope">
{{ scope.row.联系电话 }}
</template>
</el-table-column>
<el-table-column align="center" label="岗位工种" width="100">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="民族" width="100">
<template slot-scope="scope">
{{ scope.row.民族 }}
</template>
</el-table-column>
<el-table-column align="center" label="家庭住址" width="200">
<template slot-scope="scope">
{{ scope.row.家庭住址 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="220">
<template slot-scope="scope">
<el-button
:disabled="scope.row.文件标识 && scope.row.文件标识 !== 'null'"
size="mini"
type="primary"
icon="el-icon-picture"
@click="handlePicture(scope.row)">上传图片</el-button>
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="handleEditPeople(scope.row)">编辑</el-button>
<!--<el-button-->
<!--size="mini"-->
<!--type="danger"-->
<!--icon="el-icon-delete"-->
<!--@click="deletePeopleTable(scope.row)">删除</el-button>-->
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="PageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="PageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</el-col>
</el-row>
<!--新增和编辑部门-->
<el-dialog :title="department_Title" :visible.sync="department_DFV" center style="min-height: 200px" width="400px">
<el-form ref="department_Form" :model="department_Form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form-item label="部门名称" prop="DepartmentName">
<el-input v-model="department_Form.DepartmentName" size="small" style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取消</el-button>
<el-button v-if="department_Title==='新增部门'" type="primary" @click="submitAdd('department_Form')">确定</el-button>
<el-button v-else-if="department_Title==='编辑部门'" type="primary" @click="submitEdit('department_Form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :title="people_title" :visible.sync="people_DFV" center style="min-height: 200px" width="800px">
<el-form ref="people_form" :rules="rules" :model="people_form" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="考勤编号" prop="AccountNumber">
<el-input v-model="people_form.AccountNumber" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密码" prop="Password">
<el-input v-model="people_form.Password" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="姓名" prop="Name">
<el-input v-model="people_form.Name" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="性别" prop="Sex">
<el-select v-model="people_form.Sex" clearable placeholder="请选择性别" style="width: 200px" size="small">
<el-option
v-for="item in SexData"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="出生日期" prop="Birthday">
<el-date-picker
v-model="people_form.Birthday"
style="width: 200px"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="请选择出生日期"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="身份证号" prop="IDcard">
<el-input v-model="people_form.IDcard" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="入职时间" prop="TimeOfEntry">
<el-date-picker
v-model="people_form.TimeOfEntry"
style="width: 200px"
value-format="yyyy-MM-dd"
size="small"
type="date"
placeholder="请选择入职时间"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系方式" prop="ContactInformation">
<el-input v-model="people_form.ContactInformation" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="学历" prop="Education">
<el-select v-model="people_form.Education" clearable placeholder="请选择学历" style="width: 200px" size="small">
<el-option
v-for="item in EducationDate"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="家庭住址" prop="Address">
<el-input v-model="people_form.Address" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="民族" prop="Nation">
<el-input v-model="people_form.Nation" size="small" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="岗位" prop="Post">
<el-select v-model="people_form.Post" clearable placeholder="请选择岗位" style="width: 200px" size="small">
<el-option
v-for="item in PostData"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="btnLoading" @click="cancel">取消</el-button>
<el-button v-if="people_title === '新增人员'" :loading="btnLoading" type="primary" @click="submitAddPeople">确定</el-button>
<el-button v-else-if="people_title === '编辑人员'" :loading="btnLoading" type="primary" @click="submitEditPeople">确定</el-button>
</div>
</el-dialog>
<!--离职名单-->
<el-dialog :visible.sync="LeavingListVisiable" title="离职名单" center style="height: 800px" width="80%">
<el-table
:data="LeavingList"
stripe
tooltip-effect="dark"
style="width: 100%"
height="500"
highlight-current-row
border
size="mini">
<el-table-column align="center" label="部门名称" width="100">
<template slot-scope="scope">
{{ scope.row.节点名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="考勤编号" width="100">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="密码" width="100">
<template slot-scope="scope">
{{ scope.row.密码 }}
</template>
</el-table-column>
<el-table-column align="center" label="姓名" width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column align="center" label="性别" width="100">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column align="center" label="身份证号" width="165">
<template slot-scope="scope">
{{ scope.row.身份证号 }}
</template>
</el-table-column>
<el-table-column align="center" label="学历" width="100">
<template slot-scope="scope">
{{ scope.row.学历名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="入职时间" width="100">
<template slot-scope="scope">
{{ scope.row.入公司时间 !== '' && scope.row.入公司时间 !== null ? scope.row.入公司时间 = scope.row.入公司时间.split(' ')[0]: scope.row.入公司时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="出生日期" width="100">
<template slot-scope="scope">
{{ scope.row.出生日期 !== '' && scope.row.出生日期 !== null ? scope.row.出生日期 = scope.row.出生日期.split(' ')[0]: scope.row.出生日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="联系方式" width="110">
<template slot-scope="scope">
{{ scope.row.联系电话 }}
</template>
</el-table-column>
<el-table-column align="center" label="岗位工种" width="100">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="民族" width="100">
<template slot-scope="scope">
{{ scope.row.民族 }}
</template>
</el-table-column>
<el-table-column align="center" label="家庭住址">
<template slot-scope="scope">
{{ scope.row.家庭住址 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="PageCurrentN"
:page-sizes="[10, 20, 30, 40]"
:page-size="PageSizeN"
:total="totalN"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChangeN"
@current-change="handleCurrentChangeN"/>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible" title="上传图片" center style="height: 800px" width="30%">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:action="upload+'?num='+ PersonId"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPerson()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { moveGroups, getTree, tree, getTablePeople, getTablePeopleForName, addDepartmentName, delList, editList, delPeopleList, fetchEducationData, fetchPostData, addPeople, editPeople, quit, searchLeavingList } from '@/api/BasicData/PersonnelManagement'
import { uploadPerson } from '@/utils/request'
import { readFile } from '@/utils/request'
import request from '@/utils/request'
export default {
data() {
return {
limit: 999,
readFile: readFile,
disabledMove: true,
PageCurrentN: 1,
PageSizeN: 10,
totalN: null,
LeavingList: [],
LeavingListVisiable: false,
departmentData: [],
expandAll: true,
i: 1,
id: '',
PageCurrent: 1,
PageSize: 50,
List: [],
total: null,
nodeName: '',
btnLoading: false,
department_DFV: false,
upload: uploadPerson,
dialogFormVisible: false,
PersonId: '',
department_Form: {
DepartmentName: ''
},
department_Title: '',
Name: '',
people_title: '',
people_DFV: false,
defaultProps: {
children: 'children',
label: 'label'
},
people_form: {
Name: '',
AccountNumber: '',
Password: '',
Sex: null,
Birthday: '',
IDcard: '',
TimeOfEntry: '',
ContactInformation: '',
Address: null,
Nation: '',
ForeignLanguageLevel: null,
Title: null,
PositionStatus: null,
Education: null,
Post: null,
PeopleID: null
},
rules: {
Name: [{ required: true, message: '请输入', trigger: 'blur' }],
AccountNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
Password: [{ required: true, message: '请输入', trigger: 'blur' }],
Sex: [{ required: true, message: '请输入', trigger: 'change' }],
Birthday: [{ required: true, message: '请输入', trigger: 'change' }],
IDcard: [{ required: true, message: '请输入', trigger: 'blur' }],
TimeOfEntry: [{ required: true, message: '请输入', trigger: 'change' }],
ContactInformation: [{ required: true, message: '请输入', trigger: 'blur' }],
Address: [{ required: true, message: '请输入', trigger: 'change' }],
Nation: [{ required: true, message: '请输入', trigger: 'change' }],
ForeignLanguageLevel: [{ required: true, message: '请输入', trigger: 'change' }],
Title: [{ required: true, message: '请输入', trigger: 'change' }],
PositionStatus: [{ required: true, message: '请输入', trigger: 'change' }],
Education: [{ required: true, message: '请输入', trigger: 'change' }],
Post: [{ required: true, message: '请输入', trigger: 'change' }],
DepartmentName: [{ required: true, message: '请输入', trigger: 'blur' }]
},
SexData: [{
value: 1,
label: '男'
}, {
value: 2,
label: '女'
}],
EducationDate: [],
PostData: [],
multipleSelection: [],
nodeName1: '',
count1: 0,
count2: 0
}
},
created() {
this.getTreeData()
this.fetchEducationData()
this.fetchPostData()
},
methods: {
// 删除人员照片
deletePhoto(row) {
this.$confirm('此操作将永久删除该图片, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '',
method: 'post',
data: {
type: '4',
name: `delete from 人员管理_图片 where 人员编号 = ${row.人员编号}`
}
}).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.handleNodeClick()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
})
})
},
fetchEducationData() {
this.getSelect(fetchEducationData, ['学历名称', '学历编号'], 'EducationDate')
},
fetchPostData() {
this.people_form.Post = ''
this.PostData = []
this.getSelect(fetchPostData, ['岗位名称', '岗位编号'], 'PostData')
},
getTreeData() {
getTree().then(response => {
const data = response.data
this.departmentData = tree(data, 0)
})
},
expandALL() {
this.expandAll = !this.expandAll
for (let i = 0; i < this.$refs.treeForm.store._getAllNodes().length; i++) {
this.$refs.treeForm.store._getAllNodes()[i].expanded = this.expandAll
}
},
handleNodeClick() {
this.getTable(getTablePeople, [this.id, this.PageCurrent, this.PageSize], ['List', 'total'])
},
handleClick(data, checked) {
if (this.$refs.treeForm.getCheckedKeys().length !== 0 && this.$refs.treeForm.getCheckedNodes().length !== 0) {
const data = this.$refs.treeForm.getCheckedKeys()
if (data.length === 1) {
this.id = data[0]
this.handleNodeClick()
}
this.nodeName = this.$refs.treeForm.getCheckedNodes()[0].label
} else {
this.id = ''
this.handleNodeClick()
}
this.i++
if (this.i % 2 === 1) {
if (checked) {
this.$refs.treeForm.setCheckedNodes([data])
} else {
this.$refs.treeForm.setCheckedNodes([])
}
}
},
uploadSuccess(res) { // 上传成功回调
if (res[0].result === '1') {
this.$message.success('增加成功')
this.handleNodeClick()
this.dialogFormVisible = false
this.$refs.upload.clearFiles()
} else {
this.$message.error('增加失败')
}
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
handlePicture(row) {
this.dialogFormVisible = true
this.PersonId = row.人员编号
},
submitPerson() {
this.$refs.upload.submit()
},
handleAdd(formName) {
this.department_Title = '新增部门'
this.department_DFV = true
this.department_Form.DepartmentName = ''
this.count1 = this.count1 + 1
if (this.count1 !== 1) {
this.$refs[formName].resetFields()
}
},
handleEdit() {
this.addForm('department_Form')
if (this.id) {
this.department_Title = '编辑部门'
this.department_DFV = true
this.department_Form.DepartmentName = this.nodeName
} else {
this.$message.warning(`请选择要修改的部门`)
}
},
submitAdd(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.department_DFV = false
if (this.id) {
addDepartmentName(this.id, this.department_Form.DepartmentName, 0).then(response => {
if (response.data[0].result === '1') {
this.getTreeData()
this.$message.success('添加成功')
this.i = 0
} else {
this.$message.error('添加失败')
}
})
} else {
addDepartmentName(0, this.department_Form.DepartmentName, 0).then(response => {
if (response.data[0].result === '1') {
this.getTreeData()
this.$message.success('添加成功')
this.i = 1
} else {
this.$message.error('添加失败')
}
})
}
} else {
return false
}
})
},
submitEdit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.department_DFV = false
editList(this.id, this.department_Form.DepartmentName).then(response => {
if (response.data[0].result === '1') {
this.getTreeData()
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
} else {
return false
}
})
},
deleteTable() {
if (this.id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delList(this.id).then(response => {
if (response.data[0].result === '1') {
this.getTreeData()
this.i = 1
this.id = ''
this.$message({
message: '已被成功删除',
type: 'success'
})
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
} else {
this.$message.warning(`请选择部门`)
}
},
cancel() {
this.department_DFV = false
this.people_DFV = false
},
fetchPeopleForName() {
if (this.Name) {
getTablePeopleForName(this.Name).then(response => {
for (let i = 0; i < response.data.length; i++) {
// let Data = response.data
if (response.data[i].入公司时间) {
response.data[i].入公司时间 = response.data[i].入公司时间.split(' ')[0]
}
if (response.data[i].出生日期) {
response.data[i].出生日期 = response.data[i].出生日期.split(' ')[0]
}
}
this.List = response.data
})
} else {
this.$message.warning(`请输入人员姓名`)
this.List = []
}
},
addPeople() {
if (this.id) {
this.people_title = '新增人员'
this.people_DFV = true
this.addForm('people_form')
} else {
this.$message.warning(`请选择部门名称`)
}
},
submitAddPeople() {
this.btnLoading = true
addPeople(this.id, this.people_form.Sex, this.people_form.Education, this.people_form.Address, this.people_form.Nation, this.people_form.Post, this.people_form.AccountNumber, this.people_form.Password, this.people_form.Name, this.people_form.IDcard, this.people_form.TimeOfEntry, this.people_form.Birthday, this.people_form.ContactInformation).then(response => {
this.btnLoading = false
if (response.data[0].result === '1') {
this.people_DFV = false
this.i = 0
this.handleNodeClick()
this.$message.success('添加成功')
} else {
this.$message.error('添加失败')
}
})
},
handleEditPeople(row) {
this.people_title = '编辑人员'
this.people_DFV = true
this.addForm('people_form')
this.people_form.PeopleID = row.人员编号
this.people_form.Sex = parseInt(row.性别编号)
this.people_form.Education = parseInt(row.学历编号)
this.people_form.Address = row.家庭住址
this.people_form.Nation = row.民族
this.people_form.Post = parseInt(row.岗位编号)
this.people_form.AccountNumber = row.考勤编号
this.people_form.Password = row.密码
this.people_form.Name = row.姓名
this.people_form.IDcard = row.身份证号
this.people_form.TimeOfEntry = row.入公司时间
this.people_form.Birthday = row.出生日期
this.people_form.ContactInformation = row.联系电话
},
submitEditPeople() {
this.btnLoading = true
editPeople(this.people_form.PeopleID, this.people_form.Sex, this.people_form.Education, this.people_form.Address, this.people_form.Nation, this.people_form.Post, this.people_form.AccountNumber, this.people_form.Password, this.people_form.Name, this.people_form.IDcard, this.people_form.TimeOfEntry, this.people_form.Birthday, this.people_form.ContactInformation).then(response => {
this.btnLoading = false
if (response.data[0].result === '1') {
if (this.id !== '' && this.Name === '') {
this.handleNodeClick()
} else {
this.feathPeopleForName()
}
this.$message.success('编辑成功')
this.people_DFV = false
} else {
this.$message.error('编辑失败')
}
})
},
deletePeopleTable(row) {
this.deleteRow(delPeopleList, row.人员编号, function() { this.id ? this.handleNodeClick() : this.feathPeopleForName() })
this.i = 0
},
postMaintain() {
},
handleSizeChange(val) {
this.PageSize = val
this.PageCurrent = 1
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
handleCurrentChange(val) {
this.PageCurrent = val
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
},
handleSizeChangeN(val) {
this.PageSizeN = val
this.PageCurrentN = 1
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
},
handleCurrentChangeN(val) {
this.PageCurrentN = val
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
},
handleSelectionChange(val) {
this.multipleSelection = val
this.multipleSelection.length === 0 ? this.disabledMove = true : this.disabledMove = false
},
Quit() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请选择进行离职操作的员工')
} else {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (let i = 0; i < this.multipleSelection.length; i++) {
quit(this.multipleSelection[i].人员编号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离职成功')
getTablePeople(this.id, this.PageCurrent, this.PageSize).then(response => {
this.List = response.data.rows
this.total = response.data.total
})
} else { this.$message.error('离职失败') }
})
}
}).catch(() => {
this.$message({
type: 'info',
message: '已取消离职操作'
})
})
}
},
searchLeavingList() {
this.LeavingListVisiable = true
this.getTable(searchLeavingList, [this.PageCurrentN, this.PageSizeN], ['LeavingList', 'totalN'])
},
moveGroupConfim() {
this.id = this.node
for (let i = 0; i < this.multipleSelection.length; i++) {
moveGroups(this.multipleSelection[i].人员编号, this.node).then(response => {
if (response.data[0].result === '1') {
this.handleNodeClick()
if (i === this.multipleSelection.length - 1) {
this.$message.success('移组成功')
}
} else {
this.$message.error('更新失败')
}
})
}
},
hide() {
this.nodeName1 = ''
this.node = ''
},
moveGroup() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请至少选择一个人员')
}
},
NodeClick(data) {
this.node = data.id
this.nodeName1 = data.label
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,474 @@
<template>
<div class="app-container">
<el-card>
<span style="margin-left: 15px">班次类型:</span>
<el-select v-model="roleName" placeholder="班次类型" clearable size="small" style="width:200px">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="searchTable()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="addShifttable()">增加</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="ShiftType()">班次类型工作时间</el-button>
</el-card>
<el-card>
<el-table
:data="tableData"
border
size="mini"
style="width: 100%;height: 550px;">
<el-table-column label="开始工作时间">
<template slot-scope="scope">
{{ scope.row.开始工作时间 }}
</template>
</el-table-column>
<el-table-column disabled label="结束工作时间" >
<template slot-scope="scope">
{{ scope.row.结束工作时间 }}
</template>
</el-table-column>
<el-table-column label="班次类型">
<template slot-scope="scope">
{{ scope.row.班次类型 }}
</template>
</el-table-column>
<el-table-column label="班次代码">
<template slot-scope="scope">
{{ scope.row.班次代码 }}
</template>
</el-table-column>
<el-table-column label="是否夜班">
<template slot-scope="scope">
{{ scope.row.是否夜班 }}
</template>
</el-table-column>
<el-table-column label="是否工作">
<template slot-scope="scope">
{{ scope.row.是否工作 }}
</template>
</el-table-column>
<el-table-column label="是否工作">
<template slot-scope="scope">
{{ scope.row.是否工作 }}
</template>
</el-table-column>
<el-table-column label="日工作能力">
<template slot-scope="scope">
{{ scope.row.日工作能力 }}
</template>
</el-table-column>
<el-table-column label="是否可以安排高难度件">
<template slot-scope="scope">
{{ scope.row.是否可以安排高难度件 }}
</template>
</el-table-column>
<el-table-column label="备注">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="aeditShifttable(scope.row)">修改</el-button>
<el-button
size="mini"
type="danger"
icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="10"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync ="dialogFormVisible1" title="增加" center style="min-height: 270px" width="900px">
<el-form ref="form1" :model="form1" :rules="rules" label-position="right" label-width="160px" class="demo-ruleForm">
<el-row>
<el-col :span="10">
<el-form-item label="开始工作时间" >
<el-time-picker
v-model="form1.value"
:picker-options="{
selectableRange: '01:30:00 - 23:30:00'
}"
value-format="hh:mm:ss"
size="mini"
style="width: 200px"
placeholder="任意时间点"/>
</el-form-item>
<el-form-item label="结束工作时间" >
<el-time-picker
v-model="form1.value2"
:picker-options="{
selectableRange: '01:30:00 - 23:30:00'
}"
value-format="hh:mm:ss"
size="mini"
style="width: 200px"
placeholder="任意时间点"/>
</el-form-item>
<el-form-item label="班次类型" >
<el-input
v-model="form1.shifttype"
size="mini"
style="width:200px"/>
</el-form-item>
<el-form-item label="班次代码" >
<el-input v-model="form1.shiftnumber" size="mini" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="是否夜班" >
<el-select v-model="form1.nightwork" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否工作" >
<el-select v-model="form1.work" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否可以安排临时件" >
<el-select v-model="form1.temporary" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否可以安排高难度件" >
<el-select v-model="form1.difficult" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注" >
<el-input
v-model="form1.note"
size="mini"
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOFF"> </el-button>
<el-button type="primary" @click="submitAdd1()"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="编辑" center style="min-height: 270px" width="900px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="10">
<el-form-item label="开始工作时间" >
<el-time-picker
v-model="form1.value"
:picker-options="{
selectableRange: '01:30:00 - 23:30:00'
}"
value-format="hh:mm:ss"
size="mini"
style="width: 200px"
placeholder="任意时间点"/>
</el-form-item>
<el-form-item label="结束工作时间" >
<el-time-picker
v-model="form1.value2"
:picker-options="{
selectableRange: '01:30:00 - 23:30:00'
}"
value-format="hh:mm:ss"
size="mini"
style="width: 200px"
placeholder="任意时间点"/>
</el-form-item>
<el-form-item label="班次类型" >
<el-input
v-model="form2.shifttype"
size="mini"
style="width:200px"/>
</el-form-item>
<el-form-item label="班次代码" >
<el-input v-model="form2.shiftnumber" size="mini" style="width:200px"/>
</el-form-item>
</el-col>
<el-col :span="14">
<el-form-item label="是否夜班" >
<el-select v-model="form2.nightwork" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否工作" >
<el-select v-model="form2.work" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否可以安排临时件" >
<el-select v-model="form2.temporary" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="是否可以安排高难度件" >
<el-select v-model="form2.difficult" placeholder="请选择" size="mini">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注" >
<el-input
v-model="form2.note"
size="mini"
style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOFF">取消</el-button>
<el-button type="primary" @click="submitAdd2()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getScheduling, searchProgramme, addShift, editShift, deleteShift, addShiftType } from '@/api/BasicData/ShiftManagement'
export default {
data() {
return {
roleName: '',
roleNames: [],
tableData: [],
hour: '',
minutes: '',
seconds: '',
tableDatate: [],
dialogFormVisible: false,
form1: {
value: '',
value2: '',
shifttype: '',
shiftnumber: '',
nightwork: '',
work: '',
temporary: '',
difficult: '',
note: ''
},
options: [{
value: '1',
label: '是'
}, {
value: '0',
label: '否'
}],
rules: { // 表单验证规则
value: [{ required: true, message: '请选择时间', trigger: 'blur' }],
value2: [{ required: true, message: '请选择时间', trigger: 'blur' }],
shifttype: [{ required: true, message: '请输入班次', trigger: 'change' }]
},
form2: {
value: new Date(2016, 9, 10, 18, 40),
value2: new Date(2016, 9, 10, 18, 40),
shifttype: '',
shiftnumber: '',
nightwork: '',
work: '',
temporary: '',
difficult: '',
note: ''
},
dialogFormVisible1: false,
dialogFormVisible2: false,
pageCurrent: 1,
pageSize: 10,
total: 0,
rules2: { // 表单验证规则
value: [{ required: true, message: '请选择时间', trigger: 'blur' }],
value2: [{ required: true, message: '请选择时间', trigger: 'blur' }],
shifttype: [{ required: true, message: '请输入班次', trigger: 'change' }]
},
listnumber: ''
}
},
created() {
this.searchData()
},
methods: {
searchData() {
searchProgramme().then(response => {
console.log(response.data)
for (let i = 0; i < response.data.length; i++) {
this.roleNames.push({
label: response.data[i].班次代码,
value: response.data[i].班次代码
})
}
})
},
searchTable() {
getScheduling(this.roleName).then(response => {
this.tableDatate = response.data
for (let i = 0; i < this.tableDatate.length; i++) {
this.hour = this.tableDatate[i].开始工作时间.Hours
this.minutes = this.tableDatate[i].开始工作时间.Minutes
this.seconds = this.tableDatate[i].开始工作时间.Seconds
this.tableDatate[i].开始工作时间 = JSON.stringify(this.tableDatate[i].开始工作时间)
this.tableDatate[i].开始工作时间 = this.hour.toString() + ':' + this.minutes.toString() + ':' + this.seconds.toString()
}
for (let i = 0; i < this.tableDatate.length; i++) {
this.hour = this.tableDatate[i].结束工作时间.Hours
this.minutes = this.tableDatate[i].结束工作时间.Minutes
this.seconds = this.tableDatate[i].结束工作时间.Seconds
this.tableDatate[i].结束工作时间 = JSON.stringify(this.tableDatate[i].结束工作时间)
this.tableDatate[i].结束工作时间 = this.hour.toString() + ':' + this.minutes.toString() + ':' + this.seconds.toString()
}
this.tableData = this.tableDatate
this.total = this.tableData.length
})
},
addShifttable() {
this.dialogFormVisible1 = true
},
aeditShifttable(row) {
this.listnumber = row.序号
this.form2.value = row.开始工作时间
this.form2.value2 = row.结束工作时间
this.form2.shifttype = row.班次类型
this.form2.shiftnumber = row.班次代码
this.form2.nightwork = row.是否夜班
this.form2.work = row.是否工作
this.form2.temporary = row.是否可以安排临时件
this.form2.difficult = row.是否可以安排高难度件
this.form2.note = row.备注
this.dialogFormVisible2 = true
},
submitAdd1() {
this.$refs['form1'].validate((valid) => {
if (valid) {
addShift(this.form1.value, this.form1.value2, this.form1.shifttype, this.form1.shiftnumber, this.form1.nightwork, this.form1.work, this.form1.temporary, this.form1.difficult, this.form1.note).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.form1 = {}
this.searchTable()
this.dialogFormVisible1 = false
} else { this.$message.error('增加失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
ShiftType() {
addShiftType().then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.searchTable()
} else { this.$message.error('增加失败') }
})
},
submitAdd2() {
this.$refs['form2'].validate((valid) => {
if (valid) {
editShift(this.listnumber, this.form2.value, this.form2.value2, this.form2.shifttype, this.form2.shiftnumber, this.form2.nightwork, this.form2.work, this.form2.temporary, this.form2.difficult, this.form2.note).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改成功')
this.searchTable()
this.dialogFormVisible2 = false
this.form2 = {}
} else { this.$message.error('修改失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleDelete(row) { // 删除
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteShift(row.序号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
} else { this.$message.error('删除失败') }
this.searchTable()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
callOFF() {
this.dialogFormVisible1 = false
this.form1 = {}
this.dialogFormVisible2 = false
this.form2 = {}
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom:15px;
margin-left: 15px;
margin-right: 15px;
}
</style>

View File

@@ -0,0 +1,218 @@
<template>
<div class="app-container">
<el-card>
<span>角色功能:</span>
<el-input v-model="RoleFunctioning" size="small" clearable style="width:200px"/>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="pageCurrent=1;pageSize = 10;searchData()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="handleAdd()">增加</el-button>
</el-card>
<el-card style="margin-top: 15px">
<el-table
v-loading="loading"
:data="tableData"
highlight-current-row
border>
<el-table-column align="center" label="角色编号" width="100">
<template slot-scope="scope">
{{ scope.row.角色编号 }}
</template>
</el-table-column>
<el-table-column align="center" label="角色功能">
<template slot-scope="scope">
{{ scope.row.角色功能 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作日期">
<template slot-scope="scope">
{{ scope.row.操作日期 }}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="handleEdit(scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-dialog :visible.sync="dialogFormVisible1" title="新增角色" center style="min-height: 200px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px">
<el-form-item label="角色名称" prop="角色功能" style="display: inline-block">
<el-input
v-model="form.角色功能"
clearable
size="small"
placeholder="角色功能"
style="width: 200px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible1 = false">取消</el-button>
<el-button type="primary" size="small" @click="submitAdd1('form')">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="编辑角色" center style="min-height: 200px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px">
<el-form-item label="角色名称" prop="角色功能" style="display: inline-block">
<el-input
v-model="form2.角色功能"
clearable
size="small"
placeholder="角色功能"
style="width: 200px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button size="small" @click="dialogFormVisible2 = false">取消</el-button>
<el-button type="primary" size="small" @click="submitAdd2('form2')">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { InitRolefunction, deleteData, searchTable, addData, addData2 } from '@/api/BasicData/SystemRrolemaintenance'
export default {
data() {
return {
RoleFunctioning: '',
pageCurrent: 1,
pageSize: 10,
total: null,
loading: false,
tableData: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
name: '',
num: '', // 角色编号
form: {
角色功能: ''
},
form2: {
角色功能: ''
},
rules: {
角色功能: [{ required: true, message: '请输入角色名称', trigger: 'blur' }]
},
rules2: {
角色功能: [{ required: true, message: '请输入角色名称', trigger: 'blur' }]
}
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
InitRolefunction(this.pageCurrent, this.pageSize).then(response => { // 初始化
this.tableData = response.data.rows
this.total = response.data.total
})
},
searchData() {
this.loading = true
searchTable(this.RoleFunctioning, this.pageCurrent, this.pageSize).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
this.loading = false
console.log(response.data)
})
},
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.fetchData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.fetchData()
},
handleEdit(row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.dialogFormVisible2 = true
this.form2.角色功能 = row.角色功能
this.num = row.角色编号
},
submitAdd2(formName) { // 编辑角色功能
this.$refs[formName].validate((valid) => {
if (valid) {
addData2(this.form2.角色功能, this.num).then(response => {
if (response.data[0].result === '1') {
this.$message.success('编辑成功')
this.fetchData()
this.dialogFormVisible2 = false
} else { this.$message.error('编辑失败') }
})
}
})
},
submitAdd1(formName) { // 增加角色功能
this.$refs[formName].validate((valid) => {
if (valid) {
addData(this.form.角色功能).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.form.角色功能 = ''
this.fetchData()
this.dialogFormVisible1 = false
} else { this.$message.error('增加失败') }
})
}
})
},
handleAdd() {
if (this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields()
}
this.dialogFormVisible1 = true
},
handleDelete(row) { // 删除
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteData(row.角色编号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
this.fetchData()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,262 @@
<template>
<div class="app-container">
<el-card>
<div style="margin: 0 auto;width: 850px">
<span>角色名称:</span>
<el-select v-model="roleName" placeholder="请选择" size="small" style="width:200px;margin-left:10px" filterable clearable @change="getmodule">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="primary" size="small" style="float: right" @click="openModelWin">添加模块(开发使用)</el-button>
</div>
</el-card>
<el-card>
<div style="margin: 0 auto;width: 850px">
<el-transfer
:filter-method="filterMoudles"
v-model="value1"
:titles="['权限列表','角色对应权限列表']"
:props="{key: 'value'}"
:data="modelNames"
filterable
@change="roleChange"/>
</div>
</el-card>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-form-item label="选择模块名称" prop="选择模块名称">
<el-select v-model="modelName" size="mini" clearable placeholder="请选择模块名称" filterable @change="getModelData" @clear="clearModel">
<el-option
v-for="item in modelNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<div style="font-size: 12px;color: red;margin: -15px 0">选择模块名称是修改没选择是增加</div>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="组件" prop="组件">
<el-input
v-model="form.组件"
size="small"
style="width:200px"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="标题" prop="标题">
<el-input
v-model="form.标题"
size="small"
style="width:200px"/>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="图标" prop="图标">
<el-input
v-model="form.图标"
size="small"
style="width:200px"/>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel('form')">取消</el-button>
<el-button type="primary" @click="submit('form')">确定</el-button>
<el-button v-if="show" type="danger" @click="deleteModule()">删除模块</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getRole, getModule, addModule, deleteModule, getModelData, addModelData, editModelData } from '@/api/BasicData/UserRightsManagement'
import { arrayUnique2 } from '@/utils/tool'
export default {
data() {
return {
modelNames: [],
value4: [],
value1: [],
addnum: 0,
deletenum: 0,
roleName: null,
roleNames: [],
data1: [],
dialogFormVisible: false,
title: '',
form: {
组件: '',
标题: '',
图标: ''
},
rules: {
组件: [{ required: true, message: '请输入', trigger: 'blur' }],
标题: [{ required: true, message: '请输入', trigger: 'blur' }],
图标: [{ required: true, message: '请输入', trigger: 'blur' }]
},
modelName: '',
show: false
}
},
created() {
this.getRoleName()
this.getAllModules()
},
methods: {
clearModel() {
this.modelName = ''
},
getRoleName() {
getRole().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.roleNames.push({
value: response.data[i].角色编号,
label: response.data[i].角色功能
})
}
})
},
getAllModules() {
this.modelName = ''
this.modelNames = []
getModule().then(response => {
const data = response.data
for (let i = 0; i < data.length; i++) {
this.modelNames.push({
value: response.data[i].主模块编号,
label: response.data[i].标题,
disabled: true
})
if (i === data.length - 1) {
this.modelNames = arrayUnique2(this.modelNames, 'value')
}
}
})
},
filterMoudles(query, item) {
return item.label.indexOf(query) > -1
},
getmodule() {
this.value1 = []
if (this.roleName) {
for (let i = 0; i < this.modelNames.length; i++) {
this.modelNames[i].disabled = false
}
getModule(1, this.roleName).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.value1.push(parseInt(response.data[i].主模块编号))
}
})
} else {
for (let i = 0; i < this.modelNames.length; i++) {
this.modelNames[i].disabled = true
}
this.value1 = []
}
},
roleChange(value, direction, movedKeys) {
for (let i = 0; i < movedKeys.length; i++) {
if (direction === 'right') {
this.addnum = 0
addModule(movedKeys[i], this.roleName).then(response => {
this.addnum = this.addnum + parseInt(response.data[0].result)
if (this.addnum === movedKeys.length) {
this.$notify({
title: '成功',
message: '分配成功',
type: 'success'
})
}
})
} else {
this.deletenum = 0
deleteModule(movedKeys[i], this.roleName).then(response => {
this.deletenum = this.deletenum + parseInt(response.data[0].result)
console.log(this.deletenum, movedKeys.length)
if (this.deletenum === movedKeys.length) {
this.$notify({
title: '成功',
message: '分配成功',
type: 'success'
})
}
})
}
}
},
// 开发者
getModelData() {
if (typeof this.modelName === 'number') {
getModelData(this.modelName).then(response => {
const data = response.data[0]
this.form.组件 = data.子组件
this.form.标题 = data.标题
this.form.图标 = data.图标
})
}
},
openModelWin() {
this.dialogFormVisible = true
this.addForm('form')
},
cancel() { // 取消
this.modelName = ''
this.dialogFormVisible = false
},
submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.dialogFormVisible = false
if (typeof this.modelName === 'string') {
addModelData(this.form.组件, this.form.标题, this.form.图标).then(response => {
if (response.data[0].result === '1') {
this.$message.success('添加成功')
this.getAllModules()
} else {
this.$message.error('添加失败')
}
})
} else {
editModelData(this.modelName, this.form.组件, this.form.标题, this.form.图标).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改成功')
this.getAllModules()
} else {
this.$message.error('修改失败')
}
})
}
} else {
console.log('error submit!!')
return false
}
})
},
deleteModule() {
console.log(1)
}
}
}
</script>
<style>
.el-transfer-panel {
width:300px;
}
.el-transfer-panel__body {
height: 500px;
width: 300px;
}
.el-transfer-panel__list {
height: 500px;
width: 300px;
}
.el-transfer-panel__list.is-filterable{
height: 100%;
}
</style>

View File

@@ -0,0 +1,400 @@
<template>
<div class="app-container">
<table style="width: 100%">
<el-card>
<span>员工姓名:</span>
<el-input v-model="staffName" placeholder="员工姓名" size="small" clearable style="width:200px"/>
<span style="margin-left: 15px">角色名称:</span>
<el-select v-model="roleName" placeholder="角色名称" clearable size="small" style="width:200px">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 15px" @click="pageCurrent1=1;searchData()">查询</el-button>
<el-button type="primary" icon="el-icon-circle-plus-outline" size="small" @click="handelAdd">增加</el-button>
</el-card>
<el-card>
<el-table :data="tableData" highlight-current-row>
<el-table-column label="员工姓名">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column disabled label="所属部门" >
<template slot-scope="scope">
{{ scope.row.部门名称 }}
</template>
</el-table-column>
<el-table-column label="岗位名称">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
<el-table-column label="角色名称">
<template slot-scope="scope">
{{ scope.row.角色功能 }}
</template>
</el-table-column>
<el-table-column label="考勤编号">
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
icon="el-icon-edit"
@click="submitEdit(scope.$index, scope.row)">修改</el-button>
<el-button
size="mini"
type="danger"
icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent1"
:page-sizes="[10, 20, 30, 40, 50]"
:page-size="10"
:total="total1"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
</el-card>
</table>
<el-dialog :visible.sync="dialogFormVisible" title="人员信息" center width="750px">
<div style="height: 500px">
<div style="float: left;margin-top: 10px;margin-left: 20px;overflow-y: scroll;height: 400px">
<el-tree
:data="data2"
node-key="id"
style="width: 150px;float: left"
height="400"
accordion
@node-click="handleNodeClick"
/>
</div>
<el-table :data="List1" highlight-current-row height="400" style="width: 400px;float: left;margin-left: 30px" @row-click="handleCurrentChange">
<el-table-column label="考勤编号" align="center" >
<template slot-scope="scope">
{{ scope.row.考勤编号 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" >
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="性别" align="center">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column label="工作岗位" align="center">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
</div>
<el-button style="margin-left: 260px" @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" style="margin-top: 20px" @click="getName">确认</el-button>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible1" title="增加" center style="min-height: 270px" width="800px">
<el-form ref="form1" :model="form1" :rules="rules" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="员工姓名" prop="staffName">
<el-input v-model="form1.staffName" placeholder="请双击选择" size="small" clearable style="width:200px" @dblclick.native="dialogTableVisible()"/>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-select v-model="form1.roleName" placeholder="角色名称" size="small" clearable style="width:200px">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="考勤编号" >
<el-input
v-model="cjscgy"
disabled
size="small"
style="width:200px"/>
</el-form-item>
<el-form-item label="所属部门" >
<el-input v-model="ssks" size="small" style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOFF"> </el-button>
<el-button type="primary" @click="submitAdd1()"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="编辑" center style="min-height: 270px" width="800px">
<el-form ref="form2" :model="form2" :rules="rules1" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="员工姓名" >
<el-input v-model="form2.staffName" disabled size="small" clearable style="width:200px"/>
</el-form-item>
<el-form-item label="角色名称" prop="roleName">
<el-select v-model="form2.roleName" placeholder="角色名称" clearable size="small" style="width:200px">
<el-option
v-for="item in roleNames"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="考勤编号" >
<el-input
v-model="cjscgy"
disabled
size="small"
style="width:200px"/>
</el-form-item>
<el-form-item disabled="true" label="所属部门" >
<el-input v-model="ssks" disabled size="small" style="width:200px"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOFF">取消</el-button>
<el-button type="primary" @click="submitAdd2()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { dialogtablevisible, deleteData, getTree, fn, getTable8, initOrderType, addData1, addData2, searchTable } from '@/api/BasicData/WorkshopPersonnelRoleMana'
export default {
data() {
return {
number: '',
form1: {
staffName: '',
roleName: ''
},
form2: {
staffName: '',
roleName: ''
},
rules: {
staffName: [{ required: true, message: '请选择员工姓名', trigger: 'change' }],
roleName: [{ required: true, message: '请选择员工角色', trigger: 'change' }]
},
rules1: {
roleName: [{ required: true, message: '请选择员工角色', trigger: 'change' }]
},
staffName: '',
cjscgy: '',
List1: [],
ssks: '',
data2: [],
dialogFormVisible1: false,
dialogFormVisible2: false,
tableData: [],
check1: '',
check2: '',
name: '', // 中间变量
check3: '',
check4: '',
staffNum: '',
personnelNumber: '',
personnelStream: '',
pageCurrent1: 1,
pageSize1: 10,
total1: null,
roleName: null,
roleNames: [],
rybh: '',
jsbh: '',
dialogFormVisible: false
}
},
created() {
this.fetchData()
},
methods: {
handelAdd(row) {
this.dialogFormVisible1 = true
this.ssks = ''
this.cjscgy = ''
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
},
submitEdit(index, row) {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
this.dialogFormVisible2 = true
this.personnelStream = row.人员角色流水号
this.form2.staffName = row.姓名
this.ssks = row.部门名称
this.personnelNumber = row.人员编号
this.form2.roleName = parseInt(row.角色编号)
this.cjscgy = row.考勤编号
},
callOFF() {
this.dialogFormVisible1 = false
this.dialogFormVisible2 = false
this.ssks = ''
this.cjscgy = ''
},
searchData() {
if (this.staffName !== '' && this.staffName !== null) {
this.check1 = 1
} else {
this.check1 = 0
}
if (this.roleName !== '' && this.roleName !== null) {
this.check2 = 1
} else {
this.check2 = 0
}
searchTable(this.check1, this.staffName, this.check2, this.roleName, this.pageCurrent1, this.pageSize1).then(response => {
console.log(response)
this.tableData = response.data.rows
this.total1 = response.data.total
})
},
fetchData() {
getTree().then(response => { // 获取人员信息树
const data = response.data
this.data2 = fn(data, 0)
})
initOrderType().then(response => { // 角色名称
for (let i = 0; i < response.data.length; i++) {
this.roleNames.push({
label: response.data[i].角色功能,
value: response.data[i].角色编号
})
}
})
this.searchData()
},
handleSizeChange1(val) {
this.pageCurrent1 = 1
this.pageSize1 = val
this.searchData()
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
this.searchData()
},
submitAdd1() {
this.$refs['form1'].validate((valid) => {
if (valid) {
addData1(this.personnelNumber, this.form1.roleName).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.ssks = ''
this.form1.staffName = ''
this.form1.roleName = ''
this.searchData()
this.dialogFormVisible1 = false
} else { this.$message.error('增加失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
submitAdd2() {
this.$refs['form2'].validate((valid) => {
if (valid) {
addData2(this.personnelStream, this.personnelNumber, this.form2.roleName).then(response => {
if (response.data[0].result === '1') {
this.$message.success('修改成功')
this.ssks = ''
this.searchData()
this.dialogFormVisible2 = false
} else { this.$message.error('修改失败') }
})
} else {
console.log('error submit!!')
return false
}
})
},
handleCurrentChange3(val) {
this.searchgroup()
},
handleNodeClick(data) { // 树节点点击
this.ssks = data.label
getTable8(data.id).then(response => {
this.List1 = response.data
})
},
handleDelete(row) { // 删除
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteData(row.人员角色流水号).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
} else { this.$message.error('删除失败') }
this.searchData()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
dialogTableVisible() {
this.dialogFormVisible = true
dialogtablevisible().then(response => {
})
},
handleCurrentChange(row) { // 获取当前行人员信息
this.ssks = row.节点名称
this.number = row.考勤编号
this.name = row.姓名
this.personnelNumber = row.人员编号
},
getName() { // 提交人员
this.cjscgy = this.number
this.dialogFormVisible = false
this.form1.staffName = this.name
this.form2.staffName = this.name
}
}
}
</script>
<style scoped>
.el-card{
margin-bottom:15px;
margin-left: 15px;
margin-right: 15px;
}
</style>

View File

@@ -0,0 +1,592 @@
<template>
<div class="app-container">
<el-row>
<el-col :span="6">
<el-card>
<span>工艺分类</span>
<el-button type="primary" style="margin: 3px" icon="el-icon-circle-plus-outline" size="small" @click="addProcessClassification()">新增</el-button>
<el-button size="small" style="margin-left: 10px" type="warning" icon="el-icon-edit-outline" @click="editProcessClassification()">编辑</el-button>
<el-button size="small" style="margin-left: 10px" type="danger" icon="el-icon-delete" @click="delProcessClassification()">删除</el-button>
</el-card>
</el-col>
<el-col :span="18">
<el-card>
<el-button type="primary" plain style="margin: 3px" icon="el-icon-circle-plus-outline" size="small" @click="addProcess">新增工艺名称</el-button>
</el-card>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-card>
<el-table
v-loading="loading1"
ref="multipleTable"
:data="tableData1"
size="mini"
highlight-current-row
stripe
border
tooltip-effect="dark"
style="width: 100%"
height="800">
<el-table-column align="center" label=" " width="50px">
<template slot-scope="scope">
<el-radio :label="scope.row.工艺分类流水号" v-model="radio" @change.native="getCurrentRow(scope.row.工艺分类流水号, scope.row.工艺分类名称)">
{{ a }}
</el-radio>
</template>
</el-table-column>
<el-table-column align="left" label="工艺分类">
<template slot-scope="scope">
{{ scope.row.工艺分类名称 }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="18">
<el-card >
<el-table
:data="tableData2"
:row-key="getRowKeys"
:row-style="abc"
:expand-row-keys="expands"
size="mini"
highlight-current-row
stripe
border
height="800"
width="100%"
@expand-change="searchTechnologicalRequirementsOfProcessNum">
<el-table-column type="expand" label="详情">
<template slot-scope="scope">
<el-table :data="tableData3" border stripe style="width: 40%">
<el-table-column label="工艺要求" align="center">
<template slot-scope="scope">
{{ scope.row.工艺要求 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" >
<template slot-scope="scope">
<el-tooltip effect="dark" content="编辑" placement="top">
<div style="display: inline-block">
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="editTechnologicalRequirements(scope.row)"/>
</div>
</el-tooltip>
<el-tooltip effect="dark" content="删除" placement="top">
<div style="display: inline-block">
<el-button
size="mini"
type="text"
style="margin-left: 20px"
icon="el-icon-delete"
@click="delTechnologicalRequirements(scope.row)"/>
</div>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="工艺名称" width="200">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作" >
<template slot-scope="scope">
<el-button
size="mini"
type="warning"
icon="el-icon-edit-outline"
plain
@click="editProcess(scope.row)">编辑工艺</el-button>
<el-button
size="mini"
type="danger"
plain
icon="el-icon-delete"
@click="delProcess(scope.row)">删除工艺</el-button>
<el-button
size="mini"
type="primary"
plain
icon="el-icon-circle-plus-outline"
@click="addTechnologicalRequirements(scope.row)">新增要求</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-dialog :visible.sync="dialogFormVisible1" title="新增工艺分类" center style="min-height: 300px" width="400px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" label-width="110px" >
<el-form-item label="工艺分类" prop="ProcessClassification">
<el-input v-model="form1.ProcessClassification" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form1')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible2" title="编辑工艺分类" center style="min-height: 300px" width="400px">
<el-form ref="form1" :model="form1" :rules="rules1" label-position="left" label-width="110px" >
<el-form-item label="工艺分类" prop="ProcessClassification">
<el-input v-model="form1.ProcessClassification" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form1')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible3" title="新增工艺" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px" >
<el-form-item label="工艺名称" prop="Process">
<el-input v-model="form2.Process" size="small" clearable style="width:200px"/>
</el-form-item>
<el-form-item label="工艺名称简称" prop="ProcessShort">
<el-input v-model="form2.ProcessShort" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form2')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible4" title="编辑工艺" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="110px" >
<el-form-item label="工艺名称" prop="Process">
<el-input v-model="form2.Process" size="small" clearable style="width:200px"/>
</el-form-item>
<el-form-item label="工艺名称简称" prop="ProcessShort">
<el-input v-model="form2.ProcessShort" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form2')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible5" title="新增工艺要求" center style="min-height: 300px" width="400px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left" label-width="110px" >
<el-form-item label="工艺要求" prop="Process">
<el-input v-model="form3.TechnologicalRequirements" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form3')"> </el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible6" title="编辑工艺要求" center style="min-height: 300px" width="400px">
<el-form ref="form3" :model="form3" :rules="rules3" label-position="left" label-width="110px" >
<el-form-item label="工艺要求" prop="TechnologicalRequirements">
<el-input v-model="form3.TechnologicalRequirements" size="small" clearable style="width:200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="calloff"> </el-button>
<el-button type="primary" @click="submit1('form3')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchProcessClassification, searchProcessNameOfProcessClassification, searchTechnologicalRequirementsOfProcessNum, searchProcessClassificationOfProcessClassificationNum, addProcessClassification, editProcessClassification, delProcessClassification, addProcess, delProcess, editProcess, addTechnologicalRequirements, editTechnologicalRequirements, delTechnologicalRequirements } from '@/api/BasicData/WorkshopProcessMaintenance'
export default {
data() {
return {
// 工艺分类所需变量
a: '',
expands: [],
tableData1: [],
ProcessNum: '',
loading1: false,
loading2: false,
loading3: false,
ProcessClassificationNum: '',
radio: null,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
dialogFormVisible4: false,
dialogFormVisible5: false,
dialogFormVisible6: false,
temp: null,
ProcessClassificationNumS: '',
form1: {
ProcessClassification: ''
},
form2: {
Process: '',
ProcessShort: ''
},
form3: {
TechnologicalRequirements: ''
},
rules1: {
ProcessClassification: [{ required: true, message: '请输入工艺分类名称', trigger: 'blur' }]
},
rules2: {
Process: [{ required: true, message: '请输入工艺名称', trigger: 'blur' }],
ProcessShort: [{ required: true, message: '请输入工艺名称简称', trigger: 'blur' }]
},
rules3: {
TechnologicalRequirements: [{ required: true, message: '请输入工艺要求', trigger: 'blur' }]
},
tableData2: [],
tableData3: [],
Num: [],
maxNum: '',
max: [],
code: ''
}
},
created() {
this.searchProcessClassification()
},
methods: {
abc() {
return {
height: '35px'
}
},
searchProcessClassification() {
this.loading1 = true
searchProcessClassification().then(response => {
this.loading1 = false
this.tableData1 = response.data
this.total1 = response.data
return this.tableData1
}).then(data => {
this.Num = data
this.max = []
for (let i = 0; i < this.Num.length; i++) {
this.max.push(this.Num[i].工艺分类流水号)
}
return this.max
}).then(data => {
const a = data
this.maxNum = a[0]
for (let j = 0; j < a.length; j++) {
if (this.maxNum < a[j]) {
this.maxNum = a[j]
}
}
return this.maxNum
}).then(data => {
const b = data
this.radio = b
return this.radio
}).then(data => {
const c = data
this.loading2 = true
searchProcessNameOfProcessClassification(c).then(response => {
this.loading2 = false
this.tableData2 = response.data
})
})
},
addProcessClassification() {
if (this.$refs['form1'] !== undefined) {
this.$refs['form1'].resetFields()
}
this.form1 = {}
this.dialogFormVisible1 = true
this.temp = 1
},
editProcessClassification() {
if (this.radio !== '') {
this.temp = 2
this.dialogFormVisible2 = true
searchProcessClassificationOfProcessClassificationNum(this.radio).then(response => {
this.form1.ProcessClassification = response.data[0].工艺分类名称
})
} else {
this.$message.warning('请选择工艺分类')
}
},
submitProcessClassification() {
editProcessClassification(this.radio, this.form1.ProcessClassification).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.dialogFormVisible2 = false
this.searchProcessClassification()
} else {
this.$message.error('信息更新失败')
}
})
},
submitaddProcessClassification() {
addProcessClassification(this.form1.ProcessClassification).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.searchProcessClassification()
this.dialogFormVisible1 = false
} else { this.$message.error('增加失败') }
})
},
submit1(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (this.temp === 1) {
this.submitaddProcessClassification()
this.form1 = {
ProcessClassification: ''
}
this.temp = null
} else if (this.temp === 2) {
this.submitProcessClassification()
this.form1 = {
ProcessClassification: ''
}
this.temp = null
} else if (this.temp === 3) {
this.submitaddProcess()
this.form2 = {
Process: '',
ProcessShort: ''
}
this.temp = null
} else if (this.temp === 4) {
this.submiteditProcess()
this.form2 = {
Process: '',
ProcessShort: ''
}
this.temp = null
} else if (this.temp === 5) {
this.submitTechnologicalRequirements()
this.form3 = {
TechnologicalRequirements: ''
}
this.temp = null
} else if (this.temp === 6) {
this.submiteditTechnologicalRequirements()
this.form3 = {
TechnologicalRequirements: ''
}
this.temp = null
}
}
})
},
delProcessClassification() {
if (this.radio !== '') {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delProcessClassification(this.radio).then(response => {
if (response.data[0].result === '1') {
this.searchProcessClassification()
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
})
} else {
this.$message.warning('请选择工艺分类')
}
},
calloff() {
this.dialogFormVisible1 = false
this.dialogFormVisible2 = false
this.dialogFormVisible3 = false
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
this.dialogFormVisible6 = false
this.form1 = {
ProcessClassification: ''
}
this.form2 = {
Process: '',
ProcessShort: ''
}
this.form3 = {
TechnologicalRequirements: ''
}
},
getCurrentRow(row) {
searchProcessClassificationOfProcessClassificationNum(this.radio).then(response => {
this.form1.ProcessClassification = response.data[0].工艺分类名称
})
this.loading2 = true
searchProcessNameOfProcessClassification(row).then(response => {
this.loading2 = false
this.tableData2 = response.data
})
},
searchTechnologicalRequirementsOfProcessNum(row, expandedRows) {
// this.expands = []
// this.expands.push(row.工艺编号)
if (expandedRows.length > 1) {
expandedRows.shift()
}
this.loading3 = true
searchTechnologicalRequirementsOfProcessNum(row.工艺编号).then(response => {
this.loading3 = false
this.tableData3 = response.data
})
},
addProcess() {
if (this.$refs['form2'] !== undefined) {
this.$refs['form2'].resetFields()
}
if (this.radio !== '') {
this.form2.Process = ''
this.form2.ProcessShort = ''
this.dialogFormVisible3 = true
this.temp = 3
} else {
this.$message.warning('请选择一个工艺分类')
}
},
submitaddProcess() {
addProcess(this.radio, this.form2.Process, this.form2.ProcessShort).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.loading2 = true
searchProcessNameOfProcessClassification(this.radio).then(response => {
this.loading2 = false
this.tableData2 = response.data
})
this.dialogFormVisible3 = false
} else { this.$message.error('增加失败') }
})
},
editProcess(row) {
this.dialogFormVisible4 = true
this.temp = 4
this.form2.Process = row.工艺名称
this.form2.ProcessShort = row.工艺名称简称
this.ProcessNum = row.工艺编号
},
submiteditProcess() {
editProcess(this.ProcessNum, this.form2.Process, this.form2.ProcessShort).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.dialogFormVisible4 = true
searchProcessNameOfProcessClassification(this.radio).then(response => {
this.loading2 = false
this.tableData2 = response.data
})
this.dialogFormVisible4 = false
} else {
this.$message.error('信息更新失败')
}
})
},
getRowKeys(row) {
return row.工艺编号
},
delProcess(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delProcess(row.工艺编号).then(response => {
if (response.data[0].result === '1') {
this.loading2 = true
searchProcessNameOfProcessClassification(this.radio).then(response => {
this.loading2 = false
this.tableData2 = response.data
})
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
})
},
addTechnologicalRequirements(row) {
if (this.$refs['form3'] !== undefined) {
this.$refs['form3'].resetFields()
}
this.ProcessNum = row.工艺编号
this.form3.TechnologicalRequirements = ''
this.dialogFormVisible5 = true
this.temp = 5
},
submitTechnologicalRequirements() {
addTechnologicalRequirements(this.ProcessNum, this.form3.TechnologicalRequirements).then(response => {
if (response.data[0].result === '1') {
this.$message.success('增加成功')
this.loading3 = true
searchTechnologicalRequirementsOfProcessNum(this.ProcessNum).then(response => {
this.loading3 = false
this.tableData3 = response.data
})
this.dialogFormVisible5 = false
} else { this.$message.error('增加失败') }
})
},
editTechnologicalRequirements(row) {
this.temp = 6
this.dialogFormVisible6 = true
this.form3.TechnologicalRequirements = row.工艺要求
this.code = row.工艺要求流水号
this.ProcessNum = row.工艺编号
},
submiteditTechnologicalRequirements() {
editTechnologicalRequirements(this.code, this.form3.TechnologicalRequirements).then(response => {
if (response.data[0].result === '1') {
this.$message.success('信息更新成功')
this.loading3 = true
searchTechnologicalRequirementsOfProcessNum(this.ProcessNum).then(response => {
this.loading3 = false
this.tableData3 = response.data
})
this.dialogFormVisible6 = false
} else {
this.$message.error('信息更新失败')
}
})
},
delTechnologicalRequirements(row) {
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delTechnologicalRequirements(row.工艺要求流水号).then(response => {
if (response.data[0].result === '1') {
this.loading3 = true
searchTechnologicalRequirementsOfProcessNum(row.工艺编号).then(response => {
this.loading3 = false
this.tableData3 = response.data
})
this.$message.success('删除成功')
} else {
this.$message.error('删除失败')
}
})
})
}
}
}
</script>
<style scoped>
/*.el-card {*/
/* margin-top: 15px;*/
/* margin-left: 15px;*/
/* }!**!*/
</style>