Просмотр исходного кода

配方对应替代方案下拉

Shan9312 1 год назад
Родитель
Сommit
5cd90d3f87

+ 2 - 2
.env.development

@@ -4,9 +4,9 @@ ENV = 'development'
 # base api
 # 测试线
 # VUE_APP_BASE_API = 'http://192.168.1.70:8082/'
-VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
+# VUE_APP_BASE_API = 'http://kpttest.kptyun.com/'
 # 白少后台本地
-# VUE_APP_BASE_API = 'http://192.168.1.56:80/'
+VUE_APP_BASE_API = 'http://192.168.1.56:80/'
 # VUE_APP_BASE_API = 'http://192.168.1.93/'
 # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
 # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

+ 29 - 7
src/views/formulationPlan/recipeTemplate/index.vue

@@ -154,7 +154,8 @@
             <el-table-column label="替代方案" min-width="130px" align="center">
               <template slot-scope="scope">
                 <span v-if="scope.row.NoEdit">{{ scope.row.surplus }}</span>
-                <el-select v-if="scope.row.id && scope.row.Edit" v-model="scope.row.surplusId" filterable placeholder="替代方案" class="filter-item" style="width:95%;padding:10px 0;" >
+                <el-select v-if="scope.row.id && scope.row.Edit" v-model="scope.row.surplusId" filterable clearable placeholder="替代方案" class="filter-item" style="width:95%;padding:10px 0;"  @change="(val)=>handlegetSurplus(val,scope.row)"
+                >
                   <el-option v-for="item in tableData" :key="item.id" :label="item.surplus" :value="item.id" />
                 </el-select>
               </template>
@@ -873,6 +874,7 @@ export default {
   data() {
     return {
       tableData:[],
+      chooseTableData:[],
       dialogFull: false,
       predefineColors: [
         '#E57373', '#F06292', '#BA68C8', '#9575CD', '#7986CB', '#64B5F6', '#4FC3F7', '#4DD0E1', '#4DB6AC', '#81C784', '#AED581', '#DCE775', '#FFF176', '#FFD54F', '#FFB74D', '#FF8A65', '#A1887F', '#E0E0E0', '#90A4AE'
@@ -1190,6 +1192,15 @@ export default {
     this.getLeftTable();
   },
   methods: {
+      // 获取替代方案的名字
+      handlegetSurplus(id,row){
+        const arr = this.tableData.filter(item => {
+          if(item.id == id) return item
+        })
+        row.surplus = arr.length && arr[0].surplus || ''
+        row.surplusId = arr.length && arr[0].id || 0
+        console.log(row,'hsss')
+      },
      // 点击编辑的时候 获取当前配方下的饲料数组
      // 把剩料的数组和 配方下的进行比较 相同的值则可选择,不同的则只能禁止掉
      handleChooseLeftOver(row){
@@ -1202,21 +1213,29 @@ export default {
           this.table2.getdataListParm.parammaps.dryweight = row.dryweight
        GetDataByName(this.table2.getdataListParm).then(res=>{
           const {data} = res;
-          console.log(data,res,'饲料');
-          const ids = data.list.map(item =>{return item.fid})
-          const arr = this.tableData.filter(item=>{
+          
+          let ids=[]
+          if(data.list && data.list.length ){
+            ids = data.list.map(item =>{return item.fid})
+          } else{
+            ids =[]
+          }
+          console.log(ids,this.chooseTableData,'饲料-----');
+          const arr = this.chooseTableData.filter(item=>{
             if(ids.includes(item.feedId) || item.surplus == '日粮'){
               return item
             }
           })
-          console.log(ids,arr,'hss');
+          console.log(ids,arr,'hss----');
           this.tableData = arr;
 
        })
      },
      async getLeftTable(){
         const {data} = await getSurplus(Cookies.get('pastureid'));
+        this.chooseTableData = JSON.parse(JSON.stringify(data));
         this.tableData = data;
+
       },
     getButtons() {
       const Edit = 'RecipeTemplate'
@@ -1554,7 +1573,7 @@ export default {
       console.log(row,'当前数据',this.table.temp)
     },
     updateData(row) {
-      console.log('点击了编辑保存', row);
+
       this.table.temp.tname = row.tname
       this.table.temp.tcode = row.tcode
       this.table.temp.tcolor = row.tcolor
@@ -1569,7 +1588,9 @@ export default {
       this.table.temp.id = row.id
       this.table.temp.cattle = row.cattle
       this.table.temp.autozone = row.autozone
-      this.table.temp.surplusId = row.surplusId
+
+      this.table.temp.surplusId = row.surplusId 
+      this.table.temp.surplus =  row.surplus
       if(this.table.temp.volume == '' || this.table.temp.volume == null || this.table.temp.volume == undefined){
         this.table.temp.volume = 0
       }
@@ -1611,6 +1632,7 @@ export default {
       this.requestParam2.name = 'checkNumber'
       this.requestParam2.parammaps = {}
       this.requestParam2.parammaps.number = this.table.temp.tcode
+      console.log('点击了编辑保存-------——————', row, this.table.temp);
       GetDataByName(this.requestParam2).then(response => {
         console.log('table数据', response.data.list)
         if (response.data.list[0].vmsg !== '输入非法字符') {

+ 27 - 10
src/views/shedProduction/materialRemainingRecord/index.vue

@@ -151,12 +151,13 @@
           <el-row>
             <el-col :span="20">
               <el-form-item label="收集:" >
-                <el-select ref="times" v-model="create.temp.times" filterable placeholder="班次" :disabled="create.dialogStatus=='update'" class="filter-item" style="width: 100%;">
+                <el-select ref="times" v-model="create.temp.times" filterable placeholder="收集" :disabled="create.dialogStatus=='update'" class="filter-item" style="width: 100%;">
                   <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
                 </el-select>
               </el-form-item>
             </el-col>
           </el-row>
+
           <el-row>
             <el-col :span="20">
               <el-form-item label="原剩料所属时间:" prop="remaindate">
@@ -164,6 +165,7 @@
                   v-model="create.temp.remaindate"
                   type="date"
                   value-format="yyyy-MM-dd"
+                  style="width: 100%;"
                   :picker-options="pickerOptions"
                   placeholder="原剩料所属时间">
                 </el-date-picker>
@@ -192,6 +194,20 @@
                 <el-date-picker v-model="create.temp.operatetime" :disabled="create.dialogStatus=='update'" type="datetime" placeholder="选择处理时间" format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" style="width: 100%;" :clearable="false" />
               </el-form-item>
             </el-col> -->
+            <el-row>
+          <el-col :span="20">
+              <el-form-item label="收集时间:"   prop="operatetime">
+                <el-date-picker
+                :disabled="create.dialogStatus=='update'"
+                  v-model="create.temp.operatetime"
+                  type="datetime"
+                  style="width: 100%;"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                  placeholder="选择收集时间">
+                </el-date-picker>
+              </el-form-item>
+            </el-col>
+          </el-row>
           </el-row>
           <el-row>
             <el-col :span="20">
@@ -251,7 +267,7 @@ export default {
 
       ],
       houseNameList: [], // 栏舍名称
-      frequencyList: [], // 班次
+      frequencyList: [], // 收集
       recordList:[{id:'0',name:'手动记录'},{id:'1',name:'TMR设备自动记录'}],
       record:'0',
       table: {
@@ -283,7 +299,7 @@ export default {
       create: {
         dialogFormVisible: false,
         dialogStatus: '',
-        temp: { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), emp: Cookies.get('employename'), barid: '', barname: '', remain: '',dry:0, times: 0 },
+        temp: { pastureid: Cookies.get('pastureid'), operatetime: new Date(), emp: Cookies.get('employename'), barid: '', barname: '', remain: '',dry:0, times: '0' },
         rules: {
           barid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
           remain: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
@@ -490,7 +506,7 @@ export default {
 
     // 新增
     resetTemp() {
-      this.create.temp = { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), emp: Cookies.get('employename'), barid: '', barname: '', remain: '',dry:0, times: 0 }
+      this.create.temp = { pastureid: Cookies.get('pastureid'), operatetime: new Date(), emp: Cookies.get('employename'), barid: '', barname: '', remain: '',dry:0, times: '0' }
     },
     blurEmp(item) {
       this.create.temp.emp = item.target.value
@@ -527,7 +543,8 @@ export default {
       })
     },
     handleCreate() {
-      console.log('点击了新增')
+      console.log('点击了新增', this.create)
+
       this.dialogFull = false
       this.resetTemp()
       this.getNoteTakerList()
@@ -751,7 +768,7 @@ export default {
             if (response.msg === 'fail') {
               const barid = new RegExp("key 'barid'")
               if (barid.test(response.data)) {
-                this.$notify({ type: 'warning', message: '该栏舍该班次今日剩料量已存在,不可重复生成', duration: 2000 })
+                this.$notify({ type: 'warning', message: '该栏舍该收集今日剩料量已存在,不可重复生成', duration: 2000 })
                 return
               }
               this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
@@ -826,8 +843,8 @@ export default {
            if(item== 2){
               var excelDatas1 = [
                 {
-                  tHeader: ['栏舍名称', '剩料量(kg)','干物质', '班次(第一班/第二班/第三班)', '收集时间', '操作人'],
-                  filterVal: ['barname', 'remain','dry', 'timesstr', 'operatetime', 'emp'],
+                  tHeader: ['栏舍名称','配方名称','原剩料所属时间', '剩料量(kg)','干物质', '收集', '收集时间', '操作人'],
+                  filterVal: ['barname', 'ftname','remaindate','remain','dry', 'timesstr', 'operatetime', 'emp'],
                   tableDatas: this.download.list,
                   sheetName: 'Sheet1'
                 }
@@ -863,8 +880,8 @@ export default {
           this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
            import('@/vendor/Export2Excel').then(excel => {
              const list1 = res.data.result
-             const tHeader = ['栏舍名称', '剩料量(kg)', '班次', '收集时间', '操作人', '错误信息']
-             const filterVal = ['栏舍名称', '剩料量(kg)', '班次', '收集时间', '操作人', 'error_msg']
+             const tHeader = ['栏舍名称', '配方名称','原剩料所属时间','剩料量(kg)', '收集', '收集时间', '操作人', '错误信息']
+             const filterVal = ['栏舍名称', '配方名称','原剩料所属时间','剩料量(kg)', '收集', '收集时间', '操作人', 'error_msg']
              const data1 = this.formatJson(filterVal, list1)
              excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍剩料记录导入报错信息', autoWidth: true, bookType: 'xlsx' })
            })