Преглед изворни кода

组织架构模块,工厂模块

asd26269546 пре 1 година
родитељ
комит
4635535f6f

+ 37 - 0
src/router/index.js

@@ -86,6 +86,43 @@ const routes = [{
 				name: '多公司配置新增',
 				component: () => import('../views/commonModule/multiCompanyConfig/add.vue')
 			},
+			//生产管理模块
+			{
+				path: 'workshop',
+				name: '车间配置',
+				component: () => import('../views/production/workshop/index.vue')
+			},
+			{
+				path: 'workshopAdd',
+				name: '车间配置新增',
+				component: () => import('../views/production/workshop/add.vue')
+			},
+			{
+				path: 'factory',
+				name: '产线配置',
+				component: () => import('../views/production/factory/index.vue')
+			},
+			{
+				path: 'factoryAdd',
+				name: '产线配置新增',
+				component: () => import('../views/production/factory/add.vue')
+			},
+			//系统管理
+			{
+				path: 'dept',
+				name: '组织架构',
+				component: () => import('../views/system/dept/index.vue')
+			},
+			{
+				path: 'deptAdd',
+				name: '组织架构新增',
+				component: () => import('../views/system/dept/add.vue')
+			},
+			{
+				path: 'deptEdit',
+				name: '组织架构编辑',
+				component: () => import('../views/system/dept/edit.vue')
+			},
 			{
 				path: 'xiamenList',
 				name: '发酵机列表',

+ 1 - 1
src/utils/ruoyi.js

@@ -249,4 +249,4 @@ export async function blobValidate(data) {
   } catch (error) {
     return true;
   }
-}
+}

+ 178 - 0
src/views/production/factory/add.vue

@@ -0,0 +1,178 @@
+<template>
+	<div class="form">
+		<van-nav-bar
+			title="产线配置"
+			left-text="返回"
+			left-arrow
+			@click-left="onClickLeft"
+		>
+		</van-nav-bar>
+
+		<testForm
+			v-model="formData.data"
+			:formOption="formOption"
+			:formConfig="formConfig"
+			:rules="rules"
+			@onSubmit="onSubmit"
+			ref="formDom"
+		></testForm>
+	</div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
+import { showSuccessToast, showToast } from 'vant'
+import { useRoute } from 'vue-router'
+import { getUserInfo } from '@/utils/auth'
+import testForm from '@/components/testForm/index.vue'
+const proxy = getCurrentInstance().proxy
+const route = useRoute()
+const show = ref(false)
+const typeModal = ref(false)
+const unitModal = ref(false)
+const classification = ref([])
+const formData = reactive({
+	data: {},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = reactive([
+	{
+		type: 'picker',
+		label: '车间名称',
+		prop: 'workshopId',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'name',
+			value: 'id',
+		},
+		data: [],
+	},
+	{
+		type: 'picker',
+		label: '产线类型',
+		prop: 'type',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'label',
+			value: 'value',
+		},
+		data: [
+			{
+				label: '普通产线',
+				value: '1',
+			},
+			{
+				label: '半自动化产线',
+				value: '2',
+			},
+			{
+				label: '自动化产线',
+				value: '3',
+			},
+		],
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '产线名称',
+		prop: 'name',
+		clearable: true,
+	},
+	{
+		type: 'picker',
+		label: '负责人',
+		prop: 'personLiableId',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'nickName',
+			value: 'userId',
+		},
+		data: [],
+	},
+	// {
+	// 	type: 'upload',
+	// 	label: '文件上传',
+	// 	prop: 'fileList',
+	// },
+	{
+		type: 'input',
+		itemType: 'textarea',
+		label: '产线说明',
+		prop: 'remark',
+	},
+])
+const rules = {
+	type: [{ required: true, message: '产线类型不能为空' }],
+	name: [{ required: true, message: '产线名称不能为空' }],
+	workshopId: [{ required: true, message: '车间名称不能为空' }],
+}
+const unitList = ref([])
+
+const getUserList = () => {
+    proxy
+        .get('/system/user/list?pageNum=1&pageSize=10000', {
+        })
+        .then((res) => {
+            formConfig[3].data = res.rows
+        })
+}
+const getWorkshopList = () => {
+    proxy
+        .post('/workshop/page', {
+			pageNum: 1,
+			pageSize: 10000,
+        })
+        .then((res) => {
+            formConfig[0].data = res.data.rows
+        })
+}
+getUserList()
+getWorkshopList()
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	console.log(formData)
+
+	proxy.post('/assemblyLine/' + route.query.type, formData.data).then(() => {
+		showSuccessToast('添加成功')
+		setTimeout(() => {
+			history.back()
+		}, 500)
+	})
+}
+const treeToList = (arr) => {
+	let res = [] // 用于存储递归结果(扁平数据)
+	// 递归函数
+	let fn = (source) => {
+		source.forEach((el) => {
+			res.push(el)
+			el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
+		})
+	}
+	fn(arr)
+	return res
+}
+onMounted(() => {
+	if (route.query.id) {
+        proxy
+            .post('/workshop/detail', { id: route.query.id })
+            .then((resDetail) => {
+                formData.data = resDetail.data
+            })
+    }
+})
+</script>

+ 150 - 0
src/views/production/factory/index.vue

@@ -0,0 +1,150 @@
+<template>
+	<van-nav-bar
+		title="产线配置"
+		left-text=""
+		left-arrow
+		@click-left="onClickLeft"
+		@click-right="onClickRight"
+	>
+		<template #right> 添加 </template>
+	</van-nav-bar>
+	<van-search
+		v-model="req.keyword"
+		placeholder="请输入搜索关键词"
+		@search="onRefresh"
+	/>
+	<van-pull-refresh v-model="loading" @refresh="onRefresh">
+		<div class="list">
+			<van-list
+				v-model:loading="loading"
+				:finished="finished"
+				finished-text="没有更多了"
+				@load="onLoad"
+				style="margin-bottom: 60px"
+			>
+				<commonList
+					:data="listData"
+					@onClick="toDtl"
+					:config="listConfig"
+				></commonList>
+			</van-list>
+		</div>
+	</van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from 'vue'
+import commonList from '@/components/common-list.vue'
+import { useRoute } from 'vue-router'
+
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum: 1,
+	keyword: null,
+	definition: '1',
+})
+const finished = ref(false)
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+const listConfig = ref([
+	{
+		label: '产线名称',
+		prop: 'name',
+	},
+	{
+		label: '负责人名称',
+		prop: 'personLiableName',
+	},
+	{
+		label: '产线类型',
+		prop: 'typeName',
+	},
+])
+//车间类型
+const typeList = ref([
+	{
+		label: '普通产线',
+		value: '1',
+	},
+	{
+		label: '半自动化产线',
+		value: '2',
+	},
+	{
+		label: '自动化产线',
+		value: '3',
+	},
+])
+const onRefresh = () => {
+	req.value.pageNum = 1
+	finished.value = false
+	getList('refresh')
+}
+const onLoad = () => {
+	
+}
+const onClickLeft = () => proxy.$router.push('/main/working')
+const onClickRight = () => {
+	proxy.$router.push({
+		path: 'factoryAdd',
+		query: {
+			type: 'add',
+		},
+	})
+}
+const toDtl = (row) => {
+	proxy.$router.push({
+		path: 'factoryAdd',
+		query: {
+			id: row.id,
+			type: 'edit',
+		},
+	})
+}
+const treeToList = (arr) => {
+	let res = [] // 用于存储递归结果(扁平数据)
+	// 递归函数
+	let fn = (source) => {
+		source.forEach((el) => {
+			res.push(el)
+			el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
+		})
+	}
+	fn(arr)
+	return res
+}
+const getList = (type) => {
+	loading.value = true
+	proxy
+		.post('/assemblyLine/page', req.value)
+		.then((res) => {
+			listData.value =
+				type === 'refresh'
+					? res.data.rows
+					: listData.value.concat(res.data.rows)
+			if (req.value.pageNum * 10 >= res.data.total) {
+				finished.value = true
+			}
+			req.value.pageNum++
+			loading.value = false
+			listData.value = res.data.rows.map((item) => {
+				return {
+					...item,
+					typeName: typeList.value.find((v) => v.value == item.type)
+						.label,
+				}
+			})
+			console.log(listData.value)
+		})
+		.catch((err) => {
+			loading.value = false
+		})
+}
+getList()
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+</style>

+ 155 - 0
src/views/production/workshop/add.vue

@@ -0,0 +1,155 @@
+<template>
+	<div class="form">
+		<van-nav-bar
+			title="车间配置"
+			left-text="返回"
+			left-arrow
+			@click-left="onClickLeft"
+		>
+		</van-nav-bar>
+
+		<testForm
+			v-model="formData.data"
+			:formOption="formOption"
+			:formConfig="formConfig"
+			:rules="rules"
+			@onSubmit="onSubmit"
+			ref="formDom"
+		></testForm>
+	</div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
+import { showSuccessToast, showToast } from 'vant'
+import { useRoute } from 'vue-router'
+import { getUserInfo } from '@/utils/auth'
+import testForm from '@/components/testForm/index.vue'
+const proxy = getCurrentInstance().proxy
+const route = useRoute()
+const show = ref(false)
+const typeModal = ref(false)
+const unitModal = ref(false)
+const classification = ref([])
+const formData = reactive({
+	data: {},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = reactive([
+	{
+		type: 'picker',
+		label: '车间类型',
+		prop: 'type',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'label',
+			value: 'value',
+		},
+		data: [
+			{
+                label: '普通车间',
+                value: 1,
+            },
+            {
+                label: '半自动化车间',
+                value: 2,
+            },
+            {
+                label: '自动化车间',
+                value: 3,
+            },
+		],
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '车间名称',
+		prop: 'name',
+		clearable: true,
+	},
+	{
+		type: 'picker',
+		label: '负责人',
+		prop: 'personLiableId',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'nickName',
+			value: 'userId',
+		},
+		data: [],
+	},
+	// {
+	// 	type: 'upload',
+	// 	label: '文件上传',
+	// 	prop: 'fileList',
+	// },
+	{
+		type: 'input',
+		itemType: 'textarea',
+		label: '备注',
+		prop: 'remark',
+	},
+])
+const rules = {
+	type: [{ required: true, message: '车间类型不能为空' }],
+	name: [{ required: true, message: '车间名称不能为空' }],
+	personLiableId: [{ required: true, message: '负责人不能为空' }],
+}
+const unitList = ref([])
+
+const getUserList = () => {
+    proxy
+        .get('/system/user/list?pageNum=1&pageSize=10000', {
+        })
+        .then((res) => {
+            formConfig[2].data = res.rows
+        })
+}
+getUserList()
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	console.log(formData)
+
+	proxy.post('/workshop/' + route.query.type, formData.data).then(() => {
+		showSuccessToast('添加成功')
+		setTimeout(() => {
+			history.back()
+		}, 500)
+	})
+}
+const treeToList = (arr) => {
+	let res = [] // 用于存储递归结果(扁平数据)
+	// 递归函数
+	let fn = (source) => {
+		source.forEach((el) => {
+			res.push(el)
+			el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
+		})
+	}
+	fn(arr)
+	return res
+}
+onMounted(() => {
+	if (route.query.id) {
+        proxy
+            .post('/workshop/detail', { id: route.query.id })
+            .then((resDetail) => {
+                formData.data = resDetail.data
+            })
+    }
+})
+</script>

+ 166 - 0
src/views/production/workshop/index.vue

@@ -0,0 +1,166 @@
+<template>
+	<van-nav-bar
+		title="车间配置"
+		left-text=""
+		left-arrow
+		@click-left="onClickLeft"
+		@click-right="onClickRight"
+	>
+		<template #right> 添加 </template>
+	</van-nav-bar>
+	<van-search
+		v-model="req.keyword"
+		placeholder="请输入搜索关键词"
+		@search="onRefresh"
+	/>
+	<van-pull-refresh v-model="loading" @refresh="onRefresh">
+		<div class="list">
+			<van-list
+				v-model:loading="loading"
+				:finished="finished"
+				finished-text="没有更多了"
+				@load="onLoad"
+				style="margin-bottom: 60px"
+			>
+				<commonList
+					:data="listData"
+					@onClick="toDtl"
+					:config="listConfig"
+				></commonList>
+			</van-list>
+		</div>
+	</van-pull-refresh>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from 'vue'
+import commonList from '@/components/common-list.vue'
+import { useRoute } from 'vue-router'
+
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum: 1,
+	keyword: null,
+	definition: '1',
+})
+const finished = ref(false)
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+const classification = ref([])
+const listConfig = ref([
+	{
+		label: '车间名称',
+		prop: 'name',
+	},
+	{
+		label: '负责人名称',
+		prop: 'personLiableName',
+	},
+	{
+		label: '车间类型',
+		prop: 'typeName',
+	},
+])
+//车间类型
+const typeList = ref([
+	{
+		label: '普通车间',
+		value: '1',
+	},
+	{
+		label: '半自动化车间',
+		value: '2',
+	},
+	{
+		label: '自动化车间',
+		value: '3',
+	},
+])
+const onRefresh = () => {
+	req.value.pageNum = 1
+	finished.value = false
+	getList('refresh')
+}
+const onLoad = () => {
+	getClassification()
+}
+const onClickLeft = () => proxy.$router.push('/main/working')
+const onClickRight = () => {
+	proxy.$router.push({
+		path: 'workshopAdd',
+		query: {
+			type: 'add',
+		},
+	})
+}
+const toDtl = (row) => {
+	proxy.$router.push({
+		path: 'workshopAdd',
+		query: {
+			id: row.id,
+			type: 'edit',
+		},
+	})
+}
+const treeToList = (arr) => {
+	let res = [] // 用于存储递归结果(扁平数据)
+	// 递归函数
+	let fn = (source) => {
+		source.forEach((el) => {
+			res.push(el)
+			el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
+		})
+	}
+	fn(arr)
+	return res
+}
+const getClassification = () => {
+	if (classification.value && classification.value.length > 0) {
+		getList()
+	} else {
+		proxy
+			.post('/productClassify/tree', {
+				parentId: '',
+				name: '',
+				definition: '1',
+			})
+			.then((res) => {
+				classification.value = treeToList(res.data)
+				getList()
+			})
+	}
+}
+const getList = (type) => {
+	loading.value = true
+	proxy
+		.post('/workshop/page', req.value)
+		.then((res) => {
+			
+			listData.value =
+				type === 'refresh'
+					? res.data.rows
+					: listData.value.concat(res.data.rows)
+			if (req.value.pageNum * 10 >= res.data.total) {
+				finished.value = true
+			}
+			req.value.pageNum++
+			loading.value = false
+            listData.value = res.data.rows.map((item) => {
+				return {
+					...item,
+					typeName: typeList.value.find((v) => v.value == item.type)
+                        .label,
+				}
+			})
+		})
+		.catch((err) => {
+			loading.value = false
+		})
+}
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+</style>

+ 231 - 0
src/views/system/dept/add.vue

@@ -0,0 +1,231 @@
+<template>
+	<div class="form">
+		<van-nav-bar
+			title="添加机构"
+			left-text="返回"
+			left-arrow
+			@click-left="onClickLeft"
+		>
+		</van-nav-bar>
+
+		<testForm
+			v-model="formData.data"
+			:formOption="formOption"
+			:formConfig="formConfig"
+			:rules="rules"
+			@onSubmit="onSubmit"
+			ref="formDom"
+		></testForm>
+	</div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from 'vue'
+import { showSuccessToast, showToast } from 'vant'
+import { useRoute } from 'vue-router'
+import { getUserInfo } from '@/utils/auth'
+import testForm from '@/components/testForm/index.vue'
+import { handleTree } from '@/utils/ruoyi'
+const proxy = getCurrentInstance().proxy
+const route = useRoute()
+const show = ref(false)
+const typeModal = ref(false)
+const unitModal = ref(false)
+const classification = ref([])
+const formData = reactive({
+	data: {},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = reactive([
+	{
+		type: 'cascader',
+		label: '上级机构',
+		prop: 'parentId',
+		itemType: 'common',
+		showPicker: false,
+		data: [],
+		fieldNames: {
+			text: 'deptName',
+			value: 'deptId',
+			children: 'children',
+		},
+	},
+	// {
+	// 	type: 'input',
+	// 	label: '上级机构',
+	// 	prop: 'tenantName',
+	// 	itemType: 'text',
+	// 	showPicker: false,
+	// 	readonly: true,
+	// },
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '机构名称',
+		prop: 'deptName',
+		clearable: true,
+	},
+	{
+		type: 'picker',
+		label: '机构类型',
+		prop: 'type',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'label',
+			value: 'value',
+		},
+		data: [
+			{
+				label: '公司',
+				value: '0',
+			},
+			{
+				label: '业务中心',
+				value: '1',
+			},
+			{
+				label: '部门',
+				value: '2',
+			},
+			{
+				label: '组',
+				value: '3',
+			},
+		],
+	},
+
+	{
+		type: 'picker',
+		label: '负责人',
+		prop: 'leaderId',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'nickName',
+			value: 'userId',
+		},
+		data: [],
+	},
+	{
+		type: 'picker',
+		label: '总监',
+		prop: 'directorId',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'nickName',
+			value: 'userId',
+		},
+		data: [],
+	},
+	{
+		type: 'input',
+		itemType: 'digit',
+		label: '部门排序',
+		prop: 'orderNum',
+	},
+])
+const rules = {
+	deptName: [{ required: true, message: '机构名称不能为空' }],
+	type: [{ required: true, message: '机构类型不能为空' }],
+	orderNum: [{ required: true, message: '部门排序不能为空' }],
+    parentId: [{ required: true, message: '上级机构不能为空' }],
+}
+const unitList = ref([])
+
+const getUserList = () => {
+	proxy
+		.get('/tenantUser/list', {
+			pageNum: 1,
+			pageSize: 10000,
+			tenantId: getUserInfo().tenantId,
+		})
+		.then((message) => {
+			message.rows.map((item) => {
+				item.label = item.nickName
+				item.id = item.userId
+			})
+			formConfig[3].data = message.rows
+			formConfig[4].data = message.rows
+		})
+}
+const getWorkshopList = () => {
+	proxy
+		.post('/workshop/page', {
+			pageNum: 1,
+			pageSize: 10000,
+		})
+		.then((res) => {
+			formConfig[0].data = res.data.rows
+		})
+}
+getUserList()
+getWorkshopList()
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	console.log(formData)
+    formData.data.children = []
+	formData.data.orderNum = Number(formData.data.orderNum)
+	proxy.post('/tenantDept', formData.data,route.query.id ? 'PUT' : 'post').then(() => {
+		showSuccessToast(route.query.id ? '修改成功' : '添加成功')
+		setTimeout(() => {
+			history.back()
+		}, 500)
+	})
+}
+const treeToList = (arr) => {
+	let res = [] // 用于存储递归结果(扁平数据)
+	// 递归函数
+	let fn = (source) => {
+		source.forEach((el) => {
+			res.push(el)
+			el.children && el.children.length > 0 ? fn(el.children) : '' // 子级递归
+		})
+	}
+	fn(arr)
+	return res
+}
+
+const getTree = () => {
+    proxy
+		.get('/tenantDept/list', { tenantId: getUserInfo().tenantId })
+		.then((res) => {
+            res.data = res.data.map(item=>{
+                return {
+                    label:item.deptName,
+                    id:item.deptId,
+                    ...item
+                }
+            })
+            formConfig[0].data = handleTree(res.data, 'deptId')
+            console.log(formConfig[0].data,123891723981273)
+            
+			
+		})
+		.catch((err) => {
+			
+		})
+}
+getTree()
+onMounted(() => {
+	if (route.query.id) {
+        console.log(route.query)
+        formData.data = route.query
+	} else {
+		formData.data.tenantId = route.query.tenantId
+	}
+})
+</script>

+ 44 - 0
src/views/system/dept/edit.vue

@@ -0,0 +1,44 @@
+<template>
+    <div class="form">
+      <van-nav-bar title="组织架构编辑" left-text="返回" left-arrow @click-left="onClickLeft"> </van-nav-bar>
+      <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
+        <van-cell-group inset>
+          <van-field
+            v-model="formData.name"
+            name="节点名称"
+            label="节点名称"
+            placeholder="请填写节点名称"
+            :rules="[{ required: true, message: '节点名称不能为空' }]"
+            required />
+        </van-cell-group>
+        <div style="margin: 16px">
+          <van-button round block type="primary" native-type="submit"> 提交 </van-button>
+        </div>
+      </van-form>
+    </div>
+  </template>
+  
+  <script setup>
+  import { ref, getCurrentInstance } from "vue";
+  import { showSuccessToast } from "vant";
+  import { useRoute } from "vue-router";
+  const proxy = getCurrentInstance().proxy;
+  const route = useRoute();
+  const formData = ref({ name: route.query.name });
+  const onClickLeft = () => history.back();
+  const onSubmit = () => {
+    proxy
+      .post("/productClassify/edit", {
+        name: formData.value.name,
+        id: route.query.id,
+        definition: "1",
+      })
+      .then(() => {
+        showSuccessToast("编辑成功");
+        setTimeout(() => {
+          history.back();
+        }, 500);
+      });
+  };
+  </script>
+  

+ 143 - 0
src/views/system/dept/index.vue

@@ -0,0 +1,143 @@
+<template>
+	<div style="padding-bottom: 60px">
+		<van-nav-bar
+			title="组织架构"
+			left-text=""
+			left-arrow
+			@click-left="onClickLeft"
+		>
+		</van-nav-bar>
+		<van-pull-refresh v-model="loading" @refresh="onRefresh">
+			<div class="list">
+				<van-list
+					v-model:loading="loading"
+					:finished="finished"
+					finished-text=""
+					@load="onLoad"
+					style="margin-bottom: 60px"
+				>
+					<commonList :data="[]" :config="listConfig"> </commonList>
+					<treeNav
+						:tree-data="listData"
+						@clickAdd="(item) => clickAdd(item)"
+						@clickUpdate="(item) => clickUpdate(item)"
+						@clickDelete="(item) => clickDelete(item)"
+					>
+					</treeNav>
+					<div style="margin: 16px">
+						<van-button
+							round
+							block
+							type="primary"
+							@click="clickAdd({ id: '' })"
+							>添加一级节点</van-button
+						>
+					</div>
+				</van-list>
+			</div>
+		</van-pull-refresh>
+	</div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from 'vue'
+import commonList from '@/components/common-list.vue'
+import treeNav from '@/components/tree-nav.vue'
+import { useRoute } from 'vue-router'
+import { showConfirmDialog } from 'vant'
+import { showSuccessToast } from 'vant'
+import { getUserInfo } from '@/utils/auth'
+import { handleTree } from '@/utils/ruoyi'
+
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum: 1,
+	type: '1',
+	keyword: null,
+})
+const finished = ref(false)
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+const listConfig = ref([
+	{
+		label: '',
+		prop: 'label',
+	},
+])
+const onRefresh = () => {
+	finished.value = false
+	getList('refresh')
+}
+const onClickLeft = () => proxy.$router.push('/main/working')
+const getList = (type) => {
+	loading.value = true
+	proxy
+		.get('/tenantDept/list', { tenantId: getUserInfo().tenantId })
+		.then((res) => {
+            res.data = res.data.map(item=>{
+                return {
+                    label:item.deptName,
+                    id:item.deptId,
+                    ...item
+                }
+            })
+            
+			listData.value = handleTree(res.data, 'deptId')
+			finished.value = true
+			loading.value = false
+		})
+		.catch((err) => {
+			loading.value = false
+		})
+}
+getList()
+const clickAdd = (row) => {
+	proxy.$router.push({
+		path: '/main/deptAdd',
+		query: {
+			tenantId: getUserInfo().tenantId,
+            id:'',
+            type:'add',
+		},
+	})
+}
+const clickUpdate = (row) => {
+	proxy.$router.push({
+		path: '/main/deptAdd',
+		query: {
+			...row,
+            submitType:'update',
+		},
+	})
+}
+const clickDelete = (row) => {
+	showConfirmDialog({
+		title: '标题',
+		message: '是否确认删除该分类',
+	})
+		.then(() => {
+			proxy
+				.post('/tenantDept/' + row.deptId, {
+					id: row.deptId,
+				},'DELETE')
+				.then((res) => {
+					showSuccessToast('删除成功')
+					getList()
+				})
+		})
+		.catch(() => {
+			// on cancel
+		})
+}
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+::v-deep {
+	.van-collapse-item__content {
+		padding: 8px 0 8px 8px !important;
+	}
+}
+</style>