Browse Source

feature:增加发票管理页面、项目管理增加创建合同功能

liuzl 3 years ago
parent
commit
9b4d0a5ef7

+ 2 - 2
src/views/contract/components/DetailsInvoice.vue

@@ -43,11 +43,11 @@
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
-      <el-table-column align="center" fixed="right" 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>
-      </el-table-column>
+      </el-table-column> -->
     </el-table>
     <edit-invoice ref="invoice" :details="details" :invoice-type-data="invoiceTypeData" @invoiceSave="getInvoiceList" />
     <invoicing ref="invoicing" @invoiceSave="getInvoiceList" />

+ 2 - 2
src/views/contract/components/Edit.vue

@@ -2,7 +2,7 @@
  * @Author: liuzhenlin 461480418@qq.ocm
  * @Date: 2023-01-09 15:49:34
  * @LastEditors: liuzhenlin
- * @LastEditTime: 2023-01-11 18:30:40
+ * @LastEditTime: 2023-01-11 19:11:20
  * @Description: file content
  * @FilePath: \订单全流程管理系统\src\views\contract\components\Edit.vue
 -->
@@ -32,7 +32,7 @@
           <el-form-item label="关联项目" prop="nboName">
             <el-select
               v-model="editForm.nboName"
-              :disabled="businessData[0]"
+              :disabled="businessData.length > 0"
               placeholder="请选择关联项目"
               readonly
               style="width: 100%"

+ 10 - 8
src/views/contract/detail.vue

@@ -8,12 +8,15 @@
 -->
 <template>
   <div class="details">
-    <el-row :gutter="10">
-      <el-col :span="16">
+    <div class="side-layout">
+      <div class="info">
         <div class="title">
           <p>合同</p>
           <h3>
             {{ details.contractName }}
+            <span>
+              <el-button type="primary" @click="handleTransfer">转移</el-button>
+            </span>
           </h3>
         </div>
         <header>
@@ -54,17 +57,16 @@
             <details-enclosure v-if="activeName == 'enclosure'" :details="details" />
           </el-tab-pane>
         </el-tabs>
-      </el-col>
-      <el-col :span="8">
+      </div>
+      <div class="info-side">
         <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>
+      </div>
+    </div>
     <!-- 新增编辑客户弹窗 -->
     <Edit ref="edit" @contractSave="init" />
     <!-- 转移合同 -->
@@ -99,7 +101,7 @@
     },
     data() {
       return {
-        id: '',
+        id: 0,
         details: {},
         product: [],
         abstract: {},

+ 216 - 0
src/views/contract/invoice.vue

@@ -0,0 +1,216 @@
+<!--
+ * @Author: liuzhenlin 461480418@qq.ocm
+ * @Date: 2023-01-10 13:40:41
+ * @LastEditors: liuzhenlin
+ * @LastEditTime: 2023-01-11 18:59:03
+ * @Description: file content
+ * @FilePath: \订单全流程管理系统\src\views\contract\invoice.vue
+-->
+<template>
+  <div class="collection-plan">
+    <vab-query-form>
+      <vab-query-form-top-panel>
+        <el-form :inline="true" label-width="0px" :model="queryForm" @submit.native.prevent>
+          <el-form-item prop="contractCode">
+            <el-input
+              v-model="queryForm.contractCode"
+              clearable
+              placeholder="合同编号"
+              @keyup.enter.native="queryData" />
+          </el-form-item>
+          <el-form-item>
+            <el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button>
+          </el-form-item>
+        </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-delete" type="danger" @click="handleDelete()">删除</el-button> -->
+      </vab-query-form-left-panel>
+      <vab-query-form-right-panel :span="12">
+        <table-tool :check-list.sync="checkList" :columns="columns" />
+      </vab-query-form-right-panel>
+    </vab-query-form>
+    <el-table v-loading="listLoading" border :data="invoiceData" :height="height" @selection-change="setSelectRows">
+      <el-table-column align="center" show-overflow-tooltip type="selection" />
+      <el-table-column
+        v-for="(item, index) in finallyColumns"
+        :key="index"
+        align="center"
+        :label="item.label"
+        :min-width="item.width"
+        :prop="item.prop"
+        show-overflow-tooltip
+        :sortable="item.sortable">
+        <template #default="{ row }">
+          <span v-if="item.prop == 'invoiceType'">
+            <!-- {{ invoiceTypeData.filter((item) => item.key == row.invoiceType)[0].value || '-' }} -->
+          </span>
+          <span v-else-if="item.prop == 'approStatus'">
+            {{ row.approStatus == '10' ? '未通过' : '已通过' }}
+          </span>
+          <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" fixed="right" label="操作">
+        <template slot-scope="scope">
+          <el-button type="text" @click="$refs.invoicing.init(scope.row.id)">通过</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      background
+      :current-page="queryForm.pageNum"
+      :layout="layout"
+      :page-size="queryForm.pageSize"
+      :total="total"
+      @current-change="handleCurrentChange"
+      @size-change="handleSizeChange" />
+    <invoicing ref="invoicing" @invoiceSave="queryData" />
+  </div>
+</template>
+
+<script>
+  import to from 'await-to-js'
+  import invoiceApi from '@/api/contract/invoice'
+  import Invoicing from './components/Invoicing'
+  import TableTool from '@/components/table/TableTool'
+
+  export default {
+    name: 'DetailsInvoice',
+    components: { Invoicing, TableTool },
+    props: {
+      details: {
+        type: Object,
+        default: () => {},
+      },
+    },
+    data() {
+      return {
+        height: this.$baseTableHeight(2),
+        listLoading: true,
+        layout: 'total, sizes, prev, pager, next, jumper',
+        total: 0,
+        queryForm: {
+          pageNum: 1,
+          pageSize: 10,
+          contractCode: '', // 合同编号
+          custName: '', // 客户名称  ()
+        },
+        checkList: [],
+        invoiceData: [],
+        invoiceTypeData: [], //发票类型
+        columns: [
+          {
+            label: '合同编号',
+            width: '120px',
+            prop: 'contractCode',
+          },
+          {
+            label: '合同金额',
+            width: '100px',
+            prop: 'contractAmount',
+          },
+          {
+            label: '开票金额(元)',
+            width: '120px',
+            prop: 'invoiceAmount',
+          },
+          {
+            label: '开票日期',
+            width: '120px',
+            prop: 'invoiceDate',
+          },
+          {
+            label: '实际开票日期',
+            width: '120px',
+            prop: 'actualInvoiceDate',
+          },
+          {
+            label: '开票类型',
+            width: '80px',
+            prop: 'invoiceType',
+          },
+          {
+            label: '发票号码',
+            width: 'auto',
+            prop: 'invoiceCode',
+          },
+          {
+            label: '快递单号',
+            width: 'auto',
+            prop: 'courierCode',
+          },
+          {
+            label: '审核状态',
+            width: 'auto',
+            prop: 'approStatus',
+          },
+          {
+            label: '备注',
+            width: 'auto',
+            prop: 'remark',
+          },
+        ],
+      }
+    },
+    computed: {
+      finallyColumns() {
+        return this.columns.filter((item) => this.checkList.includes(item.label))
+      },
+    },
+    mounted() {
+      this.getOptions()
+      this.queryData()
+    },
+
+    methods: {
+      handleSizeChange(val) {
+        this.queryForm.pageSize = val
+        this.queryData()
+      },
+      handleCurrentChange(val) {
+        this.queryForm.pageNum = val
+        this.queryData()
+      },
+      setSelectRows(val) {
+        this.selectRows = val.map((item) => item.id)
+      },
+      getOptions() {
+        Promise.all([this.getDicts('invoice_type')])
+          .then(([invoiceType]) => {
+            this.invoiceTypeData = invoiceType.data.values || []
+          })
+          .catch((err) => console.log(err))
+      },
+      async queryData() {
+        this.listLoading = true
+        const params = { ...this.queryForm }
+        const [err, res] = await to(invoiceApi.getList(params))
+        if (err) return
+        this.invoiceData = res.data.list
+        this.listLoading = false
+      },
+    },
+  }
+</script>
+
+<style lang="scss" scoped>
+  $base: '.collection-plan';
+  #{$base} {
+    height: calc(100vh - 60px - 12px * 2 - 40px);
+    padding: 12px;
+    background: #fff;
+    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border 0s, color 0.1s, font-size 0s;
+  }
+</style>

+ 9 - 2
src/views/proj/business/detail.vue

@@ -11,7 +11,7 @@
               <el-button :disabled="details.nboType === 'C'" @click="handleBusinessGradation('降级')">降级</el-button>
               <el-button @click="handleTransfer">转移项目</el-button>
               <el-button>创建工单</el-button>
-              <el-button>创建合同</el-button>
+              <el-button @click="createContract">创建合同</el-button>
             </span>
           </h3>
         </div>
@@ -125,6 +125,8 @@
     <edit ref="edit" @fetch-data="init" />
     <!-- 转移 -->
     <transfer ref="transfer" @fetch-data="init" />
+    <!-- 合同 -->
+    <contract-edit ref="contract" :business-data="[details]" />
   </div>
 </template>
 
@@ -137,10 +139,11 @@
   import DetailsContact from './components/DetailsContact'
   import DetailsRecords from './components/DetailsRecords'
   import DetailsFollow from './components/DetailsFollow'
+  import ContractEdit from '@/views/contract/components/Edit'
 
   export default {
     name: 'BusinessDetail',
-    components: { Edit, Transfer, DetailsContact, DetailsRecords, DetailsFollow },
+    components: { Edit, Transfer, DetailsContact, DetailsRecords, DetailsFollow, ContractEdit },
     data() {
       return {
         id: undefined,
@@ -231,6 +234,10 @@
           this.back()
         })
       },
+      // 创建合同
+      createContract() {
+        this.$refs.contract.init()
+      },
       // 业务调级(升级、降级)
       handleBusinessGradation(type) {
         let data = { id: this.id, nboType: '' }