Browse Source

Merge branch 'master' of http://36.137.93.232:3000/hf/byte-sailing-mobile

cz 1 year ago
parent
commit
079cce6336

+ 41 - 5
src/router/index.js

@@ -80,6 +80,16 @@ const routes = [{
 			},
 			//公共模块
 			{
+				path: 'contractTemplateAdd',
+				name: '销售合同模板新增',
+				component: () => import('../views/commonModule/contractTemplate/add.vue')
+			},
+			{
+				path: 'contractTemplate',
+				name: '销售合同模板',
+				component: () => import('../views/commonModule/contractTemplate/index.vue')
+			},
+			{
 				path: 'multiCompanyConfig',
 				name: '多公司配置',
 				component: () => import('../views/commonModule/multiCompanyConfig/index.vue')
@@ -112,6 +122,36 @@ const routes = [{
 			},
 			//系统管理
 			{
+				path: 'tenantDict',
+				name: '租户字典',
+				component: () => import('../views/system/dict/tenantDict.vue')
+			},
+			{
+				path: 'tenantAdd',
+				name: '租户字典新增',
+				component: () => import('../views/system/dict/tenantAdd.vue')
+			},
+			{
+				path: 'businessDict',
+				name: '业务字典',
+				component: () => import('../views/system/dict/businessDict.vue')
+			},
+			{
+				path: 'businessAdd',
+				name: '业务字典新增',
+				component: () => import('../views/system/dict/businessAdd.vue')
+			},
+			{
+				path: 'user',
+				name: '用户管理',
+				component: () => import('../views/system/user/index.vue')
+			},
+			{
+				path: 'userAdd',
+				name: '用户管理新增',
+				component: () => import('../views/system/user/add.vue')
+			},
+			{
 				path: 'dept',
 				name: '组织架构',
 				component: () => import('../views/system/dept/index.vue')
@@ -121,11 +161,7 @@ const routes = [{
 				name: '组织架构新增',
 				component: () => import('../views/system/dept/add.vue')
 			},
-			{
-				path: 'deptEdit',
-				name: '组织架构编辑',
-				component: () => import('../views/system/dept/edit.vue')
-			},
+			
 			{
 				path: 'xiamenList',
 				name: '发酵机列表',

+ 242 - 0
src/views/commonModule/contractTemplate/add.vue

@@ -0,0 +1,242 @@
+<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: {
+		type:null,
+	},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = reactive([
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '公司名称',
+		prop: 'name',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '英文名',
+		prop: 'nameEn',
+		clearable: true,
+	},
+	{
+		type: 'picker',
+		label: '企业类型',
+		prop: 'type',
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'dictValue',
+			value: 'dictKey',
+		},
+        data:[],
+	},
+
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '统一社会信用代码',
+		prop: 'uscCode',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '法定代表人',
+		prop: 'legalPersonName',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '注册资本',
+		prop: 'registeredCapital',
+		clearable: true,
+	},
+	{
+		type: 'picker',
+		label: '营业时间(开始)',
+		prop: 'startDate',
+		itemType: 'datePicker',
+		showPicker: false,
+		split: '-',
+	},
+	{
+		type: 'picker',
+		label: '营业时间(结束)',
+		prop: 'stopDate',
+		itemType: 'datePicker',
+		showPicker: false,
+		split: '-',
+	},
+	{
+		type: 'cascader',
+		label: '注册地址',
+		prop: 'city',
+		itemType: 'city',
+		showPicker: false,
+	},
+	{
+		type: 'input',
+		itemType: 'textarea',
+		label: '详细地址',
+		prop: 'detailedAddress',
+	},
+	{
+		type: 'picker',
+		label: '纳税人资质',
+		prop: 'taxpayerQualification',
+		clearable: true,
+		itemType: 'onePicker',
+		showPicker: false,
+		fieldNames: {
+			text: 'dictValue',
+			value: 'dictKey',
+		},
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '海关注册代码',
+		prop: 'crCode',
+		clearable: true,
+	},
+	{
+		type: 'upload',
+		label: '企业logo',
+		prop: 'enterpriseLogoList',
+	},
+	{
+		type: 'upload',
+		label: '法人签名',
+		prop: 'larSignList',
+	},
+	{
+		type: 'upload',
+		label: '公章',
+		prop: 'officialSealList',
+	},
+	{
+		type: 'upload',
+		label: '合同章',
+		prop: 'contractSealList',
+	},
+])
+const rules = {
+	name: [{ required: true, message: '公司名称不能为空' }],
+}
+const unitList = ref([])
+
+const getDict = () => {
+	proxy
+		.post('/tenantDict/getDict', {
+			dictCode: 'enterprise_type',
+		})
+		.then((res) => {
+			formConfig[2].data = res.data
+		})
+	proxy
+		.post('/tenantDict/getDict', {
+			dictCode: 'taxpayer_qualification',
+		})
+		.then((res) => {
+			formConfig[10].data = res.data
+		})
+}
+getDict()
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	if (
+        formData.data.cityObj &&
+		formData.data.cityObj.selectedOptions &&
+		formData.data.cityObj.selectedOptions.length > 0
+	) {
+		formData.data.countryId = formData.data.cityObj.selectedOptions[0].value
+		if (formData.data.cityObj.selectedOptions.length == 2) {
+			formData.data.cityId =
+				formData.data.cityObj.selectedOptions[1].value
+		} else {
+			formData.data.provinceId =
+				formData.data.cityObj.selectedOptions[1].value
+			formData.data.cityId =
+				formData.data.cityObj.selectedOptions[2].value
+		}
+	}
+	proxy.post('/corporation/' + 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('/corporation/detail', { id: route.query.id })
+			.then((resDetail) => {
+				formData.data = resDetail.data
+			})
+	}
+})
+</script>
+<style lang="scss" scoped>
+.form {
+	padding-bottom: 50px;
+}
+</style>

+ 109 - 0
src/views/commonModule/contractTemplate/index.vue

@@ -0,0 +1,109 @@
+<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: "2",
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+const classification = ref([]);
+const listConfig = ref([
+  {
+    label: "公司名称",
+    prop: "name",
+  },
+  {
+    label: "公司英文名称",
+    prop: "nameEn",
+  },
+  {
+    label: "法定代表人",
+    prop: "legalPersonName",
+  },
+]);
+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: "contractTemplateAdd",
+    query: {
+        type: 'add'
+    },
+  });
+};
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "contractTemplateAdd",
+    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 = () => {
+  getList();
+};
+const getList = (type) => {
+  
+  loading.value = true;
+  proxy
+    .post("/contractTemplate/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;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+</script>
+
+<style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>

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

@@ -1,44 +0,0 @@
-<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>
-  

+ 130 - 0
src/views/system/dict/businessAdd.vue

@@ -0,0 +1,130 @@
+<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: {
+		tenantId: getUserInfo().tenantId,
+	},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = ref([
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '字典编码',
+		prop: 'code',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '字典名称',
+		prop: 'name',
+		clearable: true,
+	},
+
+	{
+		type: 'radio',
+		label: '启用状态',
+		prop: 'status',
+		itemType: 'onePicker',
+		fieldNames: {
+			text: 'label',
+			value: 'id',
+		},
+		data: [
+			{
+				label: '启用',
+				id: 1,
+			},
+			{
+				label: '禁用',
+				id: 0,
+			},
+		],
+	},
+	{
+		type: 'input',
+		itemType: 'textarea',
+		label: '备注',
+		prop: 'remark',
+		clearable: true,
+	},
+])
+const rules = {
+	status: [{ required: true, message: '状态不能为空' }],
+	name: [{ required: true, message: '字典名称不能为空' }],
+    code: [{ required: true, message: '字典编码不能为空' }],
+}
+const unitList = ref([])
+
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	formData.data.tenantId = getUserInfo().tenantId
+	proxy
+		.post('dictTenantType/add', formData.data)
+		.then(() => {
+			showSuccessToast(route.query.id ? '修改成功' : '添加成功')
+			setTimeout(() => {
+				history.back()
+			}, 500)
+		})
+}
+
+onMounted(() => {
+	if (route.query.userId) {
+		console.log(route.query)
+		proxy.get(`/tenantUser/${route.query.userId}`).then((res) => {
+			res.data.password = ''
+			formData.data = {
+				...res.data,
+				roleIds: res.roleIds,
+			}
+		})
+	} else {
+	}
+})
+</script>

+ 107 - 0
src/views/system/dict/businessDict.vue

@@ -0,0 +1,107 @@
+<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, onMounted } from 'vue'
+import commonList from '@/components/common-list.vue'
+import { useRoute } from 'vue-router'
+import { getUserInfo } from '@/utils/auth';
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum:1,
+	keyword:null,
+    tenantId:getUserInfo().tenantId
+})
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+
+
+const listConfig = ref([
+	{
+		label: '字典名称',
+		prop: 'name',
+	},
+	{
+		label: '字典编码',
+		prop: 'code',
+	},
+	{
+		label: '备注',
+		prop: 'remark',
+	}
+])
+const onRefresh = () => {
+	req.value.pageNum = 1
+	finished.value = false
+	getList('refresh')
+}
+const onLoad = () => {
+    getList()
+}
+
+const onClickLeft = () => proxy.$router.push('/main/working')
+
+const onClickRight = () => {
+	proxy.$router.push('/main/businessAdd')
+}
+
+const toDtl = (row) => {
+	console.log(row)
+	proxy.$router.push({
+        path: 'tenantDict',
+		query: row
+      })
+}
+const warehouseType = ref([])
+const getList = (type) => {
+	loading.value = true
+	proxy.post('/dictTenantType/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
+		
+		
+		
+	}).catch(err => {
+		loading.value = false
+	})
+}
+getList()
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+</style>

+ 104 - 0
src/views/system/dict/tenantAdd.vue

@@ -0,0 +1,104 @@
+<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: {
+		tenantId: getUserInfo().tenantId,
+	},
+})
+const formDom = ref(null)
+const formOption = reactive({
+	readonly: false, //用于控制整个表单是否只读
+	disabled: false,
+	labelAlign: 'top',
+	scroll: true,
+	labelWidth: '62pk',
+	// hiddenSubmitBtn: true,
+})
+const formConfig = ref([
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '键',
+		prop: 'dictKey',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'text',
+		label: '值',
+		prop: 'dictValue',
+		clearable: true,
+	},
+	{
+		type: 'input',
+		itemType: 'number',
+		label: '排序',
+		prop: 'sort',
+		clearable: true,
+	},
+])
+const rules = {
+	dictKey: [{ required: true, message: '键不能为空' }],
+    dictValue: [{ required: true, message: '值不能为空' }],
+    sort: [{ required: true, message: '排序不能为空' }],
+}
+const unitList = ref([])
+
+const fileList = ref([])
+const onOversize = () => {
+	showToast('文件大小不能超过 5MB')
+}
+const onClickLeft = () => history.back()
+const onSubmit = () => {
+	formData.data.tenantId = getUserInfo().tenantId
+	proxy
+		.post('dictTenantData/'+  (!route.query.id ? "add" : "edit"), formData.data)
+		.then(() => {
+			showSuccessToast(route.query.id ? '修改成功' : '添加成功')
+			setTimeout(() => {
+				history.back()
+			}, 500)
+		})
+}
+
+onMounted(() => {
+	if (route.query.id) {
+		console.log(route.query)
+		formData.data = route.query
+	} else {
+        formData.data.dictCode = route.query.dictCode
+	}
+})
+</script>

+ 124 - 0
src/views/system/dict/tenantDict.vue

@@ -0,0 +1,124 @@
+<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, onMounted } from 'vue'
+import commonList from '@/components/common-list.vue'
+import { useRoute } from 'vue-router'
+import { getUserInfo } from '@/utils/auth'
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum: 1,
+	keyword: null,
+	tenantId: getUserInfo().tenantId,
+	code: null,
+})
+
+const finished = ref(false)
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+
+const listConfig = ref([
+	{
+		label: '键',
+		prop: 'dictKey',
+	},
+	{
+		label: '值',
+		prop: 'dictValue',
+	},
+	{
+		label: '排序',
+		prop: 'sort',
+	},
+])
+const onRefresh = () => {
+	req.value.pageNum = 1
+	finished.value = false
+	getList('refresh')
+}
+const onLoad = () => {
+	getList()
+}
+
+const onClickLeft = () => proxy.$router.push('/main/working')
+
+const onClickRight = () => {
+    proxy.$router.push({
+		path: 'tenantAdd',
+		query: {
+            dictCode:router.query.code
+        },
+	})
+}
+
+const toDtl = (row) => {
+	console.log(row)
+	proxy.$router.push({
+		path: 'tenantAdd',
+		query: row,
+	})
+}
+const warehouseType = ref([])
+
+const getList = (type) => {
+	loading.value = true
+	proxy
+		.post('dictTenantData/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
+		})
+		.catch((err) => {
+			loading.value = false
+		})
+}
+onMounted(() => {
+	req.value.dictCode = router.query.code
+	getList()
+})
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+</style>

+ 215 - 0
src/views/system/user/add.vue

@@ -0,0 +1,215 @@
+<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: {
+    tenantId: getUserInfo().tenantId
+  },
+});
+const formDom = ref(null);
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  // hiddenSubmitBtn: true,
+});
+const formConfig = ref([
+  {
+    type: "cascader",
+    label: "部门名称",
+    prop: "deptId",
+    itemType: "common",
+    showPicker: false,
+    data: [],
+    fieldNames: {
+      text: "deptName",
+      value: "deptId",
+      children: "children",
+    },
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "姓名",
+    prop: "nickName",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "用户名",
+    prop: "userName",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "密码",
+    prop: "password",
+    clearable: true,
+  },
+  {
+    type: "radio",
+    label: "系统用户",
+    prop: "userType",
+    itemType: "onePicker",
+    showPicker: false,
+    fieldNames: {
+      text: "label",
+      value: "id",
+    },
+    data: [
+      {
+        label: "是",
+        id: 1,
+      },
+      {
+        label: "否",
+        id: 0,
+      },
+      
+    ],
+  },
+
+  {
+    type: "checkbox",
+    label: "角色",
+    prop: "roleIds",
+    itemType: "onePicker",
+    showPicker: false,
+    fieldNames: {
+      text: "roleName",
+      value: "roleId",
+    },
+    data: [],
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "手机号",
+    prop: "phonenumber",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "工号",
+    prop: "jobNumber",
+    clearable: true,
+  },
+]);
+const rules = {
+  deptId: [{ required: true, message: "部门名称不能为空" }],
+  nickName: [{ required: true, message: "姓名不能为空" }],
+  userName: [{ required: true, message: "用户名不能为空" }],
+  password: [{ required: true, message: "密码不能为空" }],
+  roleIds: [{ required: true, message: "角色不能为空" }],
+  phonenumber: [{ required: true, message: "手机号不能为空" }],
+};
+const unitList = ref([]);
+
+const getUserList = () => {
+  proxy
+    .get("/tenantRole/list", {
+      pageNum: 1,
+      pageSize: 10000,
+      tenantId: getUserInfo().tenantId,
+    })
+    .then((message) => {
+      formConfig.value[5].data = message.rows.map((item) => {
+        return {
+          text: item.roleName,
+          value: item.roleId,
+        };
+      });
+    });
+};
+
+getUserList();
+const fileList = ref([]);
+const onOversize = () => {
+  showToast("文件大小不能超过 5MB");
+};
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  formData.data.tenantId = getUserInfo().tenantId
+  proxy
+    .post("/tenantUser", 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) => {
+      formConfig.value[0].data = handleTree(res.data, "deptId");
+    })
+    .catch((err) => {});
+};
+getTree();
+onMounted(() => {
+  if (route.query.userId) {
+    console.log(route.query);
+    proxy.get(`/tenantUser/${route.query.userId}`).then((res) => {
+      res.data.password = ""
+      formData.data = {
+        ...res.data,
+        roleIds:res.roleIds
+      }
+    });
+    
+  } else {
+    
+  }
+});
+</script>

+ 145 - 0
src/views/system/user/index.vue

@@ -0,0 +1,145 @@
+<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'
+import { getUserInfo } from '@/utils/auth'
+const loading = ref(false)
+const router = useRoute()
+const req = ref({
+	pageNum: 1,
+	keyword: null,
+	definition: '1',
+    tenantId: getUserInfo().tenantId
+})
+const finished = ref(false)
+const proxy = getCurrentInstance().proxy
+const listData = ref([])
+const listConfig = ref([
+	{
+		label: '姓名',
+		prop: 'nickName',
+	},
+	{
+		label: '用户名',
+		prop: 'userName',
+	},
+	{
+		label: '手机号',
+		prop: 'phonenumber',
+	},
+])
+//车间类型
+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: 'userAdd',
+		query: {
+			type: 'add',
+		},
+	})
+}
+const toDtl = (row) => {
+	proxy.$router.push({
+		path: 'userAdd',
+		query: {
+			...row,
+			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
+		.get('/tenantUser/list', req.value)
+		.then((res) => {
+			listData.value =
+				type === 'refresh'
+					? res.rows
+					: listData.value.concat(res.rows)
+			if (req.value.pageNum * 10 >= res.total) {
+				finished.value = true
+			}
+			req.value.pageNum++
+			loading.value = false
+			
+			console.log(listData.value)
+		})
+		.catch((err) => {
+			loading.value = false
+		})
+}
+getList()
+</script>
+
+<style lang="scss" scoped>
+.list {
+	min-height: 70vh;
+}
+</style>