a8083587fe6bb6f44f26d00e7ca20405221aae48.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <div class="app-container" style="width: 90%;">
  3. <div class="el-icon-info" style="font-size: 30px;float: right;color: #009C69;" @click="handleDescription" />
  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="decimalPlaces">
  31. <el-select v-model="createTemp.decimalPlaces" :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.id" />
  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-row>
  112. <!-- <el-col :span="12">
  113. <el-form-item label="设备运转标准时间(分钟):" prop="remainOptRate">
  114. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item" placeholder="剩料分配占比原混料" type="text" />
  115. </el-form-item>
  116. </el-col> -->
  117. <el-col :span="12">
  118. <el-form-item label="是否启用数据同步:" prop="isDataSync">
  119. <el-select v-model="createTemp.isDataSync" :disabled="isRoleEdit==false" filterable placeholder="是否启用数据同步" class="filter-item" style="width:100%">
  120. <el-option v-for="item in dataSynchronizationList" :key="item.id" :label="item.name" :value="item.id" />
  121. </el-select>
  122. </el-form-item>
  123. </el-col>
  124. </el-row>
  125. </el-form>
  126. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  127. <el-button v-if="isRoleEdit" class="save" :disabled="isokDisable" @click="handleSave">保存</el-button>
  128. <el-button v-if="isRoleEdit" class="warning" :disabled="isokDisable" @click="handleRecovery">恢复默认</el-button>
  129. </div>
  130. <el-dialog :title="textMap[description.dialogStatus]" :destroy-on-close="true" :visible.sync="description.dialogFormVisible" :close-on-click-modal="false" width="70%">
  131. <div class="app-description dialogMinHeight">
  132. <div class="content">
  133. 1、是否可取前一天计划:若选择是,代表在当天过了凌晨12点仍可以取到昨天的料。
  134. <br>
  135. 2、是否可取后一天计划:若当天做完全部的料需要预备第二天的料的时候可以选择是。
  136. <br>
  137. 3、班次数量:控制栏舍配方,计划等页面班次数量。
  138. <br>
  139. 4、重量小数点位数:控制栏舍配方、撒料计划等页面重量小数位数。
  140. <br>
  141. 5、是否启用饲料合同:若选择是,则开启库存管理中饲料合同页面。
  142. <br>
  143. 6、启用饲料锁定牛头数:开启后则配方模板中饲料表显示此字段。
  144. </div>
  145. </div>
  146. <div slot="footer" class="dialog-footer">
  147. <el-button class="cancelClose" @click="description.dialogFormVisible = false; ">关闭</el-button>
  148. </div>
  149. </el-dialog>
  150. </div>
  151. </template>
  152. <script>
  153. import { GetDataByName, GetDataByNames, failproccess, checkButtons, ExecDataByConfig } from '@/api/common'
  154. import Cookies from 'js-cookie'
  155. import { MessageBox } from 'element-ui'
  156. export default {
  157. name: 'DefaultParameter',
  158. data() {
  159. return {
  160. isRoleEdit: [],
  161. planBeforeDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取前一天计划
  162. planNextDayList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否可取后一天计划
  163. isSupplementList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用补料
  164. isLeftoverMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用剩料
  165. decimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 日计划报表小数点位数
  166. isLockBullsList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 启用饲料锁定牛头数
  167. disposalList: [], // 剩料处理选项
  168. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  169. feedontractList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用饲料合同
  170. leftoverMaterialList: [{ id: '0', name: '顶额分配' }, { id: '1', name: '剩料分配' }],
  171. weightDecimalPlacesList: [{ id: '0', name: '整数' }, { id: '1', name: '一位小数' }, { id: '2', name: '两位小数' }, { id: '3', name: '三位小数' }], // 重量小数点位数
  172. smallMaterialList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 小料是否称量
  173. dataSynchronizationList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用数据同步
  174. requestParams: [
  175. { name: 'getRemainFeedList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  176. ],
  177. getdataListParm: {
  178. name: 'getysoptList',
  179. page: 1,
  180. offset: 1,
  181. pagecount: 10,
  182. returntype: 'Map',
  183. parammaps: {
  184. pastureid: Cookies.get('pastureid')
  185. }
  186. },
  187. tableKey: 0,
  188. listLoading: true,
  189. createTemp: {},
  190. rules: {},
  191. description: {
  192. dialogFormVisible: false,
  193. dialogStatus: ''
  194. },
  195. textMap: {
  196. description: '参数说明'
  197. },
  198. isokDisable: false,
  199. requestParam: {}
  200. }
  201. },
  202. created() {
  203. this.getList()
  204. this.getButtons()
  205. this.getDownList()
  206. },
  207. methods: {
  208. getButtons() {
  209. const Edit = 'DefaultParameter'
  210. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  211. this.isRoleEdit = isRoleEdit
  212. },
  213. getDownList() {
  214. GetDataByNames(this.requestParams).then(response => {
  215. this.disposalList = response.data.getRemainFeedList.list
  216. })
  217. },
  218. getList() {
  219. this.listLoading = true
  220. GetDataByName(this.getdataListParm).then(response => {
  221. console.log('table1数据', response.data.list)
  222. if (response.data.list !== null) {
  223. this.createTemp = response.data.list[0]
  224. } else {
  225. this.list = []
  226. }
  227. setTimeout(() => {
  228. this.listLoading = false
  229. }, 100)
  230. })
  231. },
  232. handleSave() {
  233. console.log('点击了保存')
  234. this.isokDisable = true
  235. setTimeout(() => {
  236. this.isokDisable = false
  237. }, 1000)
  238. this.requestParam.common = { 'returnmap': '0' }
  239. this.requestParam.data = []
  240. this.requestParam.data[0] = { 'name': 'updatesysopt', 'type': 'e', 'parammaps': {
  241. pastureid: this.createTemp.pastureid,
  242. isGetLastPlan: this.createTemp.isGetLastPlan,
  243. isGetNextPlan: this.createTemp.isGetNextPlan,
  244. isEnableSupplyFeed: this.createTemp.isEnableSupplyFeed,
  245. isEnableRemainFeed: this.createTemp.isEnableRemainFeed,
  246. reportDigit: this.createTemp.reportDigit,
  247. isLockCount: this.createTemp.isLockCount,
  248. remainOpt: this.createTemp.remainOpt,
  249. waterOpt: this.createTemp.waterOpt,
  250. overweightWarnRate: this.createTemp.overweightWarnRate,
  251. overweightBanRate: this.createTemp.overweightBanRate,
  252. repertoryWarn: this.createTemp.repertoryWarn,
  253. isfeedstorage: this.createTemp.isfeedstorage,
  254. times: this.createTemp.times,
  255. decimalPlaces: this.createTemp.decimalPlaces,
  256. isEnableContract: this.createTemp.isEnableContract,
  257. remainOptDis: this.createTemp.remainOptDis,
  258. remainOptRate: this.createTemp.remainOptRate,
  259. isSmallMaterial: this.createTemp.isSmallMaterial,
  260. isDataSync: this.createTemp.isDataSync,
  261. }}
  262. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  263. pastureid: this.createTemp.pastureid
  264. }}
  265. ExecDataByConfig(this.requestParam).then(response => {
  266. console.log('保存发送参数', this.requestParam)
  267. if (response.msg !== 'fail') {
  268. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  269. this.getList()
  270. } else {
  271. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  272. }
  273. })
  274. },
  275. handleRecovery() {
  276. console.log('点击了恢复默认')
  277. this.isokDisable = true
  278. setTimeout(() => {
  279. this.isokDisable = false
  280. }, 1000)
  281. MessageBox.confirm('是否确认恢复默认设置?', {
  282. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  283. }).then(() => {
  284. this.requestParam.common = { 'returnmap': '0' }
  285. this.requestParam.data = []
  286. this.requestParam.data[0] = { 'name': 'updatesysoptinit', 'type': 'e', 'parammaps': {
  287. pastureid: this.createTemp.pastureid
  288. }}
  289. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  290. pastureid: this.createTemp.pastureid
  291. }}
  292. ExecDataByConfig(this.requestParam).then(response => {
  293. console.log('保存发送参数', this.requestParam)
  294. if (response.msg !== 'fail') {
  295. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  296. this.getList()
  297. } else {
  298. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  299. }
  300. })
  301. })
  302. },
  303. handleDescription() {
  304. this.description.dialogStatus = 'description'
  305. this.description.dialogFormVisible = true
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. .app-description{
  312. display:flex; justify-content: center; align-items: center;font-size: 14px;line-height: 28px;
  313. .content{
  314. display:flex;
  315. }
  316. }
  317. </style>