浏览代码

对接备件申购

duanxiaoduan 1 年之前
父节点
当前提交
d477d751ad
共有 1 个文件被更改,包括 176 次插入70 次删除
  1. 176 70
      src/views/custom/subscribe/index.vue

+ 176 - 70
src/views/custom/subscribe/index.vue

@@ -28,6 +28,7 @@
 
         <el-button v-if="isSubscribeAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="apply_subscribe">新增</el-button>
         <el-button v-if="isSubscribeSpecial" class="filter-item" type="primary" icon="el-icon-edit" @click="handle_specialSubscription">特殊申购</el-button>
+        <el-button v-if="isSubscribeMilk" class="filter-item" type="primary" icon="el-icon-edit" @click="handle_milkSubscription">奶厅申购</el-button>
         <el-button v-if="isSubscribeExport" v-waves class="filter-item" type="success" icon="el-icon-upload2" @click="handleDownload">导出</el-button>
         <el-radio-group v-model="radioAll" style="margin-top:-9px" @change="changeAll()">
           <el-radio-button label="全部" />
@@ -156,8 +157,8 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="申购部门:" prop="departmentId">
-                <el-select v-model="createTemp.departmentId" placeholder="申购部门" class="filter-item" style="width:100%" :disabled="dialogStatus==='update'" @change="changeDepart">
-                  <el-option v-for="item in createDepartList" :key="item.id" :label="item.name" :value="item.id" />
+                <el-select v-model="createTemp.departmentId" placeholder="申购部门" class="filter-item" style="width:100%" :disabled="dialogStatus==='update' || isMilk" @change="changeDepart">
+                  <el-option v-for="item in createDepartList" :key="item.id" :label="item.name" :value="item.id" :disabled="item.name== '挤奶处'" />
                 </el-select>
               </el-form-item>
             </el-col>
@@ -309,8 +310,8 @@
               </el-form>
             </template>
           </el-table-column>
-          <el-table-column label="部门" min-width="110px" align="center" prop="purpose" valign="middle" />
-          <el-table-column label="驳回说明" min-width="110px" align="center" prop="purpose" valign="middle" />
+          <!-- <el-table-column label="部门" min-width="110px" align="center" prop="purpose" valign="middle" /> -->
+          <el-table-column label="驳回说明" min-width="110px" align="center" prop="explain1" valign="middle" />
           <el-table-column label="备注" min-width="110px" align="center" valign="middle">
             <template slot-scope="scope">
               <el-input v-model="scope.row.purpose" />
@@ -710,7 +711,8 @@
               </div>
             </template>
           </el-table-column>
-          <el-table-column label="申购数量" sortable prop="amount" align="center" min-width="60" />
+          <el-table-column label="申购数量" sortable prop="amount" align="center" min-width="60" />
+          <el-table-column label="驳回说明" min-width="110px" align="center" prop="explain1" valign="middle" />
           <el-table-column label="备注" min-width="110px" align="center" prop="purpose" />
         </el-table>
         <el-form
@@ -924,9 +926,9 @@
               </div>
             </template>
           </el-table-column>
-          <el-table-column label="部门" prop="unit" align="center" min-width="60" />
-          <el-table-column label="申购人" prop="reportery" align="center" min-width="60" />
-          <el-table-column label="申购日期" prop="reportery" align="center" min-width="60" />
+          <el-table-column label="部门" prop="departmentName" align="center" min-width="60" />
+          <el-table-column label="申购人" prop="empname" align="center" min-width="60" />
+          <el-table-column label="申购日期" prop="date" align="center" min-width="60" />
           <el-table-column label="备注" min-width="110px" align="center" valign="middle" prop="purpose" />
           <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right" >
             <template slot-scope="{row}">
@@ -941,6 +943,7 @@
       </div>
     </el-dialog>
 
+
     <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisibleSee1" :close-on-click-modal="false" width="90%">
       <div class="app-containerSee">
         <el-form
@@ -1094,6 +1097,7 @@ export default {
   data() {
     return {
       isSubscribeAdd: [],isSubscribeSpecial:[], isSubscribeExamineSBZG:[],isSubscribeTemplate: [], isSubscribeImport: [], isSubscribeExport: [], isSubscribeSee: [], isSubscribeDelete: [], isSubscribeExamineKG: [], isSubscribeExamineCG: [],isSubscribeExamineCW:[], isSubscribeExamineZG: [],sdchangzhangshenhe: [],
+      isSubscribeMilk:[],
       isokDisable: false,
       findAllProvider: [],
       findAllPasture: [],
@@ -1165,7 +1169,8 @@ export default {
       total: 0,
       list: [],
       dialogStatus: '',
-      dialogFormVisible: false,
+      dialogFormVisible: false,
+      dialogFormVisible_milk:false,
       dialogFormVisible2: false,
       dialogFormVisibleSee: false,
       dialogFormVisibleSee1: false,
@@ -1260,7 +1265,8 @@ export default {
         }
       },
       apply_subscribeData:{},
-      isApplyEx4:true,
+      isApplyEx4:true,
+      isMilk:false, //标记是不是奶厅申购
       myHeight:document.documentElement.clientHeight - 85- 150,
       dialogFormVisible_modify:false,
       modifyTemp:{
@@ -1295,7 +1301,12 @@ export default {
       // 特殊申购
       const SubscribeSpecial = 'customs:subscribe:special'
       const isSubscribeSpecial = checkButtons(this.$store.state.user.buttons, SubscribeSpecial)
-      this.isSubscribeSpecial = isSubscribeSpecial
+      this.isSubscribeSpecial = isSubscribeSpecial
+
+      // 奶厅申购
+      const SubscribeMilk = 'customs:subscribe:milk'
+      const isSubscribeMilk = checkButtons(this.$store.state.user.buttons, SubscribeMilk)
+      this.isSubscribeMilk = isSubscribeMilk
       // 模板
       // eslint-disable-next-line no-redeclare
       const SubscribeTemplate = 'customs:subscribe:template'
@@ -1507,6 +1518,7 @@ export default {
       this.listAdd = []
     },
     form_add() {
+      this.isMilk = false
       this.seepart.getdataListParm.parammaps.partName = ''
       this.resetCreateTemp()
       this.edit = 1
@@ -1524,6 +1536,7 @@ export default {
       let data = {
         name:'getBigPartpurchase',
         parammaps:{
+          purchaseType:0,
           pastureId:parseInt(Cookies.get('pastureid'))
         }
       }
@@ -1534,10 +1547,11 @@ export default {
           this.createTemp.pastureId = response.data.list[0].pastureId
           this.createTemp.orderNumber = response.data.list[0].orderNumber
           this.createTemp.createTime = response.data.list[0].inputTime
+          this.createTemp.bigId = response.data.list[0].id
           this.getdataListSee.parammaps.id = response.data.list[0].id
           this.getSeeList()
         }else{
-          this.createTemp.markBackend = true
+          this.createTemp.markBackend = false
           this.getCreateNumber()
         }
 
@@ -1816,31 +1830,64 @@ export default {
           }
         }
         if(this.createTemp.markBackend){
-          this.postDataPramas.common = { 'returnmap': '0' }
-          this.postDataPramas.data = []
-          this.postDataPramas.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.listAdd }}
-          this.postDataPramas.data[0].children = []
-          this.postDataPramas.data[0].children[0] = { 'name': 'insertPartpurchase', 'type': 'e', 'parammaps': {
-            bigId: '@insertBigPartpurchase.LastInsertId',
-            pastureId: '@insertSpotList.pastureId',
-            partId: '@insertSpotList.partId',
-            partCode: '@insertSpotList.partCode',
-            partName: '@insertSpotList.partName',
-            specification: '@insertSpotList.specification',
-            unit: '@insertSpotList.unit',
-            brandId: '@insertSpotList.brandId',
-            storageAmount: '@insertSpotList.reportery',
-            purpose: '@insertSpotList.purpose',
-            amount: '@insertSpotList.amount',
-            price: '@insertSpotList.price',
-            contractId: '@insertSpotList.contractId',
-            lifeCycle: '@insertSpotList.lifeCycle',
-            contractVarianceItem: '@insertSpotList.contractVarianceItem',
-            reject: '@insertSpotList.reject',
-            departmentId: '@insertSpotList.departmentId',
-            explain: '@insertSpotList.explain',
-          }}
+          console.log('有数据-走新保存')
+          let url = 'authdata/partpurchase/edit'
+          let dataArr = []
+          for(let i =0 ;i<this.listAdd.length;i++){
+            let obj = {
+              "id": parseFloat(this.listAdd[i].id),
+              "bigId": parseFloat(this.createTemp.bigId),
+              "pastureId": parseFloat(this.listAdd[i].pastureId),
+              "partId": parseFloat(this.listAdd[i].partId),
+              "partCode": this.listAdd[i].partCode.toString(),
+              "partName": this.listAdd[i].partName.toString(),
+              "specification": this.listAdd[i].specification,
+              "amount": parseFloat(this.listAdd[i].amount),
+              "unit":  this.listAdd[i].unit.toString(),
+              "brandId": parseFloat(this.listAdd[i].brandId),
+              "purpose":  this.listAdd[i].purpose.toString(),
+              "price":  this.listAdd[i].price.toString(),
+              "contractId":  this.listAdd[i].contractId.toString(),
+              "lifeCycle":  this.listAdd[i].lifeCycle.toString(),
+              "contractVarianceItem":  this.listAdd[i].contractVarianceItem.toString(),
+              "departmentId": this.createTemp.departmentId.toString(),
+              "date": this.createTemp.createTime.toString(),
+              "employeId": parseFloat(this.createTemp.employeId)
+            }
+            if(this.listAdd[i].storageAmount){
+              obj.storageAmount = parseFloat(this.listAdd[i].storageAmount)
+            }else{
+               obj.storageAmount = 0
+            }
+            if(this.listAdd[i].reject){
+              obj.reject = this.listAdd[i].reject.toString()
+            }else{
+               obj.reject = ''
+            }
+            if(this.listAdd[i].explain){
+              obj.explain = this.listAdd[i].explain.toString()
+            }else{
+               obj.explain = ''
+            }
+
+            dataArr.push(obj)
+          }
+          let data = dataArr
+          postJson(url, data).then(response => {
+            if (response.msg !== 'fail') {
+              this.get_table_data()
+              this.dialogFormVisible = false
+              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+            } else {
+              failproccess(response, this.$notify)
+            }
+          })
         }else{
+          console.log('无数据-走原有保存')
+          for(let i=0;i<this.listAdd.length;i++){
+            this.$set(this.listAdd[i],'date',this.createTemp.createTime)
+            this.$set(this.listAdd[i],'employeId',this.createTemp.employeId)
+          }
           this.postDataPramas.common = { 'returnmap': '0' }
           this.postDataPramas.data = []
           this.postDataPramas.data[0] = { 'name': 'insertBigPartpurchase', 'type': 'e', 'parammaps': {
@@ -1869,33 +1916,35 @@ export default {
             amount: '@insertSpotList.amount',
             price: '@insertSpotList.price',
             contractId: '@insertSpotList.contractId',
-            lifeCycle: '@insertSpotList.lifeCycle',
+            lifeCycle: '@insertSpotList.lifeCycle',
+            date: '@insertSpotList.date',
+            employeId: '@insertSpotList.employeId',
             contractVarianceItem: '@insertSpotList.contractVarianceItem'
           }}
+          ExecDataByConfig(this.postDataPramas).then(response => {
+            console.log('新增保存发送参数', this.postDataPramas)
+            if (response.msg === 'fail') {
+              this.$notify({
+                title: '保存失败',
+                message: response.data,
+                type: 'warning',
+                duration: 2000
+              })
+            } else {
+              this.dialogFormVisible = false
+              this.getdataListParm.parammaps.inputDatetime = ''
+              this.get_table_data()
+              this.getPendingList()
+              this.$notify({
+                title: '',
+                message: '保存成功',
+                type: 'success',
+                duration: 2000
+              })
+            }
+          })
+          return true
         }
-        ExecDataByConfig(this.postDataPramas).then(response => {
-          console.log('新增保存发送参数', this.postDataPramas)
-          if (response.msg === 'fail') {
-            this.$notify({
-              title: '保存失败',
-              message: response.data,
-              type: 'warning',
-              duration: 2000
-            })
-          } else {
-            this.dialogFormVisible = false
-            this.getdataListParm.parammaps.inputDatetime = ''
-            this.get_table_data()
-            this.getPendingList()
-            this.$notify({
-              title: '',
-              message: '保存成功',
-              type: 'success',
-              duration: 2000
-            })
-          }
-        })
-        return true
       } else {
         this.$message({
           title: '',
@@ -2068,7 +2117,14 @@ export default {
       }
     },
     getSeeList() {
-      this.listLoadingSee = true
+      this.listLoadingSee = true
+      console.log(this.dialogStatus,'======')
+      if(this.dialogStatus == 'create'){
+        console.log(this.dialogStatus,'======')
+        this.getdataListSee.parammaps.reject = ''
+      }else{
+        this.getdataListSee.parammaps.reject = 0
+      }
       GetDataByName(this.getdataListSee).then(response => {
         if (response.data.list !== null) {
           console.log('查看下方table数据', response.data.list)
@@ -2082,7 +2138,8 @@ export default {
             this.$set(item,'contractVarianceItemarr',contractVarianceItemarr)
           })
           this.listSee = response.data.list
-          this.listAdd = response.data.list
+          this.listAdd = response.data.list
+          this.modifylist = response.data.list
           var sumPrices = 0
           response.data.list.forEach(function(i,j){
             sumPrices = sumPrices + (parseFloat(i.price1) *parseFloat(i.amount) )
@@ -2139,7 +2196,8 @@ export default {
         }, 100)
       })
     },
-    form_edit(row) {
+    form_edit(row) {
+      this.isMilk = false
       this.edit = 0
       this.getDepartParam.parammaps.pastureId = row.pastureId
       this.getCreateDepartDownList()
@@ -2290,6 +2348,11 @@ export default {
           } else {
             this.createTemp.departmentId = response.data.list[0].id
             this.createTemp.departmentName = response.data.list[0].name
+          }
+          if(this.isMilk){
+            console.log('milk')
+            this.createTemp.departmentName  = '挤奶处'
+            this.createTemp.departmentId = this.createDepartList.find(obj => obj.name == this.createTemp.departmentName).id
           }
         }
       })
@@ -2893,12 +2956,14 @@ export default {
     },
     // 合单
     form_edit1(row){
-      this.createTemp = Object.assign({}, row) // copy obj
+      this.modifyTemp = Object.assign({}, row) // copy obj
       this.dialogStatus = 'update'
       this.dialogFormVisible_modify = true
-      // this.getCreateNumber()
+      this.modifylist = []
+      this.getdataListSee.parammaps.id = row.id
+      this.getSeeList()
     },
-    partReject(){
+    partReject(row){
       // 驳回
       this.$prompt('请输入驳回原因:', '驳回', {
         confirmButtonText: '确定',
@@ -2911,10 +2976,34 @@ export default {
         // inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
         inputErrorMessage: '请输入驳回原因'
       }).then(({ value }) => {
-        this.$message({
-          type: 'success',
-          message: '驳回原因: ' + value
-        });
+        let data = {
+          name:'editPartpurchaseReject',
+          parammaps:{
+            reject:1,
+            explain:value,
+            id:row.id
+          }
+        }
+        PostDataByName(data).then(response => {
+          console.log('审核确认发送参数', this.requestParam)
+          this.isokDisable = false
+          if (response.msg !== 'fail') {
+            this.get_table_data()
+            this.dialogFormVisible_Examine = false
+            this.dialogFormVisible_See = false
+            this.statueReason = false
+            this.$notify({
+              title: '成功',
+              message: '驳回成功',
+              type: 'success',
+              duration: 2000
+            })
+            this.getdataListSee.parammaps.id = this.modifyTemp.id
+            this.getSeeList()
+          } else {
+            failproccess(response, this.$notify)
+          }
+        })
       }).catch(() => {
         this.$message({
           type: 'info',
@@ -2924,6 +3013,23 @@ export default {
     },
     form_modify(){
       // 提交
+    },
+    handle_milkSubscription(){
+      // 奶厅申购
+      this.textMap.create = '奶厅申购'
+      this.dialogStatus = 'create'
+      this.isMilk = true
+      this.seepart.getdataListParm.parammaps.partName = ''
+      this.resetCreateTemp()
+      this.edit = 1
+      this.getDepartParam.parammaps.pastureId = this.createTemp.pastureId
+      this.getCreateDepartDownList()
+      this.dialogStatus = 'create'
+      this.dialogFormVisible = true
+      this.dialogFormVisible_seepart = false
+      this.$nextTick(() => {
+        this.$refs['createTemp'].clearValidate()
+      })
     }
   }
 }