90ebfa312cefc8cc9cca5952b73bfffc46e0afc6.svn-base 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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="stallRetails">
  137. <p>栏舍内容<br>栏舍详情 </p>
  138. </div> -->
  139. <div class="content-table">
  140. <el-table
  141. :key="table3.tableKey"
  142. v-loading="table3.listLoading"
  143. element-loading-text="给我一点时间"
  144. :data="table3.list"
  145. height="450"
  146. fit
  147. highlight-current-row
  148. style="width: 100%;"
  149. :row-style="rowStyle"
  150. :cell-style="cellStyle"
  151. class="elTable table-fixed"
  152. >
  153. <el-table-column label=" 操作序号" min-width="130px" align="center">
  154. <template slot-scope="scope">
  155. <span>{{ scope.row.sort }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="栏舍编号" min-width="130px" align="center">
  159. <template slot-scope="scope">
  160. <span>{{ scope.row.fname }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  164. <template slot-scope="scope">
  165. <span>{{ scope.row.weight }}</span>
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. </div>
  170. </div>
  171. </div>
  172. <!-- 新生成 -->
  173. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="50%">
  174. <div class="newGeneration">
  175. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  176. <el-row>
  177. <el-col :span="16">
  178. <el-form-item label="时间范围:" prop="inputDatetime">
  179. <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" />
  180. </el-form-item>
  181. </el-col>
  182. </el-row>
  183. </el-form>
  184. <div slot="footer" class="dialog-footer" style="bottom:10px">
  185. <el-button class="cancel" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  186. <el-button class="success" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  187. </div>
  188. </div>
  189. </el-dialog>
  190. </div>
  191. </template>
  192. <script>
  193. import { GetDataByName, GetDataByNames, ExecDataByConfig } from '@/api/common'
  194. import { MessageBox } from 'element-ui'
  195. import { parseTime } from '@/utils/index.js'
  196. import Cookies from 'js-cookie'
  197. export default {
  198. name: 'DailyExecutionPlan',
  199. data() {
  200. return {
  201. requestParams: [
  202. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  203. ],
  204. planTypeList: [{ lable: '撒料计划', value: '2' }, { lable: '预混计划', value: '3' }, { lable: '剩料计划', value: '4' }], // 计划类型
  205. printingTypeList: [{ lable: '所有', value: '0' }, { lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  206. frequencyList: [], // 班次
  207. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  208. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '投料简打', value: '1' }], // 导出类型
  209. // 班次
  210. maxTime: {
  211. getMaxTimesParm: {
  212. name: 'getSysoptEnable',
  213. page: 1,
  214. offset: 1,
  215. pagecount: 1,
  216. returntype: 'Map',
  217. parammaps: {
  218. pastureid: Cookies.get('pastureid'),
  219. inforname: 'times'
  220. }
  221. }
  222. },
  223. table: {
  224. getdataListParm: {
  225. name: 'getDownloadedplanList',
  226. page: 1,
  227. offset: 1,
  228. pagecount: 10,
  229. returntype: 'Map',
  230. parammaps: {
  231. pastureid: Cookies.get('pastureid'),
  232. barid: '',
  233. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  234. times: '',
  235. lpplantype: ''
  236. }
  237. },
  238. tableKey: 0,
  239. list: [],
  240. total: 0,
  241. listLoading: false
  242. },
  243. // 计划内容操作详情
  244. table2: {
  245. getdataListParm: {
  246. name: 'getDownloadplandtl1List',
  247. page: 1,
  248. offset: 1,
  249. returntype: 'Map',
  250. parammaps: {
  251. pastureid: Cookies.get('pastureid'),
  252. date: '',
  253. flpid: ''
  254. }
  255. },
  256. tableKey: 0,
  257. list: [],
  258. total: 0,
  259. listLoading: false
  260. },
  261. // 计划内容 舍栏详情
  262. table3: {
  263. getdataListParm: {
  264. name: 'getDownloadplandt2List',
  265. page: 1,
  266. offset: 1,
  267. returntype: 'Map',
  268. parammaps: {
  269. pastureid: Cookies.get('pastureid'),
  270. date: '',
  271. flpid: ''
  272. }
  273. },
  274. tableKey: 0,
  275. list: [],
  276. total: 0,
  277. listLoading: false
  278. },
  279. // 新生成
  280. newGeneration: {
  281. dialogFormVisible: false,
  282. dialogStatus: '',
  283. getdataListParm: {
  284. name: 'checkLLPIsDistribution',
  285. page: 1,
  286. offset: 1,
  287. pagecount: 1,
  288. returntype: 'Map',
  289. parammaps: {
  290. pastureid: Cookies.get('pastureid')
  291. }
  292. },
  293. temp: {},
  294. rules: {
  295. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  296. }
  297. },
  298. textMap: {
  299. newGeneration: '新生成'
  300. },
  301. isokDisable: false,
  302. requestParam: {},
  303. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  304. cellStyle: { padding: 0 + 'px' }
  305. }
  306. },
  307. created() {
  308. this.getList()
  309. this.getDownList()
  310. this.getIsDisplay()
  311. },
  312. methods: {
  313. getIsDisplay() {
  314. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  315. console.log(response.data.list[0].inforvalue)
  316. if (response.data.list[0].inforvalue == 1) {
  317. this.frequencyList = [{ id: '1', name: '第一班' }]
  318. } else if (response.data.list[0].inforvalue == 2) {
  319. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  320. } else if (response.data.list[0].inforvalue == 3) {
  321. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  322. } else if (response.data.list[0].inforvalue == 4) {
  323. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  324. }
  325. })
  326. },
  327. getDownList() {
  328. GetDataByNames(this.requestParams).then(response => {
  329. // this.livestockTypeList = response.data.getDictByName.list
  330. })
  331. },
  332. // -------------------日执行计划-----------------------------
  333. getList() {
  334. this.table.listLoading = true
  335. GetDataByName(this.table.getdataListParm).then(response => {
  336. console.log('table数据', response.data.list)
  337. if (response.data.list !== null) {
  338. this.table.list = response.data.list
  339. this.table.pageNum = response.data.pageNum
  340. this.table.pageSize = response.data.pageSize
  341. this.table.total = response.data.total
  342. this.table2.getdataListParm.parammaps.flpid = response.data.list[0].pid
  343. this.table3.getdataListParm.parammaps.flpid = response.data.list[0].pid
  344. this.getList2()
  345. this.getList3()
  346. } else {
  347. this.table.list = []
  348. }
  349. setTimeout(() => {
  350. this.table.listLoading = false
  351. }, 100)
  352. })
  353. },
  354. lpplantype: function(cellValue) {
  355. if (cellValue.lpplantype == 2) {
  356. return '撒料'
  357. } else if (cellValue.lpplantype == 3) {
  358. return '预混'
  359. } else if (cellValue.lpplantype == 4) {
  360. return '剩料'
  361. }
  362. },
  363. changeDate(val) {
  364. console.log('选择了日期', val)
  365. this.getList()
  366. this.getList2()
  367. this.getList3()
  368. },
  369. changePlanType(val) {
  370. console.log('选择了计划类型', val)
  371. this.getList()
  372. this.getList2()
  373. this.getList3()
  374. },
  375. changeFrequency(val) {
  376. console.log('选择了班次', val)
  377. this.getList()
  378. this.getList2()
  379. this.getList3()
  380. },
  381. // 日执行计划行点击
  382. tableRowClick(row, column, event) {
  383. console.log(row, column, event)
  384. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  385. this.table2.getdataListParm.parammaps.flpid = row.pid
  386. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  387. this.table3.getdataListParm.parammaps.flpid = row.pid
  388. this.getList2()
  389. this.getList3()
  390. },
  391. // 计划内容操作详情
  392. getList2() {
  393. this.table2.listLoading = true
  394. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  395. GetDataByName(this.table2.getdataListParm).then(response => {
  396. console.log('table数据', response.data.list)
  397. if (response.data.list !== null) {
  398. this.table2.list = response.data.list
  399. const arr = []
  400. var a = 0
  401. let b = this.table2.list[0].sort
  402. let c = 0
  403. for (let i = 0; i < this.table2.list.length; i++) {
  404. if (b !== parseInt(this.table2.list[i].sort)) {
  405. b = this.table2.list[i].sort
  406. arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
  407. a = 0
  408. }
  409. a = a + parseFloat(this.table2.list[i].weight)
  410. c = c + parseFloat(this.table2.list[i].weight)
  411. arr.push(this.table2.list[i])
  412. }
  413. arr.push({ 'sort': '小计', 'weight': a })
  414. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  415. this.table2.list = arr
  416. console.log(this.table2.list)
  417. this.table2.pageNum = response.data.pageNum
  418. this.table2.pageSize = response.data.pageSize
  419. this.table2.total = response.data.total
  420. } else {
  421. this.table2.list = []
  422. }
  423. setTimeout(() => {
  424. this.table2.listLoading = false
  425. }, 100)
  426. })
  427. },
  428. // 计划内容栏舍详情
  429. getList3() {
  430. this.table3.listLoading = true
  431. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  432. GetDataByName(this.table3.getdataListParm).then(response => {
  433. console.log('table数据', response.data.list)
  434. if (response.data.list !== null) {
  435. this.table3.list = response.data.list
  436. this.table3.pageNum = response.data.pageNum
  437. this.table3.pageSize = response.data.pageSize
  438. this.table3.total = response.data.total
  439. } else {
  440. this.table3.list = []
  441. }
  442. setTimeout(() => {
  443. this.table3.listLoading = false
  444. }, 100)
  445. })
  446. },
  447. // 新生成
  448. handleCreate() {
  449. console.log('点击了新生成')
  450. this.newGeneration.temp = {}
  451. this.newGeneration.dialogStatus = 'newGeneration'
  452. this.newGeneration.dialogFormVisible = true
  453. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  454. console.log('table数据', response.data.list)
  455. if (response.data.list !== null) {
  456. if (response.data.list[0].vmsg == '存在未分配') {
  457. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  458. }
  459. }
  460. })
  461. },
  462. newGenerationData() {
  463. console.log('点击了新生成保存', this.newGeneration.temp)
  464. this.isokDisable = true
  465. setTimeout(() => {
  466. this.isokDisable = false
  467. }, 1000)
  468. this.$refs['temp'].validate(valid => {
  469. if (valid) {
  470. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  471. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  472. this.requestParam = {}
  473. this.requestParam.common = { 'returnmap': '0' }
  474. this.requestParam.data = []
  475. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'e', 'parammaps': {
  476. pastureid: Cookies.get('pastureid'),
  477. startTime: this.newGeneration.temp.startTime
  478. }}
  479. this.requestParam.data[1] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  480. pastureid: Cookies.get('pastureid'),
  481. startTime: this.newGeneration.temp.startTime,
  482. stopTime: this.newGeneration.temp.stopTime
  483. }}
  484. ExecDataByConfig(this.requestParam).then(response => {
  485. console.log('新生成保存发送参数', this.requestParam)
  486. if (response.msg === 'fail') {
  487. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  488. } else {
  489. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  490. this.newGeneration.dialogFormVisible = false
  491. this.getList()
  492. }
  493. })
  494. }
  495. })
  496. },
  497. // 配方模板
  498. handleRecipeemplate() {
  499. console.log('点击了配方模板,页面待画')
  500. },
  501. handleShedFormula() {
  502. console.log('点击了栏舍配方,页面待画')
  503. },
  504. handlePremixedPlan() {
  505. console.log('点击了预混计划,页面待画')
  506. },
  507. handleMaterialPlan() {
  508. console.log('点击了撒料计划,页面待画')
  509. },
  510. handleHistoryRecord() {
  511. console.log('点击了历史记录,页面待画')
  512. },
  513. handleExport() {
  514. console.log('点击了导出')
  515. }
  516. }
  517. }
  518. </script>
  519. <style lang="scss" scoped>
  520. .operation{margin-bottom:10px;}
  521. .search{margin-top:10px;}
  522. .table{margin-top:10px;}
  523. .template{
  524. background: #fff;
  525. position: relative;
  526. .recipeTemplate{
  527. width: 72px;
  528. height: 70px;
  529. position: absolute;
  530. background: url(../../../assets/images/bg3.jpg) no-repeat;
  531. right: 0;
  532. top: 0;
  533. margin: 0;
  534. }
  535. }
  536. .table2{
  537. float: left;width: 49%;margin-right: 1%;background: red;
  538. background: #fff;
  539. position: relative;
  540. .contentOperation{
  541. width: 72px;
  542. height: 70px;
  543. position: absolute;
  544. background: url(../../../assets/images/bg4.jpg) no-repeat;
  545. right: 0;
  546. top: 0;
  547. margin: 0;
  548. }
  549. .content-table{margin-top: 70px;}
  550. }
  551. .table3{
  552. float: left;
  553. width: 49%;
  554. background: #fff;
  555. position: relative;
  556. .stallRetails{
  557. width: 72px;
  558. height: 70px;
  559. position: absolute;
  560. background: url(../../../assets/images/bg5.jpg) no-repeat;
  561. right: 0;
  562. top: 0;
  563. margin: 0;
  564. // p{
  565. // font-size: 12px;
  566. // transform:rotate(45deg);
  567. // -ms-transform:rotate(45deg); /* Internet Explorer 9*/
  568. // -moz-transform:rotate(45deg); /* Firefox */
  569. // -webkit-transform:rotate(45deg); /* Safari 和 Chrome */
  570. // -o-transform:rotate(45deg); /* Opera */
  571. // filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
  572. // }
  573. }
  574. .content-table{margin-top: 70px;}
  575. }
  576. </style>