123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <div v-if="visible">
- <el-dialog id="reviseplanDialog" :title="title" :destroy-on-close="true" :visible.sync="visible" :close-on-click-modal="false" append-to-body :before-close="closeDialog" width="90%">
- <el-row class="dialogMinHeight">
- <el-button class="successBorder" size="medium" style="position: absolute;z-index: 1;right: 2px;top: 2px;" @click="saveData()">应用</el-button>
- <el-tabs v-model="parentActiveName" type="border-card" @tab-click="handleClick">
- <el-tab-pane label="栏舍配方" name="栏舍配方">
- <DhedFormula ref="DhedFormula" :parent-date="date" />
- </el-tab-pane>
- <el-tab-pane label="撒料计划" name="撒料计划">
- <MaterialIssuancePlan ref="MaterialIssuancePlan" :parent-date="date" />
- </el-tab-pane>
- <el-tab-pane label="预混计划" name="预混计划">
- <PremixedPlan ref="PremixedPlan" :parent-date="date" />
- </el-tab-pane>
- </el-tabs>
- </el-row>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose cancelClose1" @click="closeDialog()">关闭</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { PostDataByName } from '@/api/common'
- import DhedFormula from './typePage/dhedFormula.vue'
- import MaterialIssuancePlan from './typePage/materialIssuancePlan.vue'
- import PremixedPlan from './typePage/premixedPlan.vue'
- import { MessageBox } from 'element-ui'
- import Cookies from 'js-cookie'
- export default {
- name: 'RevisePlan',
- components: {
- DhedFormula, MaterialIssuancePlan, PremixedPlan
- },
- props: {
- show: { type: Boolean, default: false }, // 弹框可见标志
- parentActiveName: { type: String, defalut: '栏舍配方' },
- parentDate: { type: String, defalut: '' }
- },
- data() {
- return {
- typeList: [{ id: '1', effect: 'dark', label: '栏舍配方' }, { id: '2', effect: 'plain', label: '撒料计划' }, { id: '3', effect: 'plain', label: '预混计划' }],
- visible: this.show,
- dialogFormVisible: false,
- dialogStatus: '',
- rules: {},
- date: '',
- parentActiveName: '',
- temp: {},
- title: '',
- isDhedFormula: true,
- isMaterialIssuancePlan: false,
- isPremixedPlan: false,
- textMap: {
- revisePlan: '修改计划'
- },
- isokDisable: false,
- requestParam: {}
- }
- },
- watch: {
- // 监听show,visible 随着show变化而变化
- show: {
- immediate: true,
- handler(show) {
- this.visible = show
- }
- },
- parentDate: {
- immediate: true,
- handler(newVal, oldVal) {
- console.log('newVal-date', newVal)
- this.date = newVal
- this.title = '修改计划——' + this.date
- }
- },
- parentActiveName: {
- immediate: true,
- handler(newVal, oldVal) {
- console.log('newVal===', newVal)
- console.log('oldVal', oldVal)
- this.parentActiveName = newVal
- }
- }
- },
- created() {
- },
- methods: {
- closeDialog() {
- this.$emit('update:show', false) // 子组件更新弹框隐藏
- this.$emit('activeName', '栏舍配方')
- },
- saveData() {
- console.log('点击了应用')
- MessageBox.confirm('是否确认将当前修改计划应用至' + this.date, {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.requestParam.name = 'updatedownloadedplanDone'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
- this.requestParam.parammaps.date = this.date
- PostDataByName(this.requestParam).then(response => {
- if (response.msg === 'fail') {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
- this.closeDialog()
- this.$parent.getList()
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消应用' })
- })
- },
- handleClick(item) {
- console.log(item.name)
- if (item.name == '撒料计划') {
- this.$refs.MaterialIssuancePlan.getIsDisplay()
- this.$refs.MaterialIssuancePlan.getDownList()
- } else if (item.name == '栏舍配方') {
- this.$refs.DhedFormula.getIsDisplay()
- this.$refs.DhedFormula.getDownList()
- } else {
- this.$refs.PremixedPlan.getDownList()
- this.$refs.PremixedPlan.getIsDisplay()
- this.$refs.PremixedPlan.getList()
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- #reviseplanDialog {
- margin-top: -10vh !important
- }
- </style>
|