Browse Source

Merge branch 'feature/ci-test7' of duanxiaoduan/tmr-admin into master

duanxiaoduan 1 year ago
parent
commit
c57930c7ab

+ 3 - 2
.env.development

@@ -6,7 +6,8 @@ ENV = 'development'
 # VUE_APP_BASE_API = 'http://210.16.189.72:8081/'
 
 
-VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
+# VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
+# 南通测试线
 # VUE_APP_BASE_API = 'http://kpttestnt.kptyun.com/'
 
 
@@ -22,7 +23,7 @@ VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
 
 
 # 白少杰
-# VUE_APP_BASE_API = 'http://192.168.1.77:8081/'
+VUE_APP_BASE_API = 'http://192.168.1.77:8081/'
 
 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

BIN
dist.zip


+ 1 - 1
src/views/basicData/equipmentTMR/index.vue

@@ -69,7 +69,7 @@
           </template>
         </el-table-column>
 
-        <el-table-column label="最大搅拌量(KG)" min-width="85px" align="center">
+        <el-table-column label="最大搅拌量(KG)" min-width="110px" align="center">
           <template slot-scope="scope">
             <span v-if="scope.row.NoEdit">{{ scope.row.maxstirfeed }}</span>
             <el-input v-if="scope.row.Edit" v-model="scope.row.maxstirfeed" style="width: 80%;" />

+ 201 - 53
src/views/basicData/feedTable/index.vue

@@ -37,6 +37,7 @@
     </div>
     <div class="operation" ref="operation">
       <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
+      <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleSet">设置</el-button>
       <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleGetSapCode">获取SAP编码</el-button>
       <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="form_delete">删除</el-button>
       <el-button class="success" icon="el-icon-receiving" @click="handleFeedBank">饲料库</el-button>
@@ -82,10 +83,10 @@
         <u-table-column label="序号" type="index" align="center" width="50" fixed="left"/>
         <u-table-column label="饲料名称" min-width="80px" align="center" prop="fname" fixed="left"/>
         <u-table-column label="饲料分类" min-width="80px" align="center" prop="fclass" fixed="left"/>
-        <u-table-column label="物料类型" min-width="90px" align="center" prop="materialtyp" />
+        <u-table-column label="物料类型" min-width="90px" align="center" prop="sapMaterialtypeName" />
         <!-- <u-table-column label="SAP货位" min-width="90px" align="center" prop="goods" /> -->
         <u-table-column label="唯一编码" min-width="80px" align="center" prop="feedcode" />
-        <!-- <u-table-column label="SAP编码" min-width="90px" align="center" prop="sapcode" /> -->
+        <!-- <u-table-column label="SAP编码" min-width="90px" align="center" prop="sapCode" /> -->
         <u-table-column label="饲料来源" min-width="80px" align="center" prop="source" />
         <u-table-column label="计划类型" min-width="80px" align="center" prop="printgroup" />
         <u-table-column v-if="isInforvalue" label="小料秤" min-width="90px" align="center" prop="smtmrname" />
@@ -194,24 +195,25 @@
           </el-row>
           <el-row>
             <el-col :span="6">
-              <el-form-item label="物料类型:" prop="materialtype">
-                <el-select v-model="create.temp.materialtype" filterable placeholder="物料类型" class="filter-item" style="width: 100%;">
-                  <el-option v-for="item in materialtypeList" :key="item.id" :label="item.mixname" :value="item.id" />
+              <el-form-item label="物料类型:" prop="sapMaterialtype">
+                <el-select v-model="create.temp.sapMaterialtype" filterable placeholder="物料类型" class="filter-item" style="width: 100%;">
+                  <el-option v-for="item in materialtypeList" :key="item.id" :label="item.distName" :value="item.distCode" />
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item label="SAP货位:" prop="goods">
-                <el-select v-model="create.temp.goods" filterable placeholder="SAP货位" class="filter-item" style="width: 100%;">
-                  <el-option v-for="item in sapGoodsList" :key="item.id" :label="item.mixname" :value="item.id" />
+              <el-form-item label="SAP货位:" prop="sapGoods">
+                <el-select v-model="create.temp.sapGoods" filterable placeholder="SAP货位" class="filter-item" style="width: 100%;">
+                  <el-option v-for="item in sapGoodsList" :key="item.id" :label="item.distName" :value="item.distCode" />
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="6">
-              <el-form-item label="SAP编码:" prop="sapcode">
-                <el-select v-model="create.temp.sapcode" filterable placeholder="SAP编码" class="filter-item" style="width: 100%;">
+              <el-form-item label="SAP编码:" prop="sapCode">
+                <el-input ref="sapCode" v-model="create.temp.sapCode" class="filter-item" disabled placeholder="SAP编码" type="text" />
+                <!-- <el-select v-model="create.temp.sapcode" filterable placeholder="SAP编码" class="filter-item" style="width: 100%;">
                   <el-option v-for="item in sapCodeList" :key="item.id" :label="item.mixname" :value="item.id" />
-                </el-select>
+                </el-select> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -281,7 +283,7 @@
           <el-row>
             <el-col :span="6">
               <el-form-item label="备用字段01:" prop="backup1">
-                <el-input ref="backup1" v-model="create.temp.backup1" class="filter-item" placeholder="备用字段01" type="text" />
+                <el-input ref="backup1" v-model="create.temp.backup1" class="filter-item" placeholder="备用字段01" type="text" onkeyup="value=value.replace(/[^\x00-\xff]/g, '')" />
               </el-form-item>
             </el-col>
             <el-col :span="6">
@@ -656,7 +658,7 @@
         </div>
       </div>
     </el-dialog>
-    <!-- 获取SAP编码 -->
+    <!-- 设置 -->
     <el-dialog :fullscreen="dialogFull" :visible.sync="sapCode.dialogFormVisible" :close-on-click-modal="false" width="90%">
       <template slot="title">
         <div class="avue-crud__dialog__header">
@@ -710,12 +712,52 @@
         </div>
       </div>
     </el-dialog>
+
+    <!-- 获取SAP编码 -->
+    <el-dialog :fullscreen="dialogFull" :visible.sync="sapCode2.dialogFormVisible" :close-on-click-modal="false" width="50%">
+      <template slot="title">
+        <div class="avue-crud__dialog__header">
+          <span class="el-dialog__title">
+            <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
+            {{ textMap[sapCode2.dialogStatus] }}
+          </span>
+          <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
+            <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
+            <svg-icon v-else icon-class="fullscreen" />
+          </div>
+        </div>
+      </template>
+      <div class="app-add">
+        <el-form ref="sapCode2" :rules="sapCode2.rules" :model="sapCode2.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
+          <el-row>
+            <el-col :span="18">
+              <el-form-item label="时间范围:" prop="inputDatetime">
+                <el-date-picker v-model="sapCode2.temp.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="18">
+              <el-form-item label="物料类型:" prop="sapMaterialtype">
+                <el-select v-model="sapCode2.temp.sapMaterialtype" filterable placeholder="物料类型" class="filter-item" style="width: 100%;">
+                  <el-option v-for="item in materialtypeList" :key="item.id" :label="item.distName" :value="item.distCode" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button class="cancelClose" @click="sapCode2.dialogFormVisible = false;getList()">关闭</el-button>
+          <el-button v-if="sapCode2.dialogStatus==='sapCode2' && isRoleEdit" class="save" :disabled="isokDisable" @click="sapCodeData2()">确认</el-button>
+        </div>
+      </div>
+    </el-dialog>
   </div>
 
 </template>
 
 <script>
-import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
+import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons,postJson } from '@/api/common'
 import Cookies from 'js-cookie'
 import Sortable from 'sortablejs'
 import Pagination from '@/components/Pagination'
@@ -778,7 +820,9 @@ export default {
         { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
         { name: 'getFeedclassByBig', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
         { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['计划类型'] },
-        { name: 'getTMRListEnableTypeFeed', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '4' }}
+        { name: 'getTMRListEnableTypeFeed', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '4' }},
+        { name: 'getDistMateriel', offset: 0, pagecount: 0, params: [] },
+        { name: 'getDistGoods', offset: 0, pagecount: 0, params: [] },
       ],
       requestParams2: {
         name: 'getSysoptEnable', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), inforname: 'isSmallMaterial' }
@@ -828,7 +872,7 @@ export default {
       create: {
         dialogFormVisible: false,
         dialogStatus: '',
-        temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '',feedgroupid:'',materialtype:'',goods:'',sapcode:''},
+        temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '',feedgroupid:'',sapMaterialtype:'',sapGoods:'',sapCode:''},
         rules: {
           printgroupid :[{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
           fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
@@ -909,14 +953,29 @@ export default {
             }
           }
         }
-      },
+      },
+      sapCode2:{
+        dialogFormVisible: false,
+        dialogStatus: '',
+        materialtypeList:[],
+        temp:{
+          inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
+          sapMaterialtype:'',
+        },
+        rules: {
+          inputDatetime :[{required: true, message: '必填', trigger: 'blur' }],
+          sapMaterialtype: [{ required: true, message: '必填', trigger: 'blur' }],
+        }
+      },
+
       textMap: {
         create: '新增',
         update: '编辑',
         feedBank: '饲料库',
         relation: '关联',
         nutritive: '营养价值',
-        sapCode: '获取SAP编码'
+        sapCode: '设置',
+        sapCode2: '获取SAP编码',
       },
 
       isokDisable: false,
@@ -1146,6 +1205,8 @@ export default {
         this.feedTypeList = response.data.getFeedclassByBig.list
         this.planTypeList = response.data.getDictByName2.list
         this.smallMaterialList = response.data.getTMRListEnableTypeFeed.list
+        this.materialtypeList = response.data.getDistMateriel	.list
+        this.sapGoodsList = response.data.getDistGoods.list
       })
     },
 
@@ -1280,21 +1341,37 @@ export default {
           if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
           if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
           if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
-          if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
-          PostDataByName(this.requestParam).then(response => {
-            console.log('新增保存发送参数', this.requestParam)
-            if (response.msg !== 'fail') {
-              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
-              this.create.dialogFormVisible = false
-              this.getList()
-            } else {
-              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
-              if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
-              if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
-              if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
-              if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
-              if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
-            }
+          if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
+          let url = 'authdata/feedbackup/check'
+          let data = {
+            fclassid:this.create.temp.fclassid,
+            backup1:this.create.temp.backup1
+          }
+          postJson(url,data).then(response => {
+            if(response.msg == 'fail'){
+              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+              if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
+              if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
+              if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
+              if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
+              if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
+            }else{
+              PostDataByName(this.requestParam).then(response => {
+                console.log('新增保存发送参数', this.requestParam)
+                if (response.msg !== 'fail') {
+                  this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+                  this.create.dialogFormVisible = false
+                  this.getList()
+                } else {
+                  this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+                  if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
+                  if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
+                  if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
+                  if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
+                  if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
+                }
+              })
+            }
           })
         }
       })
@@ -1380,21 +1457,37 @@ export default {
           if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
           if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
           if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
-
-          PostDataByName(this.requestParam).then(response => {
-            console.log('新增保存发送参数', this.requestParam)
-            if (response.msg !== 'fail') {
-              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
-              this.create.dialogFormVisible = false
-              this.getList()
-            } else {
-              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
-              if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
-              if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
-              if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
-              if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
-              if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
-            }
+          let url = 'authdata/feedbackup/check'
+          let data = {
+            fclassid:this.create.temp.fclassid,
+            feedId:this.create.temp.id,
+            backup1:this.create.temp.backup1
+          }
+          postJson(url,data).then(response => {
+            if(response.msg == 'fail'){
+              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+              if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
+              if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
+              if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
+              if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
+              if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
+            }else{
+              PostDataByName(this.requestParam).then(response => {
+                console.log('新增保存发送参数', this.requestParam)
+                if (response.msg !== 'fail') {
+                  this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+                  this.create.dialogFormVisible = false
+                  this.getList()
+                } else {
+                  this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+                  if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
+                  if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
+                  if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
+                  if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
+                  if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
+                }
+              })
+            }
           })
         }
       })
@@ -1812,18 +1905,18 @@ export default {
         }
       })
     },
-    handleGetSapCode(){
+    handleSet(){
       if (this.selectList.length == 0) {
         this.$message({ type: 'error', message: '请选择一条信息', duration: 2000 })
       } else {
         this.dialogFull = false
         this.sapCode.dialogStatus = 'sapCode'
         this.sapCode.dialogFormVisible = true
-        this.sapCode.table.getdataListParm.parammaps.MAKTX = this.selectList[0].sapcode
         this.getsapCodeList()
       }
     },
-    getsapCodeList(){
+    getsapCodeList(){
+      this.sapCode.table.getdataListParm.parammaps.MAKTX = this.selectList[0].sapCode
       GetDataByName(this.sapCode.table.getdataListParm).then(response => {
         if (response.data.list !== null) {
           this.sapCode.table.list = response.data.list
@@ -1833,13 +1926,68 @@ export default {
          this.$refs.saptable.reloadData(this.sapCode.table.list)
       })
     },
-    handleSapCodeSearch(){},
+    handleSapCodeSearch(){
+      this.getsapCodeList()
+    },
     sapCodeData(){
-
+      if(this.sapCode.selectList.length>1 || this.sapCode.selectList.length == 0){
+        this.$message({ type: 'error', message: '请选择一条信息', duration: 2000 })
+      }else{
+        this.requestParam.name = 'updateFeedSapCode'
+        let data = {
+          name:'updateFeedSapCode',
+          parammaps:{
+            sapCode:this.sapCode.selectList[0].MATNR,
+            id:this.selectList[0].id
+          }
+        }
+        PostDataByName(data).then(response => {
+          console.log('新增保存发送参数', data)
+          if (response.msg !== 'fail') {
+            this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+            this.sapCode.dialogFormVisible = false
+            this.getList()
+          } else {
+            this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+            if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
+            if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
+            if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
+            if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
+            if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
+          }
+        })
+      }
     },
     handleSapCodeSelectionChange(val){
       this.sapCode.selectList = val
       console.log(this.sapCode.selectList,'this.sapCode.selectList')
+    },
+    handleGetSapCode(){
+        this.dialogFull = false
+        this.sapCode2.dialogStatus = 'sapCode2'
+        this.sapCode2.dialogFormVisible = true
+    },
+    sapCodeData2(){
+      this.$refs['sapCode2'].validate(valid => {
+        if (valid) {
+          let url = 'authdata/sap/feed'
+          let data = {
+            startTime:parseTime(this.sapCode2.temp.inputDatetime[0],'{y}-{m}-{d}'),
+            endTime:parseTime(this.sapCode2.temp.inputDatetime[1],'{y}-{m}-{d}'),
+            mtart:this.sapCode2.temp.sapMaterialtype,
+            pastureId:Cookies.get('pastureid')
+          }
+          postJson(url,data).then(response => {
+            if (response.msg !== 'fail') {
+              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+              this.sapCode2.dialogFormVisible = false
+              this.getList()
+            } else {
+              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+            }
+          })
+        }
+      })
     }
   }
 }

+ 80 - 6
src/views/basicData/groupColumn/index.vue

@@ -37,7 +37,8 @@
        <div v-else style="float:left;margin-left: 10px;">
         <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
         <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
-      </div>
+      </div>
+      <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleGetSapCode">获取SAP编码</el-button>
     </div>
     <div class="table">
       <u-table
@@ -130,23 +131,55 @@
       </u-table>
       <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
       <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
-    </div>
+    </div>
+    <!-- 获取SAP编码 -->
+    <el-dialog :fullscreen="dialogFull" :visible.sync="sapCode2.dialogFormVisible" :close-on-click-modal="false" width="50%">
+      <template slot="title">
+        <div class="avue-crud__dialog__header">
+          <span class="el-dialog__title">
+            <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
+            {{ textMap[sapCode2.dialogStatus] }}
+          </span>
+          <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
+            <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
+            <svg-icon v-else icon-class="fullscreen" />
+          </div>
+        </div>
+      </template>
+      <div class="app-add">
+        <el-form ref="sapCode2" :rules="sapCode2.rules" :model="sapCode2.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
+          <el-row>
+            <el-col :span="18">
+              <el-form-item label="时间范围:" prop="inputDatetime">
+                <el-date-picker v-model="sapCode2.temp.inputDatetime"  class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button class="cancelClose" @click="sapCode2.dialogFormVisible = false;getList()">关闭</el-button>
+          <el-button v-if="sapCode2.dialogStatus==='sapCode2' && isRoleEdit" class="save" :disabled="isokDisable" @click="sapCodeData2()">确认</el-button>
+        </div>
+      </div>
+    </el-dialog>
   </div>
 
 </template>
 
 <script>
-import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
+import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons,postJson } from '@/api/common'
 import Cookies from 'js-cookie'
 import draggable from 'vuedraggable'
-import Sortable from 'sortablejs'
+import Sortable from 'sortablejs'
+import { parseTime } from '@/utils/index.js'
 import Pagination from '@/components/Pagination'
 import { MessageBox } from 'element-ui'
 export default {
   name: 'GroupColumn',
   components: { Pagination,draggable },
   data() {
-    return {
+    return {
+      dialogFull: false,
       isRoleEdit: [],
       requestParams: [
         { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
@@ -181,6 +214,21 @@ export default {
         total: 0,
         listLoading: true,
         temp: {}
+      },
+      sapCode2:{
+        dialogFormVisible: false,
+        dialogStatus: '',
+        materialtypeList:[],
+        temp:{
+          inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
+          sapMaterialtype:'',
+        },
+        rules: {
+          inputDatetime :[{required: true, message: '必填', trigger: 'blur' }]
+        }
+      },
+      textMap: {
+        sapCode2: '获取SAP编码',
       },
       requestParam: {},
       isokDisable: false,
@@ -628,7 +676,33 @@ export default {
           console.log('下', that.table.list[newIndex + 1])
         }
       })
-    },
+    },
+    handleGetSapCode(){
+        this.dialogFull = false
+        this.sapCode2.dialogStatus = 'sapCode2'
+        this.sapCode2.dialogFormVisible = true
+    },
+    sapCodeData2(){
+      this.$refs['sapCode2'].validate(valid => {
+        if (valid) {
+          let url = 'authdata/sap/bar'
+          let data = {
+            startTime:parseTime(this.sapCode2.temp.inputDatetime[0],'{y}-{m}-{d}'),
+            endTime:parseTime(this.sapCode2.temp.inputDatetime[1],'{y}-{m}-{d}'),
+            pastureId:Cookies.get('pastureid')
+          }
+          postJson(url,data).then(response => {
+            if (response.msg !== 'fail') {
+              this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
+              this.sapCode2.dialogFormVisible = false
+              this.getList()
+            } else {
+              this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
+            }
+          })
+        }
+      })
+    }
   }
 }
 </script>

+ 96 - 13
src/views/formulationPlan/dailyExecutionPlan/index.vue

@@ -50,6 +50,7 @@
         <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" class="success" @click="handleDataSynchronization">数据同步</el-button>
         <el-button v-if="dataSynchronization3.isDataSynchronization&&isRoleEdit" class="success" @click="handleDataUpload">数据上传</el-button>
         <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
+        <el-button v-if="isRoleEdit && sapUpload.isSap" class="success" icon="el-icon-upload2" @click="handleSAPUpload">SAP上传</el-button>
       </div>
       <!-- 日执行计划 -->
       <div class="table">
@@ -836,6 +837,24 @@
           <el-button class="cancelClose1" @click="deleteRecord.dialogFormVisible = false;getList()">取消</el-button>
         </div>
       </div>
+    </el-dialog>
+
+    <el-dialog :title="textMap[sapUpload.dialogStatus]" :destroy-on-close="true" :visible.sync="sapUpload.dialogFormVisible" :close-on-click-modal="false" width="30%">
+      <div class="sapUpload">
+        <el-form ref="sapUpload" :rules="sapUpload.rules" :model="sapUpload.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
+          <el-row>
+            <el-col :span="24">
+              <el-form-item label="时间:" prop="date">
+                <el-date-picker v-model="sapUpload.temp.date" :clearable="false" class="filter-item" type="date" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+        <div slot="footer" class="dialog-footer" style="bottom:20px">
+          <el-button class="cancelClose" @click="sapUpload.dialogFormVisible = false;getList()">取消</el-button>
+          <el-button class="save" :disabled="isokDisable" @click="sapUploadData()">确认</el-button>
+        </div>
+      </div>
     </el-dialog>
   </div>
 </template>
@@ -1062,7 +1081,8 @@ export default {
         historyRecord: '历史记录',
         revisePlan: '修改计划',
         copy: '复制计划',
-        deleteRecord:'删除记录'
+        deleteRecord:'删除记录',
+        sapUpload:'SAP上传'
       },
       isokDisable: false,
       requestParam: {},
@@ -1114,7 +1134,29 @@ export default {
         mydate: parseTime(new Date(), '{y}-{m}-{d}')
       },
       selectList: [],
-      driverList:[]
+      driverList:[],
+      sapUpload:{
+        dialogFormVisible: false,
+        dialogStatus: '',
+        temp:{
+          date: parseTime(new Date(), '{y}-{m}-{d}')
+        },
+        rules: {
+          date: [{ required: true, message: '必填', trigger: 'blur' }],
+        },
+        getdataListParm: {
+          name: 'getSysoptEnable',
+          page: 1,
+          offset: 1,
+          pagecount: 1,
+          returntype: 'Map',
+          parammaps: {
+            pastureid: Cookies.get('pastureid'),
+            inforname: 'xdmysapupload'
+          }
+        },
+        isSap: false
+      }
     }
   },
 
@@ -1128,6 +1170,7 @@ export default {
     this.getList()
     this.getDownList()
     this.getIsDisplay()
+    this.getIsSap()
     this.getTMRList()
     this.getDriverList()
   },
@@ -1167,21 +1210,24 @@ export default {
     },
     getDataSynchronization() {
       GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
-        // console.log(response.data.list[0])
-        if (response.data.list[0].inforvalue == 0) {
-          this.dataSynchronization.isDataSynchronization = false
-        } else {
-          this.dataSynchronization.isDataSynchronization = true
+        // console.log(response.data.list[0])
+        if(response.data.list !== null){
+          if (response.data.list[0].inforvalue == 0) {
+            this.dataSynchronization.isDataSynchronization = false
+          } else {
+            this.dataSynchronization.isDataSynchronization = true
+          }
         }
       })
     },
     getDataSynchronization2() {
-      GetDataByName(this.dataSynchronization2.getdataListParm).then(response => {
-        // console.log(response.data.list[0])
-        if (response.data.list[0].inforvalue == 0) {
-          this.dataSynchronization2.isDataSynchronization = false
-        } else {
-          this.dataSynchronization2.isDataSynchronization = true
+      GetDataByName(this.dataSynchronization2.getdataListParm).then(response => {
+        if(response.data.list !== null){
+          if (response.data.list[0].inforvalue == 0) {
+            this.dataSynchronization2.isDataSynchronization = false
+          } else {
+            this.dataSynchronization2.isDataSynchronization = true
+          }
         }
       })
     },
@@ -2834,6 +2880,43 @@ export default {
           this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
         }
       })
+    },
+    getIsSap() {
+      GetDataByName(this.sapUpload.getdataListParm).then(response => {
+        // console.log()
+        if(response.data.list !== null){
+          if(response.data.list[0].inforvalue == 1){
+            this.sapUpload.isSap = true
+          }else{
+            this.sapUpload.isSap = false
+          }
+          console.log(this.sapUpload.isSap)
+        }
+      })
+    },
+    handleSAPUpload(){
+      this.sapUpload.dialogStatus = 'sapUpload'
+      this.sapUpload.dialogFormVisible = true
+    },
+    sapUploadData(){
+      this.$refs['sapUpload'].validate(valid => {
+        if (valid) {
+          const url = 'authdata/sap/material'
+          const data = {
+            // "name":"xdmysapupload",
+            "pastureid":Cookies.get('pastureid'),date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
+          }
+          postJson(url, data).then(response => {
+            if(response.msg == 'ok'){
+              this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
+              this.sapUpload.dialogFormVisible = false
+              this.getList()
+            }else{
+              this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
+            }
+          })
+        }
+      })
     }
   }
 }

+ 16 - 4
src/views/formulationPlan/recipeTemplate/index.vue

@@ -41,7 +41,7 @@
         </div>
         <div class="operation">
           <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
- 
+
           <el-upload style="float: right;margin-right: 15px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
             <el-button v-if="isRoleEdit" class="export" icon="el-icon-download" style="float: right;">导入</el-button>
           </el-upload>
@@ -126,6 +126,14 @@
                 <span>{{ scope.row.version }}</span>
               </template>
             </el-table-column>
+            <el-table-column label="牛群类别" min-width="130px" align="center">
+              <template slot-scope="scope">
+                <span v-if="scope.row.NoEdit">{{ scope.row.cattleName }}</span>
+                <el-select v-if="scope.row.Edit" v-model="scope.row.cattle" filterable placeholder="牛群类别" class="filter-item" style="width:95%;padding:10px 0;">
+                  <el-option v-for="item in distCattle" :key="item.value" :label="item.distName" :value="item.distCode" />
+                </el-select>
+              </template>
+            </el-table-column>
             <el-table-column label="是否启用" min-width="90px" align="center">
               <template slot-scope="scope">
                 <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
@@ -823,8 +831,10 @@ export default {
       requestParams: [
         { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },
         { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },
-        { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
+        { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
+        { name: 'getDistCattle', offset: 0, pagecount: 0, parammaps: {}}
       ],
+      distCattle:[],//牛群类别
       enableList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用
       lockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否锁定牛头数比例
       livestockTypeList: [], // 牲畜类别
@@ -987,7 +997,7 @@ export default {
         tableKey2: 0,
         total2: 0,
         listLoading2: false,
-        list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }],
+        list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1, }],
         getdataListParm: {
           name: 'getFTDetailCompare',
           page: 1,
@@ -1200,6 +1210,7 @@ export default {
         this.livestockTypeList = response.data.getDictByName.list
         this.formulaTypeList = response.data.getDictByName2.list
         this.feedNameList = response.data.getFeedAndPre.list
+        this.distCattle = response.data.getDistCattle.list
       })
     },
     // -------------------模板-----------------------------
@@ -1298,7 +1309,7 @@ export default {
           return false
         }
       }
-      this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'tname': '', tcode: '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '', 'source': '自定义', 'remark': '' })
+      this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'tname': '', tcode: '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '', 'source': '自定义', 'remark': '','cattle':'' })
       console.log('点击了新增this.table.list====>', this.table.list)
       this.table.temp = this.table.list[0]
       this.getTcodeList()
@@ -1455,6 +1466,7 @@ export default {
       this.table.temp.fttype = this.table.temp.fttype
       this.table.temp.pastureid = row.pastureid
       this.table.temp.id = row.id
+      this.table.temp.cattle = row.cattle
       if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
         this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
         return false