Commit d1d4ffec authored by 高宇's avatar 高宇

删除菜单

parent 714f9103
import request from '@/utils/request'
// 根据key值查询数据字典数据
export function getDictData(params) {
return request({
url: '/wbapply/queryDict',
method: 'get',
params
})
}
// 新增设备新增
export function addApplication(data) {
return request({
url: '/wbapply/add',
method: 'post',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="form" :rules="rule" label-width="80px">
<!-- TODO: 基础设备管理--> <div class="info"><span class="title">设备申请</span></div>
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-row :gutter="40">
<el-col :span="12" style="padding-left: 16%;">
<el-form-item label="申请状态" prop="state"> <el-form-item label="pn" style="flex-basis: 50%;" prop="pn">
<el-select <el-input v-model="form.pn" placeholder="请输入pn" :style="{ width: '400px', height: '30px' }" :maxlength="50" />
v-model="queryParams.state" </el-form-item>
placeholder="请选择状态" </el-col>
clearable <el-col :span="12">
size="small" <el-form-item label="phd" style="flex-basis: 50%;" prop="phd">
style="width: 150px" <el-input v-model="form.phd" placeholder="请输入phd" :style="{ width: '400px', height: '30px' }" :maxlength="10" />
@change="handleQuery" </el-form-item>
> </el-col>
<el-option label="所有" value="all" /> </el-row>
<el-option label="驳回" value="rejected" /> <el-row :gutter="40">
<el-option label="待审核" value="pending" /> <el-col :span="12" style="padding-left: 16%;">
<el-option label="通过" value="approved" /> <el-form-item label="prank" style="flex-basis: 50%;" prop="prank">
</el-select> <el-input v-model="form.prank" placeholder="请输入prank" :style="{ width: '400px', height: '30px' }" :maxlength="10" />
</el-form-item> </el-form-item>
<el-form-item> </el-col>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">查询</el-button> <el-col :span="12">
</el-form-item> <el-form-item label="pgx" style="flex-basis: 50%;" prop="pgx">
</el-form> <el-select
v-model="form.pgx"
<div class="placeholder" /> clearable
placeholder="请选择pgx"
<!-- TODO: 中间的分隔符号 --> :style="{ width: '400px', height: '30px' }"
<div style="padding:5px 10px"> >
<el-option
<!-- TODO: 以下为基础设备管理列表 --> v-for="(dict,index) in pissbList"
<div class="mb12 font-small-bold">设备领用列表</div> :key="index"
<el-table v-loading="loading" border :data="roleList" @selection-change="handleSelectionChange"> :label="dict.dictLabel"
<el-table-column type="index" label="序号" width="50" /> :value="dict.dictValue"
<el-table-column label="设备名称" prop="deviceName" :show-overflow-tooltip="true"> />
<template slot-scope="scope"> </el-select>
{{ scope.row.deviceName || '-' }} </el-form-item>
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="设备编码" prop="deviceId"> <el-row>
<template slot-scope="scope"> <el-col :span="12" style="padding-left: 15.1%;">
{{ scope.row.deviceId || '-' }} <el-form-item label="pissb" style="flex-basis: 50%;" prop="pissb">
</template> <el-select
</el-table-column> v-model="form.pissb"
<el-table-column label="申请人" prop="createBy"> clearable
<template slot-scope="scope"> placeholder="请选择pissb"
{{ scope.row.createBy || '-' }} :style="{ width: '400px', height: '30px' }"
</template> >
</el-table-column> <el-option
<el-table-column label="创建时间" :show-overflow-tooltip="true" align="center" prop="createTime"> v-for="(dict,index) in pgxList"
<template slot-scope="scope"> :key="index"
<span>{{ scope.row.createTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span> :label="dict.label"
</template> :value="dict.value"
</el-table-column> />
<el-table-column label="状态" prop="state"> </el-select>
<template slot-scope="scope"> </el-form-item>
<span :style="getFontColor(scope.row.state)">{{ scope.row.state || '-' }}</span> </el-col>
</template> </el-row>
</el-table-column> <div class="button">
<el-table-column label="操作" class-name="small-padding fixed-width" width="140px"> <el-button type="primary" @click="submitForm">提交</el-button>
<template slot-scope="scope">
<el-button v-if="scope.row.state !== ' '" :type="typeParent" :size="size" @click="handleDetail(scope.row)">
详情
</el-button>
<!-- <el-button v-if="scope.row.state !== ' '" type="typeParent" :size="size" @click="handleUpdate(scope.row)">
{{ updataName }}
</el-button>
<el-button v-if="scope.row.state !== ' '" type="typeParent" :size="size" @click="handleDelete(scope.row)"
>删除</el-button> -->
</template>
</el-table-column>
</el-table>
</div>
<el-pagination
background
layout="prev, pager, next"
:total="1000"
/>
<!-- TODO: 添加或修改设备配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model.trim="form.deviceName" show-word-limit :maxlength="30" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备编码" prop="deviceId">
<el-input v-model.trim="form.deviceId" show-word-limit :maxlength="30" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="LOT" prop="LOT">
<el-input v-model.trim="form.LOT" show-word-limit :maxlength="30" placeholder="请输入LOT" />
</el-form-item>
<el-form-item label="位置" prop="location">
<el-input v-model.trim="form.location" show-word-limit :maxlength="30" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="厚度" prop="ply">
<el-input v-model.trim="form.ply" show-word-limit :maxlength="30" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="操作员" prop="createBy">
<el-input v-model.trim="form.createBy" :maxlength="30" show-word-limit placeholder="请输入创建人" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForm">确 定</el-button>
</div> </div>
</el-dialog> </el-form>
<!-- TODO: 单项详情信息表单配置 -->
<el-dialog class="aboutSingleDetails" :title="title" :visible.sync="openDetails" width="700px" append-to-body>
<el-form ref="formDetails" :model="singleDetails" size="small" label-width="90px">
<el-form-item label="名称:" prop="deviceName">
<el-input v-model.trim="singleDetails.deviceName" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="设备编码:" prop="deviceId">
<el-input v-model.trim="singleDetails.deviceId" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="LOT: " prop="LOT">
<el-input v-model.trim="singleDetails.LOT" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="位置:" prop="location">
<el-input v-model.trim="singleDetails.location" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="位置:" prop="ply">
<el-input v-model.trim="singleDetails.ply" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="创建时间:" prop="createTime">
<el-input v-model.trim="singleDetails.createTime" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="创建人:" prop="createBy">
<el-input v-model.trim="singleDetails.createBy" :readonly="isReadOnly" />
</el-form-item>
<el-form-item label="状态" prop="state">
<el-input v-model.trim="singleDetails.state" :readonly="isReadOnly" />
</el-form-item>
<el-form-item>
<el-button type="success" @click="handleApprove">通过</el-button>
<el-button type="primary" @click="handleReject">驳回</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getDictData, addApplication } from '@/api/equipment/application'
export default { export default {
name: 'Role', name: 'Role',
data() { data() {
return { return {
typeParent: 'text',
typePrimary: 'primary',
typeSuccess: 'success',
nameParent: '删除',
resetName: '重置',
addName: '新增',
application: '申请领用',
updataName: '修改',
size: 'mini',
smallSize: 'small',
delicon: 'el-icon-delete',
addIcon: 'el-icon-plus',
exportIcon: 'el-icon-download',
resetIcon: '',
// TODO: 控制只读
isReadOnly: true,
// 遮罩层
loading: true,
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 角色表格数据
roleList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 是否显示弹出层(数据详情)
openDetails: false,
// 日期范围
// dateRange: [],
// 菜单表格数据
menuList: [],
menuExpand: false,
menuNodeAll: false,
deptExpand: true,
deptNodeAll: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceName: undefined,
deviceId: undefined,
LOT: undefined,
location: undefined,
ply: undefined,
state: undefined,
flag: undefined
},
defaultProps: {},
// TODO: 表单参数
form: { form: {
deviceName: '', pn: '',
deviceId: '', phd: '',
LOT: '', prank: '',
location: '', pgx: '',
ply: '', pissb: ''
state: '',
flag: '1',
remark: '',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
},
// TODO: 表单初始参数
formReset: {
deviceName: '',
deviceId: '',
LOT: '',
location: '',
ply: '',
state: '',
flag: '1',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
}, },
// TODO: 表单里的单项详情参数 rule: {
singleDetails: { pn: [{ required: true, message: '请输入pn', trigger: 'blur' }],
deviceName: '', phd: [{ pattern: /^\d+$/, message: '仅能输入数字', trigger: 'change' }],
deviceId: '', prank: [{ pattern: /^\d+$/, message: '仅能输入数字', trigger: 'change' }]
LOT: '',
location: '',
ply: '',
state: '',
flag: '1',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
}, },
// TODO: 模拟测试数据 pissbList: [],
simulateDeviceList: [{ pgxList: [
deviceName: '设备1', deviceId: '0001', flag: 1, LOT: '0001', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已驳回' {
}, { label: '否',
deviceName: '设备2', deviceId: '0002', flag: 2, LOT: '0002', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已驳回' value: '0'
}, { },
deviceName: '设备3', deviceId: '0003', flag: 2, LOT: '0003', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已驳回' {
}, { label: '是',
deviceName: '设备4', deviceId: '0004', flag: 2, LOT: '0004', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已驳回' value: '1'
}, { }
deviceName: '设备5', deviceId: '0005', flag: 2, LOT: '0005', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '待审核' ]
}, {
deviceName: '设备6', deviceId: '0006', flag: 2, LOT: '0006', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '待审核'
}, {
deviceName: '设备7', deviceId: '0007', flag: 2, LOT: '0007', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '待审核'
}, {
deviceName: '设备8', deviceId: '0008', flag: 2, LOT: '0008', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '待审核'
}, {
deviceName: '设备9', deviceId: '0009', flag: 2, LOT: '0009', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已通过'
}, {
deviceName: '设备10', deviceId: '00010', flag: 2, LOT: '0010', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '已通过'
}
],
// 表单校验
rules: {
deviceName: [
{ required: true, message: '请输入设备名称', trigger: 'blur' }
],
deviceId: [
{ required: true, message: '请输入设备编码', trigger: 'blur' }
],
LOT: [
{ required: true, message: '请输入LOT', trigger: 'blur' }
],
createBy: [
{ required: true, message: '请输入申请人', trigger: 'blur' }
]
},
deptOptions: []
} }
}, },
/** 路由离开前存储筛选条件*/
beforeRouteLeave(to, from, next) {
this.$store.dispatch('searchSave/searchParamsSet', {
path: this.$route.path,
param: {
...this.queryParams
}
})
next()
},
created() { created() {
if (this.$store.getters.searchParams[this.$route.path]) { this.init()
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
}, },
methods: { methods: {
getFontColor(state) { // 重置
if (state === '已驳回') { resetFrom() {
return 'color: red;'
} else if (state === '待审核') {
return 'color: orange;'
} else if (state === '已通过') {
return 'color: green;'
} else {
return ''
}
},
/** 查询角色列表 */
getList() {
this.loading = true
this.roleList = this.simulateDeviceList
console.log(this.roleList)
this.loading = false
},
handleReject() {
this.$message({
message: '操作完成',
type: 'warning'
})
this.openDetails = false
this.reset()
},
handleApprove() {
this.$message({
message: '操作完成',
type: 'success'
})
this.openDetails = false
this.reset()
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
// TODO: 将模拟数据的空对象赋值给表单对象,达成清空填写表单的效果
this.form = { this.form = {
deviceName: '', pn: '',
deviceId: '', phd: '',
location: '', prank: '',
ply: '', pgx: '',
state: '', pissb: ''
flag: '1',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
} }
this.$refs.form.clearValidate()
}, },
/** TODO: 查询按钮操作 */ // 初始化要调的接口
handleQuery() { init() {
this.queryParams.pageNum = 1 this.getDict()
this.getList()
},
/** TODO: 重置按钮操作 */
resetQuery() {},
// 多选框选中数据
handleSelectionChange(selection) {},
/** TODO: 新增按钮操作 */
handleAdd() {
// TODO: 初始化新增对话框的状态
this.reset()
this.title = '申请领用设备'
this.open = !this.open
}, },
// TODO: 获取所选行详情信息操作 // 提价时要调的接口
handleDetail(row) { submitForm() {
this.singleDetails = this.formReset this.$refs.form.validate((valid) => {
this.singleDetails = row
this.title = '详情信息'
this.openDetails = !this.openDetails
},
/** TODO: 修改按钮操作 */
handleUpdate(row) {
this.reset()
this.title = '修改申请'
const upddeviceName = row.deviceName
for (const pd of this.simulateDeviceList) {
if (pd.deviceName === upddeviceName) {
this.form = pd
}
}
this.open = true
},
/** TODO: 修改或增加list列表里的数据 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
// TODO: 模拟测试数据的修改,可删除 addApplication(this.form).then(res => {
for (const p of this.simulateDeviceList) { console.log('res', res)
if (p.deviceName === this.form.deviceName) { if (res.code === 200) {
this.simulateDeviceList = this.simulateDeviceList.map(obj => this.$message.success('操作成功')
obj.deviceName === this.form.deviceName ? this.form : obj this.resetFrom()
) } else if (res.code === null) {
this.msgSuccess('申请成功') this.$message.success(res.message)
this.getList()
this.reset()
this.open = !this.open
return
} else {
this.simulateDeviceList.push(this.form)
this.msgSuccess('申请成功')
this.getList()
this.reset()
this.open = !this.open
return
} }
} })
} }
}) })
}, },
// 调数据字典查询
/** TODO: 关于模拟数据的 删除list数组所调用的删除方法,封装的函数如下 */ getDict() {
delDevice(delDeviceName) { const obj = {
let tip = false key: 'GX_CODE'
for (const pd0 of this.simulateDeviceList) {
console.log('This is pd0:', pd0)
if (pd0.deviceName === delDeviceName) {
this.simulateDeviceList = this.simulateDeviceList.filter(item => item.deviceName !== delDeviceName)
tip = true
break
}
} }
return tip getDictData(obj).then(res => {
}, if (res.code === 200 && res.data !== null) {
/** TODO:删除按钮操作 */ this.pissbList = res.data
handleDelete(row) { }
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return this.delDevice(row.deviceName)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
}) })
} }
} }
} }
</script> </script>
...@@ -465,37 +151,19 @@ export default { ...@@ -465,37 +151,19 @@ export default {
font-size: 18px; font-size: 18px;
padding: 0; padding: 0;
.placeholder { .info{
height: 1.3vh; height: 100px;
background-color: #F4F4F4; display: flex;
margin-bottom: 10px align-items: center;
justify-content: center;
.title{
color: #333;
font-weight: 700;
}
} }
.button{
.table-drop { margin-top: 7%;
vertical-align: 2px; margin-left: 20%;
line-height: 20px;
margin-left: 15px
}
.el-switch {
margin-left: 15px;
}
}
.el-divider--vertical{
height: 12em;
width: 4px;
}
.aboutSingleDetails{
.el-form-item{
.el-input >>> .el-input__inner {
-webkit-appearance: none;
background-color: #ffffff;
background-image: none;
border-radius: 4px;
border: 0;
width: 100%;
}
} }
} }
......
...@@ -20,20 +20,20 @@ ...@@ -20,20 +20,20 @@
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code"> <!-- <el-form-item prop="code">-->
<el-input <!-- <el-input-->
v-model="loginForm.code" <!-- v-model="loginForm.code"-->
auto-complete="off" <!-- auto-complete="off"-->
placeholder="验证码" <!-- placeholder="验证码"-->
style="width: 63%" <!-- style="width: 63%"-->
@keyup.enter.native="handleLogin" <!-- @keyup.enter.native="handleLogin"-->
> <!-- >-->
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> <!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />-->
</el-input> <!-- </el-input>-->
<!--<div class="login-code"> <!-- &lt;!&ndash;<div class="login-code">-->
<img :src="codeUrl" @click="getCode"> <!-- <img :src="codeUrl" @click="getCode">-->
</div>--> <!-- </div>&ndash;&gt;-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item style="width:80%;margin-bottom: 20px"> <el-form-item style="width:80%;margin-bottom: 20px">
<el-button <el-button
class="blue-btn" class="blue-btn"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment