Jelajahi Sumber

财务-合同归档

wangqiang 2 tahun lalu
induk
melakukan
c93bd5adb0

+ 2 - 2
src/views/modules/cw/workContract/ContractFileForm.vue

@@ -139,7 +139,7 @@
 
         <el-col :span="12">
           <el-form-item label="合同归档审批类型" prop="contractApprovalType"
-                        :rules="[{required: true, message: '付款主体不能为空', trigger: 'blur'}
+                        :rules="[{required: true, message: '合同归档审批类型不能为空', trigger: 'blur'}
                  ]">
             <el-select v-model="inputForm.contractApprovalType" placeholder="请选择" style="width:100%;">
               <el-option
@@ -182,7 +182,7 @@
         </el-tab-pane>
         <el-tab-pane label="参与签约方" name="contactParty">
           <el-row :gutter="15">
-            <el-button type="info" style="margin-bottom: 15px" size="mini" :disabled="true" @click="openWorkClient">
+            <el-button type="info" :disabled="true" style="margin-bottom: 15px" size="mini"  @click="openWorkClient">
               新增参与签约方
             </el-button>
           </el-row>

+ 483 - 256
src/views/modules/cw/workContract/ContractNameForm.vue

@@ -5,206 +5,252 @@
       :close-on-click-modal="false"
       v-dialogDrag
       width="1200px"
-      @close="close(),closeXTable()"
-      @keyup.enter.native="doSubmit"
+      height="500px"
+      @close="close"
+      @keyup.enter.native=""
       :visible.sync="visible">
-        <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
-           label-width="150px">
+    <el-form size="middle" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+             label-width="150px">
 
-          <el-row  :gutter="0">
-            <el-col :span="12">
-              <el-form-item label="合同编号" prop="contractNo"
-                            :rules="[{required: true, message: '合同编号不能为空', trigger: 'blur'}
-                 ]">
-                <el-input maxlength="64" :disabled="true" v-model="inputForm.contractNo" placeholder="自动生成"></el-input>
-              </el-form-item>
-            </el-col>
-
-            <el-col :span="12">
-              <el-form-item label="合同名称" prop="contractName"
-                            :rules="[{required: true, message: '合同名称不能为空', trigger: 'blur'}
-                 ]">
-                <el-input v-model="inputForm.contractName" placeholder="请输入合同名称"     clearable></el-input>
-              </el-form-item>
-            </el-col>
+      <el-row  :gutter="0">
 
-          </el-row>
-
-          <el-row  :gutter="15">
-
-            <el-col :span="12">
-              <el-form-item label="合同状态" prop="contractStatus"
-                            :rules="[{required: true, message: '合同状态不能为空', trigger: 'blur'}
+        <el-col :span="12">
+          <el-form-item label="合同编号" prop="contractNo">
+            <el-input maxlength="64" :disabled="true" v-model="inputForm.contractNo" placeholder="自动生成"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="合同名称" prop="contractName"
+                        :rules="[{required: true, message: '合同名称不能为空', trigger: 'blur'}
                  ]">
-                <el-input maxlength="64" v-model="inputForm.contractStatus" :disabled="true" placeholder="请输入合同状态"></el-input>
-              </el-form-item>
-            </el-col>
-
-            <el-col :span="12">
-              <el-form-item label="付款主体" prop="payerSubject"
-                            :rules="[{required: true, message: '付款主体不能为空', trigger: 'blur'}
+            <el-input v-model="inputForm.contractName"  placeholder="请输入合同名称"     clearable></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="合同状态" prop="contractStatus">
+            <el-input maxlength="64" :disabled="true" v-model="inputForm.contractStatus" placeholder="请输入合同状态"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="付款主体" prop="payerSubject"
+                        :rules="[{required: true, message: '付款主体不能为空', trigger: 'blur'}
                  ]">
-                <el-select v-model="inputForm.payerSubject" placeholder="请选择付款主体" style="width:100%;">
-                  <el-option
-                    v-for="item in $dictUtils.getDictList('cw_payment_subject')"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-            </el-col>
-
-            <el-col :span="12">
-              <el-form-item label="付款方式" prop="paymentMethod"
-                            :rules="[{required: true, message: '付款方式不能为空', trigger: 'blur'}
+            <el-select v-model="inputForm.payerSubject" placeholder="请选择付款主体" style="width:100%;">
+              <el-option
+                v-for="item in $dictUtils.getDictList('cw_payment_subject')"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="付款方式" prop="paymentMethod"
+                        :rules="[{required: true, message: '付款方式不能为空', trigger: 'blur'}
                  ]">
-                <el-select v-model="inputForm.paymentMethod" placeholder="请选择付款方式" style="width:100%;">
-                  <el-option
-                    v-for="item in $dictUtils.getDictList('cw_payment_method')"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-            </el-col>
+            <el-select v-model="inputForm.paymentMethod" placeholder="请选择付款方式" style="width:100%;">
+              <el-option
+                v-for="item in $dictUtils.getDictList('cw_payment_method')"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="签约日期" prop="signingDate"
-                            :rules="[
+        <el-col :span="12">
+          <el-form-item label="签约日期" prop="signingDate"
+                        :rules="[
                 {required: true, message:'请输入签约日期', trigger:'blur'}
                ]">
-                <el-date-picker
-                  placement="bottom-start"
-                  value-format="yyyy-MM-dd"
-                  v-model="inputForm.signingDate"
-                  style="width: 100%"
-                  placeholder="选择日期">
-                </el-date-picker>
-              </el-form-item>
-            </el-col>
+            <el-date-picker
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              v-model="inputForm.signingDate"
+              style="width: 100%"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="合同金额(元)" prop="contractAmount"
-                            :rules="[
+        <el-col :span="12">
+          <el-form-item label="合同金额(元)" prop="contractAmount"
+                        :rules="[
                   {required: true, message:'请输入合同金额(元)', trigger:'blur'}
                ]">
-                <el-input maxlength="15" v-model="inputForm.contractAmount" placeholder="请输入合同金额(元)"
-                          @keyup.native="inputForm.contractAmount = twoDecimalPlaces(inputForm.contractAmount)"
-                ></el-input>
-              </el-form-item>
-            </el-col>
+            <el-input maxlength="15" v-model="inputForm.contractAmount" placeholder="请输入合同金额(元)"
+                      @keyup.native="inputForm.contractAmount = twoDecimalPlaces(inputForm.contractAmount)"
+            ></el-input>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="合同实际金额" prop="actualContractAmount">
-                <el-input maxlength="64" :disabled="true" v-model="inputForm.actualContractAmount" ></el-input>
-              </el-form-item>
-            </el-col>
+        <el-col :span="12">
+          <el-form-item label="合同实际金额" prop="actualContractAmount"
+                        :rules="[
+                  {required: true, message:'请输入合同实际金额(元)', trigger:'blur'}
+               ]">
+            <el-input maxlength="15" :disabled="true" v-model="inputForm.actualContractAmount" placeholder="请输入合同实际金额(元)"
+                      @keyup.native="inputForm.actualContractAmount = twoDecimalPlaces(inputForm.actualContractAmount)"
+            ></el-input>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="合同份数" prop="contractNum"
-                            :rules="[{required: true, message: '合同份数', trigger: 'blur'}
+        <el-col :span="12">
+          <el-form-item label="合同份数" prop="contractNum"
+                        :rules="[{required: true, message: '合同份数', trigger: 'blur'}
                  ]">
-                <el-input maxlength="64" v-model="inputForm.contractNum" placeholder="请输入合同份数"></el-input>
-              </el-form-item>
-            </el-col>
+            <el-input maxlength="64" v-model="inputForm.contractNum" placeholder="请输入合同份数"></el-input>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="付款约定" prop="paymentAgreement">
-                <el-input maxlength="64" v-model="inputForm.paymentAgreement" placeholder="请输入付款约定"></el-input>
-              </el-form-item>
-            </el-col>
+        <el-col :span="12">
+          <el-form-item label="付款约定" prop="paymentAgreement">
+            <el-input maxlength="64" v-model="inputForm.paymentAgreement" placeholder="请输入付款约定"></el-input>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="修改次数" prop="changeNum"
-                            :rules="[{required: true, message: '修改次数', trigger: 'blur'}
+        <el-col :span="12">
+          <el-form-item label="修改次数" prop="changeNum"
+                        :rules="[{required: true, message: '修改次数', trigger: 'blur'}
                  ]">
-                <el-input maxlength="64" :disabled="true" v-model="inputForm.changeNum" placeholder="请输入修改次数"></el-input>
-              </el-form-item>
-            </el-col>
+            <el-input maxlength="64" :disabled="true" v-model="inputForm.changeNum" placeholder="请输入修改次数"></el-input>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="所属部门" prop="department"
-                            :rules="[{required: true, message: '所属部门', trigger: 'blur'}
-                 ]">
-                <el-input maxlength="64" v-model="inputForm.department" placeholder="请输入所属部门"></el-input>
-              </el-form-item>
-            </el-col>
+        <el-col :span="12">
+          <el-form-item  prop="department" label="所属部门">
+            <SelectTree
+              ref="officeTree"
+              :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
 
-            <el-col :span="12">
-              <el-form-item label="委托方联系人" prop="clientContacts"
-                            :rules="[{required: true, message: '委托方联系人', trigger: 'blur'}
-                 ]">
-                <el-input maxlength="100" v-model="inputForm.clientContacts" placeholder="请输入委托方联系人"></el-input>
-              </el-form-item>
-            </el-col>
+              :url="`/sys/office/treeData?type=2`"
+              :value="inputForm.department"
+              :accordion="true"
+              @getValue="(value) => {inputForm.department=value}"/>
+          </el-form-item>
+        </el-col>
 
-            <el-col :span="12">
-              <el-form-item label="委托方联系人电话" prop="clientContactsPhone"
-                            :rules="[{required: true, message: '委托方联系人电话', trigger: 'blur'}
+        <el-col :span="12">
+          <el-form-item label="委托方联系人" prop="clientContacts"
+                        :rules="[{required: true, message: '委托方联系人', trigger: 'blur'}
                  ]">
-                <el-input maxlength="15" v-model="inputForm.clientContactsPhone" placeholder="请输入委托方联系人电话"
-                          @keyup.native="inputForm.clientContactsPhone = twoDecimalPlaces(inputForm.clientContactsPhone)"
-                ></el-input>
-              </el-form-item>
-            </el-col>
-
-          </el-row>
+            <el-input maxlength="100" v-model="inputForm.clientContacts" placeholder="请输入委托方联系人"></el-input>
+          </el-form-item>
+        </el-col>
 
-          <el-col :span="12">
-            <el-form-item label="合同归档审批类型" prop="contractApprovalType">
-              <el-select :disabled="true" v-model="inputForm.contractApprovalType" placeholder="请选择" style="width:100%;">
-                <el-option
-                  v-for="item in $dictUtils.getDictList('contract_type')"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value">
-                </el-option>
-              </el-select>
-            </el-form-item>
-          </el-col>
+        <el-col :span="12">
+          <el-form-item label="委托方联系人电话" prop="clientContactsPhone"
+                        :rules="[{required: true, message: '委托方联系人电话', trigger: 'blur'}
+                 ]">
+            <el-input maxlength="15" v-model="inputForm.clientContactsPhone" placeholder="请输入委托方联系人电话"
+                      @keyup.native="inputForm.clientContactsPhone = twoDecimalPlaces(inputForm.clientContactsPhone)"
+            ></el-input>
+          </el-form-item>
+        </el-col>
 
-          <el-col :span="12">
-            <el-form-item label="创建人" prop="createBy"
-                          :rules="[{required: true, message: '创建人', trigger: 'blur'}
+        <el-col :span="12">
+          <el-form-item label="创建人" prop="createBy"
+                        :rules="[{required: true, message: '创建人', trigger: 'blur'}
                  ]">
-              <el-input maxlength="64" :disabled="true" v-model="inputForm.createBy" placeholder="请输入创建人"></el-input>
-            </el-form-item>
-          </el-col>
+            <el-input maxlength="64" :disabled="true" v-model="inputForm.createBy" placeholder="请输入创建人"></el-input>
+          </el-form-item>
+        </el-col>
 
-          <el-col :span="12">
-            <el-form-item label="创建时间" prop="createDate">
-              <el-date-picker
-                placement="bottom-start"
-                value-format="yyyy-MM-dd"
-                v-model="inputForm.createDate"
-                style="width: 100%"
-                :disabled="true"
-                placeholder="选择日期">
-              </el-date-picker>
-            </el-form-item>
-          </el-col>
+        <el-col :span="12">
+          <el-form-item label="创建时间" prop="createDate">
+            <el-date-picker
+              placement="bottom-start"
+              value-format="yyyy-MM-dd"
+              v-model="inputForm.createDate"
+              style="width: 100%"
+              :disabled="true"
+              placeholder="选择日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
 
+      </el-row>
+    </el-form>
+    <el-tabs v-model="activeName" type="border-card" @tab-click="tabHandleClick">
+      <el-tab-pane label="合同正文" name="uploadFile">
+        <!--        合同正文-->
+        <UpLoadComponent ref="uploadFile"></UpLoadComponent>
+      </el-tab-pane>
+      <el-tab-pane label="参与签约方" name="contactParty">
+        <el-row :gutter="15">
+          <el-button type="info" :disabled="method === 'view'" style="margin-bottom: 15px" size="mini"  @click="openWorkClient">
+            新增参与签约方
+          </el-button>
+        </el-row>
+        <el-row  :gutter="15">
+          <el-form :disabled="method === 'view'">
+            <vxe-table
+              border
+              show-overflow
+              show-footer
+              :column-config="{resizable: true}"
+              ref="contactTable"
+              :key="tableKeyClient"
+              class="vxe-table-element"
+              :data="inputForm.cwWorkClientContactDTOList"
+              style=""
+              @cell-click=""
+              @edit-closed=""
+              highlight-current-row
+              :edit-config="{trigger: 'click', mode: 'row', showStatus: false, autoClear: false}"
+            >
+              <vxe-table-column align="center" field="no" title="客户编号" :edit-render="{}">
+                <template v-slot:edit="scope">
+                  <el-input :readonly="true" v-model="scope.row.no" placeholder="客户编号" clearable></el-input>
+                </template>
+              </vxe-table-column>
+              <vxe-table-column align="center" field="name" title="客户名称" :edit-render="{}">
+                <template v-slot:edit="scope">
+                  <el-input :readonly="true" v-model="scope.row.name" placeholder="客户名称" clearable></el-input>
+                </template>
+              </vxe-table-column>
+              <vxe-table-column align="center" title="操作" width="100">
+                <template v-slot="scope">
+                  <el-button size="mini" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'client')">删除</el-button>
+                </template>
+              </vxe-table-column>
+            </vxe-table>
           </el-form>
+        </el-row>
+      </el-tab-pane>
+      <el-tab-pane label="合同归档文件" name="archiveFile">
+        <!--        合同归档文件-->
+        <UpLoadComponent ref="archiveFile"></UpLoadComponent>
+      </el-tab-pane>
 
-      <el-image-viewer
-        v-if="showViewer"
-        :on-close="closeViewer"
-        :url-list="[url]"
-        zIndex="9999"/>
+    </el-tabs>
       <span slot="footer" class="dialog-footer">
-      <el-button size="small" @click="close(),closeXTable()" icon="el-icon-circle-close">关闭</el-button>
-      <el-button size="small" type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick >确定</el-button>
+      <el-button size="small" @click="close()" icon="el-icon-circle-close">关闭</el-button>
+      <el-button size="small" v-if="method === 'edit'" type="primary" icon="el-icon-circle-check" @click="doSubmit('save')">确定</el-button>
     </span>
+
+    <el-image-viewer
+      v-if="showViewer"
+      :on-close="closeViewer"
+      :url-list="[url]"
+      zIndex="9999"/>
+    <WorkClientChooseForm ref="workClientChooseForm" @getWorkClientChoose="getWorkClientChoose"></WorkClientChooseForm>
     </el-dialog>
   </div>
 </template>
 
 <script>
   import ContractInfoService from '@/api/cw/workContract/ContractInfoService'
-  import WorkClientService from '@/api/sys/WorkClientService'
-  import WorkClientSelect from '@/components/workClientInfoSelect'
+  import ContractFileService from '../../../../api/cw/workContract/ContractFileService'
+  import UpLoadComponent from '@/views/common/UpLoadComponent'
+  import WorkClientChooseForm from '../workClientInfo/WorkClientChooseForm'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
   import OSSSerive, {
     httpRequest,
     toHref,
@@ -238,21 +284,24 @@
           contractAmountType: '',
           contractAmount: '',
           contractOpposite: '',
-          contractFees: [],
+          fees: '',
           contractFee: '',
           describes: '',
           contractSpecial: '',
           remarks: '',
           clientName: '',
-          permissionFlag: '',
-          showVi: true,
-          workAttachmentList: []
+          status: '',
+          contractProperList: [],
+          contractInfoList: [],
+          customerNo: '',
+          customerName: ''
         },
         inputForm: {
           contractNo: '',
           contractName: '',
           payerSubject: '',
           paymentMethod: '',
+          contractInfoId: '',
           signingDate: '',
           contractAmount: '',
           actualContractAmount: '',
@@ -264,9 +313,13 @@
           clientContacts: '',
           clientContactsPhone: '',
           contractApprovalType: '',
-          createBy: '',
-          createDate: ''
+          createBy: JSON.parse(localStorage.getItem('user')).name,
+          createId: JSON.parse(localStorage.getItem('user')).id,
+          createDate: '',
+          contractProperList: [],
+          contractInfoList: []
         },
+        activeName: 'archiveFile',
         filesArra2: [],
         fileList: [],
         isFlag: true,
@@ -274,29 +327,79 @@
         url: '',
         rowurl: '',
         src: '',
-        showVi: true,
         onedit: false,
         type: '',
         loadProgress: 0, // 动态显示进度条
-        progressFlag: false // 关闭进度条
+        progressFlag: false, // 关闭进度条
+        promi: null,
+        keyWatch: '',
+        tableKeyClient: '1'
+      }
+    },
+    props: {
+      businessId: {
+        type: String,
+        default: ''
+      },
+      formReadOnly: {
+        type: Boolean,
+        default: false
+      },
+      status: {
+        type: String,
+        default: ''
       }
     },
     components: {
       ElImageViewer,
-      WorkClientSelect
+      UpLoadComponent,
+      WorkClientChooseForm,
+      SelectTree
     },
     ossService: null,
+    // workContractService: null,
     contractInfoService: null,
-    workClientService: null,
+    contractFileService: null,
     created () {
       this.ossService = new OSSSerive()
+      // this.workContractService = new WorkContractService()
       this.contractInfoService = new ContractInfoService()
-      this.workClientService = new WorkClientService()
+      this.contractFileService = new ContractFileService()
     },
     mounted () {
       window.onPreview = this.onPreview
     },
+    computed: {
+      officeName () {
+        return JSON.parse(localStorage.getItem('user')).officeDTO.name
+      },
+      bus: {
+        get () {
+          this.$refs.archiveFile.setDividerName('附件')
+          return this.businessId
+        },
+        set (val) {
+          this.businessId = val
+        }
+      }
+    },
+    watch: {
+      'keyWatch': {
+        handler (newVal) {
+          if (this.commonJS.isNotEmpty(this.bus)) {
+            this.init('', this.bus)
+          } else {
+            this.$nextTick(() => {
+              this.$refs.inputForm.resetFields()
+            })
+          }
+        }
+      }
+    },
     methods: {
+      getKeyWatch (keyWatch) {
+        this.keyWatch = keyWatch
+      },
       uploadVideoProcess (event, file, fileList) {
         this.progressFlag = true // 显示进度条
         this.loadProgress = parseInt(event.percent) // 动态获取文件上传进度
@@ -318,9 +421,17 @@
         this.showViewer = false
       },
       init (method, id) {
+        console.log(method)
+        console.log('id', id)
         this.dataList = []
         this.dataListNew = []
-        this.method = method
+        if (method === 'edit') {
+          this.method = method
+          this.title = '合同信息修改'
+        } else {
+          this.method = 'view'
+          this.title = '合同信息详情'
+        }
         this.inputForm = {
           contractNo: '',
           contractName: '',
@@ -335,14 +446,19 @@
           changeNum: '',
           department: '',
           clientContacts: '',
+          contractInfoId: '',
           clientContactsPhone: '',
           contractApprovalType: '',
-          createBy: '',
-          createDate: ''
+          createBy: JSON.parse(localStorage.getItem('user')).name,
+          createId: JSON.parse(localStorage.getItem('user')).id,
+          createDate: '',
+          contractProperList: [],
+          contractInfoList: [],
+          cwWorkClientContactDTOList: []
         }
         this.inputForm.id = id
         if (method === 'add') {
-          this.inputForm.contractAmountType = '1'
+          // this.inputForm.contractAmountType = '1'
           this.title = `新建合同登记`
         } else if (method === 'edit') {
           this.title = '修改合同登记'
@@ -353,60 +469,178 @@
         this.visible = true
         this.loading = false
         this.$nextTick(() => {
-          // this.$refs.upload.clearFiles()
           this.$refs.inputForm.resetFields()
-          if (method === 'edit' || method === 'view') { // 修改或者查看
-            this.loading = true
-            this.contractInfoService.findById(this.inputForm.id).then(({data}) => {
-              this.inputForm = this.recover(this.inputForm, data)
-              const f = []
-              if (data.fees !== null && data.fees !== undefined && data.fees !== '') {
-                data.fees.split(',').forEach(item => {
-                  if (item !== null && item !== undefined && item !== '') {
-                    f.push(item)
+            // if (method === 'edit' || method === 'view') { // 修改或者查看
+          this.loading = true
+          this.contractInfoService.findById(this.inputForm.id).then(data1 => {
+            this.$refs.archiveFile.clearUpload()
+            this.$refs.uploadFile.clearUpload()
+            this.inputForm.contractProperList = data1.data.contractProperList
+            console.log('data1.id', data1.data.id)
+            console.log('data1.data.filedType', data1.data.filedType)
+            if ((data1.data.filedType !== '0' & data1.data.filedType !== undefined) || data1.data.id === undefined) {
+              console.log('data1.22222')
+              this.contractFileService.findById(this.inputForm.id).then(data2 => {
+                this.inputForm.contractProperList = data2.data.contractProperList
+                this.inputForm.contractInfoList = data2.data.contractInfoList
+                console.log('data2', data2)
+                this.contractInfoService.findById(data2.data.contractInfoId).then(data3 => {
+                  data3.data.contractProperList = this.inputForm.contractProperList
+                  data3.data.contractInfoList = this.inputForm.contractInfoList
+                  this.$refs.archiveFile.newUpload('view', data3.data.contractInfoList, 'cwWorkContract', 300, '合同登记文件')
+                  this.$refs.uploadFile.newUpload(method, data3.data.contractProperList, 'cwWorkContract', 300, '合同归档文件')
+                  this.saveData(data3.data, method)
+                  if (this.formReadOnly) {
+                    method = 'view'
                   }
                 })
+              })
+            } else {
+              console.log('进来了22')
+              this.$refs.uploadFile.newUpload(method, data1.data.contractProperList, 'cwWorkContract', null, null, null, null, false)
+              this.$refs.archiveFile.newUpload('view', [], 'cwWorkContract', null, null, null, null, false)
+              this.saveData(data1.data, method)
+              if (this.formReadOnly) {
+                method = 'view'
               }
-              this.inputForm.contractFees = f
+            }
+            this.loading = false
+          })
+        }
+        )
+      },
+      // 表单提交  保存数据
+      doSubmit (status, callback) {
+        if (status === 'save') {
+          this.loading = true
+          // this.inputForm.status = '2'
+          this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
+          this.contractInfoService.save(this.inputForm).then(({data}) => {
+            // callback(data.businessTable, data.businessId, this.inputForm)
+            // this.$refs.inputForm.resetFields()
+            this.loading = false
+            this.close()
+          }).catch(() => {
+            this.$refs.inputForm.resetFields()
+            this.loading = false
+          })
+        }
+      },
+      tabHandleClick (event) {
+        // console.log(event)
+      },
+      saveData (data, method) {
+        console.log('data', data)
+        this.inputForm = this.recover(this.inputForm, data)
+        this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+      },
+      removeEvent (row, rowIndex, type) {
+        if (type === 'client') {
+          this.$refs.contactTable.remove(row)
+          this.inputForm.cwWorkClientContactDTOList.splice(rowIndex, 1)
+        }
+      },
+      openWorkClient () {
+        this.$refs.workClientChooseForm.init()
+      },
+      getWorkClientChoose (list) {
+        console.log('list', list)
+        if (this.commonJS.isEmpty(this.inputForm.cwWorkClientContactDTOList)) {
+          this.inputForm.cwWorkClientContactDTOList = []
+        }
+        let _this = this
+        let _list = list
+        const waitForEach = function () {
+          return new Promise(function (resolve, reject) {
+            _list.forEach((item) => {
+              _this.inputForm.cwWorkClientContactDTOList.forEach(client => {
+                if (item.no === client.no) {
+                  _this.$message.error('已存在客户 “' + client.name + '”,请重新选择')
+                  throw new Error('已存在客户 “' + client.name + '”,请重新选择')
+                }
+              })
             })
-          }
-          this.loading = false
+            resolve()
+          })
+        }
+        waitForEach().then(() => {
+          list.forEach(item => {
+            this.$refs.contactTable.insertAt(item)
+            this.inputForm.cwWorkClientContactDTOList.push(item)
+            this.tableKeyClient = Math.random()
+          })
         })
       },
       // 表单提交
-      doSubmit () {
-        if (this.progressFlag === true) {
-          this.$message.warning('文件正在上传中,请稍等')
-          return
-        }
-        this.$refs['inputForm'].validate((valid) => {
-          if (valid) {
-            this.loading = true
-            this.dataListNew.forEach((item) => {
-              if (item.id === null || item.id === undefined || item.id === '') {
-                item.url = item.raw.url
-              }
-              item.attachmentFlag = 'workContract'
-              item.fileSize = item.size
-              item.attachmentName = item.name
-              this.inputForm.workAttachmentList.push(item)
-            })
-
-            this.contractInfoService.save(this.inputForm).then(({data}) => {
-              this.close()
-              this.$message.success(data.msg)
-              this.$emit('refreshDataList')
-              this.loading = false
-            }).catch(() => {
-              this.loading = false
-            })
+      // 暂存
+      async saveForm (callback) {
+        // 合同登记暂存
+        if (this.status === 'startAndHold' || this.status === 'startAndHoldFiled') {
+          this.loading = true
+          if (this.status === 'startAndHold') {
+            this.inputForm.status = '1'
           }
+          if (this.status === 'startAndHoldFiled') {
+            this.inputForm.status = '5'
+          }
+          await this.contractInfoService.save(this.inputForm)
+        }
+        // 合同登记归档暂存
+        if (this.status === 'startAndHoldFiled') {
+          this.inputForm.filedType = '1'
+          this.inputForm.contractInfoId = this.businessId
+          this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+          // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
+          this.contractFileService.save(this.inputForm)
+        }
+        this.$refs.inputForm.resetFields()
+        this.loading = false
+        this.businessId = ''
+        callback()
+      },
+      // 送审
+      startForm (callback) {
+        console.log('filedType', this.inputForm.id)
+        let id = this.inputForm.id
+        this.loading = true
+        this.inputForm.status = '5'
+        this.contractInfoService.save(this.inputForm)
+        console.log('inputForm', this.inputForm)
+        this.inputForm.filedType = '2'
+        this.inputForm.contractInfoId = id
+        this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+        this.inputForm.contractProperList = this.$refs.uploadFile.getDataList()
+        this.contractFileService.save(this.inputForm).then(({data}) => {
+          console.log('data', data)
+          callback(data.businessTable, data.businessId, this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+        })
+      },
+      // 通过
+      agreeForm (callback) {
+        let id = this.inputForm.id
+        this.loading = true
+        this.inputForm.status = '5'
+        // this.inputForm.contractInfoList = this.$refs.archiveFile.getDataList()
+        // console.log('this.inputForm.contractProperList', this.inputForm.contractProperList)
+        this.contractInfoService.save(this.inputForm)
+        this.inputForm.filedType = '5'
+        this.inputForm.contractInfoId = id
+        // this.inputForm.contractInfoList = this.$refs.uploadFile.getDataList()
+        this.contractFileService.save(this.inputForm).then(({data}) => {
+          callback(data.businessTable, data.businessId, this.inputForm)
+          this.$refs.inputForm.resetFields()
+          this.loading = false
+          this.businessId = ''
         })
       },
       close () {
         this.$refs.inputForm.resetFields()
+        this.inputForm.clientName = ''
         this.visible = false
-        this.inputForm.showVi = true
+        this.showVi = true
+        this.$refs.archiveFile.clearUpload()
       },
       httpRequest (file) {
         httpRequest(file, fileName(file), 'workContract')
@@ -476,6 +710,22 @@
         str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
         return str
       },
+      positiveInteger (num) {
+        let str = num.toString()
+        var len1 = str.substr(0, 1)
+        var len2 = str.substr(1, 1)
+        // eslint-disable-next-line eqeqeq
+        if (str.length > 1 && len1 == 0 && len2 != '.') {
+          str = str.substr(1, 1)
+        }
+        // eslint-disable-next-line eqeqeq
+        if (len1 == '.') {
+          str = ''
+        }
+        // eslint-disable-next-line no-useless-escape
+        str = str.replace(/[^\d^]+/g, '') // 保留数字
+        return str
+      },
       tableRowClassName ({row, rowIndex}) {
         row.index = rowIndex
       },
@@ -491,53 +741,30 @@
       rowStyle (event) {
         return 'cursor:pointer;'
       },
-      async rowClick (event) {
-        let id = this.gridData[event.rowIndex].companyid
-        await this.workClientService.enterpriseTicketInfo(id).then((data) => {
-          this.inputForm.clientName = data.data.ENTNAME
-          this.inputForm.clientId = data.data.COMPANYID
-        })
-        this.visable = false
-      },
-      async getPopTable () {
-        let name = this.inputForm.clientName
-        if (name !== null && name !== undefined && name !== '') {
-          await this.workClientService.enterpriseSearchByName(name).then(({data}) => {
-            this.gridData = data.data.items
-          })
-        }
-        this.$refs.pops.updatePopper()
-      },
       closePop () {
         this.visable = false
       },
-      changeContractFee () {
-        let fee = ''
-        let fees = this.inputForm.contractFees
-        if (fees.length > 0) {
-          fees.forEach(i => {
-            if (i === '1') {
-              i = '计价格(2002)1980号文下浮%'
-            }
-            if (i === '2') {
-              i = '苏价服(2014)383号文下浮%'
-            }
-            if (i === '3') {
-              i = '标段 元/标段'
-            }
-            if (i === '4') {
-              i = '其他'
-            }
-            fee = fee + ';' + i
-            this.inputForm.contractFee = fee.substring(1, fee.length)
-          })
+      updateStatusById (type) {
+        console.log('type' + type)
+        if (type === 'agree') {
+          this.inputForm.filedType = '5'
+          this.contractFileService.updateStatusById(this.inputForm)
+        }
+        // 驳回
+        if (type === 'reject') {
+          this.inputForm.filedType = '4'
+          this.contractFileService.updateStatusById(this.inputForm)
+        }
+        if (type === 'reback') {
+          this.inputForm.filedType = '3'
+          this.contractFileService.updateStatusById(this.inputForm)
         }
       },
       checkData () {
         let begin = this.inputForm.effectiveDate
         let close = this.inputForm.closingDate
         if (close < begin) {
-          this.$message.warning(`合同终止日期异常,请重新选择`)
+          this.$message.warning(`合同终止日期要大于合同开始日期`)
           this.inputForm.closingDate = ''
         }
       }

+ 17 - 4
src/views/modules/cw/workContract/ContractRegistration.vue

@@ -40,8 +40,19 @@
           @getValue="(value) => {searchForm.createBy=value}"/>
       </el-form-item>
 
-      <el-form-item label="所属部门" prop="department">
-        <el-input size="small" v-model="searchForm.department" placeholder="请输入所属部门" clearable></el-input>
+      <el-form-item  prop="department" label="所属部门">
+        <SelectTree
+          ref="officeTree"
+          :props="{
+                  value: 'id',             // ID字段名
+                  label: 'name',         // 显示名称
+                  children: 'children'    // 子级字段名
+                }"
+
+          :url="`/sys/office/treeData?type=2`"
+          :value="searchForm.department"
+          :accordion="true"
+          @getValue="(value) => {searchForm.department=value}"/>
       </el-form-item>
 
       <el-form-item label="状态" prop="status">
@@ -155,7 +166,7 @@
       </div>
     </div>
     <!-- 弹窗, 新增 / 修改 -->
-    <ContractNameForm ref="contractNameForm" @refreshDataList="refreshList"></ContractNameForm>
+    <ContractNameForm ref="contractNameForm"></ContractNameForm>
     <WorkClientForm ref="workClientForm" @refreshDataList="refreshList"></WorkClientForm>
     <WorkContractBorrowMessageForm ref="workContractBorrowMessageForm" @refreshDataList="refreshList"></WorkContractBorrowMessageForm>
   </div>
@@ -176,6 +187,7 @@
   import ProcessService from '@/api/flowable/ProcessService'
   import pick from 'lodash.pick'
   import UserService from '@/api/sys/UserService'
+  import SelectTree from '@/components/treeSelect/treeSelect.vue'
   export default {
     data () {
       return {
@@ -231,7 +243,8 @@
       ContractNameForm,
       WorkClientForm,
       WorkContractBorrowMessageForm,
-      SelectUserTree
+      SelectUserTree,
+      SelectTree
     },
     activated () {
       this.is()

+ 1 - 0
src/views/modules/cw/workContract/ContractRegistrationForm.vue

@@ -443,6 +443,7 @@
           this.$refs.inputForm.resetFields()
           // if (method === 'edit' || method === 'view') { // 修改或者查看
           this.loading = true
+          this.$refs.uploadComponent.clearUpload()
           this.contractInfoService.findById(this.inputForm.id).then(({data}) => {
             this.inputForm = this.recover(this.inputForm, data)
             // 对数值进行判断是否为空,为空则赋值默认值