ff728e5edb8722ae210c0d4c42ff5d15f0380599.svn-base 12 KB

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