|
@@ -43,6 +43,8 @@
|
|
|
<el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
|
|
|
<el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
|
|
|
<el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" @click="handleTakeEffect">生效</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" @click="handleDisable">禁用</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>
|
|
@@ -1059,7 +1061,7 @@ export default {
|
|
|
name: 'getTcode', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
|
|
|
parammaps: { pastureid: '', fttypeid: '' }
|
|
|
},
|
|
|
- sourceList: [{ id: '0', name: '自定义' }, { id: '1', name: '集团下发未调整' }, { id: '2', name: '集团下发有调整' }]
|
|
|
+ sourceList: [{ id: '0', name: '自定义' }, { id: '1', name: '集团下发未调整' }, { id: '2', name: '集团下发有调整' }, { id: '3', name: '导入' }]
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -2389,123 +2391,135 @@ export default {
|
|
|
this.table2.updateList = Object.assign({}, row)
|
|
|
},
|
|
|
updateData2(row) {
|
|
|
- console.log('点击了详情编辑保存', row)
|
|
|
- this.isokDisable = true
|
|
|
- setTimeout(() => {
|
|
|
- this.isokDisable = false
|
|
|
- }, 1000)
|
|
|
- this.table2.temp.pastureid = row.pastureid
|
|
|
- this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
|
|
|
- this.table2.temp.fid = row.fid
|
|
|
- this.table2.temp.fname = this.table2.temp.fname
|
|
|
- this.table2.temp.fweight = row.fweight
|
|
|
- this.table2.temp.islockcount = row.islockcount
|
|
|
- this.table2.temp.sort = row.sort
|
|
|
- this.table2.temp.feedgroup = row.feedgroup
|
|
|
- this.table2.temp.preftid = this.table2.temp.preftid
|
|
|
- this.table2.temp.autosecond = row.autosecond
|
|
|
- this.table2.temp.id = row.id
|
|
|
- console.log('this.table2.updateList', this.table2.updateList)
|
|
|
- console.log('temp', this.table2.temp)
|
|
|
- var status = ''
|
|
|
- if (parseFloat(this.table2.temp.fweight) > parseFloat(this.table2.updateList.fweight)) {
|
|
|
- status = 0
|
|
|
- } else {
|
|
|
- status = 1
|
|
|
- }
|
|
|
- if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
|
|
|
- this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
|
|
|
- return false
|
|
|
- } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
|
|
|
- this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
|
|
|
- return false
|
|
|
- } else if (this.table2.temp.fid == '') {
|
|
|
- this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
|
|
|
- return false
|
|
|
- } else if (this.table2.temp.fweight == '') {
|
|
|
- this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
|
|
|
- return false
|
|
|
- } else if (this.table2.temp.autosecond == '') {
|
|
|
- this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
|
|
|
- return false
|
|
|
- }
|
|
|
- if (this.table2.temp.sort !== '') {
|
|
|
- this.table2.temp.sort = this.table2.temp.sort
|
|
|
- } else {
|
|
|
- this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
|
|
|
- }
|
|
|
- if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
|
|
|
- if (parseInt(this.table2.temp.preftid) > 0) {
|
|
|
- this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
- // 校验顺序是否>=0
|
|
|
- var ruleSort = /^\d+$/
|
|
|
- if (!ruleSort.test(this.table2.temp.sort)) {
|
|
|
- this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
|
|
|
- return false
|
|
|
- }
|
|
|
- this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 3) // 根据默认参数设置小数位数
|
|
|
- row.fweight = formatNum(row.fweight, 3)
|
|
|
- // 检验重量>0
|
|
|
- // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
|
|
|
- if (this.table2.temp.fweight == 0) {
|
|
|
- this.$message({ type: 'error', message: '重量请输入正数,最多保留三位小数', duration: 2000 })
|
|
|
- return false
|
|
|
- }
|
|
|
- this.requestParam.common = { 'returnmap': '0' }
|
|
|
- this.requestParam.data = []
|
|
|
- this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
|
|
|
- pastureid: row.pastureid,
|
|
|
- ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
- weight: String(row.fweight),
|
|
|
- preftid: this.table2.temp.preftid,
|
|
|
- dateTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
|
|
|
- slid: this.table2.temp.id,
|
|
|
- fid: row.fid
|
|
|
- }}
|
|
|
- this.requestParam.data[1] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
|
|
|
- pastureid: row.pastureid,
|
|
|
- ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
- fid: row.fid,
|
|
|
- fname: this.table2.temp.fname,
|
|
|
- fweight: String(row.fweight),
|
|
|
- islockcount: row.islockcount,
|
|
|
- sort: row.sort,
|
|
|
- feedgroup: row.feedgroup,
|
|
|
- preftid: this.table2.temp.preftid,
|
|
|
- autosecond: row.autosecond,
|
|
|
- id: row.id
|
|
|
- }}
|
|
|
- this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
|
|
|
- pastureid: row.pastureid,
|
|
|
- ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
- type: this.table2.getdataListParm.parammaps.fttypeid,
|
|
|
- status: status
|
|
|
- }}
|
|
|
- this.requestParam.data[3] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
|
|
|
- pastureid: row.pastureid,
|
|
|
- ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
- sort: row.sort,
|
|
|
- feedgroup: row.feedgroup
|
|
|
- }}
|
|
|
- this.requestParam.data[4] = { 'name': 'updateFTdetailGroup', 'type': 'e', 'parammaps': {
|
|
|
- pastureid: this.table2.getdataListParm.parammaps.pastureid,
|
|
|
- ftid: this.table2.getdataListParm.parammaps.ftid
|
|
|
- }}
|
|
|
- ExecDataByConfig(this.requestParam).then(response => {
|
|
|
- console.log('新增保存发送参数', this.requestParam)
|
|
|
- if (response.msg !== 'fail') {
|
|
|
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
|
|
|
- this.getList2()
|
|
|
- this.getList3()
|
|
|
- this.dropState = false
|
|
|
- } else {
|
|
|
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ console.log('点击了详情编辑保存', row)
|
|
|
+ this.isokDisable = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isokDisable = false
|
|
|
+ }, 1000)
|
|
|
+ this.table2.temp.pastureid = row.pastureid
|
|
|
+ this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
|
|
|
+ this.table2.temp.fid = row.fid
|
|
|
+ this.table2.temp.fname = this.table2.temp.fname
|
|
|
+ this.table2.temp.fweight = row.fweight
|
|
|
+ this.table2.temp.islockcount = row.islockcount
|
|
|
+ this.table2.temp.sort = row.sort
|
|
|
+ this.table2.temp.feedgroup = row.feedgroup
|
|
|
+ this.table2.temp.preftid = this.table2.temp.preftid
|
|
|
+ this.table2.temp.autosecond = row.autosecond
|
|
|
+ this.table2.temp.id = row.id
|
|
|
+ console.log('this.table2.updateList', this.table2.updateList)
|
|
|
+ console.log('temp', this.table2.temp)
|
|
|
+ // var status = ''
|
|
|
+ // if (parseFloat(this.table2.temp.fweight) > parseFloat(this.table2.updateList.fweight)) {
|
|
|
+ // status = 0
|
|
|
+ // } else {
|
|
|
+ // status = 1
|
|
|
+ // }
|
|
|
+ if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
|
|
|
+ this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
|
|
|
+ this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else if (this.table2.temp.fid == '') {
|
|
|
+ this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else if (this.table2.temp.fweight == '') {
|
|
|
+ this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
|
|
|
+ return false
|
|
|
+ } else if (this.table2.temp.autosecond == '') {
|
|
|
+ this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.table2.temp.sort !== '') {
|
|
|
+ this.table2.temp.sort = this.table2.temp.sort
|
|
|
+ } else {
|
|
|
+ this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
|
|
|
+ }
|
|
|
+ if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
|
|
|
+ if (parseInt(this.table2.temp.preftid) > 0) {
|
|
|
+ this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 校验顺序是否>=0
|
|
|
+ var ruleSort = /^\d+$/
|
|
|
+ if (!ruleSort.test(this.table2.temp.sort)) {
|
|
|
+ this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 3) // 根据默认参数设置小数位数
|
|
|
+ row.fweight = formatNum(row.fweight, 3)
|
|
|
+ // 检验重量>0
|
|
|
+ // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
|
|
|
+ if (this.table2.temp.fweight == 0) {
|
|
|
+ this.$message({ type: 'error', message: '重量请输入正数,最多保留三位小数', duration: 2000 })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.requestParam.common = { 'returnmap': '0' }
|
|
|
+ this.requestParam.data = []
|
|
|
+ this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
|
|
|
+ pastureid: row.pastureid,
|
|
|
+ ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
+ weight: String(row.fweight),
|
|
|
+ preftid: this.table2.temp.preftid,
|
|
|
+ dateTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
|
|
|
+ slid: this.table2.temp.id,
|
|
|
+ fid: row.fid
|
|
|
+ }}
|
|
|
+ this.requestParam.data[1] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
|
|
|
+ pastureid: row.pastureid,
|
|
|
+ ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
+ fid: row.fid,
|
|
|
+ fname: this.table2.temp.fname,
|
|
|
+ fweight: String(row.fweight),
|
|
|
+ islockcount: row.islockcount,
|
|
|
+ sort: row.sort,
|
|
|
+ feedgroup: row.feedgroup,
|
|
|
+ preftid: this.table2.temp.preftid,
|
|
|
+ autosecond: row.autosecond,
|
|
|
+ id: row.id
|
|
|
+ }}
|
|
|
+ this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
|
|
|
+ pastureid: row.pastureid,
|
|
|
+ ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
+ type: this.table2.getdataListParm.parammaps.fttypeid,
|
|
|
+ // status: status
|
|
|
+ }}
|
|
|
+ this.requestParam.data[3] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
|
|
|
+ pastureid: row.pastureid,
|
|
|
+ ftid: this.table2.getdataListParm.parammaps.ftid,
|
|
|
+ sort: row.sort,
|
|
|
+ feedgroup: row.feedgroup
|
|
|
+ }}
|
|
|
+ this.requestParam.data[4] = { 'name': 'updateFTdetailGroup', 'type': 'e', 'parammaps': {
|
|
|
+ pastureid: this.table2.getdataListParm.parammaps.pastureid,
|
|
|
+ ftid: this.table2.getdataListParm.parammaps.ftid
|
|
|
+ }}
|
|
|
+ const url = 'authdata/ftdetail/edit'
|
|
|
+ const data = this.requestParam
|
|
|
+ postJson(url, data).then(response => {
|
|
|
+ if (response.msg !== 'fail') {
|
|
|
+ this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList2()
|
|
|
+ this.getList3()
|
|
|
+ this.dropState = false
|
|
|
+ } else {
|
|
|
+ this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // ExecDataByConfig(this.requestParam).then(response => {
|
|
|
+ // console.log('新增保存发送参数', this.requestParam)
|
|
|
+ // if (response.msg !== 'fail') {
|
|
|
+ // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
|
|
|
+ // this.getList2()
|
|
|
+ // this.getList3()
|
|
|
+ // this.dropState = false
|
|
|
+ // } else {
|
|
|
+ // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ },
|
|
|
updateCancel2(row) {
|
|
|
console.log('点击了详情编辑取消')
|
|
|
// 饲料组编辑false,不可编辑true
|
|
@@ -3048,6 +3062,72 @@ export default {
|
|
|
this.$refs.myContainer.style.posiiton = ''
|
|
|
this.$refs.detail.style.posiiton = ''
|
|
|
this.$refs.detail.style.zIndex = ''
|
|
|
+ },
|
|
|
+ handleTakeEffect() {
|
|
|
+ if (this.selectList.length == 0) {
|
|
|
+ this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
|
|
|
+ } else {
|
|
|
+ MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
|
|
|
+ confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ for (let i = 0; i < this.selectList.length; i++) {
|
|
|
+ // this.$set(this.selectList[i], 'enable', '1')
|
|
|
+ this.selectList[i].enable = 1
|
|
|
+ }
|
|
|
+ console.log('生效', this.selectList)
|
|
|
+ this.requestParam.common = { 'returnmap': '0' }
|
|
|
+ this.requestParam.data = []
|
|
|
+ this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
|
|
|
+ this.requestParam.data[0].children = []
|
|
|
+ this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
|
|
|
+ enable: '@insertSpotList.enable',
|
|
|
+ id: '@insertSpotList.id',
|
|
|
+ pastureid: '@insertSpotList.pastureid'
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.requestParam).then(response => {
|
|
|
+ console.log('生效保存发送参数', this.requestParam)
|
|
|
+ if (response.msg === 'fail') {
|
|
|
+ this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
|
|
|
+ } else {
|
|
|
+ this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleDisable() {
|
|
|
+ if (this.selectList.length == 0) {
|
|
|
+ this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
|
|
|
+ } else {
|
|
|
+ MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
|
|
|
+ confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ for (let i = 0; i < this.selectList.length; i++) {
|
|
|
+ // this.$set(this.selectList[i], 'enable', '1')
|
|
|
+ this.selectList[i].enable = 0
|
|
|
+ }
|
|
|
+ console.log('禁用', this.selectList)
|
|
|
+ this.requestParam.common = { 'returnmap': '0' }
|
|
|
+ this.requestParam.data = []
|
|
|
+ this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
|
|
|
+ this.requestParam.data[0].children = []
|
|
|
+ this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
|
|
|
+ enable: '@insertSpotList.enable',
|
|
|
+ id: '@insertSpotList.id',
|
|
|
+ pastureid: '@insertSpotList.pastureid'
|
|
|
+ }}
|
|
|
+ ExecDataByConfig(this.requestParam).then(response => {
|
|
|
+ console.log('禁用保存发送参数', this.requestParam)
|
|
|
+ if (response.msg === 'fail') {
|
|
|
+ this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
|
|
|
+ } else {
|
|
|
+ this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|