df8026a31adeb273c028fb7a3640c3befdfa251d.svn-base 13 KB

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