4db74d1af00f29f90472eb5a4227f6e6e910ad3b.svn-base 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921
  1. <template>
  2. <div class="app-container">
  3. <!-- 配方模板表 -->
  4. <div ref="template" class="template">
  5. <div class="recipeTemplate">
  6. <p>日执行计划</p>
  7. </div>
  8. <div class="search">
  9. <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" />
  10. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  11. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  12. <el-select v-model="table.getdataListParm.parammaps.lpplantype" filterable placeholder="计划类型" class="filter-item" clearable style="width: 120px;" @change="changePlanType">
  13. <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  14. </el-select>
  15. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" clearable @change="changeFrequency">
  16. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-select v-model="table.getdataListParm.parammaps.printType" filterable placeholder="打印类型" class="filter-item" :clearable="false" style="width: 120px;">
  19. <el-option v-for="item in printingTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  20. </el-select>
  21. <el-select v-model="table.getdataListParm.parammaps.plandimen" filterable placeholder="计划维度" class="filter-item" style="width: 120px;" :clearable="false">
  22. <el-option v-for="item in planningDimensionList" :key="item.value" :label="item.lable" :value="item.value" />
  23. </el-select>
  24. <el-select v-model="table.getdataListParm.parammaps.enable3" filterable placeholder="导出类型" class="filter-item" style="width: 120px;" :clearable="false">
  25. <el-option v-for="item in exportTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  26. </el-select>
  27. <el-button class="export" icon="el-icon-upload2" @click="handleExport">导出</el-button>
  28. </div>
  29. <div class="operation" style="margin-bottom: 10px;">
  30. <el-button class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
  31. <el-button class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
  32. <el-button class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
  33. <el-button v-if="isOrder" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
  34. <div v-else style="margin-left: 10px;display: inline-block;">
  35. <el-button icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  36. <el-button icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  37. </div>
  38. <el-button v-if="dataSynchronization.isDataSynchronization" class="success" @click="handleDataSynchronization">数据同步</el-button>
  39. </div>
  40. <!-- 日执行计划 -->
  41. <div class="table">
  42. <el-table
  43. id="table1"
  44. ref="parent"
  45. :key="table.tableKey"
  46. v-loading="table.listLoading"
  47. element-loading-text="给我一点时间"
  48. :data="table.list"
  49. border
  50. fit
  51. highlight-current-row
  52. style="width: 98%;"
  53. row-key="sort"
  54. :row-style="rowStyle"
  55. :cell-style="cellStyle"
  56. class="elTable table-fixed"
  57. :row-class-name="tableRowClassName"
  58. :height="370"
  59. @row-click="tableRowClick"
  60. >
  61. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  62. <el-table-column label="计划名称" min-width="90px" align="center">
  63. <template slot-scope="scope">
  64. <span>{{ scope.row.projname }}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  68. <el-table-column label="TMR编号" min-width="90px" align="center">
  69. <template slot-scope="scope">
  70. <span>{{ scope.row.tmrtname }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="驾驶员" min-width="80px" align="center">
  74. <template slot-scope="scope">
  75. <span>{{ scope.row.driver }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="已执行" min-width="70px" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.havebutton == 0">否</span>
  81. <span v-else>是</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="班次" min-width="80px" align="center">
  85. <template slot-scope="scope">
  86. <span>{{ scope.row.times }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="理论量" min-width="80px" align="center">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.lweight }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="启用" min-width="70px" align="center">
  95. <template slot-scope="scope">
  96. <el-switch v-if="dataDisabled == false" v-model="scope.row.enable" :disabled="scope.row.havebutton == 1" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  97. <el-switch v-else v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="时间" min-width="80px" align="center">
  101. <template slot-scope="scope">
  102. <span>{{ scope.row.plantime }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="配方名称" min-width="100px" align="center">
  106. <template slot-scope="scope">
  107. <span>{{ scope.row.ftname }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="牛头数" min-width="80px" align="center">
  111. <template slot-scope="scope">
  112. <span>{{ scope.row.cowcount }}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="描述" min-width="80px" align="center">
  116. <template slot-scope="scope">
  117. <span>{{ scope.row.display }}</span>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="发料位" min-width="80px" align="left">
  121. <template slot-scope="scope">
  122. <span>{{ scope.row.barnames }}</span>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  127. </div>
  128. </div>
  129. <!-- 预混料 -->
  130. <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
  131. <el-row :gutter="20">
  132. <el-col :span="12">
  133. <div class="table2">
  134. <div class="contentOperation">
  135. <p>计划详情</p>
  136. </div>
  137. <div class="content-table">
  138. <el-table
  139. :key="table2.tableKey"
  140. v-loading="table2.listLoading"
  141. element-loading-text="给我一点时间"
  142. :data="table2.list"
  143. fit
  144. border
  145. highlight-current-row
  146. style="width: 100%;"
  147. height="450"
  148. :row-style="rowStyle"
  149. :cell-style="cellStyle"
  150. class="elTable table-fixed"
  151. >
  152. <el-table-column label="操作序号" min-width="130px" align="center">
  153. <template slot-scope="scope">
  154. <span>{{ scope.row.sort }}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  158. <template slot-scope="scope">
  159. <span>{{ scope.row.fname }}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  163. <template slot-scope="scope">
  164. <span>{{ scope.row.weight }}</span>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. </div>
  169. </div>
  170. </el-col>
  171. </el-row>
  172. </div>
  173. <!-- 撒料 -->
  174. <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
  175. <el-row :gutter="20">
  176. <el-col :span="12">
  177. <div class="table2">
  178. <div class="contentOperation">
  179. <p>计划详情</p>
  180. </div>
  181. <div class="content-table">
  182. <el-table
  183. :key="table2.tableKey"
  184. v-loading="table2.listLoading"
  185. element-loading-text="给我一点时间"
  186. :data="table2.list"
  187. fit
  188. border
  189. highlight-current-row
  190. style="width: 100%;"
  191. height="450"
  192. :row-style="rowStyle"
  193. :cell-style="cellStyle"
  194. class="elTable table-fixed"
  195. >
  196. <el-table-column label="操作序号" min-width="130px" align="center">
  197. <template slot-scope="scope">
  198. <span>{{ scope.row.sort }}</span>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  202. <template slot-scope="scope">
  203. <span>{{ scope.row.fname }}</span>
  204. </template>
  205. </el-table-column>
  206. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  207. <template slot-scope="scope">
  208. <span>{{ scope.row.weight }}</span>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. </div>
  213. </div>
  214. </el-col>
  215. <el-col :span="12">
  216. <div class="table3">
  217. <div class="contentOperation">
  218. <p>栏舍详情</p>
  219. </div>
  220. <div class="content-table">
  221. <el-table
  222. :key="table3.tableKey"
  223. v-loading="table3.listLoading"
  224. element-loading-text="给我一点时间"
  225. :data="table3.list"
  226. height="450"
  227. fit
  228. border
  229. highlight-current-row
  230. style="width: 100%;"
  231. :row-style="rowStyle"
  232. :cell-style="cellStyle"
  233. class="elTable table-fixed"
  234. >
  235. <el-table-column label=" 操作序号" min-width="130px" align="center">
  236. <template slot-scope="scope">
  237. <span>{{ scope.row.sort }}</span>
  238. </template>
  239. </el-table-column>
  240. <el-table-column label="栏舍" min-width="130px" align="center">
  241. <template slot-scope="scope">
  242. <span>{{ scope.row.fname }}</span>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  246. <template slot-scope="scope">
  247. <span>{{ scope.row.weight }}</span>
  248. </template>
  249. </el-table-column>
  250. </el-table>
  251. </div>
  252. </div>
  253. </el-col>
  254. </el-row>
  255. </div>
  256. <!-- 剩料 -->
  257. <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
  258. <el-row :gutter="20">
  259. <el-col :span="12"><div class="table2">
  260. <div class="contentOperation">
  261. <p>计划详情</p>
  262. </div>
  263. <div class="content-table">
  264. <el-table
  265. :key="table2.tableKey"
  266. v-loading="table2.listLoading"
  267. element-loading-text="给我一点时间"
  268. :data="table2.list"
  269. fit
  270. border
  271. highlight-current-row
  272. style="width: 100%;"
  273. height="450"
  274. :row-style="rowStyle"
  275. :cell-style="cellStyle"
  276. class="elTable table-fixed"
  277. >
  278. <el-table-column label="操作序号" min-width="130px" align="center">
  279. <template slot-scope="scope">
  280. <span>{{ scope.row.sort }}</span>
  281. </template>
  282. </el-table-column>
  283. <el-table-column label="取料栏舍" prop="fname" min-width="130px" align="center">
  284. <template slot-scope="scope">
  285. <span>{{ scope.row.fname }}</span>
  286. </template>
  287. </el-table-column>
  288. <el-table-column label="处理方式" prop="useinbar" min-width="130px" align="center">
  289. <template slot-scope="scope">
  290. <span>{{ scope.row.useinbar }}</span>
  291. </template>
  292. </el-table-column>
  293. </el-table>
  294. </div>
  295. </div>
  296. </el-col>
  297. <el-col :span="12">
  298. <div class="table3">
  299. <div class="contentOperation">
  300. <p>栏舍详情</p>
  301. </div>
  302. <div class="content-table">
  303. <el-table
  304. :key="table3.tableKey"
  305. v-loading="table3.listLoading"
  306. element-loading-text="给我一点时间"
  307. :data="table3.list"
  308. height="450"
  309. fit
  310. border
  311. highlight-current-row
  312. style="width: 100%;"
  313. :row-style="rowStyle"
  314. :cell-style="cellStyle"
  315. class="elTable table-fixed"
  316. >
  317. <el-table-column label="操作序号" min-width="130px" align="center">
  318. <template slot-scope="scope">
  319. <span>{{ scope.row.sort }}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="转投栏舍" min-width="130px" align="center">
  323. <template slot-scope="scope">
  324. <span>{{ scope.row.fname }}</span>
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. </div>
  329. </div>
  330. </el-col>
  331. </el-row>
  332. </div>
  333. <!-- 撒料计划-混料 -->
  334. <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
  335. <el-row :gutter="20">
  336. <el-col :span="12">
  337. <div class="table2">
  338. <div class="contentOperation">
  339. <p>计划详情</p>
  340. </div>
  341. <div class="content-table">
  342. <el-table
  343. :key="table2.tableKey"
  344. v-loading="table2.listLoading"
  345. element-loading-text="给我一点时间"
  346. :data="table2.list"
  347. fit
  348. border
  349. highlight-current-row
  350. style="width: 100%;"
  351. height="450"
  352. :row-style="rowStyle"
  353. :cell-style="cellStyle"
  354. class="elTable table-fixed"
  355. >
  356. <el-table-column label="操作序号" min-width="130px" align="center">
  357. <template slot-scope="scope">
  358. <span>{{ scope.row.sort }}</span>
  359. </template>
  360. </el-table-column>
  361. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  362. <template slot-scope="scope">
  363. <span>{{ scope.row.fname }}</span>
  364. </template>
  365. </el-table-column>
  366. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  367. <template slot-scope="scope">
  368. <span>{{ scope.row.weight }}</span>
  369. </template>
  370. </el-table-column>
  371. </el-table>
  372. </div>
  373. </div>
  374. </el-col>
  375. <el-col :span="12">
  376. <div class="table3">
  377. <div class="contentOperation">
  378. <p>栏舍详情</p>
  379. </div>
  380. <div class="content-table">
  381. <el-table
  382. :key="table3.tableKey"
  383. v-loading="table3.listLoading"
  384. element-loading-text="给我一点时间"
  385. :data="table3.list"
  386. height="450"
  387. fit
  388. border
  389. highlight-current-row
  390. style="width: 100%;"
  391. :row-style="rowStyle"
  392. :cell-style="cellStyle"
  393. class="elTable table-fixed"
  394. >
  395. <el-table-column label=" 操作序号" min-width="130px" align="center">
  396. <template slot-scope="scope">
  397. <span>{{ scope.row.sort }}</span>
  398. </template>
  399. </el-table-column>
  400. <el-table-column label="撒料车辆" min-width="130px" align="center">
  401. <template slot-scope="scope">
  402. <span>{{ scope.row.fname }}</span>
  403. </template>
  404. </el-table-column>
  405. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  406. <template slot-scope="scope">
  407. <span>{{ scope.row.weight }}</span>
  408. </template>
  409. </el-table-column>
  410. </el-table>
  411. </div>
  412. </div>
  413. </el-col>
  414. </el-row>
  415. </div>
  416. <!-- 撒料计划-撒料 -->
  417. <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
  418. <el-row :gutter="20">
  419. <el-col :span="12">
  420. <div class="table3">
  421. <div class="contentOperation">
  422. <p>栏舍详情</p>
  423. </div>
  424. <div class="content-table">
  425. <el-table
  426. :key="table3.tableKey"
  427. v-loading="table3.listLoading"
  428. element-loading-text="给我一点时间"
  429. :data="table3.list"
  430. height="450"
  431. fit
  432. border
  433. highlight-current-row
  434. style="width: 100%;"
  435. :row-style="rowStyle"
  436. :cell-style="cellStyle"
  437. class="elTable table-fixed"
  438. >
  439. <el-table-column label=" 操作序号" min-width="130px" align="center">
  440. <template slot-scope="scope">
  441. <span>{{ scope.row.sort }}</span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column label="撒料车辆" min-width="130px" align="center">
  445. <template slot-scope="scope">
  446. <span>{{ scope.row.fname }}</span>
  447. </template>
  448. </el-table-column>
  449. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  450. <template slot-scope="scope">
  451. <span>{{ scope.row.weight }}</span>
  452. </template>
  453. </el-table-column>
  454. </el-table>
  455. </div>
  456. </div>
  457. </el-col>
  458. <el-col :span="12">
  459. <div class="table2">
  460. <div class="contentOperation">
  461. <p>计划详情</p>
  462. </div>
  463. <div class="content-table">
  464. <el-table
  465. :key="table2.tableKey"
  466. v-loading="table2.listLoading"
  467. element-loading-text="给我一点时间"
  468. :data="table2.list"
  469. fit
  470. border
  471. highlight-current-row
  472. style="width: 100%;"
  473. height="450"
  474. :row-style="rowStyle"
  475. :cell-style="cellStyle"
  476. class="elTable table-fixed"
  477. >
  478. <el-table-column label="操作序号" min-width="130px" align="center">
  479. <template slot-scope="scope">
  480. <span>{{ scope.row.sort }}</span>
  481. </template>
  482. </el-table-column>
  483. <el-table-column label="栏舍名称" prop="fname" min-width="130px" align="center">
  484. <template slot-scope="scope">
  485. <span>{{ scope.row.fname }}</span>
  486. </template>
  487. </el-table-column>
  488. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  489. <template slot-scope="scope">
  490. <span>{{ scope.row.weight }}</span>
  491. </template>
  492. </el-table-column>
  493. </el-table>
  494. </div>
  495. </div>
  496. </el-col>
  497. </el-row>
  498. </div>
  499. <!-- 新生成 -->
  500. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  501. <div class="newGeneration">
  502. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  503. <el-row v-if="newGeneration.dialogStatus== 'newGeneration'">
  504. <el-col :span="24">
  505. <el-form-item label="时间范围:" prop="inputDatetime">
  506. <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" :picker-options="pickerOptions2" />
  507. </el-form-item>
  508. </el-col>
  509. </el-row>
  510. <el-row v-else>
  511. <el-col :span="24">
  512. <el-form-item label="时间范围:" prop="copyInputDatetime">
  513. <el-date-picker v-model="newGeneration.temp.copyInputDatetime" :picker-options="pickerOptions" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
  514. </el-form-item>
  515. </el-col>
  516. </el-row>
  517. </el-form>
  518. <div slot="footer" class="dialog-footer" style="bottom:10px">
  519. <el-button class="cancelClose" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  520. <el-button v-if="newGeneration.dialogStatus== 'newGeneration'" class="save" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  521. <el-button v-else class="save" :disabled="isokDisable" @click="copyData()">确认</el-button>
  522. </div>
  523. </div>
  524. </el-dialog>
  525. <!-- 历史记录 -->
  526. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  527. <div class="historyRecord">
  528. <keep-alive>
  529. <component :is="historyRecord.myComponent" ref="historyRecord" />
  530. </keep-alive>
  531. </div>
  532. <div slot="footer" class="dialog-footer">
  533. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  534. </div>
  535. </el-dialog>
  536. <!-- 正在同步中 -->
  537. <el-dialog :destroy-on-close="true" :visible.sync="dataSynchronization.dialogFormVisible" :close-on-click-modal="false" width="30%">
  538. <div class="dataSynchronization" style="text-align: center;font-size: 18px;">
  539. <i class="el-icon-loading" />
  540. <span>正在同步</span>
  541. <div slot="footer" class="dialog-footer" style="bottom:10px">
  542. <el-button class="miniPrimary" @click="dataSynchronization.dialogFormVisible = false;">确认</el-button>
  543. </div>
  544. </div>
  545. </el-dialog>
  546. <!-- 修改计划 -->
  547. <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
  548. </div>
  549. </template>
  550. <script>
  551. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, getDorm, GetReportform } from '@/api/common'
  552. import RevisePlan from './revisePlan.vue'
  553. import { parseTime, json2excel } from '@/utils/index.js'
  554. import Cookies from 'js-cookie'
  555. import Sortable from 'sortablejs'
  556. import { MessageBox } from 'element-ui'
  557. export default {
  558. name: 'DailyExecutionPlan',
  559. components: {
  560. RevisePlan
  561. },
  562. data() {
  563. return {
  564. dataDisabled: false,
  565. requestParams: [
  566. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  567. ],
  568. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  569. printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  570. frequencyList: [], // 班次
  571. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  572. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
  573. // 班次
  574. maxTime: {
  575. getMaxTimesParm: {
  576. name: 'getSysoptEnable',
  577. page: 1,
  578. offset: 1,
  579. pagecount: 1,
  580. returntype: 'Map',
  581. parammaps: {
  582. pastureid: Cookies.get('pastureid'),
  583. inforname: 'times'
  584. }
  585. }
  586. },
  587. isOrder: true,
  588. table: {
  589. getdataListParm: {
  590. name: 'getDownloadedplanList',
  591. page: 1,
  592. offset: 1,
  593. pagecount: '',
  594. returntype: 'Map',
  595. parammaps: {
  596. pastureid: Cookies.get('pastureid'),
  597. barid: '',
  598. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  599. times: '',
  600. lpplantype: '',
  601. printType: '',
  602. plandimen: '0',
  603. enable3: '0'
  604. }
  605. },
  606. tableKey: 0,
  607. list: [],
  608. total: 0,
  609. listLoading: false
  610. },
  611. // 计划内容操作详情
  612. table2: {
  613. getdataListParm: {
  614. name: 'getDownloadplandtl1ListV2',
  615. page: 1,
  616. offset: 1,
  617. returntype: 'Map',
  618. parammaps: {
  619. pastureid: Cookies.get('pastureid'),
  620. date: '',
  621. id: ''
  622. }
  623. },
  624. tableKey: 0,
  625. list: [],
  626. total: 0,
  627. listLoading: false
  628. },
  629. // 计划内容 舍栏详情
  630. table3: {
  631. getdataListParm: {
  632. name: 'getDownloadplandt2ListV2',
  633. page: 1,
  634. offset: 1,
  635. returntype: 'Map',
  636. parammaps: {
  637. pastureid: Cookies.get('pastureid'),
  638. date: '',
  639. id: ''
  640. }
  641. },
  642. tableKey: 0,
  643. list: [],
  644. total: 0,
  645. listLoading: false
  646. },
  647. // 新生成
  648. newGeneration: {
  649. dialogFormVisible: false,
  650. dialogStatus: '',
  651. getdataListParm: {
  652. name: 'checkLLPIsDistribution',
  653. page: 1,
  654. offset: 1,
  655. pagecount: 1,
  656. returntype: 'Map',
  657. parammaps: {
  658. pastureid: Cookies.get('pastureid')
  659. }
  660. },
  661. temp: {
  662. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  663. },
  664. rules: {
  665. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
  666. copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  667. }
  668. },
  669. pickerMinDate: '',
  670. pickerOptions: {
  671. onPick: ({ maxDate, minDate }) => {
  672. this.pickerMinDate = minDate.getTime()
  673. if (maxDate) {
  674. this.pickerMinDate = ''
  675. }
  676. },
  677. disabledDate: (time) => {
  678. if (this.pickerMinDate !== '') {
  679. const one = 31 * 24 * 3600 * 1000
  680. const minTime = this.pickerMinDate
  681. const maxTime = this.pickerMinDate + one
  682. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  683. }
  684. return time.getTime() < Date.now() - 8.64e7
  685. }
  686. },
  687. pickerOptions2: {
  688. onPick: ({ maxDate, minDate }) => {
  689. this.pickerMinDate = minDate.getTime()
  690. if (maxDate) {
  691. this.pickerMinDate = ''
  692. }
  693. },
  694. disabledDate: (time) => {
  695. if (this.pickerMinDate !== '') {
  696. const one = 14 * 24 * 3600 * 1000
  697. const minTime = this.pickerMinDate
  698. const maxTime = this.pickerMinDate + one
  699. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  700. }
  701. return time.getTime() < Date.now() - 8.64e7
  702. }
  703. },
  704. historyRecord: {
  705. dialogFormVisible: false,
  706. dialogStatus: '',
  707. myComponent: null
  708. },
  709. dataSynchronization: {
  710. dialogFormVisible: false,
  711. dialogStatus: '',
  712. getdataListParm: {
  713. name: 'getSysoptEnable',
  714. page: 1,
  715. offset: 1,
  716. pagecount: 1,
  717. returntype: 'Map',
  718. parammaps: {
  719. pastureid: Cookies.get('pastureid'),
  720. inforname: 'isDataSync'
  721. }
  722. },
  723. isDataSynchronization: false
  724. },
  725. textMap: {
  726. newGeneration: '新生成',
  727. historyRecord: '历史记录',
  728. revisePlan: '修改计划',
  729. copy: '复制计划'
  730. },
  731. isokDisable: false,
  732. requestParam: {},
  733. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  734. cellStyle: { padding: 0 + 'px' },
  735. isShowDialog: false,
  736. activeName: '栏舍配方',
  737. parentDate: '',
  738. downLoad: {
  739. getdataListParm: {
  740. name: '',
  741. page: 1,
  742. offset: 1,
  743. pagecount: '',
  744. returntype: 'Map',
  745. parammaps: {
  746. pastureid: Cookies.get('pastureid'),
  747. date: ''
  748. }
  749. },
  750. list: [],
  751. labelList: []
  752. }
  753. }
  754. },
  755. created() {
  756. this.parentDate = this.table.getdataListParm.parammaps.mydate
  757. console.log(this.parentDate, 'this.parentDate')
  758. this.getDataSynchronization()
  759. this.getList()
  760. this.getDownList()
  761. this.getIsDisplay()
  762. },
  763. mounted() {
  764. this.table.getdataListParm.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
  765. },
  766. methods: {
  767. getDataSynchronization() {
  768. GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
  769. console.log(response.data.list[0])
  770. if (response.data.list[0].inforvalue == 0) {
  771. this.dataSynchronization.isDataSynchronization = false
  772. } else {
  773. this.dataSynchronization.isDataSynchronization = true
  774. }
  775. })
  776. },
  777. getIsDisplay() {
  778. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  779. console.log(response.data.list[0].inforvalue)
  780. if (response.data.list[0].inforvalue == 1) {
  781. this.frequencyList = [{ id: '1', name: '第一班' }]
  782. } else if (response.data.list[0].inforvalue == 2) {
  783. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  784. } else if (response.data.list[0].inforvalue == 3) {
  785. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  786. } else if (response.data.list[0].inforvalue == 4) {
  787. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  788. }
  789. })
  790. },
  791. getDownList() {
  792. GetDataByNames(this.requestParams).then(response => {
  793. // this.livestockTypeList = response.data.getDictByName.list
  794. })
  795. },
  796. // -------------------日执行计划-----------------------------
  797. handleBefore() {
  798. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  799. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  800. var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
  801. // var start = this.table.getdataListParm.parammaps.mydate - 1
  802. this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
  803. // this.$forceUpdate()
  804. this.parentDate = this.table.getdataListParm.parammaps.mydate
  805. this.getList()
  806. }
  807. var d = this.table.getdataListParm.parammaps.mydate
  808. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  809. if (d < curDate) {
  810. this.dataDisabled = true
  811. } else {
  812. this.dataDisabled = false
  813. }
  814. console.log(this.dataDisabled)
  815. },
  816. handleNext() {
  817. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  818. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  819. var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
  820. this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
  821. this.parentDate = this.table.getdataListParm.parammaps.mydate
  822. this.getList()
  823. }
  824. var d = this.table.getdataListParm.parammaps.mydate
  825. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  826. if (d < curDate) {
  827. this.dataDisabled = true
  828. } else {
  829. this.dataDisabled = false
  830. }
  831. console.log(this.dataDisabled)
  832. },
  833. getList() {
  834. this.table.listLoading = true
  835. GetDataByName(this.table.getdataListParm).then(response => {
  836. console.log('table数据', response.data.list)
  837. if (response.data.list !== null) {
  838. // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
  839. // response.data.list[6] = obj
  840. this.getIsColor(response.data.list)
  841. this.table.list = response.data.list
  842. this.table.pageNum = response.data.pageNum
  843. this.table.pageSize = response.data.pageSize
  844. this.table.total = response.data.total
  845. console.log('计划类型', response.data.list[0].lpplantype)
  846. if (response.data.list[0].lpplantype == 0) {
  847. // 撒料
  848. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  849. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  850. this.table2.getdataListParm.parammaps.useinbartype = ''
  851. this.table3.getdataListParm.parammaps.useinbartype = ''
  852. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  853. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  854. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  855. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  856. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  857. this.getList2()
  858. this.getList3()
  859. } else if (response.data.list[0].lpplantype == 1) {
  860. // 撒料计划-混料
  861. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  862. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  863. this.table2.getdataListParm.parammaps.useinbartype = ''
  864. this.table3.getdataListParm.parammaps.useinbartype = ''
  865. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  866. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  867. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  868. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  869. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  870. this.getList2()
  871. this.getList3()
  872. } else if (response.data.list[0].lpplantype == 2) {
  873. // 撒料计划-撒料
  874. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  875. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  876. this.table2.getdataListParm.parammaps.useinbartype = ''
  877. this.table3.getdataListParm.parammaps.useinbartype = ''
  878. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  879. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  880. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  881. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  882. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  883. this.getList2()
  884. this.getList3()
  885. } else if (response.data.list[0].lpplantype == 3) {
  886. // 剩料
  887. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  888. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  889. this.table2.getdataListParm.parammaps.useinbartype = 0
  890. this.table3.getdataListParm.parammaps.useinbartype = 1
  891. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  892. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  893. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  894. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  895. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  896. this.getList2()
  897. this.getList3()
  898. } else if (response.data.list[0].lpplantype == 4) {
  899. // 预混
  900. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  901. this.table2.getdataListParm.parammaps.useinbartype = ''
  902. this.table3.getdataListParm.parammaps.useinbartype = ''
  903. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  904. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  905. this.getList2()
  906. } else if (response.data.list[0].lpplantype == 5) {
  907. // 预称重计划
  908. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  909. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  910. this.table2.getdataListParm.parammaps.useinbartype = ''
  911. this.table3.getdataListParm.parammaps.useinbartype = ''
  912. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  913. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  914. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  915. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  916. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  917. this.getList2()
  918. this.getList3()
  919. }
  920. } else {
  921. this.table.list = []
  922. this.table3.getdataListParm.parammaps.lpplantype = ''
  923. this.table2.getdataListParm.parammaps.id = ''
  924. this.table3.getdataListParm.parammaps.id = ''
  925. // this.getList2()
  926. // this.getList3()
  927. this.table2.list = []
  928. this.table3.list = []
  929. }
  930. setTimeout(() => {
  931. this.table.listLoading = false
  932. }, 100)
  933. })
  934. },
  935. handleEnableChange(row) {
  936. this.requestParam.name = 'updatedownloadenable'
  937. this.requestParam.parammaps = {}
  938. this.requestParam.parammaps.pastureid = row.pastureid
  939. this.requestParam.parammaps.id = row.id
  940. this.requestParam.parammaps.enable = row.enable
  941. PostDataByName(this.requestParam).then(response => {
  942. if (response.msg === 'fail') {
  943. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  944. } else {
  945. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  946. this.getList()
  947. }
  948. })
  949. },
  950. getIsColor(arr) {
  951. var map = {}
  952. var dest = []
  953. for (var i = 0; i < arr.length; i++) {
  954. var ai = arr[i]
  955. if (!map[ai.pid]) {
  956. dest.push({
  957. pid: ai.pid,
  958. data: [ai]
  959. })
  960. map[ai.pid] = ai
  961. } else {
  962. for (var j = 0; j < dest.length; j++) {
  963. var dj = dest[j]
  964. if (dj.pid == ai.pid) {
  965. dj.data.push(ai)
  966. break
  967. }
  968. }
  969. }
  970. }
  971. console.log(dest)
  972. var newArr1 = []
  973. for (var i = 0; i < dest.length; i++) {
  974. var newArr = dest[i].data
  975. for (var j = 0; j < dest[i].data.length; j++) {
  976. dest[i].data[j].isColor = i
  977. newArr1.push(dest[i].data[j])
  978. }
  979. }
  980. console.log(newArr1)
  981. this.table.list = newArr1
  982. },
  983. tableRowClassName({ row }) {
  984. if (row.isColor % 2 == 0) {
  985. return 'warning-row'
  986. } else {
  987. return 'success-row'
  988. }
  989. },
  990. lpplantype: function(cellValue) {
  991. if (cellValue.lpplantype == 0) {
  992. return '撒料计划'
  993. } else if (cellValue.lpplantype == 1) {
  994. return '撒料计划-混料'
  995. } else if (cellValue.lpplantype == 2) {
  996. return '撒料计划-撒料'
  997. } else if (cellValue.lpplantype == 3) {
  998. return '剩料计划'
  999. } else if (cellValue.lpplantype == 4) {
  1000. return '预混计划'
  1001. } else if (cellValue.lpplantype == 5) {
  1002. return '预称重计划'
  1003. }
  1004. },
  1005. changeDate(val) {
  1006. console.log('选择了日期', val)
  1007. this.getList()
  1008. // this.getList2()
  1009. // this.getList3()
  1010. var d = this.table.getdataListParm.parammaps.mydate
  1011. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1012. if (d < curDate) {
  1013. this.dataDisabled = true
  1014. } else {
  1015. this.dataDisabled = false
  1016. }
  1017. console.log(this.dataDisabled)
  1018. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1019. console.log(this.parentDate, 'this.parentDate')
  1020. },
  1021. changePlanType(val) {
  1022. console.log('选择了计划类型', val)
  1023. this.getList()
  1024. this.getList2()
  1025. this.getList3()
  1026. },
  1027. changeFrequency(val) {
  1028. console.log('选择了班次', val)
  1029. this.getList()
  1030. this.getList2()
  1031. this.getList3()
  1032. },
  1033. // 日执行计划行点击
  1034. tableRowClick(row, column, event) {
  1035. console.log(row, column, event)
  1036. console.log('点击计划类型', row.lpplantype)
  1037. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
  1038. if (row.lpplantype == 0) {
  1039. // 撒料
  1040. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1041. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1042. this.table2.getdataListParm.parammaps.useinbartype = ''
  1043. this.table3.getdataListParm.parammaps.useinbartype = ''
  1044. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1045. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1046. this.table2.getdataListParm.parammaps.id = row.id
  1047. this.table3.getdataListParm.parammaps.id = row.id
  1048. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1049. this.getList2()
  1050. this.getList3()
  1051. } else if (row.lpplantype == 1) {
  1052. // 撒料计划-混料
  1053. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1054. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1055. this.table2.getdataListParm.parammaps.useinbartype = ''
  1056. this.table3.getdataListParm.parammaps.useinbartype = ''
  1057. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1058. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1059. this.table2.getdataListParm.parammaps.id = row.id
  1060. this.table3.getdataListParm.parammaps.id = row.id
  1061. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1062. this.getList2()
  1063. this.getList3()
  1064. } else if (row.lpplantype == 2) {
  1065. // 撒料计划-撒料
  1066. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1067. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1068. this.table2.getdataListParm.parammaps.useinbartype = ''
  1069. this.table3.getdataListParm.parammaps.useinbartype = ''
  1070. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1071. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1072. this.table2.getdataListParm.parammaps.id = row.id
  1073. this.table3.getdataListParm.parammaps.id = row.id
  1074. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1075. this.getList2()
  1076. this.getList3()
  1077. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1078. } else if (row.lpplantype == 3) {
  1079. // 剩料
  1080. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1081. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1082. this.table2.getdataListParm.parammaps.useinbartype = 0
  1083. this.table3.getdataListParm.parammaps.useinbartype = 1
  1084. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1085. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1086. this.table2.getdataListParm.parammaps.id = row.id
  1087. this.table3.getdataListParm.parammaps.id = row.id
  1088. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1089. this.getList2()
  1090. this.getList3()
  1091. } else if (row.lpplantype == 4) {
  1092. // 预混
  1093. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1094. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1095. this.table2.getdataListParm.parammaps.useinbartype = ''
  1096. this.table3.getdataListParm.parammaps.useinbartype = ''
  1097. this.table2.getdataListParm.parammaps.id = row.id
  1098. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1099. this.getList2()
  1100. } else if (row.lpplantype == 5) {
  1101. // 预称重计划
  1102. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1103. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1104. this.table2.getdataListParm.parammaps.useinbartype = ''
  1105. this.table3.getdataListParm.parammaps.useinbartype = ''
  1106. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1107. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1108. this.table2.getdataListParm.parammaps.id = row.id
  1109. this.table3.getdataListParm.parammaps.id = row.id
  1110. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1111. this.getList2()
  1112. this.getList3()
  1113. }
  1114. this.$forceUpdate()
  1115. },
  1116. // 计划内容操作详情
  1117. getList2() {
  1118. this.table2.listLoading = true
  1119. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1120. GetDataByName(this.table2.getdataListParm).then(response => {
  1121. console.log('table数据', response.data.list)
  1122. if (response.data.list !== null) {
  1123. this.table2.list = response.data.list
  1124. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1125. if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
  1126. const arr = []
  1127. var a = 0
  1128. let b = this.table2.list[0].sort
  1129. let c = 0
  1130. for (let i = 0; i < this.table2.list.length; i++) {
  1131. if (b !== parseInt(this.table2.list[i].sort)) {
  1132. b = this.table2.list[i].sort
  1133. arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
  1134. a = 0
  1135. }
  1136. a = a + parseFloat(this.table2.list[i].weight)
  1137. c = c + parseFloat(this.table2.list[i].weight)
  1138. arr.push(this.table2.list[i])
  1139. }
  1140. arr.push({ 'sort': '小计', 'weight': a })
  1141. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  1142. this.table2.list = arr
  1143. }
  1144. if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
  1145. const arr = []
  1146. var aa = 0
  1147. let bb = this.table2.list[0].sort
  1148. let cc = 0
  1149. for (let i = 0; i < this.table2.list.length; i++) {
  1150. if (bb !== parseInt(this.table2.list[i].sort)) {
  1151. bb = this.table2.list[i].sort
  1152. aa = 0
  1153. }
  1154. aa = aa + parseFloat(this.table2.list[i].weight)
  1155. cc = cc + parseFloat(this.table2.list[i].weight)
  1156. arr.push(this.table2.list[i])
  1157. }
  1158. arr.push({ 'sort': '总计', 'weight': cc.toFixed(2) })
  1159. this.table2.list = arr
  1160. console.log('this.table2.list', this.table2.list)
  1161. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1162. }
  1163. console.log(this.table2.list)
  1164. this.table2.pageNum = response.data.pageNum
  1165. this.table2.pageSize = response.data.pageSize
  1166. this.table2.total = response.data.total
  1167. } else {
  1168. this.table2.list = []
  1169. }
  1170. setTimeout(() => {
  1171. this.table2.listLoading = false
  1172. }, 100)
  1173. })
  1174. },
  1175. // 计划内容栏舍详情
  1176. getList3() {
  1177. this.table3.listLoading = true
  1178. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1179. GetDataByName(this.table3.getdataListParm).then(response => {
  1180. console.log('table数据', response.data.list)
  1181. if (response.data.list !== null) {
  1182. this.table3.list = response.data.list
  1183. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1184. const arr = []
  1185. var a = 0
  1186. let b = this.table3.list[0].sort
  1187. let c = 0
  1188. for (let i = 0; i < this.table3.list.length; i++) {
  1189. if (b !== parseInt(this.table3.list[i].sort)) {
  1190. b = this.table3.list[i].sort
  1191. a = 0
  1192. }
  1193. a = a + parseFloat(this.table3.list[i].weight)
  1194. c = c + parseFloat(this.table3.list[i].weight)
  1195. arr.push(this.table3.list[i])
  1196. }
  1197. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  1198. this.table3.list = arr
  1199. }
  1200. this.table3.pageNum = response.data.pageNum
  1201. this.table3.pageSize = response.data.pageSize
  1202. this.table3.total = response.data.total
  1203. } else {
  1204. this.table3.list = []
  1205. }
  1206. setTimeout(() => {
  1207. this.table3.listLoading = false
  1208. }, 100)
  1209. })
  1210. },
  1211. // 新生成
  1212. handleCreate() {
  1213. console.log('点击了新生成')
  1214. this.newGeneration.temp.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  1215. this.newGeneration.dialogStatus = 'newGeneration'
  1216. this.newGeneration.dialogFormVisible = true
  1217. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  1218. console.log('table数据', response.data.list)
  1219. if (response.data.list !== null) {
  1220. if (response.data.list[0].vmsg == '存在未分配') {
  1221. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  1222. }
  1223. }
  1224. })
  1225. },
  1226. DateDiff(sDate1, sDate2) {
  1227. console.log(sDate1, sDate2)
  1228. var aDate, oDate1, oDate2, iDays
  1229. aDate = sDate1.split('-')
  1230. oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
  1231. aDate = sDate2.split('-')
  1232. oDate2 = new Date(aDate[0], aDate[1], aDate[2])
  1233. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
  1234. this.newGeneration.temp.days = parseInt(iDays) + 1
  1235. return iDays
  1236. },
  1237. newGenerationData() {
  1238. console.log('点击了新生成保存', this.newGeneration.temp)
  1239. this.isokDisable = true
  1240. setTimeout(() => {
  1241. this.isokDisable = false
  1242. }, 5000)
  1243. this.$refs['temp'].validate(valid => {
  1244. if (valid) {
  1245. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  1246. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  1247. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  1248. this.requestParam = {}
  1249. this.requestParam.common = { 'returnmap': '0' }
  1250. this.requestParam.data = []
  1251. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  1252. pastureid: Cookies.get('pastureid'),
  1253. startTime: this.newGeneration.temp.startTime
  1254. }}
  1255. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  1256. pastureid: Cookies.get('pastureid'),
  1257. days: this.newGeneration.temp.days
  1258. }}
  1259. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  1260. pastureid: Cookies.get('pastureid'),
  1261. startTime: this.newGeneration.temp.startTime,
  1262. stopTime: this.newGeneration.temp.stopTime
  1263. }}
  1264. ExecDataByConfig(this.requestParam).then(response => {
  1265. console.log('新生成保存发送参数', this.requestParam)
  1266. if (response.msg === 'fail') {
  1267. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1268. } else {
  1269. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1270. this.newGeneration.dialogFormVisible = false
  1271. this.getList()
  1272. }
  1273. })
  1274. }
  1275. })
  1276. },
  1277. // 修改计划
  1278. handleRevisePlan(data) {
  1279. var arr = []
  1280. for (let i = 0; i < this.table.list.length; i++) {
  1281. if (this.table.list[i].havebutton == 1) {
  1282. arr.push(this.table.list[i])
  1283. }
  1284. }
  1285. if (arr.length !== this.table.list.length) {
  1286. console.log('点击了修改计划1', this.activeName)
  1287. this.isShowDialog = true
  1288. this.activeName = '栏舍配方'
  1289. console.log('点击了修改计划2', this.activeName)
  1290. } else {
  1291. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  1292. }
  1293. },
  1294. handleExport() {
  1295. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1296. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  1297. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  1298. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  1299. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  1300. var exportTitle = ''
  1301. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  1302. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1303. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  1304. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1305. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1306. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  1307. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1308. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1309. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  1310. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1311. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1312. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  1313. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1314. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1315. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  1316. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1317. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1318. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  1319. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1320. } else {
  1321. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  1322. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1323. }
  1324. } else {
  1325. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1326. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  1327. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1328. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1329. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  1330. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1331. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1332. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  1333. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1334. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1335. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  1336. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1337. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1338. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  1339. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1340. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1341. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  1342. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1343. } else {
  1344. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  1345. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1346. }
  1347. }
  1348. GetReportform(this.downLoad.getdataListParm).then(response => {
  1349. if (response.data.list !== null) {
  1350. this.downLoad.labelList = []
  1351. var filterValArr = []
  1352. for (let i = 0; i < response.data.list.data1.length; i++) {
  1353. this.downLoad.labelList.push(response.data.list.data1[i].label)
  1354. filterValArr.push(response.data.list.data1[i].prop)
  1355. }
  1356. this.downLoad.list = response.data.list.data2
  1357. } else {
  1358. this.downLoad.list = []
  1359. }
  1360. var multiHeaderArr = []
  1361. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  1362. if (i == 0) {
  1363. multiHeaderArr.push(exportTitle)
  1364. } else {
  1365. multiHeaderArr.push('')
  1366. }
  1367. }
  1368. import('@/vendor/Export5Excel').then(excel => {
  1369. const multiHeader = [
  1370. multiHeaderArr
  1371. ]
  1372. const multiHeader2 = [
  1373. this.downLoad.labelList
  1374. ]
  1375. const filterVal = filterValArr
  1376. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  1377. const merges = []
  1378. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  1379. })
  1380. })
  1381. },
  1382. rowDrop() {
  1383. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  1384. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  1385. // this.sorTable()
  1386. const that = this
  1387. var sortable = Sortable.create(tbody, {
  1388. disabled: that.dropState,
  1389. onChoose({ newIndex, oldIndex }) {
  1390. console.log(that.isOrder, 'that.isOrder == false')
  1391. console.log(that.dropState, 'that.dropState')
  1392. if (that.dropState == true || that.isOrder == true) {
  1393. sortable.destroy()
  1394. }
  1395. },
  1396. onEnd(evt) {
  1397. var tableList = [...that.table.list] // 保留拖动前数据
  1398. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  1399. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  1400. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  1401. console.log(targetRow, 'targetRow')
  1402. console.log(targetRow2, 'targetRow2')
  1403. console.log(targetRow3, 'targetRow3')
  1404. that.table.list.splice(evt.newIndex, 0, targetRow)
  1405. // ==========
  1406. // 已执行的计划不可拖动
  1407. if (targetRow.havebutton == 1) {
  1408. that.$nextTick(() => {
  1409. that.$set(that.table, 'list', tableList)
  1410. })
  1411. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  1412. return false
  1413. }
  1414. // 相同班次之间可以拖动
  1415. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1416. if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  1417. that.$nextTick(() => {
  1418. that.$set(that.table, 'list', tableList)
  1419. })
  1420. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1421. return false
  1422. }
  1423. } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  1424. if (targetRow.times !== targetRow2.times) {
  1425. that.$nextTick(() => {
  1426. that.$set(that.table, 'list', tableList)
  1427. })
  1428. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1429. return false
  1430. }
  1431. } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  1432. if (targetRow.times !== targetRow3.times) {
  1433. that.$nextTick(() => {
  1434. that.$set(that.table, 'list', tableList)
  1435. })
  1436. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1437. return false
  1438. }
  1439. }
  1440. // 撒料计划0,
  1441. // 撒料计划-混料1
  1442. // 撒料计划-撒料2
  1443. // 剩料计划3
  1444. // 预混计划4
  1445. // 预称重计划5
  1446. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  1447. if (targetRow2 == undefined) {
  1448. that.$nextTick(() => {
  1449. that.$set(that.table, 'list', tableList)
  1450. })
  1451. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  1452. that.$nextTick(() => {
  1453. that.$set(that.table, 'list', tableList)
  1454. })
  1455. } else {
  1456. var pidArr = [] // pid相同的值
  1457. var pidArr1 = [] //
  1458. var index // 索引
  1459. for (let i = 0; i < tableList.length; i++) {
  1460. if (tableList[i].pid == targetRow.pid) {
  1461. pidArr.push(tableList[i])
  1462. } else {
  1463. pidArr1.push(tableList[i])
  1464. }
  1465. }
  1466. // 找到对应上方pid 的ID
  1467. // 比如说id 580243 找到对应的索引
  1468. if (targetRow3 !== undefined) {
  1469. for (let i = 0; i < pidArr1.length; i++) {
  1470. if (pidArr1[i].id == targetRow3.id) {
  1471. index = i
  1472. }
  1473. }
  1474. } else {
  1475. for (let i = 0; i < pidArr1.length; i++) {
  1476. if (pidArr1[i].id == targetRow2.id) {
  1477. index = i - 1
  1478. }
  1479. }
  1480. }
  1481. pidArr1.splice(index + 1, 0, ...pidArr)
  1482. console.log(pidArr1)
  1483. that.$nextTick(() => {
  1484. that.table.list = pidArr1
  1485. })
  1486. }
  1487. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1488. if (targetRow2.pid == targetRow3.pid) {
  1489. that.$nextTick(() => {
  1490. that.$set(that.table, 'list', tableList)
  1491. })
  1492. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1493. return false
  1494. }
  1495. }
  1496. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  1497. if (targetRow2 !== undefined) {
  1498. console.log(targetRow3, targetRow2, 'zhidao')
  1499. if (targetRow3 !== undefined) {
  1500. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  1501. that.$nextTick(() => {
  1502. that.$set(that.table, 'list', tableList)
  1503. })
  1504. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1505. return false
  1506. } else {
  1507. console.log('wojinlaile', targetRow2, targetRow)
  1508. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  1509. that.$nextTick(() => {
  1510. that.$set(that.table, 'list', tableList)
  1511. })
  1512. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1513. return false
  1514. }
  1515. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  1516. that.$nextTick(() => {
  1517. that.$set(that.table, 'list', tableList)
  1518. })
  1519. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1520. return false
  1521. }
  1522. }
  1523. } else {
  1524. if (targetRow2.pid !== targetRow.pid) {
  1525. that.$nextTick(() => {
  1526. that.$set(that.table, 'list', tableList)
  1527. })
  1528. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1529. return false
  1530. } else {
  1531. if (targetRow2.pid !== targetRow.pid) {
  1532. that.$nextTick(() => {
  1533. that.$set(that.table, 'list', tableList)
  1534. })
  1535. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1536. return false
  1537. }
  1538. }
  1539. }
  1540. } else {
  1541. if (targetRow2 == undefined) {
  1542. that.$nextTick(() => {
  1543. that.$set(that.table, 'list', tableList)
  1544. })
  1545. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1546. return false
  1547. } else if (targetRow3.pid !== targetRow.pid) {
  1548. that.$nextTick(() => {
  1549. that.$set(that.table, 'list', tableList)
  1550. })
  1551. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1552. return false
  1553. } else {
  1554. if (targetRow3.lpplantype == 0) {
  1555. that.$nextTick(() => {
  1556. that.$set(that.table, 'list', tableList)
  1557. })
  1558. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1559. return false
  1560. }
  1561. }
  1562. }
  1563. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1564. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  1565. that.$nextTick(() => {
  1566. that.$set(that.table, 'list', tableList)
  1567. })
  1568. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1569. return false
  1570. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  1571. that.$nextTick(() => {
  1572. that.$set(that.table, 'list', tableList)
  1573. })
  1574. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1575. return false
  1576. }
  1577. }
  1578. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  1579. if (targetRow2 == undefined) {
  1580. if (targetRow3.pid !== targetRow.pid) {
  1581. that.$nextTick(() => {
  1582. that.$set(that.table, 'list', tableList)
  1583. })
  1584. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1585. return false
  1586. }
  1587. } else {
  1588. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  1589. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  1590. that.$nextTick(() => {
  1591. that.$set(that.table, 'list', tableList)
  1592. })
  1593. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  1594. return false
  1595. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  1596. console.log('正常拖动')
  1597. } else {
  1598. that.$nextTick(() => {
  1599. that.$set(that.table, 'list', tableList)
  1600. })
  1601. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1602. return false
  1603. }
  1604. }
  1605. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1606. if (targetRow2.pid == targetRow3.pid) {
  1607. that.$nextTick(() => {
  1608. that.$set(that.table, 'list', tableList)
  1609. })
  1610. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1611. return false
  1612. }
  1613. }
  1614. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  1615. console.log('遍历有相同的pid,一起跟着拖动3')
  1616. var pidArr = [] // pid相同的值
  1617. var pidArr1 = [] //
  1618. var index // 索引
  1619. for (let i = 0; i < tableList.length; i++) {
  1620. if (tableList[i].pid == targetRow.pid) {
  1621. pidArr.push(tableList[i])
  1622. } else {
  1623. pidArr1.push(tableList[i])
  1624. }
  1625. }
  1626. if (pidArr.length > 0) {
  1627. // 找到对应上方pid 的ID
  1628. // 比如说id 580243 找到对应的索引
  1629. if (targetRow3 !== undefined) {
  1630. for (let i = 0; i < pidArr1.length; i++) {
  1631. if (pidArr1[i].id == targetRow3.id) {
  1632. index = i
  1633. }
  1634. }
  1635. } else {
  1636. for (let i = 0; i < pidArr1.length; i++) {
  1637. if (pidArr1[i].id == targetRow2.id) {
  1638. index = i - 1
  1639. }
  1640. }
  1641. }
  1642. pidArr1.splice(index + 1, 0, ...pidArr)
  1643. console.log(pidArr1)
  1644. that.$nextTick(() => {
  1645. that.table.list = pidArr1
  1646. })
  1647. }
  1648. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1649. if (targetRow2.pid == targetRow3.pid) {
  1650. that.$nextTick(() => {
  1651. that.$set(that.table, 'list', tableList)
  1652. })
  1653. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  1654. return false
  1655. }
  1656. }
  1657. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  1658. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1659. if (targetRow2.pid == targetRow3.pid) {
  1660. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  1661. that.$nextTick(() => {
  1662. that.$set(that.table, 'list', tableList)
  1663. })
  1664. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  1665. return false
  1666. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  1667. console.log('剩料之间可以互相拖动')
  1668. console.log(tableList)
  1669. } else {
  1670. that.$nextTick(() => {
  1671. that.$set(that.table, 'list', tableList)
  1672. })
  1673. // 撒料计划0,
  1674. // 撒料计划-混料1
  1675. // 撒料计划-撒料2
  1676. // 剩料计划3
  1677. // 预混计划4
  1678. // 预称重计划5
  1679. if (targetRow3.lpplantype == 0) {
  1680. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  1681. } else if (targetRow3.lpplantype == 1) {
  1682. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  1683. } else if (targetRow3.lpplantype == 2) {
  1684. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  1685. } else if (targetRow3.lpplantype == 3) {
  1686. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  1687. } else if (targetRow3.lpplantype == 4) {
  1688. that.$set(targetRow3, 'mylpplantype', '预混计划')
  1689. } else if (targetRow3.lpplantype == 5) {
  1690. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  1691. }
  1692. if (targetRow2.lpplantype == 0) {
  1693. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  1694. } else if (targetRow2.lpplantype == 1) {
  1695. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  1696. } else if (targetRow2.lpplantype == 2) {
  1697. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  1698. } else if (targetRow2.lpplantype == 3) {
  1699. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  1700. } else if (targetRow2.lpplantype == 4) {
  1701. that.$set(targetRow2, 'mylpplantype', '预混计划')
  1702. } else if (targetRow2.lpplantype == 5) {
  1703. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  1704. }
  1705. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  1706. that.$message({ type: 'error', message: message, duration: 2000 })
  1707. return false
  1708. }
  1709. }
  1710. }
  1711. // ========
  1712. // var pidArr = [] // pid相同的值
  1713. // var pidArr1 = [] //
  1714. // var index // 索引
  1715. // for (let i = 0; i < tableList.length; i++) {
  1716. // if (tableList[i].pid == targetRow.pid) {
  1717. // pidArr.push(tableList[i])
  1718. // } else {
  1719. // pidArr1.push(tableList[i])
  1720. // }
  1721. // }
  1722. // if (pidArr.length > 0) {
  1723. // // 找到对应上方pid 的ID
  1724. // // 比如说id 580243 找到对应的索引
  1725. // if (targetRow3 !== undefined) {
  1726. // for (let i = 0; i < pidArr1.length; i++) {
  1727. // if (pidArr1[i].id == targetRow3.id) {
  1728. // index = i
  1729. // }
  1730. // }
  1731. // } else {
  1732. // for (let i = 0; i < pidArr1.length; i++) {
  1733. // if (pidArr1[i].id == targetRow2.id) {
  1734. // index = i - 1
  1735. // }
  1736. // }
  1737. // }
  1738. // pidArr1.splice(index + 1, 0, ...pidArr)
  1739. // console.log(pidArr1)
  1740. // that.$nextTick(() => {
  1741. // that.table.list = pidArr1
  1742. // })
  1743. // }
  1744. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1745. // if (targetRow2.pid == targetRow3.pid) {
  1746. // that.$nextTick(() => {
  1747. // that.$set(that.table, 'list', tableList)
  1748. // })
  1749. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  1750. // return false
  1751. // }
  1752. // }
  1753. }
  1754. // ===
  1755. }
  1756. })
  1757. },
  1758. // 复制
  1759. handleCopy() {
  1760. if (this.table.list.length > 0) {
  1761. this.newGeneration.temp = {}
  1762. this.newGeneration.dialogStatus = 'copy'
  1763. this.newGeneration.dialogFormVisible = true
  1764. } else {
  1765. this.$message({ type: 'error', message: '当前无计划可复制' })
  1766. }
  1767. },
  1768. copyData() {
  1769. console.log(this.newGeneration.temp.copyInputDatetime)
  1770. this.isokDisable = true
  1771. setTimeout(() => {
  1772. this.isokDisable = false
  1773. }, 5000)
  1774. this.$refs['temp'].validate(valid => {
  1775. if (valid) {
  1776. this.requestParam.name = 'copydownloadedplan'
  1777. this.requestParam.parammaps = {}
  1778. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1779. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1780. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  1781. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  1782. PostDataByName(this.requestParam).then(response => {
  1783. if (response.msg === 'fail') {
  1784. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1785. } else {
  1786. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1787. this.newGeneration.dialogFormVisible = false
  1788. this.getList()
  1789. }
  1790. })
  1791. }
  1792. })
  1793. },
  1794. handleChangeOrder() {
  1795. // 拖动顺序
  1796. this.isOrder = false
  1797. this.rowDrop()
  1798. },
  1799. saveChangeOrder() {
  1800. // 保存顺序
  1801. var sortList = []
  1802. for (let i = 0; i < this.table.list.length; i++) {
  1803. var obj = {}
  1804. obj.sort = i
  1805. obj.pastureid = this.table.list[i].pastureid
  1806. obj.id = this.table.list[i].id
  1807. sortList.push(obj)
  1808. }
  1809. console.log(sortList)
  1810. this.requestParam = {}
  1811. this.requestParam.common = { 'returnmap': '0' }
  1812. this.requestParam.data = []
  1813. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  1814. this.requestParam.data[0].children = []
  1815. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  1816. id: '@insertSpotList.id',
  1817. pastureid: '@insertSpotList.pastureid',
  1818. sort: '@insertSpotList.sort'
  1819. }}
  1820. ExecDataByConfig(this.requestParam).then(response => {
  1821. console.log('顺序切换保存发送参数', this.requestParam)
  1822. if (response.msg === 'fail') {
  1823. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1824. } else {
  1825. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1826. this.getList()
  1827. this.isOrder = true
  1828. }
  1829. })
  1830. },
  1831. cancelChangeOrder() {
  1832. // 取消顺序
  1833. this.getList()
  1834. this.isOrder = true
  1835. },
  1836. handleDataSynchronization() {
  1837. MessageBox.confirm('是否确认同步数据?', {
  1838. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1839. }).then(() => {
  1840. this.requestParam = {}
  1841. this.requestParam.pastureid = Cookies.get('pastureid')
  1842. // this.$alert('正在同步', { confirmButtonText: '确定' })
  1843. this.dataSynchronization.dialogFormVisible = true
  1844. getDorm(this.requestParam).then(response => {
  1845. console.log(response)
  1846. if (response.msg == 'ok') {
  1847. this.dataSynchronization.dialogFormVisible = false
  1848. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  1849. } else {
  1850. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  1851. this.dataSynchronization.dialogFormVisible = false
  1852. }
  1853. })
  1854. }).catch(() => {
  1855. this.$message({ type: 'info', message: '已取消数据同步' })
  1856. })
  1857. }
  1858. }
  1859. }
  1860. </script>
  1861. <style>
  1862. .el-table .warning-row {
  1863. background: oldlace;
  1864. }
  1865. .el-table .success-row {
  1866. background: #f0f9eb;
  1867. }
  1868. </style>
  1869. <style lang="scss" scoped>
  1870. .app-container{background: #fff;}
  1871. .operation{}
  1872. .search{margin-top:10px;}
  1873. .table{margin-bottom:20px;}
  1874. .template{
  1875. background: #fff;
  1876. position: relative;
  1877. }
  1878. .table2{
  1879. // float: left;width: 50%;
  1880. background: #fff;
  1881. position: relative;
  1882. .content-table{margin-top: 20px;}
  1883. .contentOperation{right: -50px;z-index: 1;}
  1884. }
  1885. .table3{
  1886. // float: left;width: 50%;
  1887. background: #fff;
  1888. position: relative;
  1889. .content-table{margin-top: 20px;}
  1890. .contentOperation{right: -50px;z-index: 1;}
  1891. }
  1892. </style>