f6d3360e6436061ee2e4f5a66253fb8878cd2d06.svn-base 5.3 KB

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