Browse Source

组织架构问题解决

cz 1 year ago
parent
commit
25e0eb3754

+ 12 - 6
src/views/purchase-sales/inbound-outbound/waitOutbound/add.vue

@@ -9,12 +9,16 @@
     </van-nav-bar>
     </van-nav-bar>
     <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
     <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
       <van-cell-group inset>
       <van-cell-group inset>
-        <van-field v-model="formData.businessType" readonly label="数据来源" />
+        <van-field
+          v-model="formData.businessTypeName"
+          readonly
+          label="数据来源"
+        />
         <van-field v-model="formData.businessCode" readonly label="单号" />
         <van-field v-model="formData.businessCode" readonly label="单号" />
         <van-field v-model="formData.productName" readonly label="物品名称" />
         <van-field v-model="formData.productName" readonly label="物品名称" />
-        <van-field v-model="formData.inQuantity" readonly label="待入库数量" />
+        <van-field v-model="formData.inQuantity" readonly label="待库数量" />
       </van-cell-group>
       </van-cell-group>
-      <div style="padding: 5px 0 5px 15px; color: #999999">本次库</div>
+      <div style="padding: 5px 0 5px 15px; color: #999999">本次库</div>
       <van-cell-group inset>
       <van-cell-group inset>
         <van-field
         <van-field
           v-model="formData.warehouseName"
           v-model="formData.warehouseName"
@@ -35,9 +39,9 @@
         </van-popup>
         </van-popup>
         <van-field
         <van-field
           v-model="formData.quantity"
           v-model="formData.quantity"
-          label="库数量"
+          label="库数量"
-          placeholder="请输入库数量"
+          placeholder="请输入库数量"
-          :rules="[{ required: true, message: '库数量不能为空' }]"
+          :rules="[{ required: true, message: '库数量不能为空' }]"
           required
           required
         />
         />
       </van-cell-group>
       </van-cell-group>
@@ -75,6 +79,8 @@ const getDetails = (id) => {
   proxy.post("/stockWait/detail", { id }).then((res) => {
   proxy.post("/stockWait/detail", { id }).then((res) => {
     res.data.inQuantity = res.data.quantity;
     res.data.inQuantity = res.data.quantity;
     formData.value = res.data;
     formData.value = res.data;
+    formData.value.businessTypeName =
+      formData.value.businessType == 6 ? "销售订单出库" : "京东订单出库";
   });
   });
 };
 };
 
 

+ 5 - 1
src/views/purchase-sales/inbound-outbound/waitOutbound/index.vue

@@ -44,7 +44,7 @@ const listData = ref([]);
 const listConfig = ref([
 const listConfig = ref([
   {
   {
     label: "数据来源",
     label: "数据来源",
-    prop: "businessType",
+    prop: "businessTypeName",
   },
   },
   {
   {
     label: "物品名称",
     label: "物品名称",
@@ -89,6 +89,10 @@ const getList = (type) => {
         type === "refresh"
         type === "refresh"
           ? res.data.rows
           ? res.data.rows
           : listData.value.concat(res.data.rows);
           : listData.value.concat(res.data.rows);
+      listData.value = listData.value.map((x) => ({
+        ...x,
+        businessTypeName: x.businessType == 6 ? "销售订单出库" : "京东订单出库",
+      }));
       if (req.value.pageNum * 10 >= res.data.total) {
       if (req.value.pageNum * 10 >= res.data.total) {
         finished.value = true;
         finished.value = true;
       }
       }

+ 194 - 213
src/views/system/dept/add.vue

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

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

@@ -97,6 +97,7 @@ const clickAdd = (row) => {
 		query: {
 		query: {
 			tenantId: getUserInfo().tenantId,
 			tenantId: getUserInfo().tenantId,
             id:'',
             id:'',
+						deptId:row.deptId,
             type:'add',
             type:'add',
 		},
 		},
 	})
 	})