5dedc60d2b7e03e4fff963779889661f03496491.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 } from '@/api/common'
  119. import Cookies from 'js-cookie'
  120. export default {
  121. name: 'DefaultParameter',
  122. data() {
  123. return {
  124. isRoleEdit: [],
  125. planBeforeDayList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否可取前一天计划
  126. planNextDayList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否可取后一天计划
  127. isSupplementList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用补料
  128. isLeftoverMaterialList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用剩料
  129. decimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 日计划报表小数点位数
  130. isLockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 启用饲料锁定牛头数
  131. disposalList: [{ id: '0', name: '替换青贮' }, { id: '1', name: '转为饲料' }, { id: '2', name: '不处理' }], // 剩料处理选项
  132. waterConditioningList: [{ id: '0', name: '青贮' }, { id: '1', name: '总日粮饲喂量' }, { id: '2', name: '不处理' }], // 水分调节选项
  133. priceCalculationList: [{ id: '0', name: '先入先出' }, { id: '1', name: '加权平均' }], // 饲料价格计算方式
  134. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  135. feedontractList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用饲料合同
  136. getdataListParm: {
  137. name: 'getysoptList',
  138. page: 1,
  139. offset: 1,
  140. pagecount: 10,
  141. returntype: 'Map',
  142. parammaps: {
  143. pastureid: Cookies.get('pastureid')
  144. }
  145. },
  146. tableKey: 0,
  147. listLoading: true,
  148. createTemp: {},
  149. rules: {},
  150. isokDisable: false,
  151. requestParam: {}
  152. }
  153. },
  154. created() {
  155. this.getList()
  156. this.getButtons()
  157. },
  158. methods: {
  159. getButtons() {
  160. const Edit = 'DefaultParameter'
  161. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  162. this.isRoleEdit = isRoleEdit
  163. },
  164. getList() {
  165. this.listLoading = true
  166. GetDataByName(this.getdataListParm).then(response => {
  167. console.log('table1数据', response.data.list)
  168. if (response.data.list !== null) {
  169. this.createTemp = response.data.list[0]
  170. } else {
  171. this.list = []
  172. }
  173. setTimeout(() => {
  174. this.listLoading = false
  175. }, 100)
  176. })
  177. },
  178. handleSave() {
  179. console.log('点击了保存')
  180. this.isokDisable = true
  181. setTimeout(() => {
  182. this.isokDisable = false
  183. }, 1000)
  184. this.requestParam.name = 'updatesysopt'
  185. this.requestParam.parammaps = this.createTemp
  186. PostDataByName(this.requestParam).then(response => {
  187. console.log('新增保存发送参数', this.requestParam)
  188. if (response.msg !== 'fail') {
  189. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  190. this.getList()
  191. } else {
  192. failproccess(response, this.$notify)
  193. }
  194. })
  195. },
  196. handleRecovery() {
  197. console.log('点击了恢复默认')
  198. this.isokDisable = true
  199. setTimeout(() => {
  200. this.isokDisable = false
  201. }, 1000)
  202. this.requestParam.name = 'updatesysoptinit'
  203. this.requestParam.parammaps = {}
  204. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  205. PostDataByName(this.requestParam).then(response => {
  206. console.log('保存发送参数', this.requestParam)
  207. if (response.msg !== 'fail') {
  208. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  209. this.getList()
  210. } else {
  211. failproccess(response, this.$notify)
  212. }
  213. })
  214. }
  215. }
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. </style>