设备管理-设备台账-新增排序/权限

dev-scheduling
ysn 4 weeks ago
parent 582b160e9b
commit 24bc6d144b
  1. 309
      src/views/equiptManagement/equipmentLedger/index.vue

@ -21,16 +21,25 @@
@size-change="sizeChange" @size-change="sizeChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@on-load="onLoad" @on-load="onLoad"
@sort-change="sortChange"
:permission="permissionList"
> >
<template #menu-left> </template> <template #menu-left> </template>
<template #menu-right="{ size }"> </template> <template #menu-right="{ size }"> </template>
<template #menu="scope"> <template #menu="scope">
<el-button type="primary" link @click="editIP(scope.row)">修改IP</el-button> <el-button
type="primary"
link
v-if="permission.equipmentLedger_editIp"
@click="editIP(scope.row)"
>
修改IP
</el-button>
</template> </template>
<template #virtualMac="scope"> <template #virtualMac="scope">
<span> <span>
{{ scope.row.virtualMac == 1 ? "是" : "否" }} {{ scope.row.virtualMac == 1 ? '是' : '否' }}
</span> </span>
</template> </template>
<template #virtualMac-form="{ type, disabled }"> <template #virtualMac-form="{ type, disabled }">
@ -54,18 +63,24 @@
</basic-container> </basic-container>
</template> </template>
<script> <script>
import { getLazyList, remove, update, add, getMenu } from "@/api/system/menu"; import { getLazyList, remove, update, add, getMenu } from '@/api/system/menu';
import { getList,addDevice,editDevice,getDetail,deleteDevice } from "@/api/equiptManagement/equipmentLedger" import {
getList,
addDevice,
editDevice,
getDetail,
deleteDevice,
} from '@/api/equiptManagement/equipmentLedger';
import { mapGetters } from "vuex"; import { mapGetters } from 'vuex';
import { import {
getQueryAllCaList, getQueryAllCaList,
getQueryAllCaDeatils, getQueryAllCaDeatils,
getQueryAllCaSave, getQueryAllCaSave,
getQueryAllCaDel, getQueryAllCaDel,
} from "@/api/processManagement/processCapability"; } from '@/api/processManagement/processCapability';
import { getDictionary } from "@/api/system/dict"; import { getDictionary } from '@/api/system/dict';
import formIp from "./formIp.vue"; import formIp from './formIp.vue';
export default { export default {
components: { components: {
formIp, formIp,
@ -80,7 +95,7 @@ export default {
query: {}, query: {},
loading: true, loading: true,
selectionList: [], selectionList: [],
parentId: "", parentId: '',
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
@ -89,12 +104,12 @@ export default {
option: { option: {
columnSort: true, columnSort: true,
tip: false, tip: false,
height: "auto", height: 'auto',
calcHeight: 32, calcHeight: 32,
simplePage: false, simplePage: false,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 6,
dialogWidth: "60%", dialogWidth: '60%',
border: true, border: true,
selection: true, selection: true,
viewBtn: true, viewBtn: true,
@ -102,58 +117,58 @@ export default {
dialogClickModal: false, dialogClickModal: false,
excelBtn: true, excelBtn: true,
viewBtn: false, viewBtn: false,
editBtnText: "编辑", editBtnText: '编辑',
refreshBtn: false, refreshBtn: false,
searchShowBtn: false, searchShowBtn: false,
gridBtn: false, gridBtn: false,
searchIndex: 3, searchIndex: 3,
searchIcon: true, searchIcon: true,
searchLabelPosition: "left", searchLabelPosition: 'left',
searchGutter: 24, searchGutter: 24,
searchSpan: 6, searchSpan: 6,
menuAlign: "left", menuAlign: 'left',
gridBtn: false, gridBtn: false,
searchMenuPosition: "right", searchMenuPosition: 'right',
addBtnIcon: " ", addBtnIcon: ' ',
viewBtnIcon: " ", viewBtnIcon: ' ',
delBtnIcon: " ", delBtnIcon: ' ',
editBtnIcon: " ", editBtnIcon: ' ',
align: "center", align: 'center',
column: [ column: [
{ {
label: "设备编码", label: '设备编码',
prop: "deviceCode", prop: 'deviceCode',
search: true, search: true,
sortable: true, sortable: 'custom',
overHidden: true, overHidden: true,
width: 100, width: 100,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入设备编码", message: '请输入设备编码',
trigger: "blur", trigger: 'blur',
}, },
], ],
}, },
{ {
label: "设备名称", label: '设备名称',
prop: "deviceName", prop: 'deviceName',
sortable: true, sortable: 'custom',
search: true, search: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入设备名称", message: '请输入设备名称',
trigger: "click", trigger: 'click',
}, },
], ],
width: 200, width: 200,
}, },
{ {
label: "设备分类", label: '设备分类',
prop: "category", prop: 'category',
sortable: true, sortable: 'custom',
search: true, search: true,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
@ -167,29 +182,29 @@ export default {
// ], // ],
}, },
{ {
label: "类别名称", label: '类别名称',
prop: "typeName", prop: 'typeName',
sortable: true, sortable: 'custom',
search: true, search: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入类别名称", message: '请输入类别名称',
trigger: "click", trigger: 'click',
}, },
], ],
width: 200, width: 200,
overHidden: true, overHidden: true,
}, },
{ {
label: "服役状态", label: '服役状态',
prop: "used", prop: 'used',
sortable: true, sortable: 'custom',
search: true, search: true,
type: "select", type: 'select',
dicData: [ dicData: [
{ {
label: "正常服役", label: '正常服役',
value: 1, value: 1,
}, },
// { // {
@ -197,7 +212,7 @@ export default {
// value: 2, // value: 2,
// }, // },
{ {
label: "暂停服役", label: '暂停服役',
value: 3, value: 3,
}, },
], ],
@ -205,39 +220,39 @@ export default {
rules: [ rules: [
{ {
required: true, required: true,
message: "请选择服役状态", message: '请选择服役状态',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "RFID", label: 'RFID',
prop: "rfId", prop: 'rfId',
sortable: true, sortable: 'custom',
search: false, search: false,
hide: true, hide: true,
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入RFID", message: '请输入RFID',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "规格型号", label: '规格型号',
prop: "macSpec", prop: 'macSpec',
sortable: true, sortable: 'custom',
search: false, search: false,
width: 100, width: 100,
}, },
{ {
label: "作业中心", label: '作业中心',
prop: "workCenterName", prop: 'workCenterName',
sortable: true, sortable: 'custom',
search: false, search: false,
width: 150, width: 150,
display:false display: false,
// type: "select", // type: "select",
// dicUrl:"/api/blade-desk/BA/WorkCenter/listForSelect", // dicUrl:"/api/blade-desk/BA/WorkCenter/listForSelect",
// props:{ // props:{
@ -246,23 +261,23 @@ export default {
// } // }
}, },
{ {
label: "作业中心", label: '作业中心',
prop: "workCenterId", prop: 'workCenterId',
sortable: true, sortable: 'custom',
search: false, search: false,
width: 150, width: 150,
hide: true, hide: true,
type: "select", type: 'select',
dicUrl:"/api/blade-desk/BA/WorkCenter/listForSelect", dicUrl: '/api/blade-desk/BA/WorkCenter/listForSelect',
props: { props: {
label:"wcName", label: 'wcName',
value:"id" value: 'id',
} },
}, },
{ {
label: "设备IP", label: '设备IP',
prop: "deviceIp", prop: 'deviceIp',
sortable: true, sortable: 'custom',
search: false, search: false,
addDisplay: false, addDisplay: false,
editDisplay: false, editDisplay: false,
@ -270,53 +285,53 @@ export default {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入镀种分类", message: '请输入镀种分类',
trigger: "click", trigger: 'click',
}, },
], ],
}, },
{ {
label: "虚拟设备", label: '虚拟设备',
prop: "virtualMac", prop: 'virtualMac',
display: true, display: true,
span: 24, span: 24,
sortable: 'custom',
search: true, search: true,
type: "select", type: 'select',
width: 100, width: 100,
dicData: [ dicData: [
{ {
label: "是", label: '是',
value: 1, value: 1,
}, },
{ {
label: "否", label: '否',
value: 0, value: 0,
}, },
], ],
}, },
{ {
label: "类别说明", label: '类别说明',
prop: "memo", prop: 'memo',
sortable: true, sortable: 'custom',
search: false, search: false,
span: 24, span: 24,
type: "textarea", type: 'textarea',
maxlength: 100, maxlength: 100,
showWordLimit: true, showWordLimit: true,
width: 100,
minRows: 3, minRows: 3,
}, },
{ {
label: "设备仿真图", label: '设备仿真图',
prop: "attachLink", prop: 'attachLink',
listType: "picture-card", listType: 'picture-card',
type: "upload", type: 'upload',
span: 24, span: 24,
limit: 1, limit: 1,
fileSize: 10000, fileSize: 10000,
action: "/api/blade-resource/oss/endpoint/put-file-attach", action: '/api/blade-resource/oss/endpoint/put-file-attach',
hide: true, hide: true,
tip: "只能上传 image/gif,image/jpeg,image/jpg,image/png 附件,且不超过 10M", tip: '只能上传 image/gif,image/jpeg,image/jpg,image/png 附件,且不超过 10M',
accept: 'image/png, image/jpeg,image/gif,image/jpg', accept: 'image/png, image/jpeg,image/gif,image/jpg',
}, },
], ],
@ -325,21 +340,20 @@ export default {
}; };
}, },
computed: { computed: {
...mapGetters(["userInfo", "permission"]), ...mapGetters(['userInfo', 'permission']),
permissionList() { permissionList() {
return { return {
addBtn: this.validData(this.permission.menu_add, false), addBtn: this.validData(this.permission.equipmentLedger_add, false),
viewBtn: this.validData(this.permission.menu_view, false), delBtn: this.validData(this.permission.equipmentLedger_del, false),
delBtn: this.validData(this.permission.menu_delete, false), editBtn: this.validData(this.permission.equipmentLedger_edit, false),
editBtn: this.validData(this.permission.menu_edit, false),
}; };
}, },
ids() { ids() {
let ids = []; let ids = [];
this.selectionList.forEach((ele) => { this.selectionList.forEach(ele => {
ids.push(ele.id); ids.push(ele.id);
}); });
return ids.join(","); return ids.join(',');
}, },
}, },
methods: { methods: {
@ -356,7 +370,6 @@ export default {
}, },
// //
setCrew(bcId) { setCrew(bcId) {
console.log(9999, bcId);
this.bcId = bcId; this.bcId = bcId;
this.setCrewOpen = true; this.setCrewOpen = true;
}, },
@ -369,7 +382,7 @@ export default {
}, },
handleAdd(row) { handleAdd(row) {
this.parentId = row.id; this.parentId = row.id;
const column = this.findObject(this.option.column, "parentId"); const column = this.findObject(this.option.column, 'parentId');
column.value = row.id; column.value = row.id;
column.addDisabled = true; column.addDisabled = true;
this.$refs.crud.rowAdd(); this.$refs.crud.rowAdd();
@ -386,17 +399,17 @@ export default {
used: row.used, used: row.used,
virtualMac: row.virtualMac ? 1 : 0, virtualMac: row.virtualMac ? 1 : 0,
attachLink: row.attachLink.length > 0 ? row.attachLink[0] : '', attachLink: row.attachLink.length > 0 ? row.attachLink[0] : '',
workCenterId:row.workCenterId workCenterId: row.workCenterId,
} };
addDevice(params).then(res => { addDevice(params).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message.success('新增成功') this.$message.success('新增成功');
done(row) done(row);
this.onLoad() this.onLoad();
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message);
} }
}) });
}, },
// //
rowUpdate(row, index, done, loading) { rowUpdate(row, index, done, loading) {
@ -411,38 +424,34 @@ export default {
used: row.used, used: row.used,
virtualMac: row.virtualMac ? 1 : 0, virtualMac: row.virtualMac ? 1 : 0,
attachLink: row.attachLink.length > 0 ? row.attachLink[0] : '', attachLink: row.attachLink.length > 0 ? row.attachLink[0] : '',
workCenterId:row.workCenterId workCenterId: row.workCenterId,
} };
console.log('link----------',row.attachLink && row.attachLink != '' && typeof(row.attachLink) == String ? row.attachLink : row.attachLink.length > 0 ? row.attachLink[0] : '')
console.log('row------------',row)
console.log('params------------',params)
editDevice(params).then(res => { editDevice(params).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message.success('修改成功') this.$message.success('修改成功');
done() done();
this.onLoad() this.onLoad();
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message);
done() done();
} }
}) });
}, },
rowDel(row, index, done) { rowDel(row, index, done) {
this.$confirm("确定将选择数据删除?", { this.$confirm('确定将选择数据删除?', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning',
}).then(() => { }).then(() => {
deleteDevice({ ids: row.id }).then(res => { deleteDevice({ ids: row.id }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message.success('删除成功') this.$message.success('删除成功');
done() done();
this.onLoad() this.onLoad();
} }
}) });
}) });
}, },
// //
searchReset() { searchReset() {
@ -453,7 +462,7 @@ export default {
// //
searchChange(params, done) { searchChange(params, done) {
this.query = params; this.query = params;
this.parentId = ""; this.parentId = '';
this.page.currentPage = 1; this.page.currentPage = 1;
this.onLoad(this.page, params); this.onLoad(this.page, params);
done(); done();
@ -469,36 +478,34 @@ export default {
}, },
// beforeOpen // beforeOpen
beforeOpen(done, type) { beforeOpen(done, type) {
if (["edit", "view"].includes(type)) { if (['edit', 'view'].includes(type)) {
getDetail({ id: this.form.id }).then(res => { getDetail({ id: this.form.id }).then(res => {
this.form = res.data.data this.form = res.data.data;
this.form.attachLink = [this.form.attachLink] this.form.attachLink = [this.form.attachLink];
this.form.virtualMac = this.form.virtualMac == 1 ? true : false this.form.virtualMac = this.form.virtualMac == 1 ? true : false;
this.form.workCenterId = this.form.workCenterId == '-1' ? '' : this.form.workCenterId + '' this.form.workCenterId =
this.form.workCenterId == '-1' ? '' : this.form.workCenterId + '';
done(); done();
}) });
} else { } else {
done(); done();
} }
}, },
uploadAfter(res, done, loading, column) { uploadAfter(res, done, loading, column) {
console.log('res-----------------',res) this.form.attachLink = [res.data.link];
console.log('attachLink-----------------',this.form.attachLink) done();
this.form.attachLink = [res.data.link]
done()
}, },
uploadDelete(file, column) { uploadDelete(file, column) {
console.log('uploadDelete-----------------') this.form.attachLink = [];
this.form.attachLink = []
}, },
uploadExceed(limit, files, fileList, column) { uploadExceed(limit, files, fileList, column) {
this.$message.error('最多只能上传一个文件') this.$message.error('最多只能上传一个文件');
}, },
// beforeClose // beforeClose
beforeClose(done) { beforeClose(done) {
this.parentId = ""; this.parentId = '';
const column = this.findObject(this.option.column, "parentId"); const column = this.findObject(this.option.column, 'parentId');
column.value = ""; column.value = '';
column.addDisabled = false; column.addDisabled = false;
done(); done();
}, },
@ -514,18 +521,28 @@ export default {
refreshChange() { refreshChange() {
this.onLoad(this.page, this.query); this.onLoad(this.page, this.query);
}, },
sortChange({ prop, order }) {
this.query.descs = undefined;
this.query.ascs = undefined;
let orderByFieldKey = order === 'descending' ? 'descs' : 'ascs';
this.query[orderByFieldKey] = !prop
? undefined
: prop.replace(/([a-z])([A-Z0-9])/g, '$1_$2').toUpperCase();
// //
this.onLoad();
},
// //
onLoad(page, params = {}) { onLoad(page, params = {}) {
this.loading = true; this.loading = true;
getList({ getList({
current: this.page.currentPage, current: this.page.currentPage,
size: this.page.pageSize, size: this.page.pageSize,
...this.query ...this.query,
}).then(res => { }).then(res => {
this.data = res.data.data.records this.data = res.data.data.records;
this.page.total = res.data.data.total this.page.total = res.data.data.total;
this.loading = false this.loading = false;
}) });
// getLazyList(this.parentId, Object.assign(params, this.query)).then((res) => { // getLazyList(this.parentId, Object.assign(params, this.query)).then((res) => {
// // this.data = res.data.data; // // this.data = res.data.data;
// this.data = [ // this.data = [

Loading…
Cancel
Save