|
@@ -152,8 +152,8 @@
|
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
- <el-table ref="multipleTable1" key="0" :data="barnGroupTableList" element-loading-text="给我一点时间" highlight-current-row @selection-change="change_barn_group_selection" @current-change="change_barn_group_now" border fit >
|
|
|
- <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
+ <el-table ref="multipleTable1" key="0" :data="barnGroupTableList" element-loading-text="给我一点时间" highlight-current-row @selection-change="change_barn_group_selection" border fit >
|
|
|
+ <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
<el-table-column label="栏舍组名称" min-width="150px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.name }}</span>
|
|
@@ -167,7 +167,7 @@
|
|
|
</el-table>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-table ref="multipleTable2" row-key="id" :data="barnTableList" element-loading-text="给我一点时间" @selection-change="change_barn_selection"
|
|
|
+ <el-table ref="multipleTable2" row-key="id" :data="barnTableList" element-loading-text="给我一点时间" @selection-change="change_barn_selection"
|
|
|
border fit >
|
|
|
<el-table-column type="selection" :reserve-selection=true width="55"> </el-table-column>
|
|
|
<el-table-column label="栏舍名称" min-width="150px" align="center">
|
|
@@ -193,11 +193,9 @@
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
- <el-dialog title="配方模板" :visible.sync="seeFormShow" @close="see_dialog_close" width="80%">
|
|
|
+ <el-dialog title="" :visible.sync="seeFormShow" @close="see_dialog_close" width="80%">
|
|
|
<div class="">
|
|
|
- <div class="search-bx1">
|
|
|
-
|
|
|
- </div>
|
|
|
+ <h2 style="float:left">模板名称:{{tableListTxt2}}</h2>
|
|
|
|
|
|
|
|
|
<el-table key="0" :data="tableList2" v-loading="tableLoading2" element-loading-text="给我一点时间" border fit>
|
|
@@ -365,21 +363,24 @@ export default {
|
|
|
// { required: true, message: '类型必填', trigger: 'blur' },
|
|
|
// ],
|
|
|
},
|
|
|
- barnIds:[],
|
|
|
+
|
|
|
barnGroupTableList:[],
|
|
|
barnTableList:[],
|
|
|
|
|
|
+ barnIdsArrAll:[],
|
|
|
+
|
|
|
+ barnGroupArr:[],
|
|
|
+ barnArr:[],
|
|
|
+
|
|
|
barnGroupIdsArr:[],
|
|
|
barnIdsArr:[],
|
|
|
|
|
|
- //选中的栏舍树包含所有栏舍
|
|
|
- barnGroupTree:[],
|
|
|
- //选中的栏舍树只包含选中栏舍
|
|
|
- barnGroupTreeSelect:[],
|
|
|
+
|
|
|
|
|
|
|
|
|
tableLoading2: false,
|
|
|
//表格内容
|
|
|
+ tableListTxt2:'',
|
|
|
tableList2:[],
|
|
|
seeFormShow:false,
|
|
|
seeFormStatus: '',
|
|
@@ -538,6 +539,7 @@ export default {
|
|
|
if(e.data.list == null || e.data.list == undefined ||e.data.list.length == 0 ){
|
|
|
me.tableList2 = []
|
|
|
} else {
|
|
|
+ me.tableListTxt2 = e.data.name
|
|
|
me.tableList2 = e.data.list
|
|
|
}
|
|
|
|
|
@@ -553,17 +555,29 @@ export default {
|
|
|
|
|
|
//新增
|
|
|
form_add() {
|
|
|
- this.reset_form()
|
|
|
+
|
|
|
this.addFormStatus = 'create'
|
|
|
this.addFormShow = true
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs['addFormRef'].clearValidate()
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ this.barnGroupArr = []
|
|
|
+ this.barnArr = []
|
|
|
this.barnGroupIdsArr = []
|
|
|
+ this.barnIdsArr = []
|
|
|
+ this.barnTableList = []
|
|
|
+
|
|
|
+
|
|
|
this.$refs.multipleTable1.clearSelection()
|
|
|
this.$refs.multipleTable2.clearSelection()
|
|
|
|
|
|
+
|
|
|
+ this.reset_form()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
},
|
|
|
|
|
@@ -571,6 +585,16 @@ export default {
|
|
|
|
|
|
//编辑
|
|
|
form_edit(row) {
|
|
|
+
|
|
|
+ this.barnGroupArr = []
|
|
|
+ this.barnArr = []
|
|
|
+ this.barnGroupIdsArr = []
|
|
|
+ this.barnIdsArr = []
|
|
|
+ this.barnTableList = []
|
|
|
+
|
|
|
+
|
|
|
+ this.$refs.multipleTable1.clearSelection()
|
|
|
+ this.$refs.multipleTable2.clearSelection()
|
|
|
this.reset_form()
|
|
|
//编辑行内容赋值
|
|
|
this.addForm = Object.assign({}, row)
|
|
@@ -597,19 +621,47 @@ export default {
|
|
|
//验证成功
|
|
|
if (valid) {
|
|
|
//发起请求
|
|
|
+
|
|
|
+
|
|
|
+ console.log('新增保存',send_data)
|
|
|
+
|
|
|
+ console.log('新增保存 barnGroupArr', me.barnGroupArr)
|
|
|
+ console.log('新增保存 barnArr', me.barnArr)
|
|
|
+
|
|
|
+ var barnGroupIdsArr = []
|
|
|
+ var barnIdsArr = []
|
|
|
+ var barnArrTemp = []
|
|
|
+
|
|
|
+ me.barnArr.forEach(function(item){
|
|
|
+ me.barnGroupArr.forEach(function(items){
|
|
|
+ if(item.barn_group_id == items.id){
|
|
|
+ barnArrTemp.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log('新增保存 有组别的栏舍 barnArrTemp', barnArrTemp)
|
|
|
+ me.barnGroupArr.forEach(function(items){
|
|
|
+ barnGroupIdsArr.push(items.id)
|
|
|
+ })
|
|
|
+ barnArrTemp.forEach(function(items){
|
|
|
+ barnIdsArr.push(items.id)
|
|
|
+ })
|
|
|
+
|
|
|
var send_data = {
|
|
|
- "class_number": me.addForm.class_number,
|
|
|
+
|
|
|
+ "name": me.addForm.name,
|
|
|
+ "class_number": parseFloat(me.addForm.class_number),
|
|
|
"formula_id":parseFloat(me.addForm.formula_id),
|
|
|
"formula_name": me.addForm.formula_name,
|
|
|
"feed_vehicle_id": parseFloat(me.addForm.feed_vehicle_id) ,
|
|
|
"feed_vehicle_name": me.addForm.feed_vehicle_name,
|
|
|
"status": parseFloat(me.addForm.status) ,
|
|
|
"feed_time": parseTime(me.addForm.feed_time, '{h}:{i}:{s}'),
|
|
|
- "barn_group_ids":me.barnGroupIdsArr,
|
|
|
- "barn_ids":me.barnIdsArr,
|
|
|
+ "barn_group_ids":barnGroupIdsArr,
|
|
|
+ "barn_ids":barnIdsArr,
|
|
|
}
|
|
|
-
|
|
|
- console.log('新增保存',send_data)
|
|
|
+
|
|
|
|
|
|
//关闭弹窗
|
|
|
// me.addFormShow = false
|
|
@@ -714,41 +766,35 @@ export default {
|
|
|
|
|
|
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
//栏舍组选择
|
|
|
change_barn_group_selection(val){
|
|
|
console.log("选中的数组", val)
|
|
|
var me = this
|
|
|
- var barnGroupIdsArr = []
|
|
|
-
|
|
|
-
|
|
|
- val.forEach(function (item,index) {
|
|
|
- barnGroupIdsArr.push(item.id)
|
|
|
-
|
|
|
- })
|
|
|
- me.barnGroupIdsArr = barnGroupIdsArr
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ me.barnGroupArr = val
|
|
|
+ console.log("选中的栏舍组数组", me.barnGroupArr)
|
|
|
+
|
|
|
|
|
|
|
|
|
- me.barnIds = []
|
|
|
+ me.barnIdsArrAll = []
|
|
|
val.forEach(function (item,index) {
|
|
|
item.barns.forEach(function (v,k){
|
|
|
- me.barnIds.push(v)
|
|
|
+ me.barnIdsArrAll.push(v)
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- console.log("选中的栏舍组",me.barnGroupIdsArr)
|
|
|
- console.log("选中的栏舍",me.barnIdsArr)
|
|
|
+
|
|
|
+ console.log("选中的栏舍组里所有栏舍ID",me.barnIdsArrAll)
|
|
|
+ // me.$refs.multipleTable2.clearSelection()
|
|
|
|
|
|
// 查询栏舍组下的所有栏舍数据
|
|
|
- if(me.barnIds.length > 0) {
|
|
|
- ajaxDataPost('/api/v1/ops/barn/list/ids',{ids:me.barnIds}).then(e => {
|
|
|
+ if(me.barnIdsArrAll.length > 0) {
|
|
|
+ ajaxDataPost('/api/v1/ops/barn/list/ids',{ids:me.barnIdsArrAll}).then(e => {
|
|
|
if(e.code === 200) {
|
|
|
me.barnTableList = e.data.list
|
|
|
|
|
|
|
|
|
-
|
|
|
// for(let i = 0; i<me.barnTableList.length;i++){
|
|
|
// for(let j = 0; i<me.barnIdsArr.length;i++){
|
|
|
// if(me.barnTableList[i].id == me.barnIdsArr[i]){
|
|
@@ -767,22 +813,20 @@ export default {
|
|
|
},
|
|
|
|
|
|
|
|
|
- change_barn_group_now(val) {
|
|
|
- this.currentRow = val;
|
|
|
- console.log("currentRow==========",this.currentRow)
|
|
|
- },
|
|
|
-
|
|
|
+
|
|
|
change_barn_selection(val){
|
|
|
var me = this
|
|
|
- this.selectList2 = val
|
|
|
- console.log('勾选数据selectList2', this.selectList2)
|
|
|
-
|
|
|
- var barnIdsArr = []
|
|
|
- val.forEach(function (item,index) {
|
|
|
- barnIdsArr.push(item.id)
|
|
|
+ var barnArr = []
|
|
|
+ barnArr = val
|
|
|
+ me.barnArr = barnArr
|
|
|
+ console.log('栏舍选中的', me.barnArr)
|
|
|
+ // var barnIdsArr = []
|
|
|
+ // val.forEach(function (item,index) {
|
|
|
+ // barnIdsArr.push(item.id)
|
|
|
|
|
|
- })
|
|
|
- me.barnIdsArr = barnIdsArr
|
|
|
+ // })
|
|
|
+ // me.barnIdsArr = barnIdsArr
|
|
|
+ // console.log('栏舍选中的ID', me.barnIdsArr)
|
|
|
|
|
|
|
|
|
|