diff --git a/nezha-fronted/src/components/page/asset/asset.vue b/nezha-fronted/src/components/page/asset/asset.vue
index 1214ae0db..55156400a 100644
--- a/nezha-fronted/src/components/page/asset/asset.vue
+++ b/nezha-fronted/src/components/page/asset/asset.vue
@@ -9,7 +9,67 @@
{{item.name}}
- 编辑
+
+
+
+
+
+
+
+
{{$t('overall.esc')}}
+
+
+
+
标题
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$t('overall.cancel')}}
+
+
+ {{$t('overall.save')}}
+
+
+
+
@@ -71,16 +131,16 @@
-
- {{scope.row.moduleNum}}
-
+
+ {{scope.row.moduleNum}}
+
-
- {{scope.row.alertNum}}
-
+
+ {{scope.row.alertNum}}
+
@@ -119,7 +179,8 @@
@@ -1144,33 +205,6 @@ export default {
data() {
return {
vendorModelData: '',
- assetData: {
- id: '',
- sn: '',
- host: '',
- state: '',
- purchaseDate: '',
- idcId: '',
- cabinetId: '',
- modelId: ''
- },
- assetViewData: {
- assetType: '',
- vendor: '',
- model: '',
- moduleNum: '',
- alertNum: '',
- idcName: '',
- cabinetName: ''
- },
- assetStateOption: [
- {
- value: 1,
- label: '在库'
- }, {
- value: 2,
- label: '出库'
- }],
cabinetModelData: '',
checkList: [],
tableTitle: [
@@ -1293,17 +327,21 @@ export default {
addIdcData: {
id: '',
name: '',
+ popName: '',
location: '',
principal: '',
tel: ''
},
idcUserData: '',
cabinetSelectedData: {
- uSize: '',
+ name: '',
+ uSize: 0,
remark: '',
+ idcId: '',
},
addCabinetData: {
name: '',
+ popName: '',
uSize: 0,
remark: '',
idcId: '',
@@ -1330,8 +368,10 @@ export default {
isResourceShow: 0,
unitDisable: '',
modelClickData: '',
- popState:true,
- obj: null
+ popState: true,
+ obj: null,
+ addUnitShow: false,
+ editUnitShow: false,
}
},
computed: {
@@ -1341,32 +381,35 @@ export default {
},
watch: {
getData: {
- handler(newVal) {
- this.checkList.splice(0, 0, newVal.selectedData)
+ handler(oldVal,newVal) {
+ console.log(oldVal,newVal)
+ this.checkList.splice(0, 1, newVal.selectedData)
+ this.pageObj.idcIds = newVal.selectedData
+ this.getAssetData()
},
deep: true,
},
allModelUlData(newVal) {
if (newVal) {
this.getConnectData()
- if(this.pageObj.id!=''){
+ if (this.pageObj.id != '') {
this.assetData.modelId = [this.obj.model.vendor.code, this.obj.model.id]
}
}
},
assetType(newVal) {
- if(newVal==''){
- this.popState=true
- }else{
- this.popState=false
+ if (newVal == '') {
+ this.popState = true
+ } else {
+ this.popState = false
}
},
},
methods: {
- ssss() {
+ ssss(data) {
let routeData = this.$router.resolve({
name: "terminal",
- query: {id:96}
+ query: {id: data}
});
window.open(routeData.href);
},
@@ -1472,7 +515,6 @@ export default {
code: ''
}
if (data === 'asset') {
- console.log('asset')
this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1]
this.$put('asset', this.assetData).then(res => {
if (res.code === 200) {
@@ -1498,6 +540,13 @@ export default {
data = 'sys/dict/update'
item = obj
}
+ if (data === 'cabinet') {
+ item.name = this.addCabinetData.popName
+ }
+ if (data === 'idc') {
+ console.log(item)
+ item.name = this.addIdcData.popName
+ }
this.$put(data, item).then(res => {
if (res.code === 200) {
const h = this.$createElement;
@@ -1513,6 +562,7 @@ export default {
},
addNewData(type) {
if (type === 'IDC') {
+ console.log(this.addIdcData)
this.$post('idc', this.addIdcData).then(res => {
if (res.code === 200) {
const h = this.$createElement;
@@ -1538,7 +588,7 @@ export default {
})
}
if (type === 'asset') {
- console.log(this.assetData.modelId)
+ console.log(this.assetData)
this.assetData.modelId = this.assetData.modelId.join(',').split(',')[1]
this.$post('asset', this.assetData).then(res => {
if (res.code === 200) {
@@ -1552,7 +602,6 @@ export default {
})
}
if (type === 'vendor') {
- console.log(this.addVendorData)
this.$post('sys/dict/save', this.addVendorData).then(res => {
if (res.code === 200) {
const h = this.$createElement;
@@ -1613,16 +662,13 @@ export default {
message: h('i', {style: 'color: teal'}, '删除成功'),
duration: 2000
});
-
this.getAssetData()
this.getIDCOptionData()
this.getVendorOptionData()
this.getCabinetOptionData(this.assetData.idcId)
this.getAllModelOptionData(this.assetType)
this.getModelOptionData(this.assetType, this.vendorCode)
-
} else {
- console.log(response)
this.$notify({
message: h('i', {style: 'color: teal'}, response.msg),
duration: 2000
@@ -1634,13 +680,15 @@ export default {
data.forEach(item => {
this.$set(item, 'isEdit', false);
this.$set(item, 'oldName', item.value);
+ this.$set(item, item.name, false)
+ this.$set(item, item.id, false)
+ this.$set(item, item.id + item.name, false)
})
},
getConnectData() {
this.isResourceShow += 1
let resultData = []
let modelData = this.allModelUlData
- console.log(modelData)
for (let i = 0; i < modelData.length; i++) {
let obj = {}
obj.id = modelData[i].vendor.id
@@ -1668,7 +716,6 @@ export default {
}
}
}
- console.log(result)
this.vendorTypeOptionData = result
},
editOptionData(item) {
@@ -1684,64 +731,60 @@ export default {
},
delOptionData(data) {
},
- tagShow(t, data) {
- this.tabShow = false;
- if (t === 'showAdd') {
- this.tabShow = true;
- this.tagType = 'add'
- this.$refs['addForm'].resetFields()
- this.assetType = ''
- this.assetData.idcId = ''
- this.assetData.cabinetId = ''
- this.assetData.modelId = ''
- this.idcSelectedData.location = ''
- this.idcSelectedData.principal = ''
- this.idcSelectedData.tel = ''
- this.cabinetSelectedData.uSize = ''
- this.cabinetSelectedData.remark = ''
-
+ tabControl(data) {
+ if (data === 'close') {
+ this.addUnitShow = false
+ this.editUnitShow = false
}
- if (t === 'showEdit') {
- this.tabShow = true;
- this.tagType = 'edit'
- this.assetData.id = data
- this.getAssetData(data)
- this.tabView = false
+ },
+ tagShow(data, id, type) {
+ if(data === 'showAdd'){
+ this.addUnitShow = true
}
- if (t === 'showView') {
- this.tabShow = true;
- this.tagType = 'edit'
- this.assetData.id = data
- this.getAssetData(data)
- this.tabView = true
+ if(data === 'showEdit'){
+ this.editUnitShow = true
+ this.$refs['assetEditUnit'].getAssetData(id)
+ }
+ if(data === 'showView'){
+ this.editUnitShow = true
+ this.$refs['assetEditUnit'].tabView=true
}
},
editing() {
},
- getSingleIDCData(data) {
- this.idcSelectedData = '';
- this.IDCOptionData.forEach(item => {
- if (item.id === data) {
- this.idcSelectedData = item
- }
- });
- this.getCabinetOptionData(this.assetData.idcId);
- this.assetData.cabinetId = ''
- this.cabinetSelectedData.uSize = ''
- this.cabinetSelectedData.remark = ''
+ getSingleIDCData(data, item) {
+ if (item !== 'edit') {
+ this.idcSelectedData = '';
+ this.IDCOptionData.forEach(item => {
+ if (item.id === data) {
+ this.idcSelectedData = item
+ }
+ });
+ this.getCabinetOptionData(this.assetData.idcId);
+ this.assetData.cabinetId = ''
+ this.cabinetSelectedData.uSize = ''
+ this.cabinetSelectedData.remark = null
+ } else {
+ this.IDCOptionData.forEach(item => {
+ if (item.id === data) {
+ this.addIdcData.popName = item.name
+ this.addIdcData.location = item.location
+ this.addIdcData.principal = item.principal
+ this.addIdcData.tel = item.tel
+ }
+ });
+ }
}
,
- getSingleCabinetData(data) {
- this.cabinetSelectedData = '';
- this.cabinetOptionData.forEach(item => {
- if (item.id === data) {
- this.cabinetSelectedData = item
- }
- })
- },
getSingleAsset(data) {
+ console.log(data)
+ // let regPos = /^\d+(\.\d+)?$/;
+ // if(!regPos.test(data)){
+ // this.pageObj.idcIds = data
+ // }else{
this.pageObj.idcIds = data.join(',')
+ // }
this.getAssetData()
},
getLidata(index, item) {
@@ -1759,28 +802,6 @@ export default {
this.pageObj.pageSize = val;
this.getAssetData()
},
- clickState(index, item, data) {
- if (data === 'type') {
- this.modelCount = index;
- this.tempData = item;
- }
- if (data === 'model') {
- this.modelCount = index;
- this.modelClickData = item.id
- }
- },
- transferData(data) {
- if (data === 'type') {
- this.assetType = this.tempData.code
- this.popTypeVisible = false
- this.tempData = ''
- }
- if (data === 'model') {
- this.assetData.modelId = [this.vendorCode, this.modelClickData]
- this.popCompVisible = false
- this.tempData = ''
- }
- },
popoverClose(data) {
if (data === 'type') {
this.modelCount = ''
@@ -1798,26 +819,9 @@ export default {
this.popCabinetVisible = false
}
},
- editPopoverClose(data) {
- if (data === 'type') {
- this.modelCount = ''
- this.editPopTypeVisible = !this.editPopTypeVisible
- }
- if (data === 'vendor') {
- this.vendorCount = ''
- this.modelCount = ''
- this.editPopVendorVisible = !this.editPopVendorVisible
- }
- if (data === 'idc') {
- this.editPopIDCVisible = !this.editPopIDCVisible
- }
- if (data === 'cabinet') {
- this.editPopCabinetVisible = !this.editPopCabinetVisible
- }
- },
- getPrincipalName(data){
- for(let item in this.idcUserData){
- if(this.idcUserData[item].userId === data){
+ getPrincipalName(data) {
+ for (let item in this.idcUserData) {
+ if (this.idcUserData[item].userId === data) {
return this.idcUserData[item].username
}
}
@@ -1830,7 +834,11 @@ export default {
} else {
return "-";
}
- }
+ },
+ flushData() {
+ this.getAssetData();
+ this.getIDCOptionData();
+ },
},
mounted() {
this.getCabinetOptionData('')
@@ -1893,6 +901,29 @@ export default {
}
\ No newline at end of file
+
diff --git a/nezha-fronted/src/components/page/asset/assetAddUnit.vue b/nezha-fronted/src/components/page/asset/assetAddUnit.vue
new file mode 100644
index 000000000..95bdcca22
--- /dev/null
+++ b/nezha-fronted/src/components/page/asset/assetAddUnit.vue
@@ -0,0 +1,1615 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/components/page/asset/assetEditUnit.vue b/nezha-fronted/src/components/page/asset/assetEditUnit.vue
new file mode 100644
index 000000000..404894243
--- /dev/null
+++ b/nezha-fronted/src/components/page/asset/assetEditUnit.vue
@@ -0,0 +1,1652 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/nezha-fronted/src/main.js b/nezha-fronted/src/main.js
index 5895d34e4..79feb1961 100644
--- a/nezha-fronted/src/main.js
+++ b/nezha-fronted/src/main.js
@@ -19,12 +19,16 @@ import searchInput from "./components/common/searchInput"; //搜索框组件
import projectBox from './components/common/rightBox/projectBox'; //project弹框组件
import moduleBox from './components/common/rightBox/moduleBox'; //module弹框组件
import editEndpointBox from './components/common/rightBox/endpointBox'; //endpoint弹框组件
+import assetAddUnit from "./components/page/asset/assetAddUnit"; //资产添加组件
+import assetEditUnit from "./components/page/asset/assetEditUnit"; //资产添加组件
Vue.component("Pagination", Pagination);
Vue.component("searchInput", searchInput);
Vue.component("project-box", projectBox);
Vue.component("module-box", moduleBox);
Vue.component("edit-endpoint-box", editEndpointBox);
+Vue.component("assetAddUnit", assetAddUnit);
+Vue.component("assetEditUnit", assetEditUnit);
Vue.prototype.$axios = axios;
Vue.prototype.$post = post;