e48dc5bea4758a00226366e13320d881fb974e67.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. <template>
  2. <div class="app-container">
  3. <!-- 配方模板表 -->
  4. <div ref="template" class="template">
  5. <p class="recipeTemplate" />
  6. <div class="operation">
  7. <el-button class="success" @click="handleCreate">新生成</el-button>
  8. <el-button class="export" style="float: right;margin-right: 80px;" @click="handleHistoryRecord">历史记录</el-button>
  9. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleMaterialPlan">撒料计划</el-button>
  10. <el-button class="export" style="float: right;margin-right: 10px;" @click="handlePremixedPlan">预混计划</el-button>
  11. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleShedFormula">栏舍配方</el-button>
  12. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleRecipeemplate">配方模板</el-button>
  13. </div>
  14. <div class="search">
  15. <el-date-picker v-model="table.getdataListParm.parammaps.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDate" />
  16. <el-select v-model="table.getdataListParm.parammaps.lpplantype" filterable placeholder="计划类型" class="filter-item" clearable style="width: 120px;" @change="changePlanType">
  17. <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  18. </el-select>
  19. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" clearable @change="changeFrequency">
  20. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="打印类型" class="filter-item" clearable style="width: 120px;">
  23. <el-option v-for="item in printingTypeList" :key="item.value" :label="item.label" :value="item.value" />
  24. </el-select>
  25. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="计划维度" class="filter-item" style="width: 120px;" clearable>
  26. <el-option v-for="item in planningDimensionList" :key="item.value" :label="item.label" :value="item.value" />
  27. </el-select>
  28. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="导出类型" class="filter-item" style="width: 120px;" clearable>
  29. <el-option v-for="item in exportTypeList" :key="item.value" :label="item.label" :value="item.value" />
  30. </el-select>
  31. <el-button class="export" @click="handleExport">导出</el-button>
  32. </div>
  33. <!-- 日执行计划 -->
  34. <div class="table">
  35. <el-table
  36. :key="table.tableKey"
  37. v-loading="table.listLoading"
  38. element-loading-text="给我一点时间"
  39. :data="table.list"
  40. border
  41. fit
  42. highlight-current-row
  43. style="width: 98%;"
  44. :row-style="rowStyle"
  45. :cell-style="cellStyle"
  46. class="elTable table-fixed"
  47. @row-click="tableRowClick"
  48. >
  49. <el-table-column label="序号" align="center" type="index" width="50px">
  50. <template slot-scope="scope">
  51. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="计划名称" min-width="130px" align="center">
  55. <template slot-scope="scope">
  56. <span>{{ scope.row.projname }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="计划类型" prop="weight" min-width="130px" align="center" :formatter="lpplantype" />
  60. <el-table-column label="TMR编号" min-width="130px" align="center">
  61. <template slot-scope="scope">
  62. <span>{{ scope.row.tmrtname }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="驾驶员" min-width="130px" align="center">
  66. <template slot-scope="scope">
  67. <span>{{ scope.row.driver }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="已执行" min-width="130px" align="center">
  71. <template slot-scope="scope">
  72. <span>{{ scope.row.havebutton }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="班次" min-width="180px" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.times }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="理论量" min-width="180px" align="center">
  81. <template slot-scope="scope">
  82. <span>{{ scope.row.lweight }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="时间" min-width="180px" align="center">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.plantime }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="发料位" min-width="180px" align="left">
  91. <template slot-scope="scope">
  92. <span>{{ scope.row.barnames }}</span>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. </div>
  97. </div>
  98. <!-- 计划内容操作 -->
  99. <div class="content">
  100. <div class="table2">
  101. <p class="contentOperation" />
  102. <div class="content-table">
  103. <el-table
  104. :key="table2.tableKey"
  105. v-loading="table2.listLoading"
  106. element-loading-text="给我一点时间"
  107. :data="table2.list"
  108. fit
  109. highlight-current-row
  110. style="width: 100%;"
  111. height="450"
  112. :row-style="rowStyle"
  113. :cell-style="cellStyle"
  114. class="elTable table-fixed"
  115. >
  116. <el-table-column label="操作序号" min-width="130px" align="center">
  117. <template slot-scope="scope">
  118. <span>{{ scope.row.sort }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  122. <template slot-scope="scope">
  123. <span>{{ scope.row.fname }}</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  127. <template slot-scope="scope">
  128. <span>{{ scope.row.weight }}</span>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. </div>
  133. </div>
  134. <div class="table3">
  135. <p class="stallRetails" />
  136. <div class="content-table">
  137. <el-table
  138. :key="table3.tableKey"
  139. v-loading="table3.listLoading"
  140. element-loading-text="给我一点时间"
  141. :data="table3.list"
  142. height="450"
  143. fit
  144. highlight-current-row
  145. style="width: 100%;"
  146. :row-style="rowStyle"
  147. :cell-style="cellStyle"
  148. class="elTable table-fixed"
  149. >
  150. <el-table-column label=" 操作序号" min-width="130px" align="center">
  151. <template slot-scope="scope">
  152. <span>{{ scope.row.sort }}</span>
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="栏舍编号" min-width="130px" align="center">
  156. <template slot-scope="scope">
  157. <span>{{ scope.row.fname }}</span>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  161. <template slot-scope="scope">
  162. <span>{{ scope.row.weight }}</span>
  163. </template>
  164. </el-table-column>
  165. </el-table>
  166. </div>
  167. </div>
  168. </div>
  169. <!-- 新生成 -->
  170. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="50%">
  171. <div class="newGeneration">
  172. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  173. <el-row>
  174. <el-col :span="16">
  175. <el-form-item label="时间范围:" prop="inputDatetime">
  176. <el-date-picker v-model="newGeneration.temp.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
  177. </el-form-item>
  178. </el-col>
  179. </el-row>
  180. </el-form>
  181. <div slot="footer" class="dialog-footer" style="bottom:10px">
  182. <el-button class="cancel" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  183. <el-button class="success" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  184. </div>
  185. </div>
  186. </el-dialog>
  187. </div>
  188. </template>
  189. <script>
  190. import { GetDataByName, GetDataByNames, ExecDataByConfig } from '@/api/common'
  191. import { MessageBox } from 'element-ui'
  192. import { parseTime } from '@/utils/index.js'
  193. import Cookies from 'js-cookie'
  194. export default {
  195. name: 'DailyExecutionPlan',
  196. data() {
  197. return {
  198. requestParams: [
  199. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  200. ],
  201. planTypeList: [{ lable: '撒料计划', value: '2' }, { lable: '预混计划', value: '3' }, { lable: '剩料计划', value: '4' }], // 计划类型
  202. printingTypeList: [{ lable: '所有', value: '0' }, { lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  203. frequencyList: [], // 班次
  204. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  205. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '投料简打', value: '1' }], // 导出类型
  206. // 班次
  207. maxTime: {
  208. getMaxTimesParm: {
  209. name: 'getSysoptEnable',
  210. page: 1,
  211. offset: 1,
  212. pagecount: 1,
  213. returntype: 'Map',
  214. parammaps: {
  215. pastureid: Cookies.get('pastureid'),
  216. inforname: 'times'
  217. }
  218. }
  219. },
  220. table: {
  221. getdataListParm: {
  222. name: 'getDownloadedplanList',
  223. page: 1,
  224. offset: 1,
  225. pagecount: 10,
  226. returntype: 'Map',
  227. parammaps: {
  228. pastureid: Cookies.get('pastureid'),
  229. barid: '',
  230. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  231. times: '',
  232. lpplantype: ''
  233. }
  234. },
  235. tableKey: 0,
  236. list: [],
  237. total: 0,
  238. listLoading: false
  239. },
  240. // 计划内容操作详情
  241. table2: {
  242. getdataListParm: {
  243. name: 'getDownloadplandtl1List',
  244. page: 1,
  245. offset: 1,
  246. returntype: 'Map',
  247. parammaps: {
  248. pastureid: Cookies.get('pastureid'),
  249. date: '',
  250. flpid: ''
  251. }
  252. },
  253. tableKey: 0,
  254. list: [],
  255. total: 0,
  256. listLoading: false
  257. },
  258. // 计划内容 舍栏详情
  259. table3: {
  260. getdataListParm: {
  261. name: 'getDownloadplandt2List',
  262. page: 1,
  263. offset: 1,
  264. returntype: 'Map',
  265. parammaps: {
  266. pastureid: Cookies.get('pastureid'),
  267. date: '',
  268. flpid: ''
  269. }
  270. },
  271. tableKey: 0,
  272. list: [],
  273. total: 0,
  274. listLoading: false
  275. },
  276. // 新生成
  277. newGeneration: {
  278. dialogFormVisible: false,
  279. dialogStatus: '',
  280. getdataListParm: {
  281. name: 'checkLLPIsDistribution',
  282. page: 1,
  283. offset: 1,
  284. pagecount: 1,
  285. returntype: 'Map',
  286. parammaps: {
  287. pastureid: Cookies.get('pastureid')
  288. }
  289. },
  290. temp: {},
  291. rules: {
  292. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  293. }
  294. },
  295. textMap: {
  296. newGeneration: '新生成'
  297. },
  298. isokDisable: false,
  299. requestParam: {},
  300. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  301. cellStyle: { padding: 0 + 'px' }
  302. }
  303. },
  304. created() {
  305. this.getList()
  306. this.getDownList()
  307. this.getIsDisplay()
  308. },
  309. methods: {
  310. getIsDisplay() {
  311. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  312. console.log(response.data.list[0].inforvalue)
  313. if (response.data.list[0].inforvalue == 1) {
  314. this.frequencyList = [{ id: '1', name: '第一班' }]
  315. } else if (response.data.list[0].inforvalue == 2) {
  316. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  317. } else if (response.data.list[0].inforvalue == 3) {
  318. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  319. } else if (response.data.list[0].inforvalue == 4) {
  320. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  321. }
  322. })
  323. },
  324. getDownList() {
  325. GetDataByNames(this.requestParams).then(response => {
  326. // this.livestockTypeList = response.data.getDictByName.list
  327. })
  328. },
  329. // -------------------日执行计划-----------------------------
  330. getList() {
  331. this.table.listLoading = true
  332. GetDataByName(this.table.getdataListParm).then(response => {
  333. console.log('table数据', response.data.list)
  334. if (response.data.list !== null) {
  335. this.table.list = response.data.list
  336. this.table.pageNum = response.data.pageNum
  337. this.table.pageSize = response.data.pageSize
  338. this.table.total = response.data.total
  339. this.table2.getdataListParm.parammaps.flpid = response.data.list[0].pid
  340. this.table3.getdataListParm.parammaps.flpid = response.data.list[0].pid
  341. this.getList2()
  342. this.getList3()
  343. } else {
  344. this.table.list = []
  345. }
  346. setTimeout(() => {
  347. this.table.listLoading = false
  348. }, 100)
  349. })
  350. },
  351. lpplantype: function(cellValue) {
  352. if (cellValue.lpplantype == 2) {
  353. return '撒料'
  354. } else if (cellValue.lpplantype == 3) {
  355. return '预混'
  356. } else if (cellValue.lpplantype == 4) {
  357. return '剩料'
  358. }
  359. },
  360. changeDate(val) {
  361. console.log('选择了日期', val)
  362. this.getList()
  363. this.getList2()
  364. this.getList3()
  365. },
  366. changePlanType(val) {
  367. console.log('选择了计划类型', val)
  368. this.getList()
  369. this.getList2()
  370. this.getList3()
  371. },
  372. changeFrequency(val) {
  373. console.log('选择了班次', val)
  374. this.getList()
  375. this.getList2()
  376. this.getList3()
  377. },
  378. // 日执行计划行点击
  379. tableRowClick(row, column, event) {
  380. console.log(row, column, event)
  381. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  382. this.table2.getdataListParm.parammaps.flpid = row.pid
  383. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  384. this.table3.getdataListParm.parammaps.flpid = row.pid
  385. this.getList2()
  386. this.getList3()
  387. },
  388. // 计划内容操作详情
  389. getList2() {
  390. this.table2.listLoading = true
  391. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  392. GetDataByName(this.table2.getdataListParm).then(response => {
  393. console.log('table数据', response.data.list)
  394. if (response.data.list !== null) {
  395. this.table2.list = response.data.list
  396. const arr = []
  397. var a = 0
  398. let b = this.table2.list[0].sort
  399. let c = 0
  400. for (let i = 0; i < this.table2.list.length; i++) {
  401. if (b !== parseInt(this.table2.list[i].sort)) {
  402. b = this.table2.list[i].sort
  403. arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
  404. a = 0
  405. }
  406. a = a + parseFloat(this.table2.list[i].weight)
  407. c = c + parseFloat(this.table2.list[i].weight)
  408. arr.push(this.table2.list[i])
  409. }
  410. arr.push({ 'sort': '小计', 'weight': a })
  411. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  412. this.table2.list = arr
  413. console.log(this.table2.list)
  414. this.table2.pageNum = response.data.pageNum
  415. this.table2.pageSize = response.data.pageSize
  416. this.table2.total = response.data.total
  417. } else {
  418. this.table2.list = []
  419. }
  420. setTimeout(() => {
  421. this.table2.listLoading = false
  422. }, 100)
  423. })
  424. },
  425. // 计划内容栏舍详情
  426. getList3() {
  427. this.table3.listLoading = true
  428. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  429. GetDataByName(this.table3.getdataListParm).then(response => {
  430. console.log('table数据', response.data.list)
  431. if (response.data.list !== null) {
  432. this.table3.list = response.data.list
  433. this.table3.pageNum = response.data.pageNum
  434. this.table3.pageSize = response.data.pageSize
  435. this.table3.total = response.data.total
  436. } else {
  437. this.table3.list = []
  438. }
  439. setTimeout(() => {
  440. this.table3.listLoading = false
  441. }, 100)
  442. })
  443. },
  444. // 新生成
  445. handleCreate() {
  446. console.log('点击了新生成')
  447. this.newGeneration.temp = {}
  448. this.newGeneration.dialogStatus = 'newGeneration'
  449. this.newGeneration.dialogFormVisible = true
  450. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  451. console.log('table数据', response.data.list)
  452. if (response.data.list !== null) {
  453. if (response.data.list[0].vmsg == '存在未分配') {
  454. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  455. }
  456. }
  457. })
  458. },
  459. newGenerationData() {
  460. console.log('点击了新生成保存', this.newGeneration.temp)
  461. this.isokDisable = true
  462. setTimeout(() => {
  463. this.isokDisable = false
  464. }, 1000)
  465. this.$refs['temp'].validate(valid => {
  466. if (valid) {
  467. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  468. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  469. this.requestParam = {}
  470. this.requestParam.common = { 'returnmap': '0' }
  471. this.requestParam.data = []
  472. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'e', 'parammaps': {
  473. pastureid: Cookies.get('pastureid'),
  474. startTime: this.newGeneration.temp.startTime
  475. }}
  476. this.requestParam.data[1] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  477. pastureid: Cookies.get('pastureid'),
  478. startTime: this.newGeneration.temp.startTime,
  479. stopTime: this.newGeneration.temp.stopTime
  480. }}
  481. ExecDataByConfig(this.requestParam).then(response => {
  482. console.log('新生成保存发送参数', this.requestParam)
  483. if (response.msg === 'fail') {
  484. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  485. } else {
  486. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  487. this.newGeneration.dialogFormVisible = false
  488. this.getList()
  489. }
  490. })
  491. }
  492. })
  493. },
  494. // 配方模板
  495. handleRecipeemplate() {
  496. console.log('点击了配方模板,页面待画')
  497. },
  498. handleShedFormula() {
  499. console.log('点击了栏舍配方,页面待画')
  500. },
  501. handlePremixedPlan() {
  502. console.log('点击了预混计划,页面待画')
  503. },
  504. handleMaterialPlan() {
  505. console.log('点击了撒料计划,页面待画')
  506. },
  507. handleHistoryRecord() {
  508. console.log('点击了历史记录,页面待画')
  509. },
  510. handleExport() {
  511. console.log('点击了导出')
  512. }
  513. }
  514. }
  515. </script>
  516. <style lang="scss" scoped>
  517. .operation{margin-bottom:10px;}
  518. .search{margin-top:10px;}
  519. .table{margin-top:10px;}
  520. .template{
  521. background: #fff;
  522. position: relative;
  523. .recipeTemplate{
  524. width: 72px;
  525. height: 70px;
  526. position: absolute;
  527. background: url(../../../assets/images/bg3.jpg) no-repeat;
  528. right: 0;
  529. top: 0;
  530. margin: 0;
  531. }
  532. }
  533. .table2{
  534. float: left;width: 49%;margin-right: 1%;background: red;
  535. background: #fff;
  536. position: relative;
  537. .contentOperation{
  538. width: 72px;
  539. height: 70px;
  540. position: absolute;
  541. background: url(../../../assets/images/bg4.jpg) no-repeat;
  542. right: 0;
  543. top: 0;
  544. margin: 0;
  545. }
  546. .content-table{margin-top: 70px;}
  547. }
  548. .table3{
  549. float: left;
  550. width: 49%;
  551. background: #fff;
  552. position: relative;
  553. .stallRetails{
  554. width: 72px;
  555. height: 70px;
  556. position: absolute;
  557. background: url(../../../assets/images/bg5.png) no-repeat;
  558. right: 0;
  559. top: 0;
  560. margin: 0;
  561. }
  562. .content-table{margin-top: 70px;}
  563. }
  564. </style>