index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  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="270px" style="margin-top: 40px;margin-bottom:30px;">
  5. <el-row>
  6. <el-col :span="12">
  7. <el-form-item
  8. :label="$t('defaultParameter.jhzqlyjz')" prop="remainOptRate">
  9. <el-input ref="remainOptRate" v-model.number="createTemp.remainOptRate" type="number" :disabled="isRoleEdit==false" class="filter-item"
  10. :placeholder="$t('defaultParameter.slfpzb')" />
  11. </el-form-item>
  12. </el-col>
  13. <el-col :span="12">
  14. <el-form-item
  15. :label="$t('defaultParameter.pfzqlyjz')" prop="remainOptRate">
  16. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  17. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  18. </el-form-item>
  19. </el-col>
  20. </el-row>
  21. <el-row>
  22. <el-col :span="12">
  23. <el-form-item
  24. :label="$t('defaultParameter.nqzqlyjz')" prop="remainOptRate">
  25. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  26. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="12">
  30. <el-form-item
  31. :label="$t('defaultParameter.cczqlyjz')" prop="remainOptRate">
  32. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  33. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  34. </el-form-item>
  35. </el-col>
  36. </el-row>
  37. <el-row>
  38. <el-col :span="12">
  39. <el-form-item
  40. :label="$t('defaultParameter.hlzdtzzqlyj')" prop="remainOptRate">
  41. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  42. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="12">
  46. <el-form-item
  47. :label="$t('defaultParameter.hlzdtzzqlyj1')" prop="remainOptRate">
  48. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  49. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  50. </el-form-item>
  51. </el-col>
  52. </el-row>
  53. <el-row>
  54. <el-col :span="12">
  55. <el-form-item
  56. :label="$t('defaultParameter.mrcapjz')" prop="remainOptRate">
  57. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  58. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="12">
  62. <el-form-item
  63. :label="$t('defaultParameter.mrcayjz')" prop="remainOptRate">
  64. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  65. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. <el-row>
  70. <el-col :span="12">
  71. <el-form-item
  72. :label="$t('defaultParameter.slsjpccyjz')" prop="remainOptRate">
  73. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  74. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="12">
  78. <el-form-item
  79. :label="$t('defaultParameter.ccpjhlyjz')" prop="remainOptRate">
  80. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  81. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  82. </el-form-item>
  83. </el-col>
  84. </el-row>
  85. <el-row>
  86. <el-col :span="12">
  87. <el-form-item
  88. :label="$t('defaultParameter.ccpjzhlyjz')" prop="remainOptRate">
  89. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  90. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="12">
  94. <el-form-item
  95. :label="$t('defaultParameter.ccpjgjnslcb')" prop="remainOptRate">
  96. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  97. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="12">
  103. <el-form-item
  104. :label="$t('defaultParameter.nlsllccyjz')" prop="remainOptRate">
  105. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  106. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="12">
  110. <el-form-item
  111. :label="$t('defaultParameter.kcyjts')" prop="remainOptRate">
  112. <el-input ref="remainOptRate" v-model="createTemp.remainOptRate" :disabled="isRoleEdit==false" class="filter-item"
  113. :placeholder="$t('defaultParameter.slfpzb')" type="text" />
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. </el-form>
  118. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  119. <el-button v-if="isRoleEdit" class="save" :disabled="isokDisable" @click="handleSave">{{$t('formulationEvaluation.save')}}</el-button>
  120. <el-button v-if="isRoleEdit" class="warning" :disabled="isokDisable" @click="handleRecovery">
  121. {{$t('defaultParameter.hfmr')}}</el-button>
  122. </div>
  123. <el-dialog :title="textMap[description.dialogStatus]" :destroy-on-close="true" :visible.sync="description.dialogFormVisible" :close-on-click-modal="false" width="70%">
  124. <div class="app-description dialogMinHeight">
  125. <div class="content">
  126. {{$t('defaultParameter.msg1')}}
  127. <br>
  128. {{$t('defaultParameter.msg2')}}
  129. <br>
  130. {{$t('defaultParameter.msg3')}}
  131. <br>
  132. {{$t('defaultParameter.msg4')}}
  133. <br>
  134. {{$t('defaultParameter.msg5')}}
  135. <br>
  136. {{$t('defaultParameter.msg6')}}
  137. <br>
  138. {{$t('defaultParameter.msg7')}}
  139. <br>
  140. {{$t('defaultParameter.msg8')}}
  141. <br>
  142. {{$t('defaultParameter.msg9')}}
  143. <br>
  144. {{$t('defaultParameter.msg10')}}
  145. <br>
  146. {{$t('defaultParameter.msg11')}}
  147. <br>
  148. {{$t('defaultParameter.msg12')}}
  149. <br>
  150. {{$t('defaultParameter.msg13')}}
  151. <br>
  152. {{$t('defaultParameter.msg14')}}
  153. </div>
  154. </div>
  155. <div slot="footer" class="dialog-footer">
  156. <el-button class="cancelClose" @click="description.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  157. </div>
  158. </el-dialog>
  159. </div>
  160. </template>
  161. <script>
  162. import { GetDataByName, PostDataByName, GetDataByNames, failproccess, checkButtons, ExecDataByConfig } from '@/api/common'
  163. import Cookies from 'js-cookie'
  164. import { MessageBox } from 'element-ui'
  165. export default {
  166. name: 'DefaultParameter',
  167. data() {
  168. return {
  169. isRoleEdit: [],
  170. planBeforeDayList: [{ id: '1',
  171. name:this.$t('supplier.yes')}, { id: '0',
  172. name:this.$t('supplier.no') }], // 是否可取前一天计划
  173. planNextDayList: [{ id: '1',
  174. name:this.$t('supplier.yes')}, { id: '0',
  175. name:this.$t('supplier.no') }], // 是否可取后一天计划
  176. isSupplementList: [{ id: '1',
  177. name:this.$t('supplier.yes')}, { id: '0',
  178. name:this.$t('supplier.no') }], // 是否启用补料
  179. isLeftoverMaterialList: [{ id: '1',
  180. name:this.$t('supplier.yes')}, { id: '0',
  181. name:this.$t('supplier.no') }], // 是否启用剩料
  182. decimalPlacesList: [{ id: '0',
  183. name:this.$t('supplier.zs') }, { id: '1',
  184. name:this.$t('supplier.xs1') }, { id: '2',
  185. name:this.$t('supplier.xs2') }, { id: '3',
  186. name:this.$t('supplier.xs3') }], // 日计划报表小数点位数
  187. isLockBullsList: [{ id: '1',
  188. name:this.$t('supplier.yes')}, { id: '0',
  189. name:this.$t('supplier.no') }], // 启用饲料锁定牛头数
  190. disposalList: [], // 剩料处理选项
  191. waterConditioningList: [{ id: '0',
  192. name:this.$t('defaultParameter.qz')}, { id: '1',
  193. name:this.$t('defaultParameter.bcl') }, { id: '2',
  194. name:this.$t('defaultParameter.bcl') }], // 水分调节选项
  195. priceCalculationList: [{ id: '1',
  196. name:this.$t('supplier.yes')}, { id: '0',
  197. name:this.$t('supplier.no') }], // 是否启用库存管理
  198. numberList: [{ id: '0', name: '1' }, { id: '1', name: '2' }, { id: '2', name: '3' }, { id: '3', name: '4' }], // 班次数量
  199. feedontractList: [{ id: '1',
  200. name:this.$t('supplier.yes')}, { id: '0',
  201. name:this.$t('supplier.no') }], // 是否启用饲料合同
  202. leftoverMaterialList: [{ id: '0',
  203. name:this.$t('supplier.defb') }, { id: '1',
  204. name:this.$t('supplier.slfb') }],
  205. requestParams: [
  206. { name: 'getRemainFeedList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  207. ],
  208. getdataListParm: {
  209. name: 'getysoptList',
  210. page: 1,
  211. offset: 1,
  212. pagecount: 10,
  213. returntype: 'Map',
  214. parammaps: {
  215. pastureid: Cookies.get('pastureid')
  216. }
  217. },
  218. tableKey: 0,
  219. listLoading: true,
  220. createTemp: {},
  221. rules: {},
  222. isokDisable: false,
  223. description: {
  224. dialogFormVisible: false,
  225. dialogStatus: ''
  226. },
  227. textMap: {
  228. description:this.$t('supplier.cssm')
  229. },
  230. requestParam: {}
  231. }
  232. },
  233. created() {
  234. this.getList()
  235. this.getButtons()
  236. this.getDownList()
  237. },
  238. methods: {
  239. getButtons() {
  240. const Edit = 'DefaultParameter'
  241. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  242. this.isRoleEdit = isRoleEdit
  243. },
  244. getDownList() {
  245. GetDataByNames(this.requestParams).then(response => {
  246. this.disposalList = response.data.getRemainFeedList.list
  247. })
  248. },
  249. getList() {
  250. this.listLoading = true
  251. GetDataByName(this.getdataListParm).then(response => {
  252. console.log('table1数据', response.data.list)
  253. if (response.data.list !== null) {
  254. this.createTemp = response.data.list[0]
  255. } else {
  256. this.list = []
  257. }
  258. setTimeout(() => {
  259. this.listLoading = false
  260. }, 100)
  261. })
  262. },
  263. handleSave() {
  264. console.log('点击了保存')
  265. this.isokDisable = true
  266. setTimeout(() => {
  267. this.isokDisable = false
  268. }, 1000)
  269. this.requestParam.common = { 'returnmap': '0' }
  270. this.requestParam.data = []
  271. this.requestParam.data[0] = { 'name': 'updatesysopt', 'type': 'e', 'parammaps': {
  272. pastureid: this.createTemp.pastureid,
  273. isGetLastPlan: this.createTemp.isGetLastPlan,
  274. isGetNextPlan: this.createTemp.isGetNextPlan,
  275. isEnableSupplyFeed: this.createTemp.isEnableSupplyFeed,
  276. isEnableRemainFeed: this.createTemp.isEnableRemainFeed,
  277. reportDigit: this.createTemp.reportDigit,
  278. isLockCount: this.createTemp.isLockCount,
  279. remainOpt: this.createTemp.remainOpt,
  280. waterOpt: this.createTemp.waterOpt,
  281. overweightWarnRate: this.createTemp.overweightWarnRate,
  282. overweightBanRate: this.createTemp.overweightBanRate,
  283. repertoryWarn: this.createTemp.repertoryWarn,
  284. isfeedstorage: this.createTemp.isfeedstorage,
  285. times: this.createTemp.times,
  286. isEnableContract: this.createTemp.isEnableContract,
  287. remainOptDis: this.createTemp.remainOptDis,
  288. remainOptRate: this.createTemp.remainOptRate
  289. }}
  290. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  291. pastureid: this.createTemp.pastureid
  292. }}
  293. ExecDataByConfig(this.requestParam).then(response => {
  294. console.log('保存发送参数', this.requestParam)
  295. if (response.msg !== 'fail') {
  296. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  297. this.getList()
  298. } else {
  299. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  300. }
  301. })
  302. },
  303. handleRecovery() {
  304. console.log('点击了恢复默认')
  305. this.isokDisable = true
  306. setTimeout(() => {
  307. this.isokDisable = false
  308. }, 1000)
  309. MessageBox.confirm('是否确认恢复默认设置?', {
  310. confirmButtonText: this.$t('common.confirm'), cancelButtonText: this.$t('common.cancel'), type: 'warning'
  311. }).then(() => {
  312. this.requestParam.common = { 'returnmap': '0' }
  313. this.requestParam.data = []
  314. this.requestParam.data[0] = { 'name': 'updatesysoptinit', 'type': 'e', 'parammaps': {
  315. pastureid: this.createTemp.pastureid
  316. }}
  317. this.requestParam.data[1] = { 'name': 'updateFPbyFTChangeALL', 'type': 'e', 'parammaps': {
  318. pastureid: this.createTemp.pastureid
  319. }}
  320. ExecDataByConfig(this.requestParam).then(response => {
  321. console.log('保存发送参数', this.requestParam)
  322. if (response.msg !== 'fail') {
  323. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  324. this.getList()
  325. } else {
  326. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  327. }
  328. })
  329. })
  330. },
  331. handleDescription() {
  332. this.description.dialogStatus = 'description'
  333. this.description.dialogFormVisible = true
  334. }
  335. }
  336. }
  337. </script>
  338. <style lang="scss" scoped>
  339. .app-description{
  340. display:flex; justify-content: center; align-items: center;font-size: 14px;line-height: 28px;
  341. .content{
  342. display:flex;
  343. }
  344. }
  345. </style>