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

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

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

Loading…
Cancel
Save