063f0787de881699faa5aaa04a26833f5f38a70d.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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.fname" :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="isfeedstorage">
  88. <el-select v-model="createTemp.isfeedstorage" :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-row>
  111. <el-col :span="12">
  112. <el-form-item label="剩料分配方式:" prop="remainOptDis">
  113. <el-select v-model="createTemp.remainOptDis" :disabled="isRoleEdit==false" filterable placeholder="剩料分配方式" class="filter-item" style="width:100%">
  114. <el-option v-for="item in leftoverMaterialList" :key="item.id" :label="item.name" :value="item.name" />
  115. </el-select>
  116. </el-form-item>
  117. </el-col>
  118. <el-col :span="12">
  119. <el-form-item label="剩料分配占比原混料(%):" prop="remainOptRate">
  120. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. </el-form>
  125. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  126. <el-button v-if="isRoleEdit" class="success" :disabled="isokDisable" @click="handleSave">保存</el-button>
  127. <el-button v-if="isRoleEdit" class="warning" :disabled="isokDisable" @click="handleRecovery">恢复默认</el-button>
  128. </div>
  129. </div>
  130. </template>
  131. <script>
  132. import { GetDataByName, PostDataByName, GetDataByNames, failproccess, checkButtons, ExecDataByConfig } from '@/api/common'
  133. import Cookies from 'js-cookie'
  134. import { MessageBox } from 'element-ui'
  135. export default {
  136. name: 'DefaultParameter',
  137. data() {
  138. return {
  139. isRoleEdit: [],
  140. planBeforeDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取前一天计划
  141. planNextDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取后一天计划
  142. isSupplementList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用补料
  143. isLeftoverMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用剩料
  144. decimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 日计划报表小数点位数
  145. isLockBullsList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 启用饲料锁定牛头数
  146. disposalList: [], // 剩料处理选项
  147. waterConditioningList: [{ id: '0', name: '青贮' }, { id: '1', name: '总日粮饲喂量' }, { id: '2', name: '不处理' }], // 水分调节选项
  148. priceCalculationList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用库存管理
  149. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  150. feedontractList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用饲料合同
  151. leftoverMaterialList: [{ id: '0', name: '顶额分配' }, { id: '1', name: '平均分配' }],
  152. requestParams: [
  153. { name: 'getRemainFeedList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  154. ],
  155. getdataListParm: {
  156. name: 'getysoptList',
  157. page: 1,
  158. offset: 1,
  159. pagecount: 10,
  160. returntype: 'Map',
  161. parammaps: {
  162. pastureid: Cookies.get('pastureid')
  163. }
  164. },
  165. tableKey: 0,
  166. listLoading: true,
  167. createTemp: {},
  168. rules: {},
  169. isokDisable: false,
  170. requestParam: {}
  171. }
  172. },
  173. created() {
  174. this.getList()
  175. this.getButtons()
  176. this.getDownList()
  177. },
  178. methods: {
  179. getButtons() {
  180. const Edit = 'DefaultParameter'
  181. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  182. this.isRoleEdit = isRoleEdit
  183. },
  184. getDownList() {
  185. GetDataByNames(this.requestParams).then(response => {
  186. this.disposalList = response.data.getRemainFeedList.list
  187. })
  188. },
  189. getList() {
  190. this.listLoading = true
  191. GetDataByName(this.getdataListParm).then(response => {
  192. console.log('table1数据', response.data.list)
  193. if (response.data.list !== null) {
  194. this.createTemp = response.data.list[0]
  195. } else {
  196. this.list = []
  197. }
  198. setTimeout(() => {
  199. this.listLoading = false
  200. }, 100)
  201. })
  202. },
  203. handleSave() {
  204. console.log('点击了保存')
  205. this.isokDisable = true
  206. setTimeout(() => {
  207. this.isokDisable = false
  208. }, 1000)
  209. this.requestParam.common = { 'returnmap': '0' }
  210. this.requestParam.data = []
  211. this.requestParam.data[0] = { 'name': 'updatesysopt', 'type': 'e', 'parammaps': {
  212. pastureid: this.createTemp.pastureid,
  213. isGetLastPlan: this.createTemp.isGetLastPlan,
  214. isGetNextPlan: this.createTemp.isGetNextPlan,
  215. isEnableSupplyFeed: this.createTemp.isEnableSupplyFeed,
  216. isEnableRemainFeed: this.createTemp.isEnableRemainFeed,
  217. reportDigit: this.createTemp.reportDigit,
  218. isLockCount: this.createTemp.isLockCount,
  219. remainOpt: this.createTemp.remainOpt,
  220. waterOpt: this.createTemp.waterOpt,
  221. overweightWarnRate: this.createTemp.overweightWarnRate,
  222. overweightBanRate: this.createTemp.overweightBanRate,
  223. repertoryWarn: this.createTemp.repertoryWarn,
  224. isfeedstorage: this.createTemp.isfeedstorage,
  225. times: this.createTemp.times,
  226. isEnableContract: this.createTemp.isEnableContract,
  227. remainOptDis: this.createTemp.remainOptDis,
  228. remainOptRate: this.createTemp.remainOptRate
  229. }}
  230. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  231. pastureid: this.createTemp.pastureid
  232. }}
  233. ExecDataByConfig(this.requestParam).then(response => {
  234. console.log('保存发送参数', this.requestParam)
  235. if (response.msg !== 'fail') {
  236. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  237. this.getList()
  238. } else {
  239. failproccess(response, this.$notify)
  240. }
  241. })
  242. },
  243. handleRecovery() {
  244. console.log('点击了恢复默认')
  245. this.isokDisable = true
  246. setTimeout(() => {
  247. this.isokDisable = false
  248. }, 1000)
  249. MessageBox.confirm('是否确认恢复默认设置?', {
  250. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  251. }).then(() => {
  252. this.requestParam.common = { 'returnmap': '0' }
  253. this.requestParam.data = []
  254. this.requestParam.data[0] = { 'name': 'updatesysoptinit', 'type': 'e', 'parammaps': {
  255. pastureid: this.createTemp.pastureid
  256. }}
  257. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  258. pastureid: this.createTemp.pastureid
  259. }}
  260. ExecDataByConfig(this.requestParam).then(response => {
  261. console.log('保存发送参数', this.requestParam)
  262. if (response.msg !== 'fail') {
  263. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  264. this.getList()
  265. } else {
  266. failproccess(response, this.$notify)
  267. }
  268. })
  269. })
  270. }
  271. }
  272. }
  273. </script>
  274. <style lang="scss" scoped>
  275. </style>