Răsfoiți Sursa

组织架构问题解决

cz 1 an în urmă
părinte
comite
25e0eb3754

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

@@ -9,12 +9,16 @@
     </van-nav-bar>
     <van-form @submit="onSubmit" label-align="top" style="margin-top: 20px">
       <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.productName" readonly label="物品名称" />
-        <van-field v-model="formData.inQuantity" readonly label="待入库数量" />
+        <van-field v-model="formData.inQuantity" readonly label="待库数量" />
       </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-field
           v-model="formData.warehouseName"
@@ -35,9 +39,9 @@
         </van-popup>
         <van-field
           v-model="formData.quantity"
-          label="库数量"
-          placeholder="请输入库数量"
-          :rules="[{ required: true, message: '库数量不能为空' }]"
+          label="库数量"
+          placeholder="请输入库数量"
+          :rules="[{ required: true, message: '库数量不能为空' }]"
           required
         />
       </van-cell-group>
@@ -75,6 +79,8 @@ const getDetails = (id) => {
   proxy.post("/stockWait/detail", { id }).then((res) => {
     res.data.inQuantity = res.data.quantity;
     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([
   {
     label: "数据来源",
-    prop: "businessType",
+    prop: "businessTypeName",
   },
   {
     label: "物品名称",
@@ -89,6 +89,10 @@ const getList = (type) => {
         type === "refresh"
           ? 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) {
         finished.value = true;
       }

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

@@ -1,231 +1,212 @@
 <template>
-	<div class="form">
-		<van-nav-bar
-			title="添加机构"
-			left-text="返回"
-			left-arrow
-			@click-left="onClickLeft"
-		>
-		</van-nav-bar>
+  <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>
+    <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([])
+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)
+  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',
-			},
-		],
-	},
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  // hiddenSubmitBtn: true,
+});
+const formConfig = ref([
+  {
+    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',
-	},
-])
+  {
+    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([])
+  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([])
+  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.value[3].data = message.rows;
+      formConfig.value[4].data = message.rows;
+    });
+};
+
+getUserList();
+const fileList = ref([]);
 const onOversize = () => {
-	showToast('文件大小不能超过 5MB')
-}
-const onClickLeft = () => history.back()
+  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)
-	})
-}
+  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
-}
+  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()
+  proxy
+    .get("/tenantDept/list", { tenantId: getUserInfo().tenantId })
+    .then((res) => {
+      formConfig.value[0].data = handleTree(res.data, "deptId");
+    })
+    .catch((err) => {});
+};
+getTree();
 onMounted(() => {
-	if (route.query.id) {
-        console.log(route.query)
-        formData.data = route.query
-	} else {
-		formData.data.tenantId = route.query.tenantId
-	}
-})
+  if (route.query.id) {
+    console.log(route.query);
+    formData.data = route.query;
+  } else {
+    formData.data.tenantId = route.query.tenantId;
+    formData.data.parentId = route.query.deptId;
+  }
+});
 </script>

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

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