liqianyi преди 3 години
родител
ревизия
baf35be63d

+ 34 - 0
src/api/cus.js

@@ -65,3 +65,37 @@ export function getCusList (param) {
     params: param
   })
 }
+
+// 台账列表
+export function getCusContractBookList (param) {
+  return request({
+    url: request.adornUrl(`/biz-service/cusContractBook/list`),
+    method: 'get',
+    params: param
+  })
+}
+
+// 合同评审编码列表
+export function getReviewCodeList (param) {
+  return request({
+    url: request.adornUrl(`/biz-service/cusContractBook/review/code/list`),
+    method: 'get',
+    params: param
+  })
+}
+
+// 合同台账详情
+export function geContractBookDetail (contractId) {
+  return request({
+    url: request.adornUrl(`/biz-service/cusContractBook/info/${contractId}`),
+    method: 'get'
+  })
+}
+
+// 沟通编码列表
+export function getCommunicationList (coId) {
+  return request({
+    url: request.adornUrl(`/biz-service/cusContractBook/communication/product/list/${coId}`),
+    method: 'get'
+  })
+}

+ 289 - 0
src/views/modules/cus/contract-record-add-or-update.vue

@@ -0,0 +1,289 @@
+<template>
+    <div>
+        <div class="my-title">{{ !id ? '新增' : '修改' }}</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="合同编码" prop="contractCode">
+                <el-input v-model="dataForm.contractCode" disabled placeholder="合同编码由系统生成"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="合同评审编码" prop="reCode">
+                <el-select
+                  v-model="dataForm.reCode"
+                  remote
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in optionsReCode"
+                    :key="item.reCode"
+                    :label="item.customerName + ' (' + item.reCode + ' )'"
+                    :value="item.reCode">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="合同号" prop="contractNumber">
+                <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row">
+            <el-col :span="8">
+              <el-form-item label="合同交期" prop="deliveryTime">
+                <el-date-picker
+                  v-model="dataForm.deliveryTime"
+                  value-format="yyyy-MM-dd"
+                  type="date">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="实际交付日期" prop="actualDeliveryTime">
+                <el-input v-model="dataForm.actualDeliveryTime" disabled></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row class="my-row" style="margin-top: 20px">
+            <el-form-item label="备注" prop="notes">
+              <el-input type="textarea" v-model="dataForm.notes"></el-input>
+            </el-form-item>
+          </el-row>
+          <el-row v-if="isProductListVisible">
+            <div class="title"><span style="color: red">*</span> 产品列表</div>
+            <el-table
+              :data="productList"
+              border
+              style="width: 100%;">
+              <el-table-column
+                label="序号"
+                type="index"
+                width="50"
+                align="center">
+              </el-table-column>
+              <el-table-column
+                prop="productName"
+                header-align="center"
+                align="center"
+                label="产品名称">
+              </el-table-column>
+              <el-table-column
+                prop="cnt"
+                header-align="center"
+                align="center"
+                label="数量"
+                width="170">
+              </el-table-column>
+              <el-table-column
+                prop="price"
+                header-align="center"
+                align="center"
+                min-width="160"
+                label="含税单价">
+              </el-table-column>
+              <el-table-column
+                prop="amount"
+                header-align="center"
+                align="center"
+                min-width="100"
+                label="含税总价">
+              </el-table-column>
+              <el-table-column
+                prop="rate"
+                header-align="center"
+                align="center"
+                label="税率">
+              </el-table-column>
+              <el-table-column
+                prop="notes"
+                header-align="center"
+                align="center"
+                min-width="140"
+                :show-tooltip-when-overflow="true"
+                label="备注">
+              </el-table-column>
+              <el-table-column
+                fixed="right"
+                header-align="center"
+                align="center"
+                width="150"
+                label="操作">
+                <template slot-scope="scope">
+                  <el-button type="text" size="small" @click="addOrUpdateProductHandle(scope.row)">编辑</el-button>
+                  <el-button style="color: red" type="text" size="small" @click="deleteProductHandle(scope.row.productId)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-row style="text-align: center; margin-top: 10px;">
+              <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateProductHandle()"></el-button>
+            </el-row>
+          </el-row>
+          <el-row class="my-row">
+            <upload-component :title="'附件'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+      <add-or-update-product v-if="productAddOrUpdateVisible" ref="productDialog" @addItem="addItem"/>
+    </div>
+</template>
+
+<script>
+  import UploadComponent from '../common/upload-component'
+  import AddOrUpdateProduct from './contract-record-product-add-or-update'
+  import { getReviewCodeList, geContractBookDetail, getCommunicationList } from '@/api/cus'
+
+export default {
+    name: 'contract-record-add-or-update',
+    components: {
+      UploadComponent,
+      AddOrUpdateProduct
+    },
+    computed: {
+      orgId: {
+        get () { return this.$store.state.user.orgId }
+      }
+    },
+    watch: {
+      'dataForm.reCode' (value) {
+        let d = this.optionsReCode.find(item => item.reCode === value)
+        if (!d) return
+        getCommunicationList(d.coId).then(({data}) => {
+          if (data && data.code === '200') {
+            this.isProductListVisible = true
+            this.productList = data.data
+          }
+        })
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        optionsReCode: [],
+        fileList: [],
+        dataList: [],
+        isProductListVisible: false, // 产品列表是否显示
+        productAddOrUpdateVisible: false, // 产品新增或修改对话框是否显示
+        productList: [], // 产品列表
+        id: 0,
+        dataForm: {
+          displayProductList: false
+        },
+        dataRule: {
+          reCode: [{ required: true, message: '请选择合同评审编码', trigger: 'change' }],
+          contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
+          deliveryTime: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.fileList = []
+        this.dataForm = {}
+        // this.optionsReCode = []
+        this.visible = true
+        this.id = id || 0
+        // 获取合同评审编码列表
+        await getReviewCodeList().then(({data}) => {
+          if (data) {
+            this.optionsReCode = data.data
+          }
+        })
+        // 详情
+        if (!id) return
+        await geContractBookDetail(this.id).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataForm = data.data
+            // 附件
+            if (data.data.attachList) {
+              data.data.attachList.forEach((item) => {
+                this.fileList.push({
+                  name: item.fileName,
+                  url: item.url,
+                  id: item.url
+                })
+              })
+            }
+          }
+        })
+      },
+      uploadSuccess (fileList) {
+        this.fileList = fileList
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            // 附件
+            let fList = this.fileList
+            if (fList.length > 0) {
+              this.dataForm.attachList = []
+              for (let i = 0; i < fList.length; i++) {
+                this.dataForm.attachList.push({
+                  fileName: fList[i].name,
+                  url: fList[i].url
+                })
+              }
+            } else {
+              this.$message.error('请上传文件')
+              return
+            }
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/cusContractBook/${!this.id ? 'save' : 'update'}`),
+              method: 'post',
+              data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                    this.$emit('refreshDataList')
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      // 删除产品项
+      deleteProductHandle (productId) {
+        this.productList.splice(this.productList.findIndex((item) => item.productId === productId))
+      },
+      // 添加或编辑产品
+      addOrUpdateProductHandle (row) {
+        this.productAddOrUpdateVisible = true
+        this.$nextTick(() => {
+          this.$refs.productDialog.init(row)
+        })
+      },
+      addItem (item) {
+        if (!item) return
+        this.productAddOrUpdateVisible = false
+        let i = this.productList.findIndex((item1) => item1.productId === item.productId)
+        if (i > -1) {
+          this.productList.splice(i)
+        }
+        this.productList.push(item)
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 105 - 0
src/views/modules/cus/contract-record-product-add-or-update.vue

@@ -0,0 +1,105 @@
+<template>
+  <div>
+    <el-dialog
+      :title="isAdd ? '新增': '修改'"
+      width="70%"
+      :close-on-click-modal="false"
+      :visible.sync="visible">
+    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+      <el-row class="my-row">
+        <el-col :span="8">
+          <el-form-item label="产品名称" prop="productName">
+            <el-input v-model="dataForm.productName" placeholder="产品名称"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" style="padding-left: 10px">
+          <el-form-item label="税率" prop="rate">
+            <el-input-number style="width: 160px" v-model="dataForm.rate" :step="1" :precision="1"/>&nbsp;%
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row class="my-row">
+        <el-col :span="8">
+          <el-form-item label="含税单价" prop="price">
+            <el-input-number v-model="dataForm.price" :precision="1" :step="1" :min="1"></el-input-number>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" style="padding-left: 10px">
+          <el-form-item label="数量" prop="cnt">
+            <el-input-number v-model="dataForm.cnt" :min="1" :step="1"></el-input-number>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" style="padding-left: 10px">
+          <el-form-item label="含税总价" prop="amount">
+            <span>{{ (dataForm.cnt * dataForm.price).toFixed(1) }}</span>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-form-item label="备注" prop="notes">
+          <el-input type="textarea" v-model="dataForm.notes"></el-input>
+        </el-form-item>
+      </el-row>
+    </el-form>
+    <span slot="footer">
+        <el-button @click="onChose">取消</el-button>
+        <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+      </span>
+     </el-dialog>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'contract-record-product-add-or-update',
+  data () {
+    return {
+      visible: false,
+      isAdd: true,
+      dataForm: {
+        cnt: 1,
+        price: 1,
+        rate: 1
+      },
+      dataRule: {
+        productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
+        cnt: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
+        price: [{ required: true, message: '含税单价不能为空', trigger: 'blur' }],
+        rate: [{ required: true, message: '税率不能为空', trigger: 'blur' }]
+      }
+    }
+  },
+  methods: {
+    async init (row) {
+      this.visible = true
+      this.isAdd = !!row
+      if (!row) return
+      this.dataForm = row
+    },
+    validateField (type) {
+      this.$refs.dataForm.validateField(type)
+    },
+    onChose () {
+      this.visible = false
+    },
+    // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          if (this.isAdd) {
+            this.dataForm.productId = Math.round(Math.random() * 1000000)
+          }
+          // 计算含税总价
+          this.dataForm.amount = (this.dataForm.cnt * this.dataForm.price).toFixed(1)
+          this.onChose()
+          this.$emit('addItem', this.dataForm)
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 337 - 0
src/views/modules/cus/contract-record.vue

@@ -0,0 +1,337 @@
+<!-- 合同台账 -->
+<template>
+  <div class="contract">
+    <template v-if="!addOrUpdateVisible && !changeFormVisible && !attachVisible && !noticeChangeVisible">
+      <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
+        <el-form-item label="名称">
+          <el-input v-model="dataForm.customerName" placeholder="客户名称" clearable/>
+        </el-form-item>
+        <el-form-item label="申请日期">
+          <el-date-picker
+            v-model="dataForm.date"
+            value-format="yyyy-MM-dd"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item>
+          <el-button @click="search()">查询</el-button>
+          <el-button v-if="isAuth('cus:contractBook:save')" type="primary" @click="addOrUpdateHandle(0)">录入</el-button>
+          <el-button v-if="isAuth('cus:contractBook:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">变更通知人设置</el-button>
+        </el-form-item>
+      </el-form>
+      <el-table
+        :data="dataList"
+        border
+        v-loading="dataListLoading"
+        style="width: 100%;">
+        <el-table-column
+          label="序号"
+          type="index"
+          width="50"
+          align="center">
+        </el-table-column>
+        <el-table-column
+          prop="contractCode"
+          header-align="center"
+          align="center"
+          min-width="120"
+          :show-tooltip-when-overflow="true"
+          label="合同编码">
+        </el-table-column>
+        <el-table-column
+          prop="customerName"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-tooltip-when-overflow="true"
+          label="客户名称">
+        </el-table-column>
+        <el-table-column
+          prop="contractNumber"
+          header-align="center"
+          align="center"
+          min-width="120"
+          :show-tooltip-when-overflow="true"
+          label="合同号">
+        </el-table-column>
+        <el-table-column
+          prop="reCode"
+          header-align="center"
+          align="center"
+          min-width="120"
+          :show-tooltip-when-overflow="true"
+          label="合同评审表编码">
+        </el-table-column>
+        <el-table-column
+          prop="deliveryTime"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-overflow-tooltip="true"
+          label="合同交期">
+        </el-table-column>
+        <el-table-column
+          prop="actualDeliveryTime"
+          header-align="center"
+          align="center"
+          min-width="140"
+          :show-overflow-tooltip="true"
+          label="实际交期">
+        </el-table-column>
+        <el-table-column
+          prop="totalAmount"
+          header-align="center"
+          align="center"
+          min-width="100"
+          label="合同总金额">
+        </el-table-column>
+        <el-table-column
+          prop="isChange"
+          header-align="center"
+          align="center"
+          label="是否进行合同更改">
+        </el-table-column>
+        <el-table-column
+          prop="changeContentDesc"
+          header-align="center"
+          align="center"
+          min-width="160"
+          :show-tooltip-when-overflow="true"
+          label="更改内容简述">
+        </el-table-column>
+        <el-table-column
+          header-align="center"
+          align="center"
+          label="合同附件">
+          <template slot-scope="scope">
+            <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
+          </template>
+        </el-table-column>
+        <el-table-column
+          header-align="center"
+          align="center"
+          label="合同更改通知单附件">
+          <template slot-scope="scope">
+            <el-button :disabled="!scope.row.noticeAttachList || scope.row.noticeAttachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="notes"
+          header-align="center"
+          align="center"
+          min-width="180"
+          :show-overflow-tooltip="true"
+          label="备注">
+        </el-table-column>
+        <el-table-column
+          fixed="right"
+          header-align="center"
+          align="center"
+          width="150"
+          label="操作">
+          <template slot-scope="scope">
+            <el-button v-if="isAuth('cus:contractBook:info')" type="text" size="small" @click="detailHandle(scope.row.contractId)">查看</el-button>
+            <el-button v-if="isAuth('cus:contractBook:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.contractId, false)">编辑</el-button>
+            <el-button v-if="isAuth('cus:contractBook:changeContract')" type="text" size="small" @click="changeHandle(scope.row.contractId)">变更</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        @size-change="sizeChangeHandle"
+        @current-change="currentChangeHandle"
+        :current-page="pageIndex"
+        :page-sizes="[10, 20, 50, 100]"
+        :page-size="pageSize"
+        :total="totalPage"
+        layout="total, sizes, prev, pager, next, jumper">
+      </el-pagination>
+    </template>
+    <!-- 弹窗, 新增 / 修改 -->
+    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
+<!--    <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>-->
+<!--    <crafts-detail v-if="craftsVisible" ref="craftsDetail" @onChose="onChose"/>-->
+<!--    <product-draw-detail v-if="drawVisible" ref="drawDetail" @onChose="onChose"/>-->
+<!--    <attach-detail v-if="changeVisible" ref="changeDetail" @onChose="onChose"/>-->
+<!--    <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>-->
+<!--    <notice-change-setting v-if="noticeChangeVisible" ref="noticeChangeSetting" @onChose="onChose"/>-->
+<!--    <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>-->
+  </div>
+</template>
+
+<script>
+import AddOrUpdate from './contract-record-add-or-update'
+// import Detail from './product-detail'
+import { getCusContractBookList } from '@/api/cus'
+// import CraftsDetail from './crafts-detail'
+// import ProductDrawDetail from './product-draw-detail'
+import AttachDetail from '../common/attach-detail'
+// import NoticeChangeSetting from './product-notice-change-setting'
+// import ChangeForm from './product-change'
+export default {
+  name: 'contract-record',
+  components: {
+    AttachDetail,
+    // ProductDrawDetail,
+    // CraftsDetail,
+    AddOrUpdate
+    // Detail,
+    // NoticeChangeSetting,
+    // ChangeForm
+  },
+  data () {
+    return {
+      addOrUpdateVisible: false,
+      detailVisible: false,
+      attachVisible: false,
+      noticeChangeVisible: false,
+      changeFormVisible: false,
+      dataForm: {},
+      dataList: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPage: 0,
+      dataListLoading: false,
+      dataListSelections: []
+    }
+  },
+  created () {
+    this.getDataList()
+  },
+  methods: {
+    onChose () {
+      this.addOrUpdateVisible = false
+      this.attachVisible = false
+      this.detailVisible = false
+      this.noticeChangeVisible = false
+      this.changeFormVisible = false
+    },
+    // 查询
+    search () {
+      this.pageIndex = 1
+      this.getDataList()
+    },
+    // 获取数据列表
+    getDataList () {
+      this.dataListLoading = true
+      let params = {
+        'current': this.pageIndex,
+        'size': this.pageSize,
+        'customerName': this.dataForm.customerName ? this.dataForm.customerName : null
+      }
+      getCusContractBookList(params).then(({data}) => {
+        if (data && data.code === '200') {
+          this.dataList = data.data.records
+          this.totalPage = Number(data.data.total)
+        } else {
+          this.dataList = []
+          this.totalPage = 0
+        }
+        this.dataListLoading = false
+      })
+    },
+    deleteHandle (id) {
+      if (!id) return
+      let ids = []
+      ids.push(id)
+      this.$confirm(`确定删除?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/cusContractBook/delete`),
+          method: 'DELETE',
+          data: ids
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.$message({
+              message: '操作成功',
+              type: 'success',
+              duration: 1500,
+              onClose: () => {
+                this.getDataList()
+              }
+            })
+          } else {
+            this.$message.error(data.msg)
+          }
+        })
+      }).catch(() => {})
+    },
+    // 每页数
+    sizeChangeHandle (val) {
+      this.pageSize = val
+      this.pageIndex = 1
+      this.getDataList()
+    },
+    // 当前页
+    currentChangeHandle (val) {
+      this.pageIndex = val
+      this.getDataList()
+    },
+    // 多选
+    selectionChangeHandle (val) {
+      this.dataListSelections = val
+    },
+    // 新增 / 修改
+    addOrUpdateHandle (id) {
+      this.addOrUpdateVisible = true
+      this.$nextTick(() => {
+        this.$refs.addOrUpdate.init(id)
+      })
+    },
+    // 变更
+    changeHandle (id) {
+      this.changeFormVisible = true
+      this.$nextTick(() => {
+        this.$refs.changeForm.init(id)
+      })
+    },
+    // 转换属性“产品类别”
+    typeFormat (row) {
+      if (this.optionsType) {
+        for (let i = 0; i < this.optionsType.length; i++) {
+          if (this.optionsType[i].code === row.productType) {
+            return this.optionsType[i].value
+          }
+        }
+      }
+    },
+    // 详情
+    detailHandle (id) {
+      this.detailVisible = true
+      this.$nextTick(() => {
+        this.$refs.detail.init(id)
+      })
+    },
+    // 变更通知人设置
+    setNoticeChangeHandel () {
+      this.noticeChangeVisible = true
+      this.$nextTick(() => {
+        this.$refs.noticeChangeSetting.init()
+      })
+    },
+    // 产品更改通知单
+    changeDetails (row) {
+      this.changeVisible = true
+      this.$nextTick(() => {
+        this.$refs.changeDetail.init(row.noticeChangeRecord.attachList)
+      })
+    },
+    // 附件
+    attachDetails (row) {
+      this.attachVisible = true
+      this.$nextTick(() => {
+        this.$refs.attachDetail.init(row.attachList)
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>