Эх сурвалжийг харах

fix:修改合同表格样式和时间的显示、合同增加客户负责人字段

liuzl 2 жил өмнө
parent
commit
097c3f477f

+ 6 - 4
src/views/collection/index.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-10 13:40:41
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-10 14:02:36
+ * @LastEditTime: 2023-01-11 15:38:46
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\collection\index.vue
 -->
@@ -70,6 +70,8 @@
             {{ collectionTypeOption.filter((item) => item.key == row.collectionType)[0].value || '-' }}
           </span>
           <span v-else-if="item.prop == 'approStatus'">{{ row.approStatus == '10' ? '未回款' : '已回款' }}</span>
+          <span v-else-if="item.prop == 'updatedTime'">{{ parseTime(row.updatedTime, '{y}-{m}-{d}') }}</span>
+          <span v-else-if="item.prop == 'createdTime'">{{ parseTime(row.createdTime, '{y}-{m}-{d}') }}</span>
           <span v-else-if="item.prop == 'contractAmount'">{{ formatPrice(row.contractAmount) }}</span>
           <span v-else-if="item.prop == 'collectionAmount'">{{ formatPrice(row.collectionAmount) }}</span>
           <span v-else>{{ row[item.prop] }}</span>
@@ -128,14 +130,14 @@
         columns: [
           {
             label: '合同编号',
-            width: 'auto',
+            width: '160px',
             prop: 'contractCode',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '客户名称',
-            width: 'auto',
+            width: '280px',
             prop: 'custName',
             sortable: false,
             disableCheck: false,
@@ -170,7 +172,7 @@
           },
           {
             label: '备注',
-            width: '100px',
+            width: 'auto',
             prop: 'remark',
             sortable: false,
             disableCheck: false,

+ 11 - 14
src/views/collection/plan.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-10 13:40:41
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-10 14:21:08
+ * @LastEditTime: 2023-01-11 15:41:44
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\collection\plan.vue
 -->
@@ -66,6 +66,10 @@
           <span v-else-if="item.label == '未回款金额'">
             {{ formatPrice(row.planAmount - row.cashedAmount) }}
           </span>
+          <span v-else-if="item.prop == 'planDatetime'">{{ parseTime(row.planDatetime, '{y}-{m}-{d}') }}</span>
+          <span v-else-if="item.prop == 'cashedDatetime'">{{ parseTime(row.cashedDatetime, '{y}-{m}-{d}') }}</span>
+          <span v-else-if="item.prop == 'updatedTime'">{{ parseTime(row.updatedTime, '{y}-{m}-{d}') }}</span>
+          <span v-else-if="item.prop == 'createdTime'">{{ parseTime(row.createdTime, '{y}-{m}-{d}') }}</span>
           <span v-else-if="item.prop == 'contractStatus'">
             {{ row.contractStatus == '10' ? '待回款' : row.contractStatus == '20' ? '部分回款' : '全部回款' }}
           </span>
@@ -121,14 +125,14 @@
         columns: [
           {
             label: '合同编号',
-            width: 'auto',
+            width: '160px',
             prop: 'contractCode',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '客户名称',
-            width: 'auto',
+            width: '280px',
             prop: 'custName',
             sortable: false,
             disableCheck: false,
@@ -142,15 +146,8 @@
           },
           {
             label: '计划回款日期',
-            width: '100px',
-            prop: 'planDatetime',
-            sortable: false,
-            disableCheck: false,
-          },
-          {
-            label: '备注',
             width: '120px',
-            prop: 'remark',
+            prop: 'planDatetime',
             sortable: false,
             disableCheck: false,
           },
@@ -163,7 +160,7 @@
           },
           {
             label: '实际回款日期',
-            width: '100px',
+            width: '120px',
             prop: 'cashedDatetime',
             sortable: false,
             disableCheck: false,
@@ -176,7 +173,7 @@
           },
           {
             label: '备注',
-            width: '100px',
+            width: 'auto',
             prop: 'remark',
             sortable: false,
             disableCheck: false,
@@ -204,7 +201,7 @@
           },
           {
             label: '创建人',
-            width: '100px',
+            width: '120px',
             prop: 'createdName',
             sortable: false,
             disableCheck: false,

+ 19 - 13
src/views/contract/components/DetailsCollection.vue

@@ -30,11 +30,14 @@
             <span v-if="item.prop == 'contractStatus'">
               {{ row.contractStatus == '10' ? '待回款' : row.contractStatus == '20' ? '部分回款' : '全部回款' }}
             </span>
+            <span v-else-if="item.prop == 'planDatetime'">
+              {{ parseTime(row.planDatetime, '{y}-{m}-{d}') }}
+            </span>
             <span v-else-if="item.prop == 'planAmount'">{{ formatPrice(row.planAmount) }}</span>
             <span v-else>{{ row[item.prop] }}</span>
           </template>
         </el-table-column>
-        <el-table-column align="center" label="操作">
+        <el-table-column align="center" fixed="right" label="操作">
           <template slot-scope="scope">
             <el-button
               :disabled="scope.row.contractStatus == '30'"
@@ -73,6 +76,9 @@
             <span v-else-if="item.prop == 'approStatus'">
               {{ row.approStatus == '10' ? '未回款' : '已回款' }}
             </span>
+            <span v-else-if="item.prop == 'collectionDatetime'">
+              {{ parseTime(row.collectionDatetime, '{y}-{m}-{d}') }}
+            </span>
             <span v-else-if="item.prop == 'collectionAmount'">{{ formatPrice(row.collectionAmount) }}</span>
             <span v-else>{{ row[item.prop] }}</span>
           </template>
@@ -115,17 +121,17 @@
         planColumns: [
           {
             label: '客户名称',
-            width: 'auto',
+            width: '280px',
             prop: 'custName',
           },
           {
             label: '合同编号',
-            width: '100px',
+            width: '160px',
             prop: 'contractCode',
           },
           {
             label: '计划回款金额',
-            width: '100px',
+            width: '120px',
             prop: 'planAmount',
           },
           {
@@ -135,49 +141,49 @@
           },
           {
             label: '计划回款日期',
-            width: '100px',
+            width: '120px',
             prop: 'planDatetime',
           },
           {
             label: '备注',
-            width: '100px',
+            width: 'auto',
             prop: 'remark',
           },
         ],
         collectionColumns: [
           {
             label: '客户名称',
-            width: 'auto',
+            width: '280px',
             prop: 'custName',
           },
           {
             label: '合同编号',
-            width: '100px',
+            width: '160px',
             prop: 'contractCode',
           },
           {
             label: '回款金额',
-            width: '100px',
+            width: '120px',
             prop: 'collectionAmount',
           },
           {
             label: '回款方式',
-            width: '160px',
+            width: '100px',
             prop: 'collectionType',
           },
           {
             label: '审核状态',
-            width: '80px',
+            width: '100px',
             prop: 'approStatus',
           },
           {
             label: '回款日期',
-            width: '160px',
+            width: '120px',
             prop: 'collectionDatetime',
           },
           {
             label: '备注',
-            width: '160px',
+            width: 'auto',
             prop: 'remark',
           },
         ],

+ 15 - 4
src/views/contract/components/DetailsEnclosure.vue

@@ -1,5 +1,13 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-10 15:03:27
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-01-11 14:45:28
+ * @Description: file content
+ * @FilePath: \订单全流程管理系统\src\views\contract\components\DetailsEnclosure.vue
+-->
 <template>
-  <!-- 回款计划 -->
+  <!-- 附件 -->
   <div class="enclosure-container">
     <el-row class="mb10">
       <el-col class="text-right" :span="24">
@@ -27,10 +35,13 @@
         :prop="item.prop"
         show-overflow-tooltip>
         <template #default="{ row }">
-          <span>{{ row[item.prop] }}</span>
+          <span v-if="item.prop == 'createdTime'">
+            {{ parseTime(row.createdTime, '{y}-{m}-{d} {h}:{i}') }}
+          </span>
+          <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
-      <el-table-column align="center" label="操作">
+      <el-table-column align="center" fixed="right" label="操作">
         <template slot-scope="scope">
           <el-button type="text" @click="downFile(scope.row.fileUrl, scope.row.fileName)">下载</el-button>
           <el-button type="text" @click="rename(scope.row.id)">重命名</el-button>
@@ -101,7 +112,7 @@
           },
           {
             label: '上传人',
-            width: '100px',
+            width: '120px',
             prop: 'createdName',
           },
           {

+ 8 - 8
src/views/contract/components/DetailsInfo.vue

@@ -2,7 +2,7 @@
  * @Author: liuzl 461480418@qq.com
  * @Date: 2023-01-09 13:54:36
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-09 14:38:24
+ * @LastEditTime: 2023-01-11 15:17:07
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\contract\components\DetailsInfo.vue
 -->
@@ -24,14 +24,14 @@
       <el-descriptions-item content-class-name="my-content" label="合同金额" label-class-name="my-label">
         {{ formatPrice(details.contractAmount) }}
       </el-descriptions-item>
+      <el-descriptions-item content-class-name="my-content" label="负责人" label-class-name="my-label">
+        {{ details.inchargeName }}
+      </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="合同开始时间" label-class-name="my-label">
-        {{ details.contractStartTime }}
+        {{ parseTime(details.contractStartTime, '{y}-{m}-{d}') }}
       </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="合同结束时间" label-class-name="my-label">
-        {{ details.contractEndTime }}
-      </el-descriptions-item>
-      <el-descriptions-item content-class-name="my-content" label="负责人" label-class-name="my-label">
-        {{ details.inchargeName }}
+        {{ parseTime(details.contractEndTime, '{y}-{m}-{d}') }}
       </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="公司签约人" label-class-name="my-label">
         {{ details.signatoryName }}
@@ -46,10 +46,10 @@
         {{ details.createdName }}
       </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="创建时间" label-class-name="my-label">
-        {{ details.createdTime }}
+        {{ parseTime(details.createdTime, '{y}-{m}-{d}') }}
       </el-descriptions-item>
       <el-descriptions-item content-class-name="my-content" label="更新时间" label-class-name="my-label">
-        {{ details.updatedTime }}
+        {{ parseTime(details.updatedTime, '{y}-{m}-{d}') }}
       </el-descriptions-item>
     </el-descriptions>
   </div>

+ 22 - 15
src/views/contract/components/DetailsInvoice.vue

@@ -1,5 +1,13 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-10 15:03:27
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-01-11 15:00:47
+ * @Description: file content
+ * @FilePath: \订单全流程管理系统\src\views\contract\components\DetailsInvoice.vue
+-->
 <template>
-  <!-- 回款计划 -->
+  <!-- 发票 -->
   <div class="invoice-container">
     <el-row class="mb10">
       <el-col class="text-right" :span="24">
@@ -25,13 +33,17 @@
           <span v-else-if="item.prop == 'contractAmount'">
             {{ formatPrice(row.contractAmount) }}
           </span>
+          <span v-else-if="item.prop == 'invoiceDate'">{{ parseTime(row.invoiceDate, '{y}-{m}-{d}') }}</span>
+          <span v-else-if="item.prop == 'actualInvoiceDate'">
+            {{ parseTime(row.actualInvoiceDate, '{y}-{m}-{d}') }}
+          </span>
           <span v-else-if="item.prop == 'invoiceAmount'">
             {{ formatPrice(row.invoiceAmount) }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
-      <el-table-column align="center" label="操作">
+      <el-table-column align="center" fixed="right" label="操作">
         <template slot-scope="scope">
           <el-button type="text" @click="$refs.invoicing.init(scope.row.id)">通过</el-button>
         </template>
@@ -62,14 +74,9 @@
         invoiceData: [],
         invoiceTypeData: [], //发票类型
         columns: [
-          {
-            label: '客户名称',
-            width: 'auto',
-            prop: 'custName',
-          },
           {
             label: '合同编号',
-            width: '100px',
+            width: '120px',
             prop: 'contractCode',
           },
           {
@@ -84,37 +91,37 @@
           },
           {
             label: '开票日期',
-            width: '100px',
+            width: '120px',
             prop: 'invoiceDate',
           },
           {
             label: '实际开票日期',
-            width: '100px',
+            width: '120px',
             prop: 'actualInvoiceDate',
           },
           {
             label: '开票类型',
-            width: '100px',
+            width: '80px',
             prop: 'invoiceType',
           },
           {
             label: '发票号码',
-            width: '100px',
+            width: 'auto',
             prop: 'invoiceCode',
           },
           {
             label: '快递单号',
-            width: '100px',
+            width: 'auto',
             prop: 'courierCode',
           },
           {
             label: '审核状态',
-            width: '100px',
+            width: 'auto',
             prop: 'approStatus',
           },
           {
             label: '备注',
-            width: '100px',
+            width: 'auto',
             prop: 'remark',
           },
         ],

+ 5 - 5
src/views/contract/components/DetailsProduct.vue

@@ -48,7 +48,7 @@
         columns: [
           {
             label: '产品名称',
-            width: 'auto',
+            width: '120px',
             prop: 'prodName',
           },
           {
@@ -58,22 +58,22 @@
           },
           {
             label: '建议成交价',
-            width: '100px',
+            width: '120px',
             prop: 'sugSalesPrice',
           },
           {
             label: '售价',
-            width: '160px',
+            width: '120px',
             prop: 'tranPrice',
           },
           {
             label: '数量',
-            width: '160px',
+            width: '100px',
             prop: 'prodNum',
           },
           {
             label: '合计',
-            width: '120px',
+            width: '100px',
           },
         ],
       }

+ 2 - 1
src/views/contract/components/DetailsRecords.vue

@@ -21,7 +21,7 @@
           <vab-icon class="user-avatar" icon="account-circle-fill" />
           <div class="text">
             <p class="action">{{ item.opnPeople }} {{ item.opnType }}</p>
-            <p>{{ item.opnDate }}</p>
+            <p>{{ parseTime(item.opnDate, '{y}-{m}-{d} {h}:{i}') }}</p>
             <p v-if="item.opnContent.custName">
               客户名称:
               <span>{{ item.opnContent.custName }}</span>
@@ -69,6 +69,7 @@
     padding: 10px 20px;
     list-style: none;
     height: 100%;
+    margin-top: 6px;
     overflow-y: auto;
 
     > li {

+ 156 - 63
src/views/contract/components/Edit.vue

@@ -1,10 +1,24 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-09 15:49:34
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-01-11 16:05:02
+ * @Description: file content
+ * @FilePath: \订单全流程管理系统\src\views\contract\components\Edit.vue
+-->
 <template>
-  <el-dialog :title="title" :visible.sync="editVisible" @close="handleClose">
-    <el-form ref="editForm" :model="editForm" :rules="editRules">
+  <el-dialog class="edit-container" :title="title" top="5vh" :visible.sync="editVisible" @close="handleClose">
+    <div class="setp-wrap">
+      <el-steps :active="stepActive" :align-center="true" finish-status="success">
+        <el-step title="基础信息" />
+        <el-step title="产品列表" />
+      </el-steps>
+    </div>
+    <el-form v-show="stepActive == 0" ref="editForm" :model="editForm" :rules="editRules">
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="合同编号" prop="contractCode">
-            <el-input v-model="editForm.contractCode" placeholder="请输入合同编号" />
+            <el-input v-model="editForm.contractCode" disabled placeholder="根据编号规则自动生产" />
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -16,10 +30,11 @@
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="关联项目" prop="nboName">
-            <el-input
-              ref="businessInput"
+            <el-select
               v-model="editForm.nboName"
               placeholder="请选择关联项目"
+              readonly
+              style="width: 100%"
               @focus="openProject" />
           </el-form-item>
         </el-col>
@@ -55,33 +70,35 @@
       </el-row>
       <el-row :gutter="20">
         <el-col :span="12">
-          <el-form-item label="负责人" prop="inchargeId">
+          <el-form-item label="销售工程师" prop="inchargeName">
             <el-select
-              v-model="editForm.inchargeId"
-              placeholder="请选择负责人"
+              v-model="editForm.inchargeName"
+              placeholder="请选择销售工程师"
+              readonly
               style="width: 100%"
-              @change="changeIncharge">
-              <el-option v-for="item in usersList" :key="item.id" :label="item.userName" :value="item.id" />
-            </el-select>
+              @focus="openUser(false, 'inchargeId', 'inchargeName')" />
           </el-form-item>
         </el-col>
         <el-col :span="12">
           <el-form-item label="公司签约人" prop="signatoryName">
-            <el-input
-              ref="userInput"
+            <el-select
+              ref="signatoryName"
               v-model="editForm.signatoryName"
               placeholder="请选择公司签约人"
-              @focus="openUser" />
+              readonly
+              style="width: 100%"
+              @focus="openUser(false, 'signatoryId', 'signatoryName')" />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="经销商" prop="distributorName">
-            <el-input
-              ref="distributorInput"
+            <el-select
               v-model="editForm.distributorName"
               placeholder="请选择经销商"
+              readonly
+              style="width: 100%"
               @focus="openDistributor" />
           </el-form-item>
         </el-col>
@@ -94,15 +111,26 @@
         </el-col>
       </el-row>
       <el-row :gutter="20">
-        <el-col :span="24">
+        <el-col :span="12">
+          <el-form-item label="客户签约人" prop="custSignatoryName">
+            <el-select
+              v-model="editForm.custSignatoryName"
+              :disabled="!businessUserQueryParams.busId"
+              placeholder="请选择客户签约人"
+              readonly
+              style="width: 100%"
+              @focus="openContact" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
           <el-form-item label="备注" prop="remark">
-            <el-input v-model="editForm.remark" placeholder="请输入备注" :rows="5" type="textarea" />
+            <el-input v-model="editForm.remark" placeholder="请输入备注" :rows="4" type="textarea" />
           </el-form-item>
         </el-col>
       </el-row>
     </el-form>
     <!-- 产品分类 -->
-    <el-row>
+    <el-row v-show="stepActive == 1">
       <el-row class="mb10" :gutter="20">
         <el-col :span="12">
           <p>产品:</p>
@@ -123,18 +151,26 @@
     </el-row>
 
     <span slot="footer">
-      <el-button v-show="!editForm.id" type="primary" @click="contractSave">保存</el-button>
-      <el-button v-show="editForm.id" type="primary" @click="contractEdit">保存</el-button>
+      <el-button v-show="stepActive == 0" type="primary" @click="setStep(1)">下一步</el-button>
+      <el-button v-show="stepActive == 1" type="primary" @click="setStep(0)">上一步</el-button>
+      <el-button v-show="!editForm.id && stepActive == 1" type="primary" @click="contractSave">保存</el-button>
+      <el-button v-show="editForm.id && stepActive == 1" type="primary" @click="contractEdit">保存</el-button>
       <el-button @click="editVisible = false">取消</el-button>
     </span>
     <!-- 选择项目 -->
     <select-business ref="project" :multiple="false" @save="getBusinessInfo" />
     <!-- 选择经销商 -->
     <select-distributor ref="distributor" :multiple="false" @save="getDistributor" />
-    <!-- 选择公司签约人 -->
-    <select-user ref="user" :multiple="false" @save="getUser" />
+    <!-- 选择用户 -->
+    <select-user ref="user" :label="label" :multiple="multiple" :property="property" @save="getUser" />
     <!-- 选择产品 -->
     <select-product ref="product" :multiple="true" @save="getProduct" />
+    <!-- 选择联系人 -->
+    <select-business-contact
+      ref="contact"
+      :multiple="false"
+      :query-params="businessUserQueryParams"
+      @save="getContact" />
   </el-dialog>
 </template>
 
@@ -148,6 +184,7 @@
   import SelectDistributor from '@/components/select/SelectDistributor'
   import SelectUser from '@/components/select/SelectUser'
   import SelectProduct from '@/components/select/SelectProduct'
+  import SelectBusinessContact from '@/components/select/SelectBusinessContact'
   export default {
     components: {
       ProductTable,
@@ -155,15 +192,11 @@
       SelectDistributor,
       SelectUser,
       SelectProduct,
-    },
-    props: {
-      usersList: {
-        type: Array,
-        default: () => [],
-      },
+      SelectBusinessContact,
     },
     data() {
       return {
+        stepActive: 0, //步骤
         title: '新增客户信息',
         editVisible: false,
         editForm: {
@@ -173,18 +206,19 @@
           nboId: null, //项目id
           nboName: '', //项目名称
           custName: '', // 客户名称
-          inchargeId: null, //负责人
-          inchargeName: '', //负责人姓名
+          inchargeId: null, //销售工程师
+          inchargeName: '', //销售工程师姓名
           contractStartTime: '', //合同开始时间
           contractEndTime: '', //合同结束时间
           signatoryName: '', //公司签约人
           signatoryId: null, //公司签约人id
           distributorId: null, //经销商id
           distributorName: '', //经销商name
+          custSignatoryId: null, //客户签约人id
+          custSignatoryName: '', //客户签约人name
           remark: '', //备注
         },
         editRules: {
-          contractCode: [{ required: true, trigger: 'blur', message: '请输入合同编号' }],
           contractName: [{ required: true, trigger: 'blur', message: '请输入合同名称' }],
           contractType: [{ required: true, trigger: 'change', message: '请选择合同类型' }],
           nboName: [{ required: true, trigger: 'change', message: '请选择关联项目' }],
@@ -194,7 +228,7 @@
           contractEndTime: [
             { required: true, trigger: 'change', validator: this.pickerOptionsEnd, message: '请选择结束时间' },
           ],
-          inchargeId: [{ required: true, trigger: 'change', message: '请选择负责人' }],
+          inchargeId: [{ required: true, trigger: 'change', message: '请选择销售工程师' }],
           signatoryName: [{ required: true, trigger: 'change', message: '请选择公司签约人' }],
           distributorName: [{ required: true, trigger: 'change', message: '请选择经销商' }],
         },
@@ -216,11 +250,16 @@
         },
         contractOptions: [], //合同类型
         productData: [],
+        multiple: false,
+        property: '',
+        label: '',
+        businessUserQueryParams: {}, //查询客户签约人参数
       }
     },
     computed: {
       ...mapGetters({
         userId: 'user/id',
+        username: 'user/username',
       }),
     },
     mounted() {
@@ -231,15 +270,18 @@
         Promise.all([this.getDicts('contract_type')])
           .then(([contract]) => {
             this.contractOptions = contract.data.values || []
-            // 设置负责人默认为当前用户
-            this.editForm.inchargeId = this.userId
-            this.editForm.inchargeName = this.usersList.filter((item) => item.id == this.userId)[0]['userName']
           })
           .catch((err) => console.log(err))
       },
       async init(id) {
         if (!id) {
           this.title = '新增合同信息'
+          // 设置销售工程师默认为当前用户
+          this.editForm.inchargeId = this.userId
+          this.editForm.inchargeName = this.username
+          this.editForm.signatoryId = this.userId
+          this.editForm.signatoryName = this.username
+          console.log(this.editForm.signatoryName)
         } else {
           this.title = '编辑合同'
           const [err, res] = await to(contractApi.getDetails({ id }))
@@ -248,6 +290,7 @@
             // eslint-disable-next-line no-unused-vars
             let { product, ...data } = res.data
             this.editForm = data
+            this.businessUserQueryParams = { busId: data.nboId, custId: data.custId }
             this.productData =
               product.length > 0
                 ? product.map((item) => ({
@@ -263,14 +306,17 @@
         }
         this.editVisible = true
       },
-      // 修改责任人
-      changeIncharge(selectedId) {
-        this.editForm.inchargeName = this.usersList.filter((item) => item.id == selectedId)[0]['userName']
+      // 修改步骤
+      async setStep(step) {
+        if (step == 1) {
+          const [valid] = await to(this.$refs.editForm.validate())
+          if (valid == false) return
+        }
+        this.stepActive = step
       },
       // 打开选择项目
       openProject() {
         this.$refs.project.open()
-        this.$refs.businessInput.blur()
       },
       // 关闭选择项目获取项目信息
       getBusinessInfo(data) {
@@ -279,13 +325,16 @@
         this.editForm.custName = business.custName
         this.editForm.nboId = business.id
         this.editForm.nboName = business.nboName
+        this.editForm.custSignatoryId = business.contactId
+        this.editForm.custSignatoryName = business.contactName
+        this.businessUserQueryParams = { busId: business.id, custId: business.custId }
+        console.log('项目信息', data)
         // 获取产品信息
         this.getProjectInfo(business.id)
       },
       // 打开选择经销商
       openDistributor() {
         this.$refs.distributor.open()
-        this.$refs.distributorInput.blur()
       },
       // 关闭经销商获取经销商信息
       getDistributor(data) {
@@ -295,16 +344,40 @@
         this.editForm.distributorId = distributor.id
       },
       // 打开选择公司签约人
-      openUser() {
+      openUser(multiple, property, label) {
+        this.multiple = multiple
+        this.property = property
+        this.label = label
+        if (this.editForm[property].length) {
+          this.$refs.user.ids = this.editForm[property]
+        } else if (this.editForm[property]) {
+          this.$refs.user.ids = [this.editForm[property]]
+        } else {
+          this.$refs.user.ids = []
+        }
         this.$refs.user.open()
-        this.$refs.userInput.blur()
       },
       // 获取签约人信息
-      getUser(data) {
+      getUser(userList, property, label) {
+        console.log(userList, property, label)
+        this.editForm[label] = userList.map((item) => item.nickName).join()
+        if (this.multiple) {
+          this.editForm[property] = userList.map((item) => item.id)
+        } else {
+          this.editForm[property] = userList[0] ? userList[0].id : ''
+        }
+        this.$forceUpdate()
+      },
+      // 打开选择公司签约人
+      openContact() {
+        this.$refs.contact.open()
+      },
+      // 获取签约人信息
+      getContact(data) {
         let user = data[0] || null
         if (!user) return
-        this.editForm.signatoryName = user.userName
-        this.editForm.signatoryId = user.id
+        this.editForm['custSignatoryName'] = user.userName
+        this.editForm['custSignatoryId'] = user.id
       },
       // 获取产品信息
       getProduct(data) {
@@ -312,19 +385,20 @@
         if (data.length > 0) this.setProductData(data)
       },
       // 根据项目id获取产品信息
-      getProjectInfo(id) {
+      async getProjectInfo(id) {
         let params = { id }
-        businessApi.getProductByBusinessId(params).then((res) => {
-          if (res.data && res.data.length > 0) this.setProductData(res.data)
-        })
+        const [err, res] = await to(businessApi.getProductByBusinessId(params))
+        console.log(res)
+        if (err) return
+        if (res.data && res.data.length > 0) this.setProductData(res.data)
       },
       setProductData(data) {
         let projData = data.map((item) => ({
-          id: item.id,
+          id: item.prodId ? item.prodId : item.id,
           prodName: item.prodName,
           prodClass: item.prodClass,
           guidPrice: item.guidPrice,
-          price: item.guidPrice,
+          price: item.prodPrice ? item.prodPrice : item.guidPrice,
           count: 1,
         }))
         this.productData.push(...projData)
@@ -359,8 +433,6 @@
           remark: '',
         }))
         let params = Object.assign({ ...this.editForm }, { product })
-        const [valid] = await to(this.$refs.editForm.validate())
-        if (valid == false) return
         if (product.length == 0) return this.$message.warning('请选择产品信息')
         const [err, res] = await to(contractApi.addContract(params))
         if (err) return
@@ -380,8 +452,6 @@
           remark: '',
         }))
         let params = Object.assign({ ...this.editForm }, { product })
-        const [valid] = await to(this.$refs.editForm.validate())
-        if (valid == false) return
         if (product.length == 0) return this.$message.warning('请选择产品信息')
         const [err, res] = await to(contractApi.updateContract(params))
         if (err) return
@@ -398,8 +468,8 @@
           nboId: null, //项目id
           nboName: '', //项目名称
           custName: '', // 客户名称
-          inchargeId: null, //负责人
-          inchargeName: '', //负责人名称
+          inchargeId: null, //销售工程师
+          inchargeName: '', //销售工程师名称
           contractStartTime: '', //合同开始时间
           contractEndTime: '', //合同结束时间
           signatoryName: '', //公司签约人
@@ -409,6 +479,8 @@
           remark: '', //备注
         }
         this.productData = []
+        this.stepActive = 0
+        this.businessUserQueryParams = {}
         this.$refs.editForm.resetFields()
       },
       delcommafy(num) {
@@ -423,10 +495,31 @@
 </script>
 
 <style lang="scss" scoped>
-  .mb10 {
-    margin-bottom: 10px;
-  }
-  .proj-col {
-    text-align: right;
+  $base: '.edit-container';
+  #{$base} {
+    .mb10 {
+      margin-bottom: 10px;
+    }
+    .proj-col {
+      text-align: right;
+    }
+    // 进度条样式
+    // ::v-deep .el-steps {
+    //   .el-step__line {
+    //     top: 17px;
+    //   }
+    //   .el-step__icon {
+    //     width: 35px;
+    //     height: 35px;
+    //     font-size: 18px;
+    //   }
+    //   .is-process {
+    //     .el-step__icon {
+    //       background: #2e51ff;
+    //       color: #fff;
+    //       border-color: #2e51ff;
+    //     }
+    //   }
+    // }
   }
 </style>

+ 1 - 1
src/views/contract/components/EditCollection.vue

@@ -12,7 +12,7 @@
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="合同编号" prop="contractCode">
-            <el-input v-model="editForm.contractCode" :disabled="Boolean(details)" placeholder="请输入合同编号" />
+            <el-input v-model="editForm.contractCode" disabled placeholder="请输入合同编号" />
           </el-form-item>
         </el-col>
         <el-col :span="12">

+ 1 - 1
src/views/contract/components/EditInvoice.vue

@@ -12,7 +12,7 @@
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="合同编号" prop="contractCode">
-            <el-input v-model="editForm.contractCode" :disabled="Boolean(details)" placeholder="请输入合同编号" />
+            <el-input v-model="editForm.contractCode" disabled placeholder="请输入合同编号" />
           </el-form-item>
         </el-col>
         <el-col :span="12">

+ 1 - 1
src/views/contract/components/EditPlan.vue

@@ -12,7 +12,7 @@
       <el-row :gutter="20">
         <el-col :span="12">
           <el-form-item label="合同编号" prop="contractCode">
-            <el-input v-model="editForm.contractCode" :disabled="Boolean(details)" placeholder="请输入合同编号" />
+            <el-input v-model="editForm.contractCode" disabled placeholder="请输入合同编号" />
           </el-form-item>
         </el-col>
         <el-col :span="12">

+ 1 - 1
src/views/contract/components/ProductTable.vue

@@ -70,7 +70,7 @@
         columns: [
           {
             label: '产品名称',
-            width: 'auto',
+            width: '180px',
             prop: 'prodName',
           },
           {

+ 44 - 13
src/views/contract/components/Transfer.vue

@@ -7,18 +7,17 @@
  * @FilePath: \订单全流程管理系统\src\views\contract\components\Transfer.vue
 -->
 <template>
-  <el-dialog append-to-body title="选择转移负责人" :visible.sync="innerVisible" width="40%" @close="handleClose">
+  <el-dialog append-to-body title="选择转移销售工程师" :visible.sync="innerVisible" width="40%" @close="handleClose">
     <el-form ref="userForm" :model="userForm" :rules="userRules">
       <el-row :gutter="20">
         <el-col :span="24">
-          <el-form-item label="负责人" prop="inchargeId">
+          <el-form-item label="销售工程师" prop="inchargeName">
             <el-select
-              v-model="userForm.inchargeId"
-              placeholder="请选择负责人"
+              v-model="userForm.inchargeName"
+              placeholder="请选择销售工程师"
+              readonly
               style="width: 100%"
-              @change="changeIncharge">
-              <el-option v-for="item in usersList" :key="item.id" :label="item.userName" :value="item.id" />
-            </el-select>
+              @focus="openUser(false, 'inchargeId', 'inchargeName')" />
           </el-form-item>
         </el-col>
       </el-row>
@@ -27,13 +26,20 @@
       <el-button size="mini" type="primary" @click="save">确认</el-button>
       <el-button size="mini" @click="handleClose">取消</el-button>
     </span>
+    <!-- 选择用户 -->
+    <select-user ref="user" :label="label" :multiple="multiple" :property="property" @save="getUser" />
   </el-dialog>
 </template>
 
 <script>
   import to from 'await-to-js'
   import contractApi from '@/api/contract'
+  import SelectUser from '@/components/select/SelectUser'
+
   export default {
+    components: {
+      SelectUser,
+    },
     props: {
       contractId: {
         type: Number,
@@ -47,20 +53,45 @@
     data() {
       return {
         userForm: {
-          inchargeId: null,
+          inchargeId: 0,
           inchargeName: '',
         },
         innerVisible: false,
         userRules: {
-          inchargeId: [{ required: true, trigger: 'change', message: '请选择负责人' }],
+          inchargeId: [{ required: true, trigger: 'change', message: '请选择销售工程师' }],
         },
+        multiple: false,
+        property: '',
+        label: '',
       }
     },
     mounted() {},
     methods: {
-      // 修改责任人
-      changeIncharge(selectedId) {
-        this.userForm.inchargeName = this.usersList.filter((item) => item.id == selectedId)[0]['userName']
+      // 打开选择公司签约人
+      openUser(multiple, property, label) {
+        this.multiple = multiple
+        this.property = property
+        this.label = label
+        console.log('property', property)
+        if (this.userForm[property].length) {
+          this.$refs.user.ids = this.userForm[property]
+        } else if (this.userForm[property]) {
+          this.$refs.user.ids = [this.userForm[property]]
+        } else {
+          this.$refs.user.ids = []
+        }
+        this.$refs.user.open()
+      },
+      // 获取签约人信息
+      getUser(userList, property, label) {
+        console.log(userList, property, label)
+        this.userForm[label] = userList.map((item) => item.nickName).join()
+        if (this.multiple) {
+          this.userForm[property] = userList.map((item) => item.id)
+        } else {
+          this.userForm[property] = userList[0] ? userList[0].id : ''
+        }
+        this.$forceUpdate()
       },
       open() {
         this.innerVisible = true
@@ -80,7 +111,7 @@
         this.innerVisible = false
         this.$emit('transferSave')
         this.userForm = {
-          inchargeId: null,
+          inchargeId: 0,
           inchargeName: '',
         }
         this.$refs.userForm.resetFields()

+ 70 - 14
src/views/contract/detail.vue

@@ -2,7 +2,7 @@
  * @Author: liuzl 461480418@qq.com
  * @Date: 2023-01-05 16:29:01
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-09 18:22:10
+ * @LastEditTime: 2023-01-11 16:10:19
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\contract\detail.vue
 -->
@@ -24,8 +24,10 @@
             <el-descriptions-item content-class-name="my-content" label="合同金额(元)" label-class-name="my-label">
               {{ formatPrice(details.contractAmount) }}
             </el-descriptions-item>
-            <el-descriptions-item content-class-name="my-content" label="下单时间" label-class-name="my-label">
-              {{ details.createdTime }}
+            <el-descriptions-item content-class-name="my-content" label="合同时间" label-class-name="my-label">
+              {{ parseTime(details.contractStartTime, '{y}-{m}-{d}') }}~{{
+                parseTime(details.contractEndTime, '{y}-{m}-{d}')
+              }}
             </el-descriptions-item>
             <el-descriptions-item content-class-name="my-content" label="回款金额(元)" label-class-name="my-label">
               {{ formatPrice(details.collectedAmount) }}
@@ -54,9 +56,19 @@
         </el-tabs>
       </el-col>
       <el-col :span="8">
+        <div class="buttons">
+          <el-button type="primary" @click="handleTransfer">转移</el-button>
+          <el-button type="primary" @click="handleEdit">编辑</el-button>
+          <el-button @click="handleDelete">删除</el-button>
+          <el-button @click="back">返回</el-button>
+        </div>
         <details-records :dynamics-list="dynamicsList" />
       </el-col>
     </el-row>
+    <!-- 新增编辑客户弹窗 -->
+    <Edit ref="edit" @contractSave="init" />
+    <!-- 转移合同 -->
+    <Transfer ref="transfer" :contract-id="id" @transferSave="init" />
   </div>
 </template>
 
@@ -70,10 +82,21 @@
   import DetailsRecords from './components/DetailsRecords'
   import DetailsInvoice from './components/DetailsInvoice'
   import DetailsEnclosure from './components/DetailsEnclosure'
+  import Edit from './components/Edit'
+  import Transfer from './components/Transfer'
 
   export default {
     name: 'ContractDetail',
-    components: { DetailsInfo, DetailsProduct, DetailsCollection, DetailsRecords, DetailsInvoice, DetailsEnclosure },
+    components: {
+      DetailsInfo,
+      DetailsProduct,
+      DetailsCollection,
+      DetailsRecords,
+      DetailsInvoice,
+      DetailsEnclosure,
+      Edit,
+      Transfer,
+    },
     data() {
       return {
         id: '',
@@ -91,22 +114,22 @@
       }),
     },
     mounted() {
-      this.id = this.$route.query.id
+      this.id = parseInt(this.$route.query.id) || null
       this.init()
       this.getRecord()
     },
     methods: {
-      init() {
-        Promise.all([contractApi.getDetails({ id: parseInt(this.id) })]).then(([details]) => {
-          if (details.data) {
-            let { product, ...data } = details.data
-            this.product = product
-            this.details = data
-          }
-        })
+      async init() {
+        const [err, res] = await to(contractApi.getDetails({ id: this.id }))
+        if (err) return
+        if (res.data) {
+          let { product, ...data } = res.data
+          this.product = product
+          this.details = data
+        }
       },
       async getRecord() {
-        const [err, res] = await to(contractApi.getDynamicsList({ contractId: parseInt(this.id) }))
+        const [err, res] = await to(contractApi.getDynamicsList({ contractId: this.id }))
         if (err) return
         if (res.data.list) {
           let obj = res.data.list
@@ -120,6 +143,39 @@
           console.log(this.dynamicsList)
         }
       },
+      async handleEdit() {
+        this.$refs.edit.init(this.id)
+      },
+      // 合同删除
+      handleDelete() {
+        let ids = [this.id]
+        if (!ids[0]) {
+          return
+        }
+        this.$confirm('确认删除?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+          .then(async () => {
+            const [err, res] = await to(contractApi.delContract({ id: ids }))
+            if (err) return
+            if (res.code == 200) {
+              this.$message({
+                type: 'success',
+                message: '删除成功!',
+              })
+              this.$router.push({
+                path: '/contract/manage',
+              })
+            }
+          })
+          .catch(() => {})
+      },
+      // 转移合同
+      handleTransfer() {
+        this.$refs.transfer.open()
+      },
       back() {
         this.$router.go(-1)
       },

+ 43 - 47
src/views/contract/manage.vue → src/views/contract/index.vue

@@ -2,8 +2,8 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-05 11:28:51
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-09 14:03:40
- * @FilePath: \订单全流程管理系统\src\views\contract\manage.vue
+ * @LastEditTime: 2023-01-11 15:09:48
+ * @FilePath: \订单全流程管理系统\src\views\contract\index.vue
 -->
 <template>
   <div class="contract-manage">
@@ -41,7 +41,7 @@
         </el-form>
       </vab-query-form-top-panel>
       <vab-query-form-left-panel :span="12">
-        <el-button icon="el-icon-plus" size="mini" type="primary" @click="handleEdit()">新建</el-button>
+        <el-button icon="el-icon-plus" type="primary" @click="handleEdit()">新建</el-button>
         <el-button icon="el-icon-delete" type="danger" @click="handleDelete()">删除</el-button>
       </vab-query-form-left-panel>
       <vab-query-form-right-panel :span="12">
@@ -52,7 +52,7 @@
       v-loading="listLoading"
       border
       :data="list"
-      height="calc(100vh - 290px)"
+      height="calc(100vh - 330px)"
       @selection-change="setSelectRows">
       <el-table-column align="center" show-overflow-tooltip type="selection" />
       <el-table-column
@@ -68,9 +68,12 @@
           <el-button v-if="item.prop === 'custName'" class="link-button" type="text" @click="handleCustDetail(row)">
             {{ row.custName }}
           </el-button>
-          <span v-else-if="item.prop === 'contractAmount'" class="link-button" type="text">
+          <span v-else-if="item.prop === 'contractAmount'">
             {{ formatPrice(row.contractAmount) }}
           </span>
+          <span v-else-if="item.label === '合同时间'">
+            {{ parseTime(row.contractStartTime, '{y}-{m}-{d}') }}~{{ parseTime(row.contractEndTime, '{y}-{m}-{d}') }}
+          </span>
           <el-button
             v-else-if="item.prop === 'contractName'"
             style="font-size: 14px"
@@ -81,7 +84,7 @@
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
-      <el-table-column align="center" label="操作">
+      <el-table-column align="center" fixed="right" label="操作" width="120px">
         <template slot-scope="scope">
           <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
           <el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
@@ -98,21 +101,15 @@
       @current-change="handleCurrentChange"
       @size-change="handleSizeChange" />
     <!-- 新增编辑客户弹窗 -->
-    <Edit ref="edit" :users-list="usersList" @contractSave="contractSave" @createContact="createContact" />
+    <Edit ref="edit" @contractSave="contractSave" />
     <!-- 转移合同 -->
-    <Transfer
-      ref="transfer"
-      :contract-id="contractId"
-      :users-list="usersList"
-      @createContact="createContact"
-      @transferSave="contractSave" />
+    <Transfer ref="transfer" :contract-id="contractId" @transferSave="contractSave" />
   </div>
 </template>
 
 <script>
   import to from 'await-to-js'
   import contractApi from '@/api/contract'
-  import userApi from '@/api/system/user'
   import Edit from './components/Edit'
   import TableTool from '@/components/table/TableTool'
   import Transfer from './components/Transfer'
@@ -125,7 +122,6 @@
     },
     data() {
       return {
-        usersList: [], //负责人列表
         approStatusOption: [
           { id: 1, label: '审批中' },
           { id: 2, label: '已拒绝' },
@@ -153,70 +149,84 @@
         columns: [
           {
             label: '合同编号',
-            width: '120px',
+            width: '160px',
             prop: 'contractCode',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '合同名称',
-            width: '120px',
+            width: '280px',
             prop: 'contractName',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '客户名称',
-            width: '120px',
+            width: '280px',
             prop: 'custName',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '项目名称',
-            width: 'auto',
+            width: '280px',
             prop: 'nboName',
             sortable: false,
             disableCheck: false,
           },
-          {
-            label: '审批状态',
-            width: 'auto',
-            prop: 'approStatus',
-            sortable: false,
-            disableCheck: false,
-          },
           {
             label: '合同类型',
-            width: 'auto',
+            width: '100px',
             prop: 'contractType',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '合同金额',
-            width: 'auto',
+            width: '120px',
             prop: 'contractAmount',
             sortable: false,
             disableCheck: false,
           },
           {
-            label: '负责人',
-            width: 'auto',
+            label: '合同时间',
+            width: '180px',
+            prop: 'distributorName',
+            sortable: false,
+            disableCheck: false,
+          },
+          {
+            label: '审批状态',
+            width: '100px',
+            prop: 'approStatus',
+            sortable: false,
+            disableCheck: false,
+          },
+          {
+            label: '销售工程师',
+            width: '120px',
             prop: 'inchargeName',
             sortable: false,
             disableCheck: false,
           },
           {
             label: '公司签约人',
-            width: '140px',
+            width: '120px',
             prop: 'signatoryName',
             sortable: false,
             disableCheck: false,
           },
           {
-            label: '经销商',
-            width: '140px',
+            label: '客户签约人',
+            width: '120px',
+            prop: 'custSignatoryName',
+            sortable: false,
+            disableCheck: false,
+          },
+          {
+            label: '经销商/代理商',
+            width: '120px',
             prop: 'distributorName',
             sortable: false,
             disableCheck: false,
@@ -231,16 +241,8 @@
     },
     mounted() {
       this.queryData()
-      this.getOptions()
     },
     methods: {
-      getOptions() {
-        Promise.all([userApi.getList()])
-          .then(([user]) => {
-            this.usersList = user.data.list || []
-          })
-          .catch((err) => console.log(err))
-      },
       async queryData() {
         this.listLoading = true
         const params = { ...this.queryForm }
@@ -323,12 +325,6 @@
           })
           .catch(() => {})
       },
-      // 联系人弹窗
-      createContact(res) {
-        this.$refs.contact.contactForm.custId = res.id
-        this.$refs.contact.contactForm.custName = res.name
-        this.$refs.contact.contactVisible = true
-      },
       contractSave() {
         this.queryData()
       },