+
@@ -52,21 +51,35 @@
-
+
- 客户
+
+
+
+
+
+
+
+
- 合同
+
+
+
+
+
+
+
+
-
+
-
+
-
+
@@ -85,7 +98,7 @@
{{ dict.label
- }}
+ }}
@@ -107,6 +120,11 @@ import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/
import CoilTable from "../components/CoilTable.vue";
import DeliveryTable from "../components/DeliveryTable.vue";
+import { listDeliveryWaybill } from "@/api/wms/deliveryWaybill";
+import { listCustomer } from "@/api/crm/customer";
+import { listOrder } from "@/api/crm/order";
+import { listDeliveryWaybillDetailBySaleman } from "@/api/wms/deliveryWaybillDetail";
+
export default {
name: "Data",
components: { DragResizePanel, CoilTable, DeliveryTable },
@@ -135,33 +153,6 @@ export default {
open: false,
// 当前选中的销售员
selectedItem: null,
- // 数据标签回显样式
- listClassOptions: [
- {
- value: "default",
- label: "默认"
- },
- {
- value: "primary",
- label: "主要"
- },
- {
- value: "success",
- label: "成功"
- },
- {
- value: "info",
- label: "信息"
- },
- {
- value: "warning",
- label: "警告"
- },
- {
- value: "danger",
- label: "危险"
- }
- ],
// 类型数据销售员
typeOptions: [],
// 查询参数
@@ -182,6 +173,14 @@ export default {
deliveryList: [],
// 发货单据列表
waybillList: [],
+ // 跟进客户列表
+ customerList: [],
+ // 跟进合同列表
+ orderList: [],
+ // 原始订单数据缓存
+ rawOrderList: [],
+ // 已加载的数据标识
+ loadedTabs: {},
// 表单校验
rules: {
dictLabel: [
@@ -193,7 +192,8 @@ export default {
dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
],
- }
+ },
+ rightLoading: false
};
},
created() {
@@ -226,6 +226,128 @@ export default {
this.loading = false;
});
},
+ handleSelect(row) {
+ if (this.rightLoading) {
+ this.$message({
+ message: '请等待当前数据加载完成',
+ type: 'warning'
+ });
+ return;
+ }
+ this.rightLoading = true;
+ this.selectedItem = row;
+ this.loadedTabs = {};
+ // 只加载当前激活tab的数据
+ this.loadTabData(this.activeTab, row.dictValue)
+ },
+ handleTabClick(tab) {
+ if (!this.selectedItem) return;
+ this.loadTabData(tab.name, this.selectedItem.dictValue);
+ },
+ loadTabData(tabName, dictValue) {
+ if (this.loadedTabs[tabName]) {
+ return Promise.resolve();
+ }
+ this.rightLoading = true;
+
+ switch (tabName) {
+ case 'customer':
+ return listCustomer({
+ contactPerson: dictValue,
+ pageNum: 1,
+ pageSize: 10000
+ }).then(response => {
+ this.customerList = response.rows;
+ this.loadedTabs.customer = true;
+ this.rightLoading = false;
+ }).catch(() => {
+ this.rightLoading = false;
+ });
+ case 'contract':
+ return listOrder({
+ salesman: dictValue,
+ pageNum: 1,
+ pageSize: 10000
+ }).then(response => {
+ this.rawOrderList = response.rows;
+ this.orderList = response.rows;
+ this.loadedTabs.contract = true;
+ this.rightLoading = false;
+ }).catch(() => {
+ this.rightLoading = false;
+ });
+ case 'delivery':
+ return listDeliveryWaybill({
+ principal: dictValue,
+ pageNum: 1,
+ pageSize: 10000
+ }).then(response => {
+ this.waybillList = response.rows;
+ this.loadedTabs.delivery = true;
+ this.rightLoading = false;
+ }).catch(() => {
+ this.rightLoading = false;
+ });
+ case 'production':
+ // 生产成果和contract使用同一个api获取数据
+ if (this.loadedTabs.contract) {
+ // 合同数据已加载,直接处理
+ this.processProductionData();
+ return Promise.resolve();
+ } else {
+ // 合同数据未加载,先请求合同数据
+ return listOrder({
+ salesman: dictValue,
+ pageNum: 1,
+ pageSize: 10000
+ }).then(response => {
+ this.rawOrderList = response.rows;
+ this.orderList = response.rows;
+ this.loadedTabs.contract = true;
+ this.processProductionData();
+ }).catch(() => {
+ this.rightLoading = false;
+ });
+ }
+ case 'planDelivery':
+ return listDeliveryWaybillDetailBySaleman(dictValue).then(response => {
+ this.deliveryList = response;
+ this.loadedTabs.planDelivery = true;
+ this.rightLoading = false;
+ }).catch(() => {
+ this.rightLoading = false;
+ });
+ default:
+ this.rightLoading = false;
+ return Promise.resolve();
+ }
+ },
+ processProductionData() {
+ // 扁平化处理所有合同下的生产成果(coilList)
+ const allCoils = [];
+ this.rawOrderList.forEach(order => {
+ if (order.coilList && Array.isArray(order.coilList)) {
+ allCoils.push(...order.coilList);
+ }
+ });
+ this.productList = allCoils;
+ this.loadedTabs.production = true;
+ this.rightLoading = false;
+ },
+ processPlanDeliveryData() {
+ // 扁平化处理所有合同下的计划发货数据
+ const allDeliveryCoils = [];
+ this.rawOrderList.forEach(order => {
+ if (order.coilList && Array.isArray(order.coilList)) {
+ // 可以根据需要过滤未发货的钢卷
+ const deliveryCoils = order.coilList.filter(coil => coil.status !== 1);
+ allDeliveryCoils.push(...deliveryCoils);
+ }
+ });
+ this.deliveryList = allDeliveryCoils;
+ this.loadedTabs.planDelivery = true;
+ this.rightLoading = false;
+ },
// 取消按钮
cancel() {
this.open = false;
@@ -267,12 +389,6 @@ export default {
this.title = "添加销售员数据";
this.form.dictType = this.queryParams.dictType;
},
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.dictCode)
- this.single = selection.length != 1
- this.multiple = !selection.length
- },
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
@@ -284,7 +400,7 @@ export default {
});
},
/** 提交按钮 */
- submitForm () {
+ submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
// 确保dictLabel和dictValue保持一致
@@ -318,12 +434,6 @@ export default {
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
}).catch(() => { });
},
- /** 导出按钮操作 */
- handleExport() {
- this.download('system/dict/data/export', {
- ...this.queryParams
- }, `data_${new Date().getTime()}.xlsx`)
- },
}
};