eb4ee83fc247c8cd8ffdbe2ff27c35905f7e8f74.svn-base 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="app-container" style="width: 90%;">
  3. <h3>功能参数</h3>
  4. <div class="el-icon-info" style="font-size: 30px;float: right;color: #409EFF;" @click="handleDescription" />
  5. <el-form ref="createTemp" :rules="rules" :model="createTemp" label-position="right" label-width="250px" style="margin-top: 40px;margin-bottom:30px;">
  6. <el-row>
  7. <el-col :span="12">
  8. <el-form-item label="是否可取前一天计划:" prop="isGetLastPlan">
  9. <el-select v-model="createTemp.isGetLastPlan" :disabled="isRoleEdit==false" filterable placeholder="是否可取前一天计划" class="filter-item" style="width:100%">
  10. <el-option v-for="item in planBeforeDayList" :key="item.id" :label="item.name" :value="item.id" />
  11. </el-select>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="12">
  15. <el-form-item label="是否可取后一天计划:" prop="isGetNextPlan">
  16. <el-select v-model="createTemp.isGetNextPlan" :disabled="isRoleEdit==false" filterable placeholder="是否可取后一天计划" class="filter-item" style="width:100%">
  17. <el-option v-for="item in planNextDayList" :key="item.id" :label="item.name" :value="item.id" />
  18. </el-select>
  19. </el-form-item>
  20. </el-col>
  21. </el-row>
  22. <el-row>
  23. <el-col :span="12">
  24. <el-form-item label="班次数量:" prop="times">
  25. <el-select v-model="createTemp.times" :disabled="isRoleEdit==false" filterable placeholder="水分调节选项" class="filter-item" style="width:100%">
  26. <el-option v-for="item in numberList" :key="item.id" :label="item.name" :value="item.name" />
  27. </el-select>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="12">
  31. <el-form-item label="重量小数点位数:" prop="decimalPlaces">
  32. <el-select v-model="createTemp.decimalPlaces" :disabled="isRoleEdit==false" filterable placeholder="重量小数点位数" class="filter-item" style="width:100%">
  33. <el-option v-for="item in weightDecimalPlacesList" :key="item.id" :label="item.name" :value="item.id" />
  34. </el-select>
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. <el-row>
  39. <el-col :span="12">
  40. <el-form-item label="是否启用饲料合同:" prop="isEnableContract">
  41. <el-select v-model="createTemp.isEnableContract" :disabled="isRoleEdit==false" filterable placeholder="启用饲料合同" class="filter-item" style="width:100%">
  42. <el-option v-for="item in feedontractList" :key="item.id" :label="item.name" :value="item.id" />
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12">
  47. <el-form-item label="启用饲料锁定牛头数:" prop="isLockCount">
  48. <el-select v-model="createTemp.isLockCount" :disabled="isRoleEdit==false" filterable placeholder="启用饲料锁定牛头数" class="filter-item" style="width:100%">
  49. <el-option v-for="item in isLockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  50. </el-select>
  51. </el-form-item>
  52. </el-col>
  53. </el-row>
  54. <el-row>
  55. <el-col :span="12">
  56. <el-form-item label="车辆载重超出重量提醒比例(%):" prop="remainOptRate">
  57. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  58. </el-form-item>
  59. </el-col>
  60. <el-col :span="12">
  61. <el-form-item label="车辆载重超出重量禁止比例(%):" prop="remainOptRate">
  62. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. <el-row>
  67. <el-col :span="12">
  68. <el-form-item label="是否启用补料:" prop="isEnableSupplyFeed">
  69. <el-select v-model="createTemp.isEnableSupplyFeed" :disabled="isRoleEdit==false" filterable placeholder="是否启用补料" class="filter-item" style="width:100%">
  70. <el-option v-for="item in isSupplementList" :key="item.id" :label="item.name" :value="item.id" />
  71. </el-select>
  72. </el-form-item>
  73. </el-col>
  74. <el-col :span="12">
  75. <el-form-item label="是否启用剩料:" prop="isEnableRemainFeed">
  76. <el-select v-model="createTemp.isEnableRemainFeed" :disabled="isRoleEdit==false" filterable placeholder="是否启用剩料" class="filter-item" style="width:100%">
  77. <el-option v-for="item in isLeftoverMaterialList" :key="item.id" :label="item.name" :value="item.id" />
  78. </el-select>
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. <el-row>
  83. <el-col :span="12">
  84. <el-form-item label="剩料处理选项:" prop="remainOpt">
  85. <el-select v-model="createTemp.remainOpt" :disabled="isRoleEdit==false" filterable placeholder="剩料处理选项" class="filter-item" style="width:100%">
  86. <el-option v-for="item in disposalList" :key="item.id" :label="item.fname" :value="item.id" />
  87. </el-select>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="剩料分配方式:" prop="remainOptDis">
  92. <el-select v-model="createTemp.remainOptDis" :disabled="isRoleEdit==false" filterable placeholder="剩料分配方式" class="filter-item" style="width:100%">
  93. <el-option v-for="item in leftoverMaterialList" :key="item.id" :label="item.name" :value="item.name" />
  94. </el-select>
  95. </el-form-item>
  96. </el-col>
  97. </el-row>
  98. <el-row>
  99. <el-col :span="12">
  100. <el-form-item label="剩料分配占比原料(%):" prop="remainOptRate">
  101. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="12">
  105. <el-form-item label="小料是否称量:" prop="isSmallMaterial">
  106. <el-select v-model="createTemp.isSmallMaterial" :disabled="isRoleEdit==false" filterable placeholder="小料是否称量" class="filter-item" style="width:100%">
  107. <el-option v-for="item in smallMaterialList" :key="item.id" :label="item.name" :value="item.id" />
  108. </el-select>
  109. </el-form-item>
  110. </el-col>
  111. </el-row>
  112. </el-form>
  113. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  114. <el-button v-if="isRoleEdit" class="success" :disabled="isokDisable" @click="handleSave">保存</el-button>
  115. <el-button v-if="isRoleEdit" class="warning" :disabled="isokDisable" @click="handleRecovery">恢复默认</el-button>
  116. </div>
  117. <el-dialog :title="textMap[description.dialogStatus]" :destroy-on-close="true" :visible.sync="description.dialogFormVisible" :close-on-click-modal="false" width="70%">
  118. <div class="app-description dialogMinHeight">
  119. <div class="content">
  120. 1、是否可取前一天计划:若选择是,代表在当天过了凌晨12点仍可以取到昨天的料。
  121. <br>
  122. 2、是否可取后一天计划:若当天做完全部的料需要预备第二天的料的时候可以选择是。
  123. <br>
  124. 3、班次数量:控制栏舍配方,计划等页面班次数量。
  125. <br>
  126. 4、重量小数点位数:控制栏舍配方、撒料计划等页面重量小数位数。
  127. <br>
  128. 5、是否启用饲料合同:若选择是,则开启库存管理中饲料合同页面。
  129. <br>
  130. 6、启用饲料锁定牛头数:开启后则配方模板中饲料表显示此字段。
  131. </div>
  132. </div>
  133. <div slot="footer" class="dialog-footer">
  134. <el-button class="cancelClose" @click="description.dialogFormVisible = false; ">关闭</el-button>
  135. </div>
  136. </el-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import { GetDataByName, GetDataByNames, failproccess, checkButtons, ExecDataByConfig } from '@/api/common'
  141. import Cookies from 'js-cookie'
  142. import { MessageBox } from 'element-ui'
  143. export default {
  144. name: 'DefaultParameter',
  145. data() {
  146. return {
  147. isRoleEdit: [],
  148. planBeforeDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取前一天计划
  149. planNextDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取后一天计划
  150. isSupplementList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用补料
  151. isLeftoverMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用剩料
  152. decimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 日计划报表小数点位数
  153. isLockBullsList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 启用饲料锁定牛头数
  154. disposalList: [], // 剩料处理选项
  155. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  156. feedontractList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用饲料合同
  157. leftoverMaterialList: [{ id: '0', name: '顶额分配' }, { id: '1', name: '剩料分配' }],
  158. weightDecimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 重量小数点位数
  159. smallMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 小料是否称量
  160. requestParams: [
  161. { name: 'getRemainFeedList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  162. ],
  163. getdataListParm: {
  164. name: 'getysoptList',
  165. page: 1,
  166. offset: 1,
  167. pagecount: 10,
  168. returntype: 'Map',
  169. parammaps: {
  170. pastureid: Cookies.get('pastureid')
  171. }
  172. },
  173. tableKey: 0,
  174. listLoading: true,
  175. createTemp: {},
  176. rules: {},
  177. description: {
  178. dialogFormVisible: false,
  179. dialogStatus: ''
  180. },
  181. textMap: {
  182. description: '参数说明'
  183. },
  184. isokDisable: false,
  185. requestParam: {}
  186. }
  187. },
  188. created() {
  189. this.getList()
  190. this.getButtons()
  191. this.getDownList()
  192. },
  193. methods: {
  194. getButtons() {
  195. const Edit = 'DefaultParameter'
  196. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  197. this.isRoleEdit = isRoleEdit
  198. },
  199. getDownList() {
  200. GetDataByNames(this.requestParams).then(response => {
  201. this.disposalList = response.data.getRemainFeedList.list
  202. })
  203. },
  204. getList() {
  205. this.listLoading = true
  206. GetDataByName(this.getdataListParm).then(response => {
  207. console.log('table1数据', response.data.list)
  208. if (response.data.list !== null) {
  209. this.createTemp = response.data.list[0]
  210. } else {
  211. this.list = []
  212. }
  213. setTimeout(() => {
  214. this.listLoading = false
  215. }, 100)
  216. })
  217. },
  218. handleSave() {
  219. console.log('点击了保存')
  220. this.isokDisable = true
  221. setTimeout(() => {
  222. this.isokDisable = false
  223. }, 1000)
  224. this.requestParam.common = { 'returnmap': '0' }
  225. this.requestParam.data = []
  226. this.requestParam.data[0] = { 'name': 'updatesysopt', 'type': 'e', 'parammaps': {
  227. pastureid: this.createTemp.pastureid,
  228. isGetLastPlan: this.createTemp.isGetLastPlan,
  229. isGetNextPlan: this.createTemp.isGetNextPlan,
  230. isEnableSupplyFeed: this.createTemp.isEnableSupplyFeed,
  231. isEnableRemainFeed: this.createTemp.isEnableRemainFeed,
  232. reportDigit: this.createTemp.reportDigit,
  233. isLockCount: this.createTemp.isLockCount,
  234. remainOpt: this.createTemp.remainOpt,
  235. waterOpt: this.createTemp.waterOpt,
  236. overweightWarnRate: this.createTemp.overweightWarnRate,
  237. overweightBanRate: this.createTemp.overweightBanRate,
  238. repertoryWarn: this.createTemp.repertoryWarn,
  239. isfeedstorage: this.createTemp.isfeedstorage,
  240. times: this.createTemp.times,
  241. decimalPlaces: this.createTemp.decimalPlaces,
  242. isEnableContract: this.createTemp.isEnableContract,
  243. remainOptDis: this.createTemp.remainOptDis,
  244. remainOptRate: this.createTemp.remainOptRate,
  245. isSmallMaterial: this.createTemp.isSmallMaterial
  246. }}
  247. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  248. pastureid: this.createTemp.pastureid
  249. }}
  250. ExecDataByConfig(this.requestParam).then(response => {
  251. console.log('保存发送参数', this.requestParam)
  252. if (response.msg !== 'fail') {
  253. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  254. this.getList()
  255. } else {
  256. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  257. }
  258. })
  259. },
  260. handleRecovery() {
  261. console.log('点击了恢复默认')
  262. this.isokDisable = true
  263. setTimeout(() => {
  264. this.isokDisable = false
  265. }, 1000)
  266. MessageBox.confirm('是否确认恢复默认设置?', {
  267. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  268. }).then(() => {
  269. this.requestParam.common = { 'returnmap': '0' }
  270. this.requestParam.data = []
  271. this.requestParam.data[0] = { 'name': 'updatesysoptinit', 'type': 'e', 'parammaps': {
  272. pastureid: this.createTemp.pastureid
  273. }}
  274. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  275. pastureid: this.createTemp.pastureid
  276. }}
  277. ExecDataByConfig(this.requestParam).then(response => {
  278. console.log('保存发送参数', this.requestParam)
  279. if (response.msg !== 'fail') {
  280. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  281. this.getList()
  282. } else {
  283. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  284. }
  285. })
  286. })
  287. },
  288. handleDescription() {
  289. this.description.dialogStatus = 'description'
  290. this.description.dialogFormVisible = true
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .app-description{
  297. display:flex; justify-content: center; align-items: center;font-size: 14px;line-height: 28px;
  298. .content{
  299. display:flex;
  300. }
  301. }
  302. </style>