29a389966ebcac81876bde8968ea132a925ee1aa.svn-base 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div v-if="visible">
  3. <el-dialog id="reviseplanDialog" title="修改计划" :destroy-on-close="true" :visible.sync="visible" :close-on-click-modal="false" append-to-body :before-close="closeDialog" width="90%">
  4. <el-row class="dialogMinHeight">
  5. <el-button class="successBorder" size="medium" style="position: absolute;z-index: 1;right: 2px;top: 2px;" @click="saveData()">应用</el-button>
  6. <el-tabs v-model="parentActiveName" type="border-card" @tab-click="handleClick">
  7. <el-tab-pane label="栏舍配方" name="栏舍配方">
  8. <DhedFormula ref="DhedFormula" :parent-date="date" />
  9. </el-tab-pane>
  10. <el-tab-pane label="撒料计划" name="撒料计划">
  11. <MaterialIssuancePlan ref="MaterialIssuancePlan" :parent-date="date" />
  12. </el-tab-pane>
  13. <el-tab-pane label="预混计划" name="预混计划">
  14. <PremixedPlan ref="PremixedPlan" :parent-date="date" />
  15. </el-tab-pane>
  16. </el-tabs>
  17. </el-row>
  18. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  19. <el-button class="cancelClose" @click="closeDialog()">关闭</el-button>
  20. </div>
  21. </el-dialog>
  22. </div>
  23. </template>
  24. <script>
  25. import { PostDataByName } from '@/api/common'
  26. import DhedFormula from './typePage/dhedFormula.vue'
  27. import MaterialIssuancePlan from './typePage/materialIssuancePlan.vue'
  28. import PremixedPlan from './typePage/premixedPlan.vue'
  29. import { MessageBox } from 'element-ui'
  30. import Cookies from 'js-cookie'
  31. export default {
  32. name: 'RevisePlan',
  33. components: {
  34. DhedFormula, MaterialIssuancePlan, PremixedPlan
  35. },
  36. props: {
  37. show: { type: Boolean, default: false }, // 弹框可见标志
  38. parentActiveName: { type: String, defalut: '栏舍配方' },
  39. parentDate: { type: String, defalut: '' }
  40. },
  41. data() {
  42. return {
  43. typeList: [{ id: '1', effect: 'dark', label: '栏舍配方' }, { id: '2', effect: 'plain', label: '撒料计划' }, { id: '3', effect: 'plain', label: '预混计划' }],
  44. visible: this.show,
  45. dialogFormVisible: false,
  46. dialogStatus: '',
  47. rules: {},
  48. date: '',
  49. parentActiveName: '',
  50. temp: {},
  51. isDhedFormula: true,
  52. isMaterialIssuancePlan: false,
  53. isPremixedPlan: false,
  54. textMap: {
  55. revisePlan: '修改计划'
  56. },
  57. isokDisable: false,
  58. requestParam: {}
  59. }
  60. },
  61. watch: {
  62. // 监听show,visible 随着show变化而变化
  63. show: {
  64. immediate: true,
  65. handler(show) {
  66. this.visible = show
  67. }
  68. },
  69. parentDate: {
  70. immediate: true,
  71. handler(newVal, oldVal) {
  72. console.log('newVal-date', newVal)
  73. this.date = newVal
  74. }
  75. },
  76. parentActiveName: {
  77. immediate: true,
  78. handler(newVal, oldVal) {
  79. console.log('newVal===', newVal)
  80. console.log('oldVal', oldVal)
  81. this.parentActiveName = newVal
  82. }
  83. }
  84. },
  85. created() {
  86. },
  87. methods: {
  88. closeDialog() {
  89. this.$emit('update:show', false) // 子组件更新弹框隐藏
  90. this.$emit('activeName', '栏舍配方')
  91. },
  92. saveData() {
  93. console.log('点击了应用')
  94. MessageBox.confirm('是否确认将' + this.date + '的数据应用到当前?', {
  95. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  96. }).then(() => {
  97. this.requestParam.name = 'updatedownloadedplanDone'
  98. this.requestParam.parammaps = {}
  99. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  100. this.requestParam.parammaps.date = this.date
  101. PostDataByName(this.requestParam).then(response => {
  102. if (response.msg === 'fail') {
  103. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  104. } else {
  105. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  106. this.closeDialog()
  107. }
  108. })
  109. }).catch(() => {
  110. this.$message({ type: 'info', message: '已取消应用' })
  111. })
  112. },
  113. handleClick(item) {
  114. console.log(item.name)
  115. if (item.name == '撒料计划') {
  116. this.$refs.MaterialIssuancePlan.getIsDisplay()
  117. this.$refs.MaterialIssuancePlan.getDownList()
  118. } else if (item.name == '栏舍配方') {
  119. this.$refs.DhedFormula.getIsDisplay()
  120. this.$refs.DhedFormula.getDownList()
  121. } else {
  122. this.$refs.PremixedPlan.getDownList()
  123. this.$refs.PremixedPlan.getIsDisplay()
  124. this.$refs.PremixedPlan.getList()
  125. }
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. #reviseplanDialog {
  132. margin-top: -10vh !important
  133. }
  134. </style>