Browse Source

feat: 企业细节逻辑调整

main
xuziqiang 6 months ago
parent
commit
819a00f733
  1. 1
      hx-op/src/api/origanizemanage.ts
  2. 28
      hx-op/src/view/organizationManage/enterpriseManage/TreeAdd.vue
  3. 18
      hx-op/src/view/organizationManage/enterpriseManage/config.ts
  4. 84
      hx-op/src/view/organizationManage/enterpriseManage/index.vue
  5. 4
      lib/util/http/axios.ts

1
hx-op/src/api/origanizemanage.ts

@ -15,4 +15,5 @@ export enum enterPrise {
queryOrgPermission = `${BASE_URL}/admin/org/QueryOrgPermission`,
queryOrgTree = `${BASE_URL}/admin/org/QueryLinkOrgTree`,
resetPwd = `${BASE_URL}/api/user/resetPwd`,
delLink = `${BASE_URL}/admin/org/delLink`,
}

28
hx-op/src/view/organizationManage/enterpriseManage/TreeAdd.vue

@ -1,22 +1,35 @@
<template>
<a-modal title="企业信息" :width="500" v-model:visible="visible" @ok="handleOk">
<a-modal title="企业信息" :width="500" destroyOnClose v-model:visible="visible" @ok="handleOk">
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" />
</a-modal>
</template>
<script lang="ts">
import { defineComponent, reactive, ref } from 'vue';
import { defineComponent, reactive, ref, watch } from 'vue';
import { enterPrise } from '/@/api/origanizemanage';
export default defineComponent({
name: 'AddBorderVisible',
props: { info: Object },
emits: ['ok'],
setup(props, { emit }) {
setup(props, { attrs, emit }) {
let formData = ref({});
const formRef = ref();
const visible = ref(false);
const toggle = () => {
formData.value = {};
visible.value = !visible.value;
};
const currentOrgId = ref();
console.log(attrs, 'attrs');
watch(
() => props.info,
() => {
console.log(props.info, 'sdfasdf');
currentOrgId.value = props.info?.orgId;
},
{ deep: true, immediate: true },
);
const formSchema = reactive([
{
field: 'orgId',
@ -35,12 +48,18 @@
labelField: 'orgName',
valueField: 'orgId',
immediate: true,
filterData: (item) => {
return item.orgId !== currentOrgId.value;
},
showSearch: true,
filterOption: (input: string, option: any) => {
return option.orgName.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
placeholder: '请选择',
},
rules: [
{
required: true,
trigger: 'blur',
},
],
},
@ -60,7 +79,6 @@
required: true,
message: '请选择是否分享',
type: 'number',
trigger: 'blur',
},
],
},

18
hx-op/src/view/organizationManage/enterpriseManage/config.ts

@ -251,6 +251,7 @@ export const tableConfig = ({
columnActions: {
title: '操作',
autoMergeAction: false,
actionNumber: 1,
actions: [
{
label: '编辑',
@ -352,24 +353,25 @@ export const tableConfig = ({
options: [
{
label: '正常',
value: 1,
value: 'NORMAL',
},
{
label: '冻结',
value: 2,
value: 'FREEZE',
},
],
},
},
{
field: 'cityName',
label: '城市地区',
component: 'NsInputCity',
defaultValue: '',
fieldMap: ['provinceName', 'cityName', 'areaName', 'province', 'city', 'area'],
label: '省市区',
component: 'NsCascader',
fieldMap: ['province', 'city', 'county'],
componentProps: {
api: '/api/parking_merchant/objs/BaseArea',
isSeparate: true,
placeholder: '请选择',
api: enterPrise.getArea,
fieldNames: { label: 'regionName', value: 'regionName' },
showSearch: true,
},
},
],

84
hx-op/src/view/organizationManage/enterpriseManage/index.vue

@ -10,18 +10,18 @@
</template>
</ns-drawer>
<ns-drawer v-bind="boundaryDrawer">
<ns-button type="primary" @click="borderAdd">新增</ns-button>
<ns-button type="primary" style="margin-left: 10px; margin-bottom: 10px" @click="borderAdd"
<ns-button type="primary" @click="borderAdd('2')">新增</ns-button>
<ns-button type="primary" style="margin-left: 10px; margin-bottom: 10px" @click="borderAdd('1')"
>新增子集</ns-button
>
<a-tree v-if="linkTree?.length" v-bind="boundaryTree" class="boundaryTree">
<template #title="data">
<span>{{ data.orgInfo.orgName }}</span>
<!-- <ns-button type="link" danger >删除</ns-button> -->
<span v-if="data.orgInfo.orgId !== currentBoundaryRecord.orgId" class="nodeDelete">
<DeleteOutlined @click="deleteTree(data)"
/></span>
<div class="node">
<span>{{ data.orgInfo.orgName }}</span>
<span v-if="data.orgInfo.orgId !== currentBoundaryRecord.orgId">
<DeleteOutlined class="nodeDelete" @click="deleteTree(data)" />
</span>
</div>
</template>
</a-tree>
</ns-drawer>
@ -35,7 +35,7 @@
<a-tree v-if="treeData?.length" v-model:checkedKeys="checkedKeys" v-bind="serverTree" />
</ns-drawer>
<TreeAdd ref="treeAdd" @ok="handleOk" />
<TreeAdd ref="treeAdd" @ok="handleOk" :info="currentBoundaryRecord" />
</template>
<script lang="ts" setup>
import { Modal } from 'ant-design-vue';
@ -47,7 +47,7 @@
import { h } from 'vue';
import { formConfig } from './config';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { mockData, treeData } from './mock';
// import { mockData, treeData } from './mock';
import { enterPrise } from '/@/api/origanizemanage';
import { tableConfig as insertConfig } from './config';
defineOptions({
@ -70,6 +70,8 @@
const currentBoundaryRecord = ref({});
const currentSelectBoundaryNode = ref({});
const linkTree = ref([]);
const treeData = ref([]);
const addType = ref(); //1 2
const totalCheckedKeys = ref([]);
const opType = ref<string>('add');
const calMap = {
@ -159,6 +161,7 @@
};
fetch(params, false);
};
const ServiceSelect = (selectedKeys: any, info: any) => {
console.log(selectedKeys, 'selectedKeys');
console.log(info, 'info');
@ -223,7 +226,7 @@
// drawer
const boundaryDrawer = ref({
width: 520,
width: 420,
visible: borderVisible,
footerStyle: { textAlign: 'right' },
destroyOnClose: true,
@ -252,7 +255,8 @@
defaultExpandAll: true,
onSelect: handleSelect,
treeData: linkTree,
// blockNode: true,
blockNode: true,
// selectable: false,
});
//
@ -263,7 +267,7 @@
{
linkOrgId: res.orgId,
point: res.point,
type: 1, //1 2
type: addType.value, //1 2
},
],
@ -278,7 +282,9 @@
});
});
};
const borderAdd = () => {
const borderAdd = (type) => {
addType.value = type;
treeAddVisible.value = true;
treeAdd.value?.toggle();
};
@ -294,7 +300,18 @@
const deleteTree = (node: any) => {
console.log(node, 'node');
const { orgId, point, type } = node.data?.orgInfo;
const params = {
linkOrgVoList: [
{
linkOrgId: orgId,
point,
type,
},
],
orgId: currentBoundaryRecord.value.orgId || '',
};
NsModal.confirm({
title: '是否确定删除',
content: createVNode('div', { style: 'color:red;' }, ''),
@ -305,18 +322,13 @@
NsMessage.error('请先删除子集');
return;
}
// http
// .post('/api/parking_merchant/objs/gateInfo/delete', {
// uuid: record.uuid,
// })
// .then((res) => {
// mainRef.value.nsTableRef.reload();
// });
},
onCancel() {
console.log('Cancel');
http.post(enterPrise.delLink, params).then((res) => {
getBoundaryTree({
orgId: currentBoundaryRecord.value.orgId,
orgName: currentBoundaryRecord.value.orgName,
});
});
},
class: 'test',
});
};
@ -326,19 +338,19 @@
</script>
<style lang="less" scoped>
.nodeDelete {
// display: none;
margin-left: 40px;
margin-right: 16px;
display: none;
}
.boundaryTree {
background-color: red !important;
.node {
display: flex;
justify-content: space-between;
align-items: center;
}
:deep(.ant-tree) {
background-color: red !important;
// &:hover {
.nodeDelete {
display: block;
.node {
&:hover {
.nodeDelete {
display: block !important;
}
}
// }
}
</style>

4
lib/util/http/axios.ts

@ -75,10 +75,10 @@ export class NSAxios {
return config;
}, undefined);
const errCodeMap = new Map([
const errCodeMap = new Map<number, any>([
[13, ''],
[1, ''],
[3005, () => routerConfig.logout()],
[10086, () => routerConfig.logout()],
]);
// type closeType = (() => void) | undefined;

Loading…
Cancel
Save