a985caa7b675f347fbcbfed5cc0616f4d7a25421.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="app-container">
  3. <h3>预警参数</h3>
  4. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="270px" style="margin-top: 40px;margin-bottom:30px;">
  5. <el-row>
  6. <el-col :span="12">
  7. <el-form-item label="计划准确率预警值(%):" prop="remainOptRate">
  8. <el-input ref="remainOptRate" v-model.number="createTemp.remainOptRate" type="number" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" />
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="12">
  12. <el-form-item label="配方准确率预警值(%):" prop="remainOptRate">
  13. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  14. </el-form-item>
  15. </el-col>
  16. </el-row>
  17. <el-row>
  18. <el-col :span="12">
  19. <el-form-item label="牛群准确率预警值(%):" prop="remainOptRate">
  20. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="12">
  24. <el-form-item label="车次准确率预警值(%):" prop="remainOptRate">
  25. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  26. </el-form-item>
  27. </el-col>
  28. </el-row>
  29. <el-row>
  30. <el-col :span="12">
  31. <el-form-item label="混料自动跳转准确率预警值(%):" prop="remainOptRate">
  32. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="混料手动跳转准确率预警值(%):" prop="remainOptRate">
  37. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  38. </el-form-item>
  39. </el-col>
  40. </el-row>
  41. <el-row>
  42. <el-col :span="12">
  43. <el-form-item label="泌乳牛采食量平均值偏差预警值(kg):" prop="remainOptRate">
  44. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="12">
  48. <el-form-item label="泌乳牛产奶量平均值偏差预警值(kg):" prop="remainOptRate">
  49. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="12">
  55. <el-form-item label="撒料时间偏差预警值(min):" prop="remainOptRate">
  56. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item label="超出平均混料时间预警值(min):" prop="remainOptRate">
  61. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row>
  66. <el-col :span="12">
  67. <el-form-item label="超出平均转化率预警值(%):" prop="remainOptRate">
  68. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="12">
  72. <el-form-item label="超出平均公斤奶饲料成本(%):" prop="remainOptRate">
  73. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. <el-row>
  78. <el-col :span="12">
  79. <el-form-item label="牛栏剩料率超出预警值(%):" prop="remainOptRate">
  80. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="12">
  84. <el-form-item label="库存预警天数:" prop="remainOptRate">
  85. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  86. </el-form-item>
  87. </el-col>
  88. </el-row>
  89. </el-form>
  90. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  91. <el-button v-if="isRoleEdit" class="success" :disabled="isokDisable" @click="handleSave">保存</el-button>
  92. <el-button v-if="isRoleEdit" class="warning" :disabled="isokDisable" @click="handleRecovery">恢复默认</el-button>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import { GetDataByName, PostDataByName, GetDataByNames, failproccess, checkButtons, ExecDataByConfig } from '@/api/common'
  98. import Cookies from 'js-cookie'
  99. import { MessageBox } from 'element-ui'
  100. export default {
  101. name: 'DefaultParameter',
  102. data() {
  103. return {
  104. isRoleEdit: [],
  105. planBeforeDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取前一天计划
  106. planNextDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取后一天计划
  107. isSupplementList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用补料
  108. isLeftoverMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用剩料
  109. decimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 日计划报表小数点位数
  110. isLockBullsList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 启用饲料锁定牛头数
  111. disposalList: [], // 剩料处理选项
  112. waterConditioningList: [{ id: '0', name: '青贮' }, { id: '1', name: '总日粮饲喂量' }, { id: '2', name: '不处理' }], // 水分调节选项
  113. priceCalculationList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用库存管理
  114. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  115. feedontractList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用饲料合同
  116. leftoverMaterialList: [{ id: '0', name: '顶额分配' }, { id: '1', name: '剩料分配' }],
  117. requestParams: [
  118. { name: 'getRemainFeedList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  119. ],
  120. getdataListParm: {
  121. name: 'getysoptList',
  122. page: 1,
  123. offset: 1,
  124. pagecount: 10,
  125. returntype: 'Map',
  126. parammaps: {
  127. pastureid: Cookies.get('pastureid')
  128. }
  129. },
  130. tableKey: 0,
  131. listLoading: true,
  132. createTemp: {},
  133. rules: {},
  134. isokDisable: false,
  135. requestParam: {}
  136. }
  137. },
  138. created() {
  139. this.getList()
  140. this.getButtons()
  141. this.getDownList()
  142. },
  143. methods: {
  144. getButtons() {
  145. const Edit = 'DefaultParameter'
  146. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  147. this.isRoleEdit = isRoleEdit
  148. },
  149. getDownList() {
  150. GetDataByNames(this.requestParams).then(response => {
  151. this.disposalList = response.data.getRemainFeedList.list
  152. })
  153. },
  154. getList() {
  155. this.listLoading = true
  156. GetDataByName(this.getdataListParm).then(response => {
  157. console.log('table1数据', response.data.list)
  158. if (response.data.list !== null) {
  159. this.createTemp = response.data.list[0]
  160. } else {
  161. this.list = []
  162. }
  163. setTimeout(() => {
  164. this.listLoading = false
  165. }, 100)
  166. })
  167. },
  168. handleSave() {
  169. console.log('点击了保存')
  170. this.isokDisable = true
  171. setTimeout(() => {
  172. this.isokDisable = false
  173. }, 1000)
  174. this.requestParam.common = { 'returnmap': '0' }
  175. this.requestParam.data = []
  176. this.requestParam.data[0] = { 'name': 'updatesysopt', 'type': 'e', 'parammaps': {
  177. pastureid: this.createTemp.pastureid,
  178. isGetLastPlan: this.createTemp.isGetLastPlan,
  179. isGetNextPlan: this.createTemp.isGetNextPlan,
  180. isEnableSupplyFeed: this.createTemp.isEnableSupplyFeed,
  181. isEnableRemainFeed: this.createTemp.isEnableRemainFeed,
  182. reportDigit: this.createTemp.reportDigit,
  183. isLockCount: this.createTemp.isLockCount,
  184. remainOpt: this.createTemp.remainOpt,
  185. waterOpt: this.createTemp.waterOpt,
  186. overweightWarnRate: this.createTemp.overweightWarnRate,
  187. overweightBanRate: this.createTemp.overweightBanRate,
  188. repertoryWarn: this.createTemp.repertoryWarn,
  189. isfeedstorage: this.createTemp.isfeedstorage,
  190. times: this.createTemp.times,
  191. isEnableContract: this.createTemp.isEnableContract,
  192. remainOptDis: this.createTemp.remainOptDis,
  193. remainOptRate: this.createTemp.remainOptRate
  194. }}
  195. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  196. pastureid: this.createTemp.pastureid
  197. }}
  198. ExecDataByConfig(this.requestParam).then(response => {
  199. console.log('保存发送参数', this.requestParam)
  200. if (response.msg !== 'fail') {
  201. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  202. this.getList()
  203. } else {
  204. failproccess(response, this.$notify)
  205. }
  206. })
  207. },
  208. handleRecovery() {
  209. console.log('点击了恢复默认')
  210. this.isokDisable = true
  211. setTimeout(() => {
  212. this.isokDisable = false
  213. }, 1000)
  214. MessageBox.confirm('是否确认恢复默认设置?', {
  215. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  216. }).then(() => {
  217. this.requestParam.common = { 'returnmap': '0' }
  218. this.requestParam.data = []
  219. this.requestParam.data[0] = { 'name': 'updatesysoptinit', 'type': 'e', 'parammaps': {
  220. pastureid: this.createTemp.pastureid
  221. }}
  222. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  223. pastureid: this.createTemp.pastureid
  224. }}
  225. ExecDataByConfig(this.requestParam).then(response => {
  226. console.log('保存发送参数', this.requestParam)
  227. if (response.msg !== 'fail') {
  228. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  229. this.getList()
  230. } else {
  231. failproccess(response, this.$notify)
  232. }
  233. })
  234. })
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="scss" scoped>
  240. </style>