cdd08bc45804a318af112e614854491296650ac0.svn-base 20 KB

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