优化页面

This commit is contained in:
18500206848
2024-04-11 22:13:33 +08:00
parent 273f47f8a5
commit 6395d65121
5 changed files with 0 additions and 859 deletions

View File

@@ -1,98 +0,0 @@
import request from '@/router/axios';
/**获取集团列表 */
export const getList =
(current, size, params) => {
return request({
url: '/api/jobslink-api/tenant/companysGroup/list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
/**添加集团 */
export const addCompanysGroup = (groupName) => {
return request({
url: '/api/jobslink-api/tenant/companysGroup/save',
method: 'post',
data: {
groupName
}
})
}
/**修改集团信息 */
export const editGroup = (id,groupName) => {
return request({
url: '/api/jobslink-api/tenant/companysGroup/update',
method: 'post',
data: {
id, groupName
}
})
}
/**获取所有企业列表 */
export const getAllCompanysList =
(current, size, params,platformId) => {
return request({
url: '/api/jobslink-api/tenant/companysGroup/company/search',
method: 'get',
params: {
...params,
current,
size,
platformId
}
})
}
/**获取集团下所属企业列表 */
export const getCompanysList = (current, size, params, platformId) => {
return request({
url: '/api/jobslink-api/tenant/companysGroup/companys/list',
method: 'get',
params: {
...params,
current,
size,
platformId
}
})
}
/**集团添加下属企业--添加关联关系 */
export const addCompanies=(companyIds,platformId,groupName)=>{
return request({
url:'/api/jobslink-api/tenant/companysGroup/companys/add',
method:'get',
params:{
companyIds,platformId,groupName
}
})
}
/**去除关联关系 */
export const removeRelations=(companyIds,platformId)=>{
return request({
url:'/api/jobslink-api/tenant/companysGroup/companys/remove',
method:'get',
params:{
companyIds,platformId
}
})
}
/**将企业设置为集团的主ID */
export const setGroupMainId=(id,companyId)=>{
return request({
url:'/api/jobslink-api/tenant/companysGroup/companys/setMainId',
method:'get',
params:{
id,companyId
}
})
}

View File

@@ -1,253 +0,0 @@
<template>
<el-drawer
title="添加企业"
size="60%"
:visible.sync="visible"
append-to-body
@close="drawerClose"
>
<!--搜索栏-->
<el-form
size="small"
label-position="right"
style="padding-left: 10px; padding-right: 10px"
:inline="true"
>
<el-row :span="24">
<el-form-item>
<el-input
v-model="query.companyName"
placeholder="请输入企业名称"
style="width: 500px"
clearable
>
</el-input>
</el-form-item>
<div class="searchBtn">
<el-button
type="primary"
size="small"
icon="el-icon-search"
@click="searchChange1"
> </el-button
>
<el-button type="primary" size="small" @click="searchReset1"
> </el-button
>
</div>
</el-row>
</el-form>
<!--搜索栏-->
<avue-crud
:option="option"
:data="data"
:page="page"
v-model="form"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@current-change="currentChange"
@size-change="sizeChange"
@selection-change="selectionChange"
@search-change="searchChange"
@search-reset="searchReset"
@refresh-change="refreshChange"
>
<template slot="cityId" slot-scope="{ row }">
<span
>{{ cityId(row.cityId)[0] }}/{{ cityId(row.cityId)[1] }}/{{
cityId(row.cityId)[2]
}}</span
>
</template>
<template slot="menuLeft">
<el-button @click="mutiAdd" type="primary" size="small">
批量添加
</el-button>
</template>
<template slot="menu" slot-scope="{ row }">
<el-button @click="handleAddCmp(row.id)" type="text" size="small">
添加
</el-button>
</template>
</avue-crud>
</el-drawer>
</template>
<script>
import { getAllCompanysList, addCompanies } from "@/api/manage/group";
export default {
props: {
parentData: {
type: Object,
default() {
return [];
},
},
},
data() {
return {
visible: false,
data: [],
selectionList: [],
query: {},
form: {},
plateformID: null,
groupName: "",
option: {
border: true,
index: true,
indexLabel: "序号",
labelWidth: 100,
selection: true,
tip: false,
align: "center",
editBtn: false,
delBtn: false,
addBtn: false,
column: [
{
label: "公司ID",
prop: "id",
display: false,
},
{
label: "企业名称",
prop: "companyName",
searchSpan: 12,
rules: [
{
required: true,
message: "请输入企业名称",
trigger: "blur",
},
],
},
{
label: "地区",
prop: "cityId",
display: false,
slot: true,
},
],
},
page: {
currentPage: 1,
pageSize: 10,
total: 0,
},
};
},
computed: {
ids() {
let ids = [];
this.selectionList.forEach((ele) => {
ids.push(ele.id);
});
return ids.join(",");
},
},
methods: {
cityId(cid) {
const result = ["", "", ""];
if (cid) {
const city = this.$store.getters.getAreaParents(cid);
for (let i = 0; i < city.length; i++) {
const element = city[i];
result[i] = element.label;
}
}
return result;
},
currentChange(current) {
this.page.currentPage = current;
this.onLoad(this.page);
},
sizeChange(size) {
this.page.pageSize = size;
this.onLoad(this.page);
},
refreshChange() {
this.onLoad(this.page);
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
searchReset1() {
this.query = {};
this.onLoad(this.page);
},
searchChange1() {
this.page.currentPage = 1;
this.onLoad(this.page, this.query);
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
show(id, name) {
this.visible = true;
this.plateformID = id;
this.groupName = name;
this.onLoad(this.page);
},
drawerClose() {
this.visible = false;
this.$emit("success");
},
submit() {
this.visible = false;
},
/*添加企业*/
handleAddCmp(cmpid) {
addCompanies(cmpid, this.plateformID, this.groupName).then(() => {
this.$message.success("添加成功");
this.$emit("success");
this.onLoad(this.page);
});
},
/*批量添加企业*/
mutiAdd() {
if (this.ids.length == 0) {
this.$message.closeAll();
this.$message.error("请先选择企业才能批量添加");
} else {
addCompanies(this.ids, this.plateformID, this.groupName).then(() => {
this.$message.success("添加成功");
this.$emit("success");
this.onLoad(this.page);
});
}
},
onLoad(page, params = {}) {
getAllCompanysList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params),
this.plateformID
).then((res) => {
const data = res.data.data;
this.data = data.records;
this.page.total = data.total;
});
},
},
};
</script>
<style scoped>
.searchBtn {
display: inline-block;
margin-bottom: 18px;
}
</style>

View File

@@ -1,63 +0,0 @@
<template>
<el-drawer title="添加集团" size="60%" :visible.sync="visible" append-to-body>
<el-form
:model="groupForm"
:rules="rules"
ref="groupForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="集团名称:" prop="groupName">
<el-input
v-model="groupForm.groupName"
style="width: 400px"
maxlength="40"
show-word-limit
></el-input>
</el-form-item>
</el-form>
<div class="demo-drawer__footer">
<el-button type="primary" @click="submit" size="small" :loading="loading"
>提交</el-button
>
<el-button @click="reset" size="small">重置</el-button>
</div>
</el-drawer>
</template>
<script>
import { addCompanysGroup } from "@/api/manage/group";
export default {
components: {},
data() {
return {
visible: false,
groupForm: {},
rules: {
groupName: [
{ required: true, message: "请输入集团名称", trigger: "blur" },
],
},
};
},
methods: {
open() {
this.visible = true;
this.groupForm = {};
},
submit() {
this.$refs.groupForm.validate((valid) => {
if (valid) {
addCompanysGroup(this.groupForm.groupName).then(() => {
this.$message.success("添加成功");
this.$emit("success");
this.visible = false;
});
}
});
},
reset() {
this.groupForm = {};
},
},
};
</script>

View File

@@ -1,277 +0,0 @@
<template>
<el-drawer
title="集团管理"
size="60%"
:visible.sync="visible"
append-to-body
@close="drawerClose"
>
<avue-crud
:option="option"
:data="data"
:page="page"
v-model="form"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@current-change="currentChange"
@size-change="sizeChange"
@selection-change="selectionChange"
@search-change="searchChange"
@search-reset="searchReset"
@refresh-change="refreshChange"
>
<template slot="areaForm" slot-scope="{ disabled }">
<jl-city-cascader
:disabled="disabled"
v-model="form.area"
></jl-city-cascader>
</template>
<template slot="mainId" slot-scope="{ row }">
<span v-if="row.platformNo == mainId">主ID</span>
<!--当mainId==集团id时为主id-->
<span v-else>副ID</span>
</template>
<template slot="menuLeft">
<el-button @click="handleAddCmp" type="primary" size="small">
添加企业
</el-button>
</template>
<template slot="menu" slot-scope="{ row }">
<el-button
v-if="row.platformNo != mainId"
@click="setMainID(row.platformNo)"
type="text"
size="small"
>
设为主ID
</el-button>
<el-button
@click="removeCompany(row.platformNo)"
type="text"
size="small"
>
移除
</el-button>
</template>
<template slot="cityId" slot-scope="{ row }">
<span
>{{ cityId(row.cityId)[0] }}/{{ cityId(row.cityId)[1] }}/{{
cityId(row.cityId)[2]
}}</span
>
</template>
</avue-crud>
<div class="demo-drawer__footer">
<el-button type="primary" @click="submit" size="small" :loading="loading"
>提交</el-button
>
<el-button @click="reset" size="small">重置</el-button>
</div>
<add-company
ref="addCmp"
@success="success"
:parentData="data"
></add-company>
</el-drawer>
</template>
<script>
import {
getCompanysList,
setGroupMainId,
removeRelations,
} from "@/api/manage/group";
import addCompany from "./addCompany";
export default {
components: {
addCompany,
},
data() {
return {
visible: false,
data: [],
selectionList: [],
query: {},
form: {},
groupId: null, //集团id
plateformId: null, //集团的plateformId
groupName: "", //集团名称
mainId: null, //集团主ID
option: {
border: true,
index: true,
indexLabel: "序号",
labelWidth: 100,
selection: false,
align: "center",
editBtn: false,
delBtn: false,
addBtn: false,
column: [
{
label: "公司ID",
prop: "platformNo",
display: false,
},
{
label: "企业名称",
prop: "name",
searchSpan: 12,
rules: [
{
required: true,
message: "请输入企业名称",
trigger: "blur",
},
],
},
{
label: "地区",
prop: "cityId",
display: false,
slot: true,
},
{
label: "主副ID",
prop: "mainId",
slot: true,
},
],
},
page: {
currentPage: 1,
pageSize: 10,
total: 0,
},
};
},
methods: {
currentChange(current) {
this.page.currentPage = current;
this.onLoad(this.page);
},
sizeChange(size) {
this.page.pageSize = size;
this.onLoad(this.page);
},
refreshChange() {
this.onLoad(this.page);
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
searchReset1() {
this.query = {};
this.onLoad(this.page);
},
searchChange1() {
this.page.currentPage = 1;
this.onLoad(this.page, this.query);
},
show(groupId, plateformId, name, mainId) {
this.visible = true;
this.groupId = groupId;
this.plateformId = plateformId;
this.groupName = name;
this.mainId = mainId;
this.onLoad(this.page);
},
cityId(cid) {
const result = ["", "", ""];
if (cid) {
const city = this.$store.getters.getAreaParents(cid);
for (let i = 0; i < city.length; i++) {
const element = city[i];
result[i] = element.label;
}
}
return result;
},
submit() {
this.visible = false;
this.$emit("success");
},
drawerClose() {
this.visible = false;
this.$emit("success");
},
/*添加企业*/
handleAddCmp() {
this.$refs.addCmp.show(this.plateformId, this.groupName);
},
/*移除企业*/
removeCompany(companyId) {
if (companyId == this.mainId) {
this.$message.closeAll();
this.$message.error("主ID企业不能移除");
} else {
removeRelations(companyId, this.plateformId).then(() => {
this.$message.closeAll();
this.$message.success("移除成功");
this.onLoad(this.page);
});
}
},
/*重置--批量移除企业*/
reset() {
//当列表中有主id企业时要滤出来
let cmpIds = [];
if (this.data.length != 0) {
this.data.forEach((element) => {
if (element.platformNo != this.mainId) {
cmpIds.push(element.platformNo);
}
});
if (cmpIds.length == 0) {
this.$message.closeAll();
this.$message.error("主ID企业不能重置");
} else {
removeRelations(cmpIds.join(","), this.plateformId).then(() => {
this.$message.success("重置成功");
this.onLoad(this.page);
this.page.total = 0;
});
}
} else {
this.$message.error("未添加企业,不能重置");
}
},
setMainID(companyID) {
setGroupMainId(this.groupId, companyID).then(() => {
this.$message.success("设置成功");
this.mainId = companyID; //主id修改成功后把集团的主id修改为所选企业的platformNo
this.onLoad(this.page);
});
},
onLoad(page, params = {}) {
getCompanysList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params),
this.plateformId
).then((res) => {
const data = res.data.data;
this.data = data.records;
this.page.total = data.total;
});
},
success(){
this.onLoad(this.page);
if(this.data.length!=0 &&!this.mainId ){
this.mainId=this.data[0]['platformNo'];
return;
}
}
},
};
</script>

View File

@@ -1,168 +0,0 @@
<template>
<basic-container>
<avue-crud
:option="option"
:data="data"
:page="page"
v-model="form"
@on-load="onLoad"
@row-update="rowUpdate"
@current-change="currentChange"
@size-change="sizeChange"
@selection-change="selectionChange"
@search-change="searchChange"
@search-reset="searchReset"
@refresh-change="refreshChange"
>
<template slot="menuLeft">
<el-button @click="addGroup" type="primary" size="small">
添加集团
</el-button>
</template>
<template slot="menu" slot-scope="{ row }">
<el-button
@click="
showCmpList(row.id, row.platformId, row.groupName, row.mainId)
"
type="text"
size="small"
>
添加企业
</el-button>
</template>
<template slot="platformUrl" slot-scope="{ row }">
<a class="download" :href="row.platformUrl" target="blank">{{
row.platformUrl
}}</a>
</template>
</avue-crud>
<add-group ref="addJT" @success="refreshChange"></add-group>
<cmp-list ref="cmpList" @success="refreshChange"></cmp-list
><!--展示集团下所属企业列表-->
</basic-container>
</template>
<script>
import addGroup from "./Dialog/addGroup";
import cmpList from "./Dialog/cmpList";
import { getList, editGroup } from "@/api/manage/group";
export default {
components: {
addGroup,
cmpList,
},
name: "groupList",
data() {
return {
data: [],
selectionList: [],
query: {},
form: {},
option: {
border: true,
index: true,
indexLabel: "序号",
labelWidth: 100,
selection: false,
align: "center",
editBtn: true,
editBtnText: "修改",
delBtn: false,
addBtn: false,
//addBtnText:'新增集团',
column: [
{
label: "集团编号",
prop: "id",
display: false,
},
{
label: "集团名称",
prop: "groupName",
rules: [
{
required: true,
message: "请输入集团名称",
trigger: "blur",
},
],
maxlength:40,
showWordLimit:true
},
{
label: "下属企业",
prop: "companyCount",
display: false,
},
{
label: "数据参数",
prop: "platformId",
rules: [
{
required: true,
message: "请输入数据参数",
trigger: "blur",
},
],
editDisabled: true,
},
{
label: "URL",
prop: "platformUrl",
slot: true,
editDisabled: true,
},
],
},
page: {
currentPage: 1,
pageSize: 10,
total: 0,
},
};
},
methods: {
refreshChange() {
this.onLoad(this.page);
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
toURL(url) {
window.open(url);
},
showCmpList(groupId, plateformId, name, mainId) {
this.$refs.cmpList.show(groupId, plateformId, name, mainId);
},
addGroup() {
this.$refs.addJT.open();
},
rowUpdate(row, index, done) {
editGroup(row.id, row.groupName).then(() => {
this.$message.success("修改成功");
done();
this.onLoad(this.page);
});
},
onLoad(page, params = {}) {
getList(
page.currentPage,
page.pageSize,
Object.assign(this.query, params)
).then((res) => {
const data = res.data.data;
this.data = data.records;
this.page.total = data.total;
});
},
},
};
</script>
<style scoped>
.download {
cursor: pointer;
color: cornflowerblue;
}
</style>