refactor(crm): 重构合同模块为订单模块并优化相关功能
重构合同模块为订单模块,包括以下主要变更: 1. 将合同编号字段从contractNo统一改为contractCode 2. 在CrmOrderBo中添加日期格式化注解 3. 重构ContractTabs组件为订单详情页 4. 添加销售员字段和相关选择器 5. 优化订单列表查询条件和展示 6. 调整订单附件管理功能
This commit is contained in:
@@ -2,13 +2,12 @@
|
||||
<div class="app-container" style="height: calc(100vh - 84px); display: flex;">
|
||||
<!-- 左侧合同列表 -->
|
||||
<div class="left-panel" style="width: 30%; border-right: 1px solid #e4e7ed; overflow-y: auto;">
|
||||
<ContractList ref="contractList"
|
||||
@add="handleAdd" @update="handleUpdate" @delete="handleDelete" @export="handleExport"
|
||||
@exportContract="handleExportContract" @rowClick="handleRowClick" />
|
||||
<ContractList ref="orderList" @add="handleAdd" @update="handleUpdate" @delete="handleDelete"
|
||||
@export="handleExport" @exportContract="handleExportContract" @rowClick="handleRowClick" />
|
||||
</div>
|
||||
|
||||
<!-- 右侧内容区域 -->
|
||||
<div class="right-panel" v-if="form.contractId" style="flex: 1; display: flex; flex-direction: column;">
|
||||
<div class="right-panel" v-if="form.orderId" style="flex: 1; display: flex; flex-direction: column;">
|
||||
<!-- 右侧上方:合同内容信息预览 -->
|
||||
<div class="preview-panel" ref="previewPanel"
|
||||
style="flex: 1; overflow-y: auto; border-bottom: 1px solid #e4e7ed;">
|
||||
@@ -24,17 +23,14 @@
|
||||
|
||||
<!-- 右侧下方:Tab标签页 -->
|
||||
<div class="tab-panel" ref="tabPanel" style="flex: 1; overflow-y: auto;">
|
||||
<ContractTabs :contractId="form.contractId"
|
||||
:customerId="form.customerId" :financeList="financeList" :objectionList="objectionList"
|
||||
:wmsDeliveryWaybills="wmsDeliveryWaybills"
|
||||
:coilList="coilList" :tabLoading="tabLoading"
|
||||
:contract-attachment="form.businessAnnex"
|
||||
:technical-agreement="form.techAnnex"
|
||||
:other-attachment="form.productionSchedule" />
|
||||
<ContractTabs :orderId="form.orderId" :customerId="form.customerId" :financeList="financeList"
|
||||
:objectionList="objectionList" :wmsDeliveryWaybills="wmsDeliveryWaybills" :coilList="coilList"
|
||||
:tabLoading="tabLoading" :contract-attachment="form.businessAnnex" :technical-agreement="form.techAnnex"
|
||||
:other-attachment="form.productionSchedule" :currentOrder="form" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-else style="flex: 1; display: flex; flex-direction: column;">
|
||||
<el-empty description="选择合同后查看内容" />
|
||||
<el-empty description="选择订单后查看内容" />
|
||||
</div>
|
||||
|
||||
<!-- 添加或修改合同信息对话框 -->
|
||||
@@ -48,8 +44,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="合同编号" prop="contractNo">
|
||||
<el-input v-model="form.contractNo" placeholder="请输入合同编号" />
|
||||
<el-form-item label="合同编号" prop="contractCode">
|
||||
<el-input v-model="form.contractCode" placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
@@ -59,13 +55,27 @@
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="订单总金额" prop="orderAmount">
|
||||
<el-input v-model="form.orderAmount" placeholder="请输入订单总金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="6">
|
||||
<el-form-item label="交货日期" prop="deliveryDate">
|
||||
<el-date-picker clearable v-model="form.deliveryDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="请选择交货日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="销售员" prop="salesman">
|
||||
<el-select style="width: 100%;" v-model="form.salesman" placeholder="请选择销售员">
|
||||
<el-option v-for="item in dict.type.wip_pack_saleman" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="签订地点" prop="signLocation">
|
||||
<el-input v-model="form.signLocation" placeholder="请输入签订地点" />
|
||||
@@ -107,7 +117,8 @@
|
||||
<!-- 需方信息 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="需方" prop="customer">
|
||||
<CustomerSelect v-model="form.customer" bindField="companyName" @change="handleCustomerChange" :style="{ width: '100%' }" />
|
||||
<CustomerSelect v-model="form.customer" bindField="companyName" @change="handleCustomerChange"
|
||||
:style="{ width: '100%' }" />
|
||||
<!-- <el-input v-model="form.customer" placeholder="请输入需方" /> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="需方地址" prop="customerAddress">
|
||||
@@ -142,6 +153,10 @@
|
||||
<file-upload v-model="form.productionSchedule"
|
||||
:fileType="['pdf', 'jpeg', 'jpg', 'png', 'webp']"></file-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他附件" prop="annexFiles">
|
||||
<file-upload v-model="form.annexFiles"
|
||||
:fileType="['pdf', 'jpeg', 'jpg', 'png', 'webp', 'xlsx', 'xls', 'docx', 'doc']"></file-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
@@ -152,7 +167,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getContract, delContract, addContract, updateContract, listContractOrderObjection, listContractPackaging } from "@/api/crm/contract";
|
||||
import { delOrder, listOrderPackaging, updateOrder, getOrder, addOrder } from "@/api/crm/order";
|
||||
import { listDeliveryWaybill } from "@/api/wms/deliveryWaybill";
|
||||
|
||||
import ContractList from "./components/ContractList.vue";
|
||||
import ContractPreview from "./components/ContractPreview.vue";
|
||||
import ContractTabs from "./components/ContractTabs.vue";
|
||||
@@ -168,6 +185,7 @@ export default {
|
||||
ProductContent,
|
||||
CustomerSelect,
|
||||
},
|
||||
dicts: ['wip_pack_saleman'],
|
||||
data() {
|
||||
return {
|
||||
financeList: [],
|
||||
@@ -187,7 +205,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
contractName: undefined,
|
||||
contractNo: undefined,
|
||||
contractCode: undefined,
|
||||
supplier: undefined,
|
||||
customer: undefined,
|
||||
signTime: undefined,
|
||||
@@ -205,9 +223,15 @@ export default {
|
||||
contractName: [
|
||||
{ required: true, message: "合同名称不能为空", trigger: "blur" }
|
||||
],
|
||||
contractNo: [
|
||||
contractCode: [
|
||||
{ required: true, message: "合同编号不能为空", trigger: "blur" }
|
||||
],
|
||||
orderAmount: [
|
||||
{ required: true, message: "订单总金额不能为空", trigger: "blur" }
|
||||
],
|
||||
salesman: [
|
||||
{ required: true, message: "销售员不能为空", trigger: "blur" }
|
||||
],
|
||||
supplier: [
|
||||
{ required: true, message: "供方不能为空", trigger: "blur" }
|
||||
],
|
||||
@@ -315,19 +339,19 @@ export default {
|
||||
/** 行点击事件 */
|
||||
handleRowClick(row) {
|
||||
this.form = row;
|
||||
this.tabLoading = true;
|
||||
// this.tabLoading = true;
|
||||
this.getCoilList();
|
||||
listContractOrderObjection(row.contractId).then(response => {
|
||||
this.financeList = response.data.financeList || [];
|
||||
this.objectionList = response.data.oobjectionList || [];
|
||||
this.wmsDeliveryWaybills = response.data.wmsDeliveryWaybills || [];
|
||||
}).finally(() => {
|
||||
this.tabLoading = false;
|
||||
})
|
||||
// listContractOrderObjection(row.contractId).then(response => {
|
||||
// this.financeList = response.data.financeList || [];
|
||||
// this.objectionList = response.data.oobjectionList || [];
|
||||
// this.wmsDeliveryWaybills = response.data.wmsDeliveryWaybills || [];
|
||||
// }).finally(() => {
|
||||
// this.tabLoading = false;
|
||||
// })
|
||||
},
|
||||
/** 查询合同配卷列表 */
|
||||
getCoilList() {
|
||||
listContractPackaging(this.form.contractId).then(response => {
|
||||
listOrderPackaging(this.form.orderId).then(response => {
|
||||
this.coilList = response.data || [];
|
||||
})
|
||||
},
|
||||
@@ -435,18 +459,18 @@ export default {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加合同信息";
|
||||
this.title = "添加订单信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const contractId = row.contractId || this.ids
|
||||
getContract(contractId).then(response => {
|
||||
const orderId = row.orderId || this.ids
|
||||
getOrder(orderId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改合同信息";
|
||||
this.title = "修改订单信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@@ -454,19 +478,19 @@ export default {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.contractId != null) {
|
||||
updateContract(this.form).then(response => {
|
||||
if (this.form.orderId != null) {
|
||||
updateOrder(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.$refs.contractList.getList();
|
||||
this.$refs.orderList.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addContract(this.form).then(response => {
|
||||
addOrder(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.$refs.contractList.getList();
|
||||
this.$refs.orderList.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
@@ -476,19 +500,19 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const contractIds = row.contractId || this.ids;
|
||||
this.$modal.confirm('是否确认删除合同信息编号为"' + contractIds + '"的数据项?').then(() => {
|
||||
return delContract(contractIds);
|
||||
const orderId = row.orderId || this.ids;
|
||||
this.$modal.confirm('是否确认删除订单信息编号为"' + orderId + '"的数据项?').then(() => {
|
||||
return delOrder(orderId);
|
||||
}).then(() => {
|
||||
this.$refs.contractList.getList();
|
||||
this.$refs.orderList.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('crm/contract/export', {
|
||||
this.download('crm/order/export', {
|
||||
...this.queryParams
|
||||
}, `contract_${new Date().getTime()}.xlsx`)
|
||||
}, `order_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 导出合同操作 */
|
||||
handleExportContract(row) {
|
||||
|
||||
Reference in New Issue
Block a user