Kaynağa Gözat

修改下单页面查询客户部门

hurx 3 ay önce
ebeveyn
işleme
2397fda2e8

+ 8 - 0
src/api/system/dept/index.ts

@@ -63,3 +63,11 @@ export const delDept = (deptId: number | string) => {
     method: 'delete'
   });
 };
+
+// 查询客户部门
+export const listCustomerDept = (customerId: string | number): AxiosPromise<DeptVO[]> => {
+  return request({
+    url: `/system/dept/customerDeptList/${customerId}`, // 拼接 customerId 到路径
+    method: 'get'
+  });
+};

+ 1 - 1
src/views/order/expense/index.vue

@@ -8,7 +8,7 @@
               <el-input v-model="queryParams.orderRevenueCode" placeholder="请输入单据编号" clearable @keyup.enter="handleQuery" />
             </el-form-item>
             <el-form-item label="单据日期" prop="createTime">
-              <el-input v-model="queryParams.createTime" placeholder="请选择单据日期" clearable @keyup.enter="handleQuery" />
+              <el-date-picker v-model="queryParams.createTime" placeholder="请选择单据日期" clearable @keyup.enter="handleQuery" />
             </el-form-item>
             <el-form-item label="关键字" prop="searchValue">
               <el-input v-model="queryParams.searchValue" placeholder="供应商名称/编号" clearable @keyup.enter="handleQuery" />

+ 2 - 15
src/views/order/orderAssignment/index.vue

@@ -89,20 +89,8 @@
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="180">
           <template #default="scope">
             <el-button link type="primary" @click="handleReview(scope.row)">查看</el-button>
-            <el-button
-              link
-              type="primary"
-              v-if="scope.row.checkStatus == '1' && scope.row.assignmentStatus == '0'"
-              @click="handleAssignment(scope.row)"
-              >订单分配</el-button
-            >
-            <el-button
-              link
-              type="primary"
-              v-if="scope.row.checkStatus == '1' && scope.row.assignmentStatus == '1'"
-              @click="handleAssignment(scope.row)"
-              >重新分配</el-button
-            >
+            <el-button link type="primary" v-if="scope.row.assignmentStatus == '0'" @click="handleAssignment(scope.row)">订单分配</el-button>
+            <el-button link type="primary" v-if="scope.row.assignmentStatus == '1'" @click="handleAssignment(scope.row)">重新分配</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -205,7 +193,6 @@ const data = reactive<PageData<OrderMainForm, OrderMainQuery>>({
   queryParams: {
     pageNum: 1,
     pageSize: 10,
-    checkStatus: '1',
     orderNo: undefined,
     shipmentNo: undefined,
     subOrderNo: undefined,

+ 20 - 12
src/views/order/orderMain/index.vue

@@ -131,9 +131,14 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="下单部门" prop="userDept">
-              <el-select v-model="form.userDept" placeholder="请选择" style="width: 100%" :disabled="!form.customerId">
-                <el-option v-for="dept in customerDeptList" :key="dept.deptId" :label="dept.deptName" :value="dept.deptId" />
-              </el-select>
+              <el-tree-select
+                v-model="form.userDept"
+                :data="customerDeptList"
+                :props="{ value: 'deptId', label: 'deptName', children: 'children' } as any"
+                value-key="deptId"
+                placeholder="选择下单部门"
+                check-strictly
+              />
             </el-form-item>
           </el-col>
         </el-row>
@@ -294,7 +299,7 @@
 
     <!-- 底部按钮 -->
     <div class="text-center mt-4">
-      <el-button @click="cancel">取消</el-button>
+      <!-- <el-button @click="cancel">取消</el-button> -->
       <el-button type="primary" :loading="buttonLoading" @click="submitForm">确定</el-button>
     </div>
 
@@ -316,8 +321,7 @@
 import { listOrderMain, getOrderMain, delOrderMain, addOrderMain, updateOrderMain } from '@/api/order/orderMain';
 import { OrderMainVO, OrderMainQuery, OrderMainForm } from '@/api/order/orderMain/types';
 import { listCompany } from '@/api/company/company';
-import { listCustomerDept } from '@/api/customer/customerFile/customerDept';
-import { CustomerDeptVO } from '@/api/customer/customerFile/customerDept/types';
+import { listCustomerDept } from '@/api/system/dept';
 import { CompanyVO } from '@/api/company/company/types';
 import { listWarehouse, getWarehouse } from '@/api/company/warehouse';
 import { WarehouseVO, WarehouseQuery } from '@/api/company/warehouse/types';
@@ -329,7 +333,6 @@ import ChooseAddress from './components/chooseAddress.vue';
 import AddAddress from './components/addressDialog.vue';
 import ChooseProduct from './components/chooseProduct.vue';
 import SelectProductDetail from './components/selectProductDetail.vue';
-import { BaseVO } from '@/api/product/base/types';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
 const { order_status, fee_type, pay_method } = toRefs<any>(proxy?.useDict('order_status', 'fee_type', 'pay_method'));
@@ -348,6 +351,12 @@ const dialog = reactive<DialogOption>({
   title: ''
 });
 
+interface DeptOptionsType {
+  deptId: number | string;
+  deptName: string;
+  children: DeptOptionsType[];
+}
+
 // 商品列表数据
 const productList = ref([]);
 
@@ -407,7 +416,7 @@ const customerList = ref<CustomerInfoVO[]>([]);
 const customerLoading = ref(false);
 
 // 客户部门列表
-const customerDeptList = ref<CustomerDeptVO[]>([]);
+const customerDeptList = ref<DeptOptionsType[]>([]);
 
 const addressList = ref<ShippingAddressVO[]>([]);
 
@@ -894,10 +903,9 @@ const handleCustomerChange = async (customerId: string | number) => {
 /** 获取客户部门列表 */
 const getCustomerDeptList = async (customerId: string | number) => {
   try {
-    const res = await listCustomerDept({
-      customerId: customerId
-    });
-    customerDeptList.value = res.rows || [];
+    const res = await listCustomerDept(customerId);
+    const data = proxy?.handleTree<DeptOptionsType>(res.data, 'deptId');
+    customerDeptList.value = data;
   } catch (error) {
     console.error('获取客户部门列表失败:', error);
     customerDeptList.value = [];

+ 1 - 0
src/views/order/saleOrder/index.vue

@@ -210,6 +210,7 @@ const initFormData: OrderMainForm = {
   companyId: undefined,
   customerId: undefined,
   customerCode: undefined,
+  isSplitChild: undefined,
   userId: undefined,
   shippingAddressId: undefined,
   purchaseReason: undefined,