Kaynağa Gözat

采购合同

liqianyi 3 yıl önce
ebeveyn
işleme
b258327b6c

+ 8 - 0
src/api/sale.js

@@ -86,3 +86,11 @@ export function getContractList (params) {
     params: params
   })
 }
+
+// 采购合同详情
+export function getContractDetail (id) {
+  return request({
+    url: request.adornUrl(`/biz-service/purPurchaseContract/info/${id}`),
+    method: 'get'
+  })
+}

+ 167 - 0
src/views/modules/sale/contract-add-or-update.vue

@@ -0,0 +1,167 @@
+<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="contractType">
+                <el-select
+                  v-model="dataForm.contractType"
+                  remote
+                  placeholder="请选择">
+                  <el-option
+                    v-for="item in optionsType"
+                    :key="item.code"
+                    :label="item.value"
+                    :value="item.code">
+                  </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="contractNumber">
+                <el-input v-model="dataForm.contractNumber" placeholder="合同号"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="合同金额" prop="actualDeliveryTime">
+                <el-input-number v-model="dataForm.actualDeliveryTime" :step="1" :min="0" :precision="1"></el-input-number>
+              </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 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>
+    </div>
+</template>
+
+<script>
+  import UploadComponent from '../common/upload-component'
+  import { getContractDetail } from '@/api/sale'
+
+export default {
+    name: 'contract-add-or-update',
+    components: {
+      UploadComponent
+    },
+    computed: {
+      orgId: {
+        get () { return this.$store.state.user.orgId }
+      }
+    },
+    data () {
+      return {
+        id: 0,
+        dataForm: {},
+        dataRule: {
+          // reCode: [{ required: true, message: '请选择合同评审编码', trigger: 'change' }],
+          // contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
+          // deliveryTime: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
+        },
+        optionsType: [],
+        fileList: []
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.fileList = []
+        this.dataForm = {}
+        this.id = id || 0
+        // 详情
+        if (!id) return
+        await getContractDetail(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/purPurchaseContract/${!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)
+              }
+            })
+          }
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 1 - 1
src/views/modules/sale/contract.vue

@@ -1,6 +1,6 @@
 <!-- 采购合同管理 -->
 <template>
-  <div class="contract">
+  <div class="sale">
     <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible">
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
         <el-form-item label="名称" prop="supplierName">

+ 307 - 0
src/views/modules/sale/outsource.vue

@@ -0,0 +1,307 @@
+<!-- 委外列表 -->
+<template>
+  <div class="sale">
+    <template v-if="!detailVisible && !addOrUpdateVisible && !changeFormVisible &&!changeAttachVisible && !attachVisible && !noticeChangeAttachVisible">
+      <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
+        <el-form-item label="名称" prop="supplierName">
+          <el-input v-model="dataForm.supplierName" 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('pur:purchaseContract:save')" type="primary" @click="addOrUpdateHandle(0)">录入</el-button>
+          <el-button type="primary" @click="setNoticeChangeHandle()">合同更改通知人设置</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="supplierName"
+          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="deliveryTime"
+          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="changeDetails(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"/>
+    <attach-detail v-if="changeAttachVisible" ref="changeDetail" @onChose="onChose"/>
+    <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
+    <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
+    <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>
+  </div>
+</template>
+
+<script>
+import AddOrUpdate from '../cus/contract-record-add-or-update'
+import Detail from '../cus/contract-record-detail'
+import { getContractList } from '@/api/sale'
+import AttachDetail from '../common/attach-detail'
+import NoticeChangeSetting from '../cus/contract-record-notice-change-setting'
+import ChangeForm from '../cus/contract-record-change'
+export default {
+  name: 'outsource',
+  components: {
+    AttachDetail,
+    AddOrUpdate,
+    Detail,
+    NoticeChangeSetting,
+    ChangeForm
+  },
+  data () {
+    return {
+      addOrUpdateVisible: false,
+      detailVisible: false,
+      attachVisible: false,
+      changeAttachVisible: false,
+      noticeChangeAttachVisible: 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.noticeChangeAttachVisible = false
+      this.changeFormVisible = false
+      this.changeAttachVisible = false
+    },
+    // 查询
+    search () {
+      this.pageIndex = 1
+      this.getDataList()
+    },
+    // 获取数据列表
+    getDataList () {
+      this.dataListLoading = true
+      let params = {
+        'current': this.pageIndex,
+        'size': this.pageSize,
+        'supplierName': this.dataForm.supplierName ? this.dataForm.supplierName : null
+      }
+      getContractList(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)
+      })
+    },
+    // 详情
+    detailHandle (id) {
+      this.detailVisible = true
+      this.$nextTick(() => {
+        this.$refs.detail.init(id)
+      })
+    },
+    // 变更通知人设置
+    setNoticeChangeHandle () {
+      this.noticeChangeAttachVisible = true
+      this.$nextTick(() => {
+        this.$refs.noticeChangeSetting.init()
+      })
+    },
+    // 产品更改通知单
+    changeDetails (row) {
+      this.changeAttachVisible = true
+      this.$nextTick(() => {
+        this.$refs.changeDetail.init(row.noticeAttachList)
+      })
+    },
+    // 附件
+    attachDetails (row) {
+      this.attachVisible = true
+      this.$nextTick(() => {
+        this.$refs.attachDetail.init(row.attachList)
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>