Ver Fonte

采购合同管理

liqianyi há 3 anos atrás
pai
commit
66722d23fc

+ 18 - 15
src/views/modules/sale/contract-add-or-update.vue

@@ -6,13 +6,13 @@
           <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-input v-model="dataForm.contractCode" disabled placeholder="合同编码由系统生成" style="width: 200px"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="合同类别" prop="contractType">
+              <el-form-item label="合同类别" prop="type">
                 <el-select
-                  v-model="dataForm.contractType"
+                  v-model="dataForm.type"
                   remote
                   placeholder="请选择">
                   <el-option
@@ -25,20 +25,15 @@
               </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 label="合同号" prop="contractNumber">
+                <el-input v-model="dataForm.contractNumber" placeholder="合同号" style="width: 200px"></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 label="合同金额" prop="totalAmount">
+                <el-input-number v-model="dataForm.totalAmount" :step="1" :min="0" :precision="1"></el-input-number>
               </el-form-item>
             </el-col>
           </el-row>
@@ -77,11 +72,19 @@ export default {
         id: 0,
         dataForm: {},
         dataRule: {
-          // reCode: [{ required: true, message: '请选择合同评审编码', trigger: 'change' }],
-          // contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
+          type: [{ required: true, message: '请选择合同类别', trigger: 'change' }],
+          contractNumber: [{ required: true, message: '合同号不能为空', trigger: 'blur' }],
+          totalAmount: [{ required: true, message: '合同金额不能为空', trigger: 'change' }]
           // deliveryTime: [{ required: true, message: '合同交期不能为空', trigger: 'change' }]
         },
-        optionsType: [],
+        optionsType: [
+          {
+            code: '1', value: '采购合同'
+          },
+          {
+            code: '2', value: '委外合同'
+          }
+        ],
         fileList: []
       }
     },

+ 130 - 0
src/views/modules/sale/contract-change.vue

@@ -0,0 +1,130 @@
+<template>
+    <div>
+        <div class="my-title">合同更改</div>
+        <!-- 表单 -->
+      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+        <el-row class="my-row">
+          <el-form-item label="更改内容描述" prop="changeContentDesc">
+            <el-input type="textarea" v-model="dataForm.changeContentDesc" placeholder="请输入更改内容描述"></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 UserComponents from '../common/user-components'
+  import UploadComponent from '../common/upload-component'
+  import { getContractDetail } from '@/api/sale'
+
+export default {
+    name: 'contract-change',
+    components: {
+      UploadComponent,
+      UserComponents
+    },
+    computed: {
+      orgId: {
+        get () { return this.$store.state.user.orgId }
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        dataForm: {
+          changeContentDesc: ''
+        },
+        id: 0,
+        fileList: [],
+        dataRule: {
+          changeContentDesc: [{ required: true, message: '更改内容简述不能为空', trigger: 'blur' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.fileList = []
+        this.visible = true
+        this.id = id || 0
+        if (!id) return
+        this.dataForm.contractId = id
+        await getContractDetail(id).then(({data}) => {
+          if (data && data.code === '200' && data.data) {
+            this.dataForm.changeContentDesc = data.data.changeContentDesc
+            if (data.data.noticeAttachList) {
+              data.data.noticeAttachList.forEach((item) => {
+                this.fileList.push({
+                  name: item.fileName,
+                  url: item.url,
+                  id: item.url
+                })
+              })
+            }
+          } else {
+            this.$message.error(data.msg)
+          }
+        })
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        // 附件
+        let fList = this.fileList
+        if (fList.length > 0) {
+          this.dataForm.noticeAttachList = []
+          for (let i = 0; i < fList.length; i++) {
+            this.dataForm.noticeAttachList.push({
+              fileName: fList[i].name,
+              url: fList[i].url
+            })
+          }
+        } else {
+          this.$message.error('请上传文件')
+          return
+        }
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/purPurchaseContract/changeContract`),
+              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)
+              }
+            })
+          }
+        })
+      },
+      uploadSuccess (fileList) {
+        this.fileList = fileList
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 96 - 0
src/views/modules/sale/contract-detail.vue

@@ -0,0 +1,96 @@
+<!-- 采购合同详情 -->
+<template>
+  <div>
+    <div class="my-title">查看</div>
+    <div style="margin-left: 20px;margin-right: 20px">
+      <e-desc title="基本信息" column="3">
+        <e-desc-item label="合同编码">{{dataForm.contractCode}}</e-desc-item>
+        <e-desc-item label="合同类别" span="2">{{!dataForm.type?'':(Number(dataForm.type) === 1?'采购合同':'委外合同')}}</e-desc-item>
+
+        <e-desc-item label="合同号">{{dataForm.contractNumber}}</e-desc-item>
+        <e-desc-item label="合同金额" span="2">{{dataForm.totalAmount}}</e-desc-item>
+
+        <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
+
+        <e-desc-item v-if="dataForm.attachList" label="附件" span="3">
+          <div v-for="(item, index) in dataForm.attachList" style="display: inline">
+            <span v-if="index > 0">,</span>
+            <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+          </div>
+        </e-desc-item>
+      </e-desc>
+      <e-desc title="合同变更" column="3">
+        <e-desc-item label="更改内容描述" span="3">{{dataForm.changeContentDesc}}</e-desc-item>
+        <e-desc-item v-if="dataForm.noticeAttachList" label="合同变更通知单" span="3">
+          <div v-for="(item, index) in dataForm.noticeAttachList" style="display: inline">
+            <span v-if="index > 0">,</span>
+            <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+          </div>
+        </e-desc-item>
+      </e-desc>
+    </div>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="onChose">返回</el-button>
+    </span>
+    <!-- 文件预览 -->
+    <preview-component v-if="previewVisible" ref="preview"/>
+  </div>
+</template>
+
+<script>
+  import EDesc from '../common/e-desc'
+  import EDescItem from '../common/e-desc-item'
+  import { getContractDetail } from '@/api/sale'
+  import PreviewComponent from '../common/preview-component'
+export default {
+    name: 'contract-detail',
+    components: {
+      PreviewComponent,
+      EDesc,
+      EDescItem
+    },
+    data () {
+      return {
+        id: 0,
+        dataForm: {},
+        previewVisible: false
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.id = id || 0
+        this.dataForm = {}
+        this.getDetails()
+      },
+      getDetails () {
+        getContractDetail(this.id).then(({data}) => {
+          if (data && data.code === '200' && data.data) {
+            this.dataForm = data.data
+          } else {
+            this.onChose()
+          }
+        })
+      },
+      // 预览
+      previewFile (fileName, url) {
+        this.previewVisible = true
+        this.$nextTick(() => {
+          this.$refs.preview.init(fileName, url)
+        })
+      }
+    }
+  }
+</script>
+
+<style scoped>
+.my-line{
+  border-bottom: 1px solid #c0c4cc;
+  margin-bottom: 10px;
+}
+.title{
+  padding: 10px 0 ;
+}
+</style>

+ 93 - 0
src/views/modules/sale/contract-notice-change-setting.vue

@@ -0,0 +1,93 @@
+<template>
+    <div>
+        <div class="my-title">合同更改通知人设置</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-form-item label="通知接收人" prop="userIds">
+              <user-components v-model="dataForm.userIds" :userIds="dataForm.userIds" @change="userSelectedChanged"/>
+            </el-form-item>
+          </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 UserComponents from '../common/user-components'
+
+export default {
+    name: 'contract-notice-change-setting',
+    components: {
+      UserComponents
+    },
+    data () {
+      return {
+        visible: false,
+        dataForm: {
+          userIds: []
+        },
+        dataRule: {
+          userIds: [{ required: true, message: '请选择通知接收人', trigger: 'change' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init () {
+        this.dataForm = {}
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/purPurchaseContract/noteChangeConfig`),
+          method: 'get'
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataForm = {
+              userIds: data.data
+            }
+          }
+        })
+        this.visible = true
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/purPurchaseContract/noteChangeConfig`),
+              method: 'post',
+              data: this.dataForm.userIds
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      userSelectedChanged (val) {
+        this.dataForm.userIds = val
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 7 - 20
src/views/modules/sale/contract.vue

@@ -78,6 +78,9 @@
           header-align="center"
           align="center"
           label="是否进行合同更改">
+          <template slot-scope="scope">
+            <span>{{!scope.row.isChange?'':(Number(scope.row.isChange) === 1?'是':'否')}}</span>
+          </template>
         </el-table-column>
         <el-table-column
           prop="changeContentDesc"
@@ -87,22 +90,6 @@
           :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="actualDeliveryTime"-->
-<!--          header-align="center"-->
-<!--          align="center"-->
-<!--          min-width="140"-->
-<!--          :show-overflow-tooltip="true"-->
-<!--          label="实际交期">-->
-<!--        </el-table-column>-->
         <el-table-column
           header-align="center"
           align="center"
@@ -161,12 +148,12 @@
 </template>
 
 <script>
-import AddOrUpdate from '../cus/contract-record-add-or-update'
-import Detail from '../cus/contract-record-detail'
+import AddOrUpdate from './contract-add-or-update'
+import Detail from './contract-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'
+import NoticeChangeSetting from './contract-notice-change-setting'
+import ChangeForm from './contract-change'
 export default {
   name: 'contract',
   components: {

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

@@ -223,7 +223,7 @@
           width="180"
           label="操作">
           <template slot-scope="scope">
-            <el-button v-if="isAuth('pur:commDetail:info')" type="text" size="small" @click="detailHandle(scope.row.purComDetailId)">查看</el-button>
+            <el-button v-if="isAuth('pur:commDetail:info')" type="text" size="small" @click="detailHandle(scope.row.purchaseCommission.purchaseId)">查看</el-button>
             <el-button v-if="isAuth('pur:commDetail:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.purComDetailId)">编辑</el-button>
             <el-button v-if="isAuth('pur:commDetail:save')" type="text" size="small" @click="addOrUpdateHandle(scope.row.purComDetailId)">委外</el-button>
             <el-button v-if="isAuth('wh:in:inbound')" type="text" size="small" @click="inBound(scope.row.purComDetailId, false)">入库</el-button>