Commit 27b351db authored by 刘宇扬's avatar 刘宇扬

图标

parent 9f6590f1
...@@ -8,4 +8,30 @@ export function listdevice(query) { ...@@ -8,4 +8,30 @@ export function listdevice(query) {
params: query params: query
}) })
} }
export function updatadevice(data) {
return request({
url: '/wbwarehouse/update',
method: 'put',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
export function getDetailById(id) {
return request({
url: '/wbwarehouse/detail/' + id,
method: 'get'
})
}
export function add(data) {
return request({
url: '/wbwarehouse/add',
method: 'post',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button> <el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="placeholder" /> <div class="placeholder" />
...@@ -100,39 +100,26 @@ ...@@ -100,39 +100,26 @@
<!-- 添加或修改设备配置对话框 --> <!-- 添加或修改设备配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="名称" prop="roleName"> <el-form-item label="pn" prop="pn">
<el-input v-model.trim="form.roleName" show-word-limit :maxlength="30" placeholder="请输入设备名称" /> <el-input v-model.trim="form.pn" :maxlength="30" placeholder="请输入pn" />
</el-form-item> </el-form-item>
<el-form-item label="设备来源" prop="roleKey"> <el-form-item label="lot" prop="lot">
<el-input v-model.trim="form.roleKey" show-word-limit :maxlength="30" placeholder="请输入设备来源" /> <el-input v-model.trim="form.lot" :maxlength="30" placeholder="请输入lot" />
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="roleSort"> <el-form-item label="plocation" prop="plocation">
<el-input-number v-model="form.roleSort" style="width: 100%" controls-position="right" :min="0" /> <el-input v-model.trim="form.plocation" :maxlength="30" placeholder="请输入plocation" />
</el-form-item> </el-form-item>
<el-form-item label="设备批次"> <el-form-item label="厚度" prop="phd">
<!-- <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>--> <el-input v-model.trim="form.phd" :maxlength="30" placeholder="请输入厚度" />
<!-- <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>-->
<!-- <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')">父子联动</el-checkbox>-->
<el-tree
ref="menu"
class="tree-border"
:data="menuOptions"
show-checkbox
node-key="id"
check-strictly
empty-text="加载中,请稍后"
:props="defaultProps"
@check-change="handleMenuCheckChange"
/>
</el-form-item> </el-form-item>
<el-form-item label="备注"> <el-form-item label="psm" prop="psm">
<el-input <el-input v-model.trim="form.psm" :maxlength="30" placeholder="请输入psm" />
v-model.trim="form.remark" </el-form-item>
maxlength="200" <el-form-item label="pzl" prop="pzl">
show-word-limit <el-input v-model.trim="form.pzl" :maxlength="30" placeholder="请输入pzl" />
type="textarea" </el-form-item>
placeholder="请输入内容" <el-form-item label="parnk" prop="prank">
/> <el-input v-model.trim="form.prank" :maxlength="30" placeholder="请输入prank" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -200,19 +187,7 @@ ...@@ -200,19 +187,7 @@
</template> </template>
<script> <script>
import { import { listdevice, updatadevice, getDetailById, add } from '@/api/magnagement'
addRole,
changeRoleStatus,
dataScope,
delRole,
exportRole,
getRole,
updateRole
} from '@/api/system/role'
import { listdevice } from '@/api/magnagement'
import { roleMenuTreeselect, roleMenuTreeselectMC, treeselect as menuTreeselect } from '@/api/system/menu'
import { roleDeptTreeselect, treeselect as deptTreeselect } from '@/api/system/dept'
// import { getRolesByInsId } from '../../../api/businessManage/template'
export default { export default {
name: 'Role', name: 'Role',
data() { data() {
...@@ -321,7 +296,8 @@ export default { ...@@ -321,7 +296,8 @@ export default {
lot: undefined, lot: undefined,
plocation: undefined, plocation: undefined,
ptype: 1, ptype: 1,
pstatus: 0 pstatus: 0,
delFlag: 0
}, },
// 表单参数 // 表单参数
form: { form: {
...@@ -335,15 +311,6 @@ export default { ...@@ -335,15 +311,6 @@ export default {
}, },
// 表单校验 // 表单校验
rules: { rules: {
roleName: [
{ required: true, message: '请输入角色名称', trigger: 'blur' }
],
roleKey: [
{ required: true, message: '请输入权限字符', trigger: 'blur' }
],
roleSort: [
{ required: true, message: '请输入角色排序', trigger: 'blur' }
]
}, },
deptOptions: [], deptOptions: [],
formData: {} formData: {}
...@@ -366,9 +333,6 @@ export default { ...@@ -366,9 +333,6 @@ export default {
this.queryParams = { ...param } this.queryParams = { ...param }
} }
this.getList() this.getList()
// this.getDicts(dictCons['NORMAL_DISABLE']).then(response => {
// this.statusOptions = response.data;
// });
}, },
methods: { methods: {
// TODO: 获取所选行详情信息操作 // TODO: 获取所选行详情信息操作
...@@ -400,100 +364,6 @@ export default { ...@@ -400,100 +364,6 @@ export default {
} }
) )
}, },
/** 查询菜单树结构 */
getMenuTreeselect() {
menuTreeselect().then(response => {
this.menuOptions = response.data
})
},
/** 查询菜单列表 */
getMenuList(roleId) {
roleMenuTreeselectMC(roleId).then(response => {
this.menuList = this.handleTree(response.data.menus, 'businessId')
this.loading = false
})
},
/** 查询部门树结构 */
getDeptTreeselect() {
deptTreeselect().then(response => {
this.deptOptions = response.data
})
},
// 树状图节点点击选中事件
handleMenuCheckChange(data, check, subCheck) { // data为选中节点信息,check选中状态
if (data.children !== undefined && data.children !== null) { // 是否包含子节点
this.checkNode(data.children, check) // 调用checkNode方法
}
// // 获取所有被选中的节点信息
// const nodes = this.$refs.menu.getCheckedNodes(false, false)
// // 将获取到的信息赋值(根据自己的需求)
// this.custGroupDesc = nodes.map(item => item.CN_NAME)
// this.searchForm.custGroup = nodes.map(item => item.code)
},
// 选中所有下级节点
checkNode(data, check) {
// 遍历所有下级节点信息
data.forEach(item => {
// 通过节点信息设置选中状态
this.$refs.menu.setChecked(item, check, false)
// 是否包含下级节点,包含下级节点则选中所有下级节点
if (item.children !== undefined) {
this.checkNode(item.children, check)
}
})
},
// 所有菜单节点数据
getMenuAllCheckedKeys() {
// 目前被选中的菜单节点
const checkedKeys = this.$refs.menu.getHalfCheckedKeys()
// 半选中的菜单节点
const halfCheckedKeys = this.$refs.menu.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys
},
// 所有部门节点数据
getDeptAllCheckedKeys() {
// 目前被选中的部门节点
const checkedKeys = this.$refs.dept.getHalfCheckedKeys()
// // 半选中的部门节点
const halfCheckedKeys = this.$refs.dept.getCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return this.$refs.dept.getCheckedKeys()
},
/** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.data.menus
return response
})
},
/** 根据角色ID和菜单ID查询部门树结构 */
getRoleDeptTreeselect(roleId, menuId) {
return roleDeptTreeselect(roleId, menuId).then(response => {
this.form.deptCheckStrictly = response.data.deptCheckStrictly
this.deptOptions = response.data.depts
this.form.dataScope = this.dataScopeOptions[response.data.dataScope - 1].value
return response
})
},
// 角色状态修改
handleStatusChange(row) {
const text = row.flag === '1' ? '启用' : '停用'
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return changeRoleStatus(row.businessId, row.flag)
}).then(() => {
this.$message({
message: text + '成功',
type: 'success'
})
}).catch(function() {
row.flag = row.flag === '0' ? '1' : '0'
})
},
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false
...@@ -534,48 +404,6 @@ export default { ...@@ -534,48 +404,6 @@ export default {
this.queryParams.page = 1 this.queryParams.page = 1
this.getList() this.getList()
}, },
/** 重置按钮操作 */
resetQuery() {
// this.dateRange = []
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.roleId)
this.single = selection.length !== 1
this.multiple = !selection.length
},
// // 树权限(父子联动)
// handleCheckedTreeConnect(value, type) {
// if (type === 'menu') {
// this.form.menuCheckStrictly = !!value
// } else if (type === 'dept') {
// this.form.deptCheckStrictly = !!value
// }
// },
// 树权限(全选/全不选)
handleCheckedTreeNodeAll(value, type) {
if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
} else if (type === 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
}
},
// 树权限(展开/折叠)
handleCheckedTreeExpand(value, type) {
if (type === 'menu') {
const treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
}
} else if (type === 'dept') {
const treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
}
}
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset()
...@@ -585,120 +413,54 @@ export default { ...@@ -585,120 +413,54 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.title = '编辑基础信息表单'
const roleId = row.businessId || this.ids const id = row.businessId
const roleMenu = this.getRoleMenuTreeselect(roleId) getDetailById(id).then(res => {
getRole(roleId).then(response => { this.form = res.data
this.form = response.data
this.open = true this.open = true
this.getMenuTreeselect(roleId)
this.$nextTick(() => {
roleMenu.then(res => {
this.$refs.menu.setCheckedKeys(res.data.checkedKeys)
})
})
this.title = '修改角色'
})
},
/** 分配数据权限操作 选择菜单 */
handleMenu(row) {
this.reset()
const roleId = row.businessId || this.ids
this.getMenuList(roleId) // 查询菜单列表树形显示
getRole(roleId).then(response => {
this.form = response.data
this.openDataScope = true
this.title = '分配数据权限'
})
},
/** 分配数据权限操作 */
handleDataScope(row) {
this.deptOptions = []
this.form.dataScope = undefined
const roleId = this.form.businessId
this.form.menuId = row.businessId
this.form.menuName = row.menuName
const roleDeptTreeselect = this.getRoleDeptTreeselect(roleId, this.form.menuId)
this.$nextTick(() => {
roleDeptTreeselect.then(res => {
this.$refs.dept.setCheckedKeys(res.data.checkedKeys)
})
}) })
this.title = '分配数据权限'
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function() {
this.$refs['form'].validate(valid => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.form.menuCheckStrictly = false // 校验通过,提交表单或进行其他操作
console.log('form', this.form)
if (this.form.businessId !== undefined) { if (this.form.businessId !== undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys() console.log('更新')
updateRole(this.form).then(response => { updatadevice(this.form).then(res => {
this.msgSuccess('修改成功') console.log('res', res)
if (res.code === 200) {
this.open = false this.open = false
this.$message.success('操作成功')
this.getList() this.getList()
this.reFrom()
} else if (res.code === null) {
this.$message.error(res.message)
}
}) })
} else { } else {
this.form.menuIds = this.getMenuAllCheckedKeys() add(this.form).then(res => {
addRole(this.form).then(response => { if (res.code === 200) {
this.msgSuccess('新增成功')
this.open = false this.open = false
this.$message.success('操作成功')
this.getList() this.getList()
this.reFrom()
} else if (res.code === null) {
this.$message.error(res.message)
}
}) })
} }
} else {
// 校验失败,显示错误信息或进行其他操作
} }
}) })
}, },
/** 提交按钮(数据权限) */
submitDataScope: function() {
if (this.form.businessId !== undefined && this.form.menuId !== undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys()
dataScope(this.form).then(response => {
this.msgSuccess('修改成功')
this.openDataScope = false
this.getList()
})
}
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const roleIds = row.businessId || this.ids
this.$confirm('是否确认操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delRole(roleIds)
}).then(() => {
this.getList()
this.$message({
message: '删除成功',
type: 'success'
})
}).catch(function() {
})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportRole(queryParams).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '角色信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
// this.download(response.msg);
})
})
} }
} }
} }
......
<template> <template>
<div class="app-container"> <el-form ref="form" :model="form" label-width="80px">
<div class="info"><span style="color: #333; font-weight: 700;">基本信息</span></div>
<!-- TODO: 基础设备管理--> <el-row :gutter="40">
<el-form ref="queryForm" style="padding: 0 0 0 10px" :model="queryParams" :inline="true"> <el-col :span="12" style="padding-left: 16%;">
<el-form-item label="设备名称" prop="roleName"> <el-form-item label="生产工艺">
<el-input <el-select v-model="form.region" placeholder="请选择活动区域">
v-model="queryParams.deviceName" <el-option label="工艺一" value="shanghai" />
placeholder="请输入设备名称" <el-option label="工艺二" value="beijing" />
clearable </el-select>
:maxlength="30" </el-form-item>
size="small" </el-col>
style="width: 150px" </el-row>
@keyup.enter.native="handleQuery" <el-row :gutter="40">
/> <el-col :span="12" style="padding-left: 16%;">
</el-form-item> <el-form-item label="编码一" style="flex-basis: 50%;">
<el-form-item label="设备编码" prop="roleKey"> <el-input ref="input1" v-model="form.name" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(1,$event)" />
<el-input </el-form-item>
v-model="queryParams.deviceId" </el-col>
placeholder="请输入设备编码" <el-col :span="12">
clearable <el-form-item label="编码二" style="flex-basis: 50%;">
size="small" <el-input ref="input2" v-model="form.date1" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(2,$event)" />
style="width: 150px" </el-form-item>
@keyup.enter.native="handleQuery" </el-col>
/> </el-row>
</el-form-item> <el-row :gutter="40">
<el-col :span="12" style="padding-left: 16%;">
<el-form-item> <el-form-item label="编码三" style="flex-basis: 50%;">
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">查询</el-button> <el-input ref="input3" v-model="form.date2" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(3,$event)" />
</el-form-item> </el-form-item>
</el-col>
</el-form> <el-col :span="12">
<el-form-item v-if="form.region === 'beijing'" label="编码四" style="flex-basis: 50%;">
<div class="placeholder" /> <el-input ref="input4" v-model="form.type" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(4,$event)" />
</el-form-item>
<!-- TODO: 中间的分隔符号 --> <el-form-item v-else label="编码六" style="flex-basis: 50%;">
<div style="padding:5px 10px"> <el-input ref="input6" v-model="form.desc" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(6,$event)" />
</el-form-item>
<!-- TODO: 以下为基础设备管理列表 --> </el-col>
<div class="mb12 font-small-bold">设备领用列表</div> </el-row>
<el-table v-loading="loading" border :data="roleList" @selection-change="handleSelectionChange"> <el-row :gutter="40">
<el-table-column type="index" label="序号" width="50" /> <el-col :span="12" style="padding-left: 16%;">
<el-table-column label="设备名称" prop="deviceName" :show-overflow-tooltip="true"> <el-form-item v-if="form.region === 'beijing'" label="编码五" style="flex-basis: 50%;">
<template slot-scope="scope"> <el-input ref="input5" v-model="form.resource" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(5,$event)" />
{{ scope.row.deviceName || '-' }} </el-form-item>
</template> </el-col>
</el-table-column> <el-col :span="12" :style="form.region !== 'beijing'? 'padding-left: 16%;': 'padding-left: noset;'">
<el-table-column label="设备编码" prop="deviceId"> <el-form-item v-if="form.region === 'beijing'" label="编码六" style="flex-basis: 50%;">
<template slot-scope="scope"> <el-input ref="input6" v-model="form.desc" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(6,$event)" />
{{ scope.row.deviceId || '-' }} </el-form-item>
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="LOT" prop="LOT"> <div class="button">
<template slot-scope="scope"> <el-button type="primary" @click="submitForm">提交</el-button>
{{ scope.row.deviceId || '-' }}
</template>
</el-table-column>
<el-table-column label="位置" prop="location">
<template slot-scope="scope">
{{ scope.row.location || '-' }}
</template>
</el-table-column>
<el-table-column label="厚度" prop="ply">
<template slot-scope="scope">
{{ scope.row.ply || '-' }}
</template>
</el-table-column>
<el-table-column label="操作员" prop="createBy">
<template slot-scope="scope">
{{ scope.row.createBy || '-' }}
</template>
</el-table-column>
<el-table-column label="创建时间" :show-overflow-tooltip="true" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ scope.row.createTime | transformDateByFormat('YYYY-MM-DD HH:mm') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" class-name="small-padding fixed-width" width="140px">
<template slot-scope="scope">
<el-button v-if="scope.row.state !== ' '" align="center" :type="typeParent" :size="size" @click="handleUpdate(scope.row)">
{{ updataName }}
</el-button>
</template>
</el-table-column>
</el-table>
</div> </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> </el-form>
<div slot="footer" class="dialog-footer"> <!-- <el-form style="display: flex; flex-wrap: wrap;justify-content: center;">
<el-button @click="cancel">取 消</el-button> <el-form-item label="编码一" style="flex-basis: 50%;">
<el-button type="primary" @click="submitForm">确 定</el-button> <el-input ref="input1" v-model="form.name" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(1,$event)" />
</div>
</el-dialog>
<!-- 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>
<el-form-item label="位置:" prop="location"> <el-form-item label="编码二" style="flex-basis: 50%;">
<el-input v-model.trim="singleDetails.location" :readonly="isReadOnly" /> <el-input ref="input2" v-model="form.date1" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(2,$event)" />
</el-form-item> </el-form-item>
<el-form-item label="位置:" prop="ply"> <el-form-item label="编码三" style="flex-basis: 50%;">
<el-input v-model.trim="singleDetails.ply" :readonly="isReadOnly" /> <el-input ref="input3" v-model="form.date2" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(3,$event)" />
</el-form-item> </el-form-item>
<el-form-item label="创建时间:" prop="createTime"> <el-form-item v-if="form.region === 'beijing'" label="编码四" style="flex-basis: 50%;">
<el-input v-model.trim="singleDetails.createTime" :readonly="isReadOnly" /> <el-input ref="input4" v-model="form.type" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(4,$event)" />
</el-form-item> </el-form-item>
<el-form-item label="创建人:" prop="createBy"> <el-form-item v-if="form.region === 'beijing'" label="编码五" style="flex-basis: 50%;">
<el-input v-model.trim="singleDetails.createBy" :readonly="isReadOnly" /> <el-input ref="input5" v-model="form.resource" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(5,$event)" />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="state"> <el-form-item label="编码六" style="flex-basis: 50%;">
<el-input v-model.trim="singleDetails.state" :readonly="isReadOnly" /> <el-input ref="input6" v-model="form.desc" :style="{ width: '400px', height: '30px' }" @keyup.enter.native="handelTab(6,$event)" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-dialog> <el-form-item style="width: 100%;">
<el-button type="primary" @click="submitForm">提交</el-button>
</el-form-item>
</el-form> -->
</div>
</template> </template>
<script> <script>
export default { export default {
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: '', region: '',
deviceId: '', name: '',
LOT: '', date1: '',
location: '', date2: '',
ply: '', type: '',
state: '', resource: '',
flag: '1', desc: '',
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: 表单里的单项详情参数
singleDetails: {
deviceName: '',
deviceId: '',
LOT: '',
location: '',
ply: '',
state: '',
flag: '1',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
},
// TODO: 模拟测试数据
simulateDeviceList: [{
deviceName: '设备1', deviceId: '0001', flag: 1, LOT: '0001', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '驳回'
}, {
deviceName: '设备2', deviceId: '0002', flag: 2, LOT: '0002', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '驳回'
}, {
deviceName: '设备3', deviceId: '0003', flag: 2, LOT: '0003', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '驳回'
}, {
deviceName: '设备4', deviceId: '0004', flag: 2, LOT: '0004', location: 'XXX', ply: 'YYY', createTime: new Date(), updataTime: new Date(), createBy: 'admin', state: '驳回'
}, {
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() {
if (this.$store.getters.searchParams[this.$route.path]) {
const { searchParams } = this.$store.getters; const { path } = this.$route
const param = JSON.parse(searchParams[path]) // 保留着的查询条件
this.queryParams = { ...param }
}
this.getList()
}, },
methods: { methods: {
/** 查询角色列表 */ handelTab(i, e) {
getList() { const that = this
this.loading = true if (!that.$refs['input' + i]) {
this.roleList = this.simulateDeviceList
console.log(this.roleList)
this.loading = false
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
// TODO: 将模拟数据的空对象赋值给表单对象,达成清空填写表单的效果
this.form = {
deviceName: '',
deviceId: '',
location: '',
ply: '',
state: '',
flag: '1',
createTime: new Date(),
updataTime: new Date(),
createBy: ''
}
},
/** TODO: 查询按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** TODO: 重置按钮操作 */
resetQuery() {},
// 多选框选中数据
handleSelectionChange(selection) {},
/** TODO: 新增按钮操作 */
handleAdd() {
// TODO: 初始化新增对话框的状态
this.reset()
this.title = '申请领用设备'
this.open = !this.open
},
// TODO: 获取所选行详情信息操作
handleDetail(row) {
this.singleDetails = this.formReset
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) {
// TODO: 模拟测试数据的修改,可删除
for (const p of this.simulateDeviceList) {
if (p.deviceName === this.form.deviceName) {
this.simulateDeviceList = this.simulateDeviceList.map(obj =>
obj.deviceName === this.form.deviceName ? this.form : obj
)
this.msgSuccess('申请成功')
this.getList()
this.reset()
this.open = !this.open
return return
} else {
if (this.form !== undefined && this.form !== null) {
this.simulateDeviceList.push(this.form)
this.msgSuccess('申请成功')
this.getList()
this.reset()
this.open = !this.open
return
}
}
}
}
})
},
/** TODO: 关于模拟数据的 删除list数组所调用的删除方法,封装的函数如下 */
delDevice(delDeviceName) {
let tip = false
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 that.$nextTick(() => {
}, e.target.blur()
/** TODO:删除按钮操作 */ const index = i + 1
handleDelete(row) { that.$refs['input' + index].focus()
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>
<style lang="scss" scoped>
.app-container {
font-size: 18px;
padding: 0;
.placeholder {
height: 1.3vh;
background-color: #F4F4F4;
margin-bottom: 10px
}
.table-drop {
vertical-align: 2px;
line-height: 20px;
margin-left: 15px
}
.el-switch { <style scoped>
margin-left: 15px; .left-margin {
} margin-left: 20px;
} }
.el-divider--vertical{ .info{
height: 12em; height: 100px;
width: 4px; display: flex;
align-items: center;
justify-content: center;
} }
.button{
.aboutSingleDetails{ margin-top: 11%;
.el-form-item{ margin-left: 20%;
.el-input >>> .el-input__inner {
-webkit-appearance: none;
background-color: #FFF;
background-image: none;
border-radius: 4px;
border: 0;
width: 100%;
}
}
} }
</style> </style>
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button> <el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="placeholder" /> <div class="placeholder" />
...@@ -306,7 +306,8 @@ export default { ...@@ -306,7 +306,8 @@ export default {
lot: undefined, lot: undefined,
plocation: undefined, plocation: undefined,
pstatus: 0, pstatus: 0,
ptype: 1 ptype: 1,
delFlag: 0
}, },
// 表单参数 // 表单参数
form: { form: {
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button> <el-button type="primary" style="padding: 8px 7px;" icon="el-icon-search" size="small" @click="handleQuery">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button style="padding: 8px 7px;" icon="el-icon-refresh" size="small" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="placeholder" /> <div class="placeholder" />
...@@ -315,7 +315,8 @@ export default { ...@@ -315,7 +315,8 @@ export default {
lot: undefined, lot: undefined,
plocation: undefined, plocation: undefined,
pstatus: 0, pstatus: 0,
ptype: 2 ptype: 2,
delFlag: 0
}, },
// 表单参数 // 表单参数
form: { form: {
......
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