754b83121885b1d02cde90140e568ba4e4dbd581.svn-base 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927
  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 v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
  31. <el-button v-if="isRoleEdit" class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
  32. <el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
  33. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
  34. <div v-else style="margin-left: 10px;display: inline-block;">
  35. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  36. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  37. </div>
  38. <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" 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, checkButtons } 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. isRoleEdit: [],
  565. dataDisabled: false,
  566. requestParams: [
  567. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  568. ],
  569. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  570. printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  571. frequencyList: [], // 班次
  572. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  573. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
  574. // 班次
  575. maxTime: {
  576. getMaxTimesParm: {
  577. name: 'getSysoptEnable',
  578. page: 1,
  579. offset: 1,
  580. pagecount: 1,
  581. returntype: 'Map',
  582. parammaps: {
  583. pastureid: Cookies.get('pastureid'),
  584. inforname: 'times'
  585. }
  586. }
  587. },
  588. isOrder: true,
  589. table: {
  590. getdataListParm: {
  591. name: 'getDownloadedplanList',
  592. page: 1,
  593. offset: 1,
  594. pagecount: '',
  595. returntype: 'Map',
  596. parammaps: {
  597. pastureid: Cookies.get('pastureid'),
  598. barid: '',
  599. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  600. times: '',
  601. lpplantype: '',
  602. printType: '',
  603. plandimen: '0',
  604. enable3: '0'
  605. }
  606. },
  607. tableKey: 0,
  608. list: [],
  609. total: 0,
  610. listLoading: false
  611. },
  612. // 计划内容操作详情
  613. table2: {
  614. getdataListParm: {
  615. name: 'getDownloadplandtl1ListV2',
  616. page: 1,
  617. offset: 1,
  618. returntype: 'Map',
  619. parammaps: {
  620. pastureid: Cookies.get('pastureid'),
  621. date: '',
  622. id: ''
  623. }
  624. },
  625. tableKey: 0,
  626. list: [],
  627. total: 0,
  628. listLoading: false
  629. },
  630. // 计划内容 舍栏详情
  631. table3: {
  632. getdataListParm: {
  633. name: 'getDownloadplandt2ListV2',
  634. page: 1,
  635. offset: 1,
  636. returntype: 'Map',
  637. parammaps: {
  638. pastureid: Cookies.get('pastureid'),
  639. date: '',
  640. id: ''
  641. }
  642. },
  643. tableKey: 0,
  644. list: [],
  645. total: 0,
  646. listLoading: false
  647. },
  648. // 新生成
  649. newGeneration: {
  650. dialogFormVisible: false,
  651. dialogStatus: '',
  652. getdataListParm: {
  653. name: 'checkLLPIsDistribution',
  654. page: 1,
  655. offset: 1,
  656. pagecount: 1,
  657. returntype: 'Map',
  658. parammaps: {
  659. pastureid: Cookies.get('pastureid')
  660. }
  661. },
  662. temp: {
  663. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  664. },
  665. rules: {
  666. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
  667. copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  668. }
  669. },
  670. pickerMinDate: '',
  671. pickerOptions: {
  672. onPick: ({ maxDate, minDate }) => {
  673. this.pickerMinDate = minDate.getTime()
  674. if (maxDate) {
  675. this.pickerMinDate = ''
  676. }
  677. },
  678. disabledDate: (time) => {
  679. if (this.pickerMinDate !== '') {
  680. const one = 31 * 24 * 3600 * 1000
  681. const minTime = this.pickerMinDate
  682. const maxTime = this.pickerMinDate + one
  683. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  684. }
  685. return time.getTime() < Date.now() - 8.64e7
  686. }
  687. },
  688. pickerOptions2: {
  689. onPick: ({ maxDate, minDate }) => {
  690. this.pickerMinDate = minDate.getTime()
  691. if (maxDate) {
  692. this.pickerMinDate = ''
  693. }
  694. },
  695. disabledDate: (time) => {
  696. if (this.pickerMinDate !== '') {
  697. const one = 14 * 24 * 3600 * 1000
  698. const minTime = this.pickerMinDate
  699. const maxTime = this.pickerMinDate + one
  700. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  701. }
  702. return time.getTime() < Date.now() - 8.64e7
  703. }
  704. },
  705. historyRecord: {
  706. dialogFormVisible: false,
  707. dialogStatus: '',
  708. myComponent: null
  709. },
  710. dataSynchronization: {
  711. dialogFormVisible: false,
  712. dialogStatus: '',
  713. getdataListParm: {
  714. name: 'getSysoptEnable',
  715. page: 1,
  716. offset: 1,
  717. pagecount: 1,
  718. returntype: 'Map',
  719. parammaps: {
  720. pastureid: Cookies.get('pastureid'),
  721. inforname: 'isDataSync'
  722. }
  723. },
  724. isDataSynchronization: false
  725. },
  726. textMap: {
  727. newGeneration: '新生成',
  728. historyRecord: '历史记录',
  729. revisePlan: '修改计划',
  730. copy: '复制计划'
  731. },
  732. isokDisable: false,
  733. requestParam: {},
  734. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  735. cellStyle: { padding: 0 + 'px' },
  736. isShowDialog: false,
  737. activeName: '栏舍配方',
  738. parentDate: '',
  739. downLoad: {
  740. getdataListParm: {
  741. name: '',
  742. page: 1,
  743. offset: 1,
  744. pagecount: '',
  745. returntype: 'Map',
  746. parammaps: {
  747. pastureid: Cookies.get('pastureid'),
  748. date: ''
  749. }
  750. },
  751. list: [],
  752. labelList: []
  753. }
  754. }
  755. },
  756. created() {
  757. this.parentDate = this.table.getdataListParm.parammaps.mydate
  758. console.log(this.parentDate, 'this.parentDate')
  759. this.getDataSynchronization()
  760. this.getButtons()
  761. this.getList()
  762. this.getDownList()
  763. this.getIsDisplay()
  764. },
  765. mounted() {
  766. this.table.getdataListParm.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
  767. },
  768. methods: {
  769. getButtons() {
  770. const Edit = 'DailyExecutionPlan'
  771. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  772. this.isRoleEdit = isRoleEdit
  773. },
  774. getDataSynchronization() {
  775. GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
  776. console.log(response.data.list[0])
  777. if (response.data.list[0].inforvalue == 0) {
  778. this.dataSynchronization.isDataSynchronization = false
  779. } else {
  780. this.dataSynchronization.isDataSynchronization = true
  781. }
  782. })
  783. },
  784. getIsDisplay() {
  785. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  786. console.log(response.data.list[0].inforvalue)
  787. if (response.data.list[0].inforvalue == 1) {
  788. this.frequencyList = [{ id: '1', name: '第一班' }]
  789. } else if (response.data.list[0].inforvalue == 2) {
  790. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  791. } else if (response.data.list[0].inforvalue == 3) {
  792. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  793. } else if (response.data.list[0].inforvalue == 4) {
  794. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  795. }
  796. })
  797. },
  798. getDownList() {
  799. GetDataByNames(this.requestParams).then(response => {
  800. // this.livestockTypeList = response.data.getDictByName.list
  801. })
  802. },
  803. // -------------------日执行计划-----------------------------
  804. handleBefore() {
  805. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  806. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  807. var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
  808. // var start = this.table.getdataListParm.parammaps.mydate - 1
  809. this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
  810. // this.$forceUpdate()
  811. this.parentDate = this.table.getdataListParm.parammaps.mydate
  812. this.getList()
  813. }
  814. var d = this.table.getdataListParm.parammaps.mydate
  815. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  816. if (d < curDate) {
  817. this.dataDisabled = true
  818. } else {
  819. this.dataDisabled = false
  820. }
  821. console.log(this.dataDisabled)
  822. },
  823. handleNext() {
  824. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  825. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  826. var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
  827. this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
  828. this.parentDate = this.table.getdataListParm.parammaps.mydate
  829. this.getList()
  830. }
  831. var d = this.table.getdataListParm.parammaps.mydate
  832. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  833. if (d < curDate) {
  834. this.dataDisabled = true
  835. } else {
  836. this.dataDisabled = false
  837. }
  838. console.log(this.dataDisabled)
  839. },
  840. getList() {
  841. this.table.listLoading = true
  842. GetDataByName(this.table.getdataListParm).then(response => {
  843. console.log('table数据', response.data.list)
  844. if (response.data.list !== null) {
  845. // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
  846. // response.data.list[6] = obj
  847. this.getIsColor(response.data.list)
  848. this.table.list = response.data.list
  849. this.table.pageNum = response.data.pageNum
  850. this.table.pageSize = response.data.pageSize
  851. this.table.total = response.data.total
  852. console.log('计划类型', response.data.list[0].lpplantype)
  853. if (response.data.list[0].lpplantype == 0) {
  854. // 撒料
  855. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  856. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  857. this.table2.getdataListParm.parammaps.useinbartype = ''
  858. this.table3.getdataListParm.parammaps.useinbartype = ''
  859. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  860. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  861. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  862. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  863. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  864. this.getList2()
  865. this.getList3()
  866. } else if (response.data.list[0].lpplantype == 1) {
  867. // 撒料计划-混料
  868. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  869. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  870. this.table2.getdataListParm.parammaps.useinbartype = ''
  871. this.table3.getdataListParm.parammaps.useinbartype = ''
  872. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  873. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  874. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  875. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  876. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  877. this.getList2()
  878. this.getList3()
  879. } else if (response.data.list[0].lpplantype == 2) {
  880. // 撒料计划-撒料
  881. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  882. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  883. this.table2.getdataListParm.parammaps.useinbartype = ''
  884. this.table3.getdataListParm.parammaps.useinbartype = ''
  885. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  886. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  887. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  888. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  889. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  890. this.getList2()
  891. this.getList3()
  892. } else if (response.data.list[0].lpplantype == 3) {
  893. // 剩料
  894. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  895. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  896. this.table2.getdataListParm.parammaps.useinbartype = 0
  897. this.table3.getdataListParm.parammaps.useinbartype = 1
  898. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  899. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  900. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  901. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  902. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  903. this.getList2()
  904. this.getList3()
  905. } else if (response.data.list[0].lpplantype == 4) {
  906. // 预混
  907. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  908. this.table2.getdataListParm.parammaps.useinbartype = ''
  909. this.table3.getdataListParm.parammaps.useinbartype = ''
  910. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  911. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  912. this.getList2()
  913. } else if (response.data.list[0].lpplantype == 5) {
  914. // 预称重计划
  915. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  916. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  917. this.table2.getdataListParm.parammaps.useinbartype = ''
  918. this.table3.getdataListParm.parammaps.useinbartype = ''
  919. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  920. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  921. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  922. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  923. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  924. this.getList2()
  925. this.getList3()
  926. }
  927. } else {
  928. this.table.list = []
  929. this.table3.getdataListParm.parammaps.lpplantype = ''
  930. this.table2.getdataListParm.parammaps.id = ''
  931. this.table3.getdataListParm.parammaps.id = ''
  932. // this.getList2()
  933. // this.getList3()
  934. this.table2.list = []
  935. this.table3.list = []
  936. }
  937. setTimeout(() => {
  938. this.table.listLoading = false
  939. }, 100)
  940. })
  941. },
  942. handleEnableChange(row) {
  943. this.requestParam.name = 'updatedownloadenable'
  944. this.requestParam.parammaps = {}
  945. this.requestParam.parammaps.pastureid = row.pastureid
  946. this.requestParam.parammaps.id = row.id
  947. this.requestParam.parammaps.enable = row.enable
  948. PostDataByName(this.requestParam).then(response => {
  949. if (response.msg === 'fail') {
  950. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  951. } else {
  952. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  953. this.getList()
  954. }
  955. })
  956. },
  957. getIsColor(arr) {
  958. var map = {}
  959. var dest = []
  960. for (var i = 0; i < arr.length; i++) {
  961. var ai = arr[i]
  962. if (!map[ai.pid]) {
  963. dest.push({
  964. pid: ai.pid,
  965. data: [ai]
  966. })
  967. map[ai.pid] = ai
  968. } else {
  969. for (var j = 0; j < dest.length; j++) {
  970. var dj = dest[j]
  971. if (dj.pid == ai.pid) {
  972. dj.data.push(ai)
  973. break
  974. }
  975. }
  976. }
  977. }
  978. console.log(dest)
  979. var newArr1 = []
  980. for (var i = 0; i < dest.length; i++) {
  981. var newArr = dest[i].data
  982. for (var j = 0; j < dest[i].data.length; j++) {
  983. dest[i].data[j].isColor = i
  984. newArr1.push(dest[i].data[j])
  985. }
  986. }
  987. console.log(newArr1)
  988. this.table.list = newArr1
  989. },
  990. tableRowClassName({ row }) {
  991. if (row.isColor % 2 == 0) {
  992. return 'warning-row'
  993. } else {
  994. return 'success-row'
  995. }
  996. },
  997. lpplantype: function(cellValue) {
  998. if (cellValue.lpplantype == 0) {
  999. return '撒料计划'
  1000. } else if (cellValue.lpplantype == 1) {
  1001. return '撒料计划-混料'
  1002. } else if (cellValue.lpplantype == 2) {
  1003. return '撒料计划-撒料'
  1004. } else if (cellValue.lpplantype == 3) {
  1005. return '剩料计划'
  1006. } else if (cellValue.lpplantype == 4) {
  1007. return '预混计划'
  1008. } else if (cellValue.lpplantype == 5) {
  1009. return '预称重计划'
  1010. }
  1011. },
  1012. changeDate(val) {
  1013. console.log('选择了日期', val)
  1014. this.getList()
  1015. // this.getList2()
  1016. // this.getList3()
  1017. var d = this.table.getdataListParm.parammaps.mydate
  1018. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1019. if (d < curDate) {
  1020. this.dataDisabled = true
  1021. } else {
  1022. this.dataDisabled = false
  1023. }
  1024. console.log(this.dataDisabled)
  1025. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1026. console.log(this.parentDate, 'this.parentDate')
  1027. },
  1028. changePlanType(val) {
  1029. console.log('选择了计划类型', val)
  1030. this.getList()
  1031. this.getList2()
  1032. this.getList3()
  1033. },
  1034. changeFrequency(val) {
  1035. console.log('选择了班次', val)
  1036. this.getList()
  1037. this.getList2()
  1038. this.getList3()
  1039. },
  1040. // 日执行计划行点击
  1041. tableRowClick(row, column, event) {
  1042. console.log(row, column, event)
  1043. console.log('点击计划类型', row.lpplantype)
  1044. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
  1045. if (row.lpplantype == 0) {
  1046. // 撒料
  1047. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1048. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1049. this.table2.getdataListParm.parammaps.useinbartype = ''
  1050. this.table3.getdataListParm.parammaps.useinbartype = ''
  1051. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1052. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1053. this.table2.getdataListParm.parammaps.id = row.id
  1054. this.table3.getdataListParm.parammaps.id = row.id
  1055. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1056. this.getList2()
  1057. this.getList3()
  1058. } else if (row.lpplantype == 1) {
  1059. // 撒料计划-混料
  1060. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1061. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1062. this.table2.getdataListParm.parammaps.useinbartype = ''
  1063. this.table3.getdataListParm.parammaps.useinbartype = ''
  1064. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1065. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1066. this.table2.getdataListParm.parammaps.id = row.id
  1067. this.table3.getdataListParm.parammaps.id = row.id
  1068. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1069. this.getList2()
  1070. this.getList3()
  1071. } else if (row.lpplantype == 2) {
  1072. // 撒料计划-撒料
  1073. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1074. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1075. this.table2.getdataListParm.parammaps.useinbartype = ''
  1076. this.table3.getdataListParm.parammaps.useinbartype = ''
  1077. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1078. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1079. this.table2.getdataListParm.parammaps.id = row.id
  1080. this.table3.getdataListParm.parammaps.id = row.id
  1081. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1082. this.getList2()
  1083. this.getList3()
  1084. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1085. } else if (row.lpplantype == 3) {
  1086. // 剩料
  1087. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1088. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1089. this.table2.getdataListParm.parammaps.useinbartype = 0
  1090. this.table3.getdataListParm.parammaps.useinbartype = 1
  1091. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1092. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1093. this.table2.getdataListParm.parammaps.id = row.id
  1094. this.table3.getdataListParm.parammaps.id = row.id
  1095. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1096. this.getList2()
  1097. this.getList3()
  1098. } else if (row.lpplantype == 4) {
  1099. // 预混
  1100. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1101. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1102. this.table2.getdataListParm.parammaps.useinbartype = ''
  1103. this.table3.getdataListParm.parammaps.useinbartype = ''
  1104. this.table2.getdataListParm.parammaps.id = row.id
  1105. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1106. this.getList2()
  1107. } else if (row.lpplantype == 5) {
  1108. // 预称重计划
  1109. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1110. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1111. this.table2.getdataListParm.parammaps.useinbartype = ''
  1112. this.table3.getdataListParm.parammaps.useinbartype = ''
  1113. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1114. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1115. this.table2.getdataListParm.parammaps.id = row.id
  1116. this.table3.getdataListParm.parammaps.id = row.id
  1117. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1118. this.getList2()
  1119. this.getList3()
  1120. }
  1121. this.$forceUpdate()
  1122. },
  1123. // 计划内容操作详情
  1124. getList2() {
  1125. this.table2.listLoading = true
  1126. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1127. GetDataByName(this.table2.getdataListParm).then(response => {
  1128. console.log('table数据', response.data.list)
  1129. if (response.data.list !== null) {
  1130. this.table2.list = response.data.list
  1131. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1132. if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
  1133. const arr = []
  1134. var a = 0
  1135. let b = this.table2.list[0].sort
  1136. let c = 0
  1137. for (let i = 0; i < this.table2.list.length; i++) {
  1138. if (b !== parseInt(this.table2.list[i].sort)) {
  1139. b = this.table2.list[i].sort
  1140. arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
  1141. a = 0
  1142. }
  1143. a = a + parseFloat(this.table2.list[i].weight)
  1144. c = c + parseFloat(this.table2.list[i].weight)
  1145. arr.push(this.table2.list[i])
  1146. }
  1147. arr.push({ 'sort': '小计', 'weight': a })
  1148. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  1149. this.table2.list = arr
  1150. }
  1151. if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
  1152. const arr = []
  1153. var aa = 0
  1154. let bb = this.table2.list[0].sort
  1155. let cc = 0
  1156. for (let i = 0; i < this.table2.list.length; i++) {
  1157. if (bb !== parseInt(this.table2.list[i].sort)) {
  1158. bb = this.table2.list[i].sort
  1159. aa = 0
  1160. }
  1161. aa = aa + parseFloat(this.table2.list[i].weight)
  1162. cc = cc + parseFloat(this.table2.list[i].weight)
  1163. arr.push(this.table2.list[i])
  1164. }
  1165. arr.push({ 'sort': '总计', 'weight': cc.toFixed(2) })
  1166. this.table2.list = arr
  1167. console.log('this.table2.list', this.table2.list)
  1168. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1169. }
  1170. console.log(this.table2.list)
  1171. this.table2.pageNum = response.data.pageNum
  1172. this.table2.pageSize = response.data.pageSize
  1173. this.table2.total = response.data.total
  1174. } else {
  1175. this.table2.list = []
  1176. }
  1177. setTimeout(() => {
  1178. this.table2.listLoading = false
  1179. }, 100)
  1180. })
  1181. },
  1182. // 计划内容栏舍详情
  1183. getList3() {
  1184. this.table3.listLoading = true
  1185. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1186. GetDataByName(this.table3.getdataListParm).then(response => {
  1187. console.log('table数据', response.data.list)
  1188. if (response.data.list !== null) {
  1189. this.table3.list = response.data.list
  1190. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1191. const arr = []
  1192. var a = 0
  1193. let b = this.table3.list[0].sort
  1194. let c = 0
  1195. for (let i = 0; i < this.table3.list.length; i++) {
  1196. if (b !== parseInt(this.table3.list[i].sort)) {
  1197. b = this.table3.list[i].sort
  1198. a = 0
  1199. }
  1200. a = a + parseFloat(this.table3.list[i].weight)
  1201. c = c + parseFloat(this.table3.list[i].weight)
  1202. arr.push(this.table3.list[i])
  1203. }
  1204. arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
  1205. this.table3.list = arr
  1206. }
  1207. this.table3.pageNum = response.data.pageNum
  1208. this.table3.pageSize = response.data.pageSize
  1209. this.table3.total = response.data.total
  1210. } else {
  1211. this.table3.list = []
  1212. }
  1213. setTimeout(() => {
  1214. this.table3.listLoading = false
  1215. }, 100)
  1216. })
  1217. },
  1218. // 新生成
  1219. handleCreate() {
  1220. console.log('点击了新生成')
  1221. this.newGeneration.temp.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  1222. this.newGeneration.dialogStatus = 'newGeneration'
  1223. this.newGeneration.dialogFormVisible = true
  1224. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  1225. console.log('table数据', response.data.list)
  1226. if (response.data.list !== null) {
  1227. if (response.data.list[0].vmsg == '存在未分配') {
  1228. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  1229. }
  1230. }
  1231. })
  1232. },
  1233. DateDiff(sDate1, sDate2) {
  1234. console.log(sDate1, sDate2)
  1235. var aDate, oDate1, oDate2, iDays
  1236. aDate = sDate1.split('-')
  1237. oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
  1238. aDate = sDate2.split('-')
  1239. oDate2 = new Date(aDate[0], aDate[1], aDate[2])
  1240. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
  1241. this.newGeneration.temp.days = parseInt(iDays) + 1
  1242. return iDays
  1243. },
  1244. newGenerationData() {
  1245. console.log('点击了新生成保存', this.newGeneration.temp)
  1246. this.isokDisable = true
  1247. this.$refs['temp'].validate(valid => {
  1248. if (valid) {
  1249. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  1250. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  1251. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  1252. this.requestParam = {}
  1253. this.requestParam.common = { 'returnmap': '0' }
  1254. this.requestParam.data = []
  1255. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  1256. pastureid: Cookies.get('pastureid'),
  1257. startTime: this.newGeneration.temp.startTime
  1258. }}
  1259. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  1260. pastureid: Cookies.get('pastureid'),
  1261. days: this.newGeneration.temp.days
  1262. }}
  1263. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  1264. pastureid: Cookies.get('pastureid'),
  1265. startTime: this.newGeneration.temp.startTime,
  1266. stopTime: this.newGeneration.temp.stopTime
  1267. }}
  1268. ExecDataByConfig(this.requestParam).then(response => {
  1269. console.log('新生成保存发送参数', this.requestParam)
  1270. if (response.msg === 'fail') {
  1271. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1272. this.isokDisable = false
  1273. } else {
  1274. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1275. this.newGeneration.dialogFormVisible = false
  1276. this.getList()
  1277. this.isokDisable = false
  1278. }
  1279. })
  1280. }
  1281. })
  1282. },
  1283. // 修改计划
  1284. handleRevisePlan(data) {
  1285. var arr = []
  1286. for (let i = 0; i < this.table.list.length; i++) {
  1287. if (this.table.list[i].havebutton == 1) {
  1288. arr.push(this.table.list[i])
  1289. }
  1290. }
  1291. if (arr.length !== this.table.list.length) {
  1292. console.log('点击了修改计划1', this.activeName)
  1293. this.isShowDialog = true
  1294. this.activeName = '栏舍配方'
  1295. console.log('点击了修改计划2', this.activeName)
  1296. } else {
  1297. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  1298. }
  1299. },
  1300. handleExport() {
  1301. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1302. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  1303. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  1304. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  1305. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  1306. var exportTitle = ''
  1307. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  1308. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1309. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  1310. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1311. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1312. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  1313. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1314. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1315. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  1316. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1317. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1318. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  1319. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1320. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1321. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  1322. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1323. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1324. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  1325. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1326. } else {
  1327. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  1328. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1329. }
  1330. } else {
  1331. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1332. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  1333. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1334. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1335. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  1336. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1337. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1338. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  1339. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1340. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1341. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  1342. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1343. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1344. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  1345. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1346. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1347. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  1348. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1349. } else {
  1350. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  1351. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1352. }
  1353. }
  1354. GetReportform(this.downLoad.getdataListParm).then(response => {
  1355. if (response.data.list !== null) {
  1356. this.downLoad.labelList = []
  1357. var filterValArr = []
  1358. for (let i = 0; i < response.data.list.data1.length; i++) {
  1359. this.downLoad.labelList.push(response.data.list.data1[i].label)
  1360. filterValArr.push(response.data.list.data1[i].prop)
  1361. }
  1362. this.downLoad.list = response.data.list.data2
  1363. } else {
  1364. this.downLoad.list = []
  1365. }
  1366. var multiHeaderArr = []
  1367. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  1368. if (i == 0) {
  1369. multiHeaderArr.push(exportTitle)
  1370. } else {
  1371. multiHeaderArr.push('')
  1372. }
  1373. }
  1374. import('@/vendor/Export5Excel').then(excel => {
  1375. const multiHeader = [
  1376. multiHeaderArr
  1377. ]
  1378. const multiHeader2 = [
  1379. this.downLoad.labelList
  1380. ]
  1381. const filterVal = filterValArr
  1382. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  1383. const merges = []
  1384. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  1385. })
  1386. })
  1387. },
  1388. rowDrop() {
  1389. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  1390. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  1391. // this.sorTable()
  1392. const that = this
  1393. var sortable = Sortable.create(tbody, {
  1394. disabled: that.dropState,
  1395. onChoose({ newIndex, oldIndex }) {
  1396. console.log(that.isOrder, 'that.isOrder == false')
  1397. console.log(that.dropState, 'that.dropState')
  1398. if (that.dropState == true || that.isOrder == true) {
  1399. sortable.destroy()
  1400. }
  1401. },
  1402. onEnd(evt) {
  1403. var tableList = [...that.table.list] // 保留拖动前数据
  1404. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  1405. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  1406. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  1407. console.log(targetRow, 'targetRow')
  1408. console.log(targetRow2, 'targetRow2')
  1409. console.log(targetRow3, 'targetRow3')
  1410. that.table.list.splice(evt.newIndex, 0, targetRow)
  1411. // ==========
  1412. // 已执行的计划不可拖动
  1413. if (targetRow.havebutton == 1) {
  1414. that.$nextTick(() => {
  1415. that.$set(that.table, 'list', tableList)
  1416. })
  1417. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  1418. return false
  1419. }
  1420. // 相同班次之间可以拖动
  1421. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1422. if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  1423. that.$nextTick(() => {
  1424. that.$set(that.table, 'list', tableList)
  1425. })
  1426. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1427. return false
  1428. }
  1429. } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  1430. if (targetRow.times !== targetRow2.times) {
  1431. that.$nextTick(() => {
  1432. that.$set(that.table, 'list', tableList)
  1433. })
  1434. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1435. return false
  1436. }
  1437. } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  1438. if (targetRow.times !== targetRow3.times) {
  1439. that.$nextTick(() => {
  1440. that.$set(that.table, 'list', tableList)
  1441. })
  1442. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1443. return false
  1444. }
  1445. }
  1446. // 撒料计划0,
  1447. // 撒料计划-混料1
  1448. // 撒料计划-撒料2
  1449. // 剩料计划3
  1450. // 预混计划4
  1451. // 预称重计划5
  1452. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  1453. if (targetRow2 == undefined) {
  1454. that.$nextTick(() => {
  1455. that.$set(that.table, 'list', tableList)
  1456. })
  1457. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  1458. that.$nextTick(() => {
  1459. that.$set(that.table, 'list', tableList)
  1460. })
  1461. } else {
  1462. var pidArr = [] // pid相同的值
  1463. var pidArr1 = [] //
  1464. var index // 索引
  1465. for (let i = 0; i < tableList.length; i++) {
  1466. if (tableList[i].pid == targetRow.pid) {
  1467. pidArr.push(tableList[i])
  1468. } else {
  1469. pidArr1.push(tableList[i])
  1470. }
  1471. }
  1472. // 找到对应上方pid 的ID
  1473. // 比如说id 580243 找到对应的索引
  1474. if (targetRow3 !== undefined) {
  1475. for (let i = 0; i < pidArr1.length; i++) {
  1476. if (pidArr1[i].id == targetRow3.id) {
  1477. index = i
  1478. }
  1479. }
  1480. } else {
  1481. for (let i = 0; i < pidArr1.length; i++) {
  1482. if (pidArr1[i].id == targetRow2.id) {
  1483. index = i - 1
  1484. }
  1485. }
  1486. }
  1487. pidArr1.splice(index + 1, 0, ...pidArr)
  1488. console.log(pidArr1)
  1489. that.$nextTick(() => {
  1490. that.table.list = pidArr1
  1491. })
  1492. }
  1493. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1494. if (targetRow2.pid == targetRow3.pid) {
  1495. that.$nextTick(() => {
  1496. that.$set(that.table, 'list', tableList)
  1497. })
  1498. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1499. return false
  1500. }
  1501. }
  1502. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  1503. if (targetRow2 !== undefined) {
  1504. console.log(targetRow3, targetRow2, 'zhidao')
  1505. if (targetRow3 !== undefined) {
  1506. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  1507. that.$nextTick(() => {
  1508. that.$set(that.table, 'list', tableList)
  1509. })
  1510. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1511. return false
  1512. } else {
  1513. console.log('wojinlaile', targetRow2, targetRow)
  1514. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  1515. that.$nextTick(() => {
  1516. that.$set(that.table, 'list', tableList)
  1517. })
  1518. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1519. return false
  1520. }
  1521. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  1522. that.$nextTick(() => {
  1523. that.$set(that.table, 'list', tableList)
  1524. })
  1525. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1526. return false
  1527. }
  1528. }
  1529. } else {
  1530. if (targetRow2.pid !== targetRow.pid) {
  1531. that.$nextTick(() => {
  1532. that.$set(that.table, 'list', tableList)
  1533. })
  1534. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1535. return false
  1536. } else {
  1537. if (targetRow2.pid !== targetRow.pid) {
  1538. that.$nextTick(() => {
  1539. that.$set(that.table, 'list', tableList)
  1540. })
  1541. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1542. return false
  1543. }
  1544. }
  1545. }
  1546. } else {
  1547. if (targetRow2 == undefined) {
  1548. that.$nextTick(() => {
  1549. that.$set(that.table, 'list', tableList)
  1550. })
  1551. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1552. return false
  1553. } else if (targetRow3.pid !== targetRow.pid) {
  1554. that.$nextTick(() => {
  1555. that.$set(that.table, 'list', tableList)
  1556. })
  1557. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1558. return false
  1559. } else {
  1560. if (targetRow3.lpplantype == 0) {
  1561. that.$nextTick(() => {
  1562. that.$set(that.table, 'list', tableList)
  1563. })
  1564. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1565. return false
  1566. }
  1567. }
  1568. }
  1569. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1570. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  1571. that.$nextTick(() => {
  1572. that.$set(that.table, 'list', tableList)
  1573. })
  1574. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1575. return false
  1576. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  1577. that.$nextTick(() => {
  1578. that.$set(that.table, 'list', tableList)
  1579. })
  1580. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1581. return false
  1582. }
  1583. }
  1584. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  1585. if (targetRow2 == undefined) {
  1586. if (targetRow3.pid !== targetRow.pid) {
  1587. that.$nextTick(() => {
  1588. that.$set(that.table, 'list', tableList)
  1589. })
  1590. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1591. return false
  1592. }
  1593. } else {
  1594. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  1595. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  1596. that.$nextTick(() => {
  1597. that.$set(that.table, 'list', tableList)
  1598. })
  1599. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  1600. return false
  1601. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  1602. console.log('正常拖动')
  1603. } else {
  1604. that.$nextTick(() => {
  1605. that.$set(that.table, 'list', tableList)
  1606. })
  1607. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1608. return false
  1609. }
  1610. }
  1611. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1612. if (targetRow2.pid == targetRow3.pid) {
  1613. that.$nextTick(() => {
  1614. that.$set(that.table, 'list', tableList)
  1615. })
  1616. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1617. return false
  1618. }
  1619. }
  1620. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  1621. console.log('遍历有相同的pid,一起跟着拖动3')
  1622. var pidArr = [] // pid相同的值
  1623. var pidArr1 = [] //
  1624. var index // 索引
  1625. for (let i = 0; i < tableList.length; i++) {
  1626. if (tableList[i].pid == targetRow.pid) {
  1627. pidArr.push(tableList[i])
  1628. } else {
  1629. pidArr1.push(tableList[i])
  1630. }
  1631. }
  1632. if (pidArr.length > 0) {
  1633. // 找到对应上方pid 的ID
  1634. // 比如说id 580243 找到对应的索引
  1635. if (targetRow3 !== undefined) {
  1636. for (let i = 0; i < pidArr1.length; i++) {
  1637. if (pidArr1[i].id == targetRow3.id) {
  1638. index = i
  1639. }
  1640. }
  1641. } else {
  1642. for (let i = 0; i < pidArr1.length; i++) {
  1643. if (pidArr1[i].id == targetRow2.id) {
  1644. index = i - 1
  1645. }
  1646. }
  1647. }
  1648. pidArr1.splice(index + 1, 0, ...pidArr)
  1649. console.log(pidArr1)
  1650. that.$nextTick(() => {
  1651. that.table.list = pidArr1
  1652. })
  1653. }
  1654. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1655. if (targetRow2.pid == targetRow3.pid) {
  1656. that.$nextTick(() => {
  1657. that.$set(that.table, 'list', tableList)
  1658. })
  1659. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  1660. return false
  1661. }
  1662. }
  1663. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  1664. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1665. if (targetRow2.pid == targetRow3.pid) {
  1666. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  1667. that.$nextTick(() => {
  1668. that.$set(that.table, 'list', tableList)
  1669. })
  1670. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  1671. return false
  1672. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  1673. console.log('剩料之间可以互相拖动')
  1674. console.log(tableList)
  1675. } else {
  1676. that.$nextTick(() => {
  1677. that.$set(that.table, 'list', tableList)
  1678. })
  1679. // 撒料计划0,
  1680. // 撒料计划-混料1
  1681. // 撒料计划-撒料2
  1682. // 剩料计划3
  1683. // 预混计划4
  1684. // 预称重计划5
  1685. if (targetRow3.lpplantype == 0) {
  1686. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  1687. } else if (targetRow3.lpplantype == 1) {
  1688. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  1689. } else if (targetRow3.lpplantype == 2) {
  1690. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  1691. } else if (targetRow3.lpplantype == 3) {
  1692. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  1693. } else if (targetRow3.lpplantype == 4) {
  1694. that.$set(targetRow3, 'mylpplantype', '预混计划')
  1695. } else if (targetRow3.lpplantype == 5) {
  1696. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  1697. }
  1698. if (targetRow2.lpplantype == 0) {
  1699. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  1700. } else if (targetRow2.lpplantype == 1) {
  1701. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  1702. } else if (targetRow2.lpplantype == 2) {
  1703. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  1704. } else if (targetRow2.lpplantype == 3) {
  1705. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  1706. } else if (targetRow2.lpplantype == 4) {
  1707. that.$set(targetRow2, 'mylpplantype', '预混计划')
  1708. } else if (targetRow2.lpplantype == 5) {
  1709. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  1710. }
  1711. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  1712. that.$message({ type: 'error', message: message, duration: 2000 })
  1713. return false
  1714. }
  1715. }
  1716. }
  1717. // ========
  1718. // var pidArr = [] // pid相同的值
  1719. // var pidArr1 = [] //
  1720. // var index // 索引
  1721. // for (let i = 0; i < tableList.length; i++) {
  1722. // if (tableList[i].pid == targetRow.pid) {
  1723. // pidArr.push(tableList[i])
  1724. // } else {
  1725. // pidArr1.push(tableList[i])
  1726. // }
  1727. // }
  1728. // if (pidArr.length > 0) {
  1729. // // 找到对应上方pid 的ID
  1730. // // 比如说id 580243 找到对应的索引
  1731. // if (targetRow3 !== undefined) {
  1732. // for (let i = 0; i < pidArr1.length; i++) {
  1733. // if (pidArr1[i].id == targetRow3.id) {
  1734. // index = i
  1735. // }
  1736. // }
  1737. // } else {
  1738. // for (let i = 0; i < pidArr1.length; i++) {
  1739. // if (pidArr1[i].id == targetRow2.id) {
  1740. // index = i - 1
  1741. // }
  1742. // }
  1743. // }
  1744. // pidArr1.splice(index + 1, 0, ...pidArr)
  1745. // console.log(pidArr1)
  1746. // that.$nextTick(() => {
  1747. // that.table.list = pidArr1
  1748. // })
  1749. // }
  1750. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1751. // if (targetRow2.pid == targetRow3.pid) {
  1752. // that.$nextTick(() => {
  1753. // that.$set(that.table, 'list', tableList)
  1754. // })
  1755. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  1756. // return false
  1757. // }
  1758. // }
  1759. }
  1760. // ===
  1761. }
  1762. })
  1763. },
  1764. // 复制
  1765. handleCopy() {
  1766. if (this.table.list.length > 0) {
  1767. this.newGeneration.temp = {}
  1768. this.newGeneration.dialogStatus = 'copy'
  1769. this.newGeneration.dialogFormVisible = true
  1770. } else {
  1771. this.$message({ type: 'error', message: '当前无计划可复制' })
  1772. }
  1773. },
  1774. copyData() {
  1775. console.log(this.newGeneration.temp.copyInputDatetime)
  1776. this.isokDisable = true
  1777. setTimeout(() => {
  1778. this.isokDisable = false
  1779. }, 5000)
  1780. this.$refs['temp'].validate(valid => {
  1781. if (valid) {
  1782. this.requestParam.name = 'copydownloadedplan'
  1783. this.requestParam.parammaps = {}
  1784. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1785. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1786. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  1787. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  1788. PostDataByName(this.requestParam).then(response => {
  1789. if (response.msg === 'fail') {
  1790. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1791. } else {
  1792. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1793. this.newGeneration.dialogFormVisible = false
  1794. this.getList()
  1795. }
  1796. })
  1797. }
  1798. })
  1799. },
  1800. handleChangeOrder() {
  1801. // 拖动顺序
  1802. this.isOrder = false
  1803. this.rowDrop()
  1804. },
  1805. saveChangeOrder() {
  1806. // 保存顺序
  1807. var sortList = []
  1808. for (let i = 0; i < this.table.list.length; i++) {
  1809. var obj = {}
  1810. obj.sort = i
  1811. obj.pastureid = this.table.list[i].pastureid
  1812. obj.id = this.table.list[i].id
  1813. sortList.push(obj)
  1814. }
  1815. console.log(sortList)
  1816. this.requestParam = {}
  1817. this.requestParam.common = { 'returnmap': '0' }
  1818. this.requestParam.data = []
  1819. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  1820. this.requestParam.data[0].children = []
  1821. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  1822. id: '@insertSpotList.id',
  1823. pastureid: '@insertSpotList.pastureid',
  1824. sort: '@insertSpotList.sort'
  1825. }}
  1826. ExecDataByConfig(this.requestParam).then(response => {
  1827. console.log('顺序切换保存发送参数', this.requestParam)
  1828. if (response.msg === 'fail') {
  1829. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1830. } else {
  1831. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1832. this.getList()
  1833. this.isOrder = true
  1834. }
  1835. })
  1836. },
  1837. cancelChangeOrder() {
  1838. // 取消顺序
  1839. this.getList()
  1840. this.isOrder = true
  1841. },
  1842. handleDataSynchronization() {
  1843. MessageBox.confirm('是否确认同步数据?', {
  1844. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1845. }).then(() => {
  1846. this.requestParam = {}
  1847. this.requestParam.pastureid = Cookies.get('pastureid')
  1848. // this.$alert('正在同步', { confirmButtonText: '确定' })
  1849. this.dataSynchronization.dialogFormVisible = true
  1850. getDorm(this.requestParam).then(response => {
  1851. console.log(response)
  1852. if (response.msg == 'ok') {
  1853. this.dataSynchronization.dialogFormVisible = false
  1854. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  1855. } else {
  1856. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  1857. this.dataSynchronization.dialogFormVisible = false
  1858. }
  1859. })
  1860. }).catch(() => {
  1861. this.$message({ type: 'info', message: '已取消数据同步' })
  1862. })
  1863. }
  1864. }
  1865. }
  1866. </script>
  1867. <style>
  1868. .el-table .warning-row {
  1869. background: oldlace;
  1870. }
  1871. .el-table .success-row {
  1872. background: #f0f9eb;
  1873. }
  1874. </style>
  1875. <style lang="scss" scoped>
  1876. .app-container{background: #fff;}
  1877. .operation{}
  1878. .search{margin-top:10px;}
  1879. .table{margin-bottom:20px;}
  1880. .template{
  1881. background: #fff;
  1882. position: relative;
  1883. }
  1884. .table2{
  1885. // float: left;width: 50%;
  1886. background: #fff;
  1887. position: relative;
  1888. .content-table{margin-top: 20px;}
  1889. .contentOperation{right: -50px;z-index: 1;}
  1890. }
  1891. .table3{
  1892. // float: left;width: 50%;
  1893. background: #fff;
  1894. position: relative;
  1895. .content-table{margin-top: 20px;}
  1896. .contentOperation{right: -50px;z-index: 1;}
  1897. }
  1898. </style>