861dc699ac23ce6024738dc5491de596853d0e34.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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" @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.label" :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.value" :label="item.label" :value="item.value" />
  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: '0' }, { lable: '发料计划', value: '1' }, { lable: '剩料计划', value: '2' }], // 计划类型
  202. printingTypeList: [{ lable: '所有', value: '0' }, { lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  203. frequencyList: [{ value: '0', label: '第一班' }, { value: '1', label: '第二班' }, { value: '2', label: '第三班' }], // 班次
  204. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  205. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '投料简打', value: '1' }], // 导出类型
  206. table: {
  207. getdataListParm: {
  208. name: 'getDownloadedplanList',
  209. page: 1,
  210. offset: 1,
  211. pagecount: 10,
  212. returntype: 'Map',
  213. parammaps: {
  214. pastureid: Cookies.get('pastureid'),
  215. barid: '',
  216. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  217. times: '',
  218. lpplantype: ''
  219. }
  220. },
  221. tableKey: 0,
  222. list: [],
  223. total: 0,
  224. listLoading: false
  225. },
  226. // 计划内容操作详情
  227. table2: {
  228. getdataListParm: {
  229. name: 'getDownloadplandtl1List',
  230. page: 1,
  231. offset: 1,
  232. pagecount: 5,
  233. returntype: 'Map',
  234. parammaps: {
  235. pastureid: Cookies.get('pastureid'),
  236. date: '',
  237. flpid: ''
  238. }
  239. },
  240. tableKey: 0,
  241. list: [],
  242. total: 0,
  243. listLoading: false
  244. },
  245. // 计划内容 舍栏详情
  246. table3: {
  247. getdataListParm: {
  248. name: 'getDownloadplandt2List',
  249. page: 1,
  250. offset: 1,
  251. pagecount: 5,
  252. returntype: 'Map',
  253. parammaps: {
  254. pastureid: Cookies.get('pastureid'),
  255. date: '',
  256. flpid: ''
  257. }
  258. },
  259. tableKey: 0,
  260. list: [],
  261. total: 0,
  262. listLoading: false
  263. },
  264. // 新生成
  265. newGeneration: {
  266. dialogFormVisible: false,
  267. dialogStatus: '',
  268. getdataListParm: {
  269. name: 'checkLLPIsDistribution',
  270. page: 1,
  271. offset: 1,
  272. pagecount: 1,
  273. returntype: 'Map',
  274. parammaps: {
  275. pastureid: Cookies.get('pastureid')
  276. }
  277. },
  278. temp: {},
  279. rules: {
  280. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  281. }
  282. },
  283. textMap: {
  284. newGeneration: '新生成'
  285. },
  286. isokDisable: false,
  287. requestParam: {},
  288. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  289. cellStyle: { padding: 0 + 'px' }
  290. }
  291. },
  292. mounted() {
  293. },
  294. created() {
  295. this.getList()
  296. this.getDownList()
  297. },
  298. methods: {
  299. getDownList() {
  300. GetDataByNames(this.requestParams).then(response => {
  301. // this.livestockTypeList = response.data.getDictByName.list
  302. })
  303. },
  304. // -------------------日执行计划-----------------------------
  305. getList() {
  306. this.table.listLoading = true
  307. GetDataByName(this.table.getdataListParm).then(response => {
  308. console.log('table数据', response.data.list)
  309. if (response.data.list !== null) {
  310. this.table.list = response.data.list
  311. this.table.pageNum = response.data.pageNum
  312. this.table.pageSize = response.data.pageSize
  313. this.table.total = response.data.total
  314. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  315. this.table2.getdataListParm.parammaps.flpid = response.data.list[0].pid
  316. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  317. this.table3.getdataListParm.parammaps.flpid = response.data.list[0].pid
  318. this.getList2()
  319. this.getList3()
  320. } else {
  321. this.table.list = []
  322. }
  323. setTimeout(() => {
  324. this.table.listLoading = false
  325. }, 100)
  326. })
  327. },
  328. lpplantype: function(cellValue) {
  329. if (cellValue.lpplantype == 2) {
  330. return '撒料'
  331. } else if (cellValue.lpplantype == 3) {
  332. return '预混'
  333. } else if (cellValue.lpplantype == 4) {
  334. return '剩料'
  335. }
  336. },
  337. changeDate(val) {
  338. console.log('选择了日期', val)
  339. this.getList()
  340. },
  341. changePlanType(val) {
  342. console.log('选择了日期', val)
  343. this.getList()
  344. },
  345. changeFrequency(val) {
  346. console.log('选择了日期', val)
  347. this.getList()
  348. },
  349. // 日执行计划行点击
  350. tableRowClick(row, column, event) {
  351. console.log(row, column, event)
  352. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  353. this.table2.getdataListParm.parammaps.flpid = row.pid
  354. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  355. this.table3.getdataListParm.parammaps.flpid = row.pid
  356. this.getList2()
  357. this.getList3()
  358. },
  359. // 计划内容操作详情
  360. getList2() {
  361. this.table2.listLoading = true
  362. GetDataByName(this.table2.getdataListParm).then(response => {
  363. console.log('table数据', response.data.list)
  364. if (response.data.list !== null) {
  365. this.table2.list = response.data.list
  366. const arr = []
  367. var a = 0
  368. let b = this.table2.list[0].sort
  369. let c = 0
  370. for (let i = 0; i < this.table2.list.length; i++) {
  371. if (b !== parseInt(this.table2.list[i].sort)) {
  372. b = this.table2.list[i].sort
  373. arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
  374. a = 0
  375. }
  376. a = a + parseFloat(this.table2.list[i].weight)
  377. c = c + parseFloat(this.table2.list[i].weight)
  378. arr.push(this.table2.list[i])
  379. }
  380. arr.push({ 'sort': '小计', 'weight': a })
  381. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  382. this.table2.list = arr
  383. console.log(this.table2.list)
  384. this.table2.pageNum = response.data.pageNum
  385. this.table2.pageSize = response.data.pageSize
  386. this.table2.total = response.data.total
  387. } else {
  388. this.table2.list = []
  389. }
  390. setTimeout(() => {
  391. this.table2.listLoading = false
  392. }, 100)
  393. })
  394. },
  395. // 计划内容栏舍详情
  396. getList3() {
  397. this.table3.listLoading = true
  398. GetDataByName(this.table3.getdataListParm).then(response => {
  399. console.log('table数据', response.data.list)
  400. if (response.data.list !== null) {
  401. this.table3.list = response.data.list
  402. this.table3.pageNum = response.data.pageNum
  403. this.table3.pageSize = response.data.pageSize
  404. this.table3.total = response.data.total
  405. } else {
  406. this.table3.list = []
  407. }
  408. setTimeout(() => {
  409. this.table3.listLoading = false
  410. }, 100)
  411. })
  412. },
  413. // 新生成
  414. handleCreate() {
  415. console.log('点击了新生成')
  416. this.newGeneration.temp = {}
  417. this.newGeneration.dialogStatus = 'newGeneration'
  418. this.newGeneration.dialogFormVisible = true
  419. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  420. console.log('table数据', response.data.list)
  421. if (response.data.list !== null) {
  422. if (response.data.list[0].vmsg == '存在未分配') {
  423. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  424. }
  425. }
  426. })
  427. },
  428. newGenerationData() {
  429. console.log('点击了新生成保存', this.newGeneration.temp)
  430. this.isokDisable = true
  431. setTimeout(() => {
  432. this.isokDisable = false
  433. }, 1000)
  434. this.$refs['temp'].validate(valid => {
  435. if (valid) {
  436. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  437. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  438. this.requestParam = {}
  439. this.requestParam.common = { 'returnmap': '0' }
  440. this.requestParam.data = []
  441. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'e', 'parammaps': {
  442. pastureid: Cookies.get('pastureid'),
  443. startTime: this.newGeneration.temp.startTime
  444. }}
  445. this.requestParam.data[1] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  446. pastureid: Cookies.get('pastureid'),
  447. startTime: this.newGeneration.temp.startTime,
  448. stopTime: this.newGeneration.temp.stopTime
  449. }}
  450. ExecDataByConfig(this.requestParam).then(response => {
  451. console.log('新生成保存发送参数', this.requestParam)
  452. if (response.msg === 'fail') {
  453. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  454. } else {
  455. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  456. this.newGeneration.dialogFormVisible = false
  457. this.getList()
  458. }
  459. })
  460. }
  461. })
  462. },
  463. // 配方模板
  464. handleRecipeemplate() {
  465. console.log('点击了配方模板,页面待画')
  466. },
  467. handleShedFormula() {
  468. console.log('点击了栏舍配方,页面待画')
  469. },
  470. handlePremixedPlan() {
  471. console.log('点击了预混计划,页面待画')
  472. },
  473. handleMaterialPlan() {
  474. console.log('点击了撒料计划,页面待画')
  475. },
  476. handleHistoryRecord() {
  477. console.log('点击了历史记录,页面待画')
  478. },
  479. handleExport() {
  480. console.log('点击了导出')
  481. }
  482. }
  483. }
  484. </script>
  485. <style lang="scss" scoped>
  486. .operation{margin-bottom:10px;}
  487. .search{margin-top:10px;}
  488. .table{margin-top:10px;}
  489. .template{
  490. background: #fff;
  491. position: relative;
  492. .recipeTemplate{
  493. width: 72px;
  494. height: 70px;
  495. position: absolute;
  496. background: url(../../../assets/images/bg3.jpg) no-repeat;
  497. right: 0;
  498. top: 0;
  499. margin: 0;
  500. }
  501. }
  502. .table2{
  503. float: left;width: 49%;margin-right: 1%;background: red;
  504. background: #fff;
  505. position: relative;
  506. .contentOperation{
  507. width: 72px;
  508. height: 70px;
  509. position: absolute;
  510. background: url(../../../assets/images/bg4.jpg) no-repeat;
  511. right: 0;
  512. top: 0;
  513. margin: 0;
  514. }
  515. .content-table{margin-top: 70px;}
  516. }
  517. .table3{
  518. float: left;
  519. width: 49%;
  520. background: #fff;
  521. position: relative;
  522. .stallRetails{
  523. width: 72px;
  524. height: 70px;
  525. position: absolute;
  526. background: url(../../../assets/images/bg5.jpg) no-repeat;
  527. right: 0;
  528. top: 0;
  529. margin: 0;
  530. }
  531. .content-table{margin-top: 70px;}
  532. }
  533. </style>