|
|
export default {
|
|
|
name: 'resourceTypePer',
|
|
|
name: 'resourceLeader',
|
|
|
template: '',
|
|
|
components: {
|
|
|
|
|
|
'ChangeUsersList': Vue.defineAsyncComponent(
|
|
|
() => myImport('views/batchChangeLeaders/changeUsersList/index')
|
|
|
),
|
|
|
},
|
|
|
data() {
|
|
|
},
|
...
|
...
|
@@ -10,11 +12,247 @@ export default { |
|
|
},
|
|
|
setup: function (props, {attrs, slots, emit}) {
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
//变更人员弹框
|
|
|
let show=Vue.ref(false);
|
|
|
//变更人员列表是否多选
|
|
|
let isMulti=Vue.ref(false);
|
|
|
//变更人员列表是否是两组
|
|
|
let isTwoGroup=Vue.ref(false);
|
|
|
//配置列表总数
|
|
|
let count = Vue.ref(0);
|
|
|
//列表高度
|
|
|
let height = Vue.ref(window.innerHeight);
|
|
|
//列表分页
|
|
|
let limit = Vue.ref(400);
|
|
|
//加载
|
|
|
let loading = Vue.ref(true);
|
|
|
//选中数据
|
|
|
let pitch = Vue.ref([]);
|
|
|
let showTypeList=Vue.ref([]);
|
|
|
let search = Vue.ref({
|
|
|
resType: '',
|
|
|
keyword: '',
|
|
|
page: 1,
|
|
|
limit: 20,
|
|
|
});
|
|
|
let resTypeOptions=Vue.ref([])
|
|
|
const columns = [
|
|
|
{
|
|
|
prop: 'resName',
|
|
|
label: '资源名称',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
prop: 'ip',
|
|
|
label: 'IP地址',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
prop: 'port',
|
|
|
label: '端口号',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
prop: 'admin',
|
|
|
label: '负责人',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
prop: 'resTypeName',
|
|
|
label: '资源类型',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
},
|
|
|
{
|
|
|
prop: 'state',
|
|
|
label: '资源状态',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
render: function (row) {
|
|
|
switch (row.state) {
|
|
|
case "new" :
|
|
|
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
|
|
|
case "monitor" :
|
|
|
return '<span style="background-color: #0BAC33;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">监控中</span>'
|
|
|
case "stop" :
|
|
|
return '<span style="background-color: #d81e06;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">暂停</span>'
|
|
|
default :
|
|
|
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
prop: 'paramDesc',
|
|
|
label: '展示类型',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
/* render: function (row) {
|
|
|
|
|
|
}*/
|
|
|
}
|
|
|
];
|
|
|
|
|
|
//列表数据
|
|
|
let resourceData = Vue.ref([]);
|
|
|
//获取列表数据
|
|
|
const getListData = () => {
|
|
|
let username=proxy.$route.query.username;
|
|
|
let resName=proxy.$route.query.resName;
|
|
|
//定义列表参数
|
|
|
let getParams = {
|
|
|
resType:search.value.resType,
|
|
|
keyword:search.value.keyword,
|
|
|
resName: resName,
|
|
|
userId: username,
|
|
|
page: search.value.page,
|
|
|
limit: search.value.limit
|
|
|
};
|
|
|
proxy.$http.get("/api-web/manage/resource/getAllResByUser", getParams, function (res) {
|
|
|
if (res && res.data) {
|
|
|
resourceData.value = res.data ? res.data : [];
|
|
|
count.value = res.count;
|
|
|
loading.value = false;
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
//重新加载表格数据
|
|
|
let loadTableDataList = ({page, limit}) => {
|
|
|
search.value.page=page;
|
|
|
search.value.limit=limit;
|
|
|
getListData();
|
|
|
}
|
|
|
let resIds=Vue.ref('');//选中的ids
|
|
|
//表格全选事件
|
|
|
let selectionChange = (val) => {
|
|
|
pitch.value = val;
|
|
|
let arr=[];
|
|
|
pitch.value.map(item=>{
|
|
|
arr.push(item.resId)
|
|
|
})
|
|
|
resIds.value=arr.join(",");//选中的值
|
|
|
proxy.resourceData.map((v, i) => {
|
|
|
v.checked = false;
|
|
|
});
|
|
|
let selectData = val;
|
|
|
if (selectData.length > 0) {
|
|
|
selectData.map((item, index) => {
|
|
|
proxy.resourceData.map((v, i) => {
|
|
|
if (item.id == v.id) {
|
|
|
v.checked = true;
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
} else {
|
|
|
proxy.resourceData.map((v, i) => {
|
|
|
v.checked = false;
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
//获取资源类型数据
|
|
|
let getResourceTypoe=()=>{
|
|
|
proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
resTypeOptions.value=res.data
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
//获取展示类型的字典数据
|
|
|
let initShowType=()=>{
|
|
|
proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
let arr=res.data;
|
|
|
if(arr && arr.length>0){
|
|
|
arr.map(v=>{
|
|
|
showTypeList.value.push({
|
|
|
name: v.ddicName
|
|
|
,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length)
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
//批量取消负责的相关资源
|
|
|
let changeCancel = () => {
|
|
|
if(pitch.value.length<1){
|
|
|
proxy.$global.showMsg('请至少选择一项','warning');
|
|
|
}else{
|
|
|
proxy.$global.confirm("确定取消负责的相关资源?", function () {
|
|
|
proxy.$global.showMsg('取消成功!');
|
|
|
// proxy.$http.get(`/api-web/`, {resIds:resIds.value}, function (res) {
|
|
|
// if (res && res.data) {
|
|
|
// proxy.$global.showMsg('取消成功!');
|
|
|
// getListData()
|
|
|
// }
|
|
|
// })
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
//变更负责人
|
|
|
let changeAdmin = () => {
|
|
|
if(pitch.value.length<1){
|
|
|
proxy.$global.showMsg('请至少选择一项','warning');
|
|
|
|
|
|
}else{
|
|
|
show.value=true;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//变更人员的弹框关闭后
|
|
|
let hideDialog =(flag)=>{
|
|
|
show.value=flag;
|
|
|
// getListData();
|
|
|
}
|
|
|
//变更人员的弹框保存后
|
|
|
let savebtn =(obj)=>{
|
|
|
show.value=false;
|
|
|
//obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
|
|
|
let params={
|
|
|
resIds:resIds.value,
|
|
|
selectModel:obj.selectModel,
|
|
|
}
|
|
|
// proxy.$http.get(`/api-web/`, {}, function (res) {
|
|
|
// if (res && res.data) {
|
|
|
// proxy.$global.showMsg('变更成功!');
|
|
|
// getListData()
|
|
|
// }
|
|
|
// })
|
|
|
}
|
|
|
// 挂载完
|
|
|
Vue.onMounted(() => {
|
|
|
initShowType();
|
|
|
getResourceTypoe();
|
|
|
getListData();
|
|
|
})
|
|
|
return {
|
|
|
isMulti,
|
|
|
isTwoGroup,
|
|
|
show,
|
|
|
initShowType,
|
|
|
showTypeList,
|
|
|
search,
|
|
|
resTypeOptions,
|
|
|
changeCancel,
|
|
|
count,
|
|
|
hideDialog,
|
|
|
savebtn,
|
|
|
changeAdmin,
|
|
|
getResourceTypoe,
|
|
|
|
|
|
resourceData,
|
|
|
columns,
|
|
|
height,
|
|
|
loading,
|
|
|
|
|
|
selectionChange,
|
|
|
|
|
|
getListData,
|
|
|
loadTableDataList,
|
|
|
|
|
|
}
|
|
|
}
|
...
|
...
|
|