45c75656b0b02ceccdf83f997ce1a8517272cea1.svn-base 77 KB

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