07b0c53f0049a4e245c5f600b67eb97210059ccd.svn-base 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928
  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. setTimeout(() => {
  1248. this.isokDisable = false
  1249. }, 5000)
  1250. this.$refs['temp'].validate(valid => {
  1251. if (valid) {
  1252. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  1253. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  1254. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  1255. this.requestParam = {}
  1256. this.requestParam.common = { 'returnmap': '0' }
  1257. this.requestParam.data = []
  1258. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  1259. pastureid: Cookies.get('pastureid'),
  1260. startTime: this.newGeneration.temp.startTime
  1261. }}
  1262. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  1263. pastureid: Cookies.get('pastureid'),
  1264. days: this.newGeneration.temp.days
  1265. }}
  1266. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  1267. pastureid: Cookies.get('pastureid'),
  1268. startTime: this.newGeneration.temp.startTime,
  1269. stopTime: this.newGeneration.temp.stopTime
  1270. }}
  1271. ExecDataByConfig(this.requestParam).then(response => {
  1272. console.log('新生成保存发送参数', this.requestParam)
  1273. if (response.msg === 'fail') {
  1274. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1275. } else {
  1276. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1277. this.newGeneration.dialogFormVisible = false
  1278. this.getList()
  1279. }
  1280. })
  1281. }
  1282. })
  1283. },
  1284. // 修改计划
  1285. handleRevisePlan(data) {
  1286. var arr = []
  1287. for (let i = 0; i < this.table.list.length; i++) {
  1288. if (this.table.list[i].havebutton == 1) {
  1289. arr.push(this.table.list[i])
  1290. }
  1291. }
  1292. if (arr.length !== this.table.list.length) {
  1293. console.log('点击了修改计划1', this.activeName)
  1294. this.isShowDialog = true
  1295. this.activeName = '栏舍配方'
  1296. console.log('点击了修改计划2', this.activeName)
  1297. } else {
  1298. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  1299. }
  1300. },
  1301. handleExport() {
  1302. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1303. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  1304. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  1305. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  1306. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  1307. var exportTitle = ''
  1308. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  1309. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1310. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  1311. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1312. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1313. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  1314. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1315. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1316. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  1317. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1318. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1319. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  1320. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1321. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1322. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  1323. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1324. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1325. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  1326. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1327. } else {
  1328. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  1329. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1330. }
  1331. } else {
  1332. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1333. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  1334. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1335. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1336. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  1337. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1338. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1339. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  1340. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1341. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1342. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  1343. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1344. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1345. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  1346. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1347. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1348. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  1349. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1350. } else {
  1351. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  1352. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1353. }
  1354. }
  1355. GetReportform(this.downLoad.getdataListParm).then(response => {
  1356. if (response.data.list !== null) {
  1357. this.downLoad.labelList = []
  1358. var filterValArr = []
  1359. for (let i = 0; i < response.data.list.data1.length; i++) {
  1360. this.downLoad.labelList.push(response.data.list.data1[i].label)
  1361. filterValArr.push(response.data.list.data1[i].prop)
  1362. }
  1363. this.downLoad.list = response.data.list.data2
  1364. } else {
  1365. this.downLoad.list = []
  1366. }
  1367. var multiHeaderArr = []
  1368. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  1369. if (i == 0) {
  1370. multiHeaderArr.push(exportTitle)
  1371. } else {
  1372. multiHeaderArr.push('')
  1373. }
  1374. }
  1375. import('@/vendor/Export5Excel').then(excel => {
  1376. const multiHeader = [
  1377. multiHeaderArr
  1378. ]
  1379. const multiHeader2 = [
  1380. this.downLoad.labelList
  1381. ]
  1382. const filterVal = filterValArr
  1383. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  1384. const merges = []
  1385. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  1386. })
  1387. })
  1388. },
  1389. rowDrop() {
  1390. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  1391. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  1392. // this.sorTable()
  1393. const that = this
  1394. var sortable = Sortable.create(tbody, {
  1395. disabled: that.dropState,
  1396. onChoose({ newIndex, oldIndex }) {
  1397. console.log(that.isOrder, 'that.isOrder == false')
  1398. console.log(that.dropState, 'that.dropState')
  1399. if (that.dropState == true || that.isOrder == true) {
  1400. sortable.destroy()
  1401. }
  1402. },
  1403. onEnd(evt) {
  1404. var tableList = [...that.table.list] // 保留拖动前数据
  1405. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  1406. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  1407. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  1408. console.log(targetRow, 'targetRow')
  1409. console.log(targetRow2, 'targetRow2')
  1410. console.log(targetRow3, 'targetRow3')
  1411. that.table.list.splice(evt.newIndex, 0, targetRow)
  1412. // ==========
  1413. // 已执行的计划不可拖动
  1414. if (targetRow.havebutton == 1) {
  1415. that.$nextTick(() => {
  1416. that.$set(that.table, 'list', tableList)
  1417. })
  1418. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  1419. return false
  1420. }
  1421. // 相同班次之间可以拖动
  1422. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1423. if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  1424. that.$nextTick(() => {
  1425. that.$set(that.table, 'list', tableList)
  1426. })
  1427. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1428. return false
  1429. }
  1430. } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  1431. if (targetRow.times !== targetRow2.times) {
  1432. that.$nextTick(() => {
  1433. that.$set(that.table, 'list', tableList)
  1434. })
  1435. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1436. return false
  1437. }
  1438. } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  1439. if (targetRow.times !== targetRow3.times) {
  1440. that.$nextTick(() => {
  1441. that.$set(that.table, 'list', tableList)
  1442. })
  1443. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1444. return false
  1445. }
  1446. }
  1447. // 撒料计划0,
  1448. // 撒料计划-混料1
  1449. // 撒料计划-撒料2
  1450. // 剩料计划3
  1451. // 预混计划4
  1452. // 预称重计划5
  1453. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  1454. if (targetRow2 == undefined) {
  1455. that.$nextTick(() => {
  1456. that.$set(that.table, 'list', tableList)
  1457. })
  1458. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  1459. that.$nextTick(() => {
  1460. that.$set(that.table, 'list', tableList)
  1461. })
  1462. } else {
  1463. var pidArr = [] // pid相同的值
  1464. var pidArr1 = [] //
  1465. var index // 索引
  1466. for (let i = 0; i < tableList.length; i++) {
  1467. if (tableList[i].pid == targetRow.pid) {
  1468. pidArr.push(tableList[i])
  1469. } else {
  1470. pidArr1.push(tableList[i])
  1471. }
  1472. }
  1473. // 找到对应上方pid 的ID
  1474. // 比如说id 580243 找到对应的索引
  1475. if (targetRow3 !== undefined) {
  1476. for (let i = 0; i < pidArr1.length; i++) {
  1477. if (pidArr1[i].id == targetRow3.id) {
  1478. index = i
  1479. }
  1480. }
  1481. } else {
  1482. for (let i = 0; i < pidArr1.length; i++) {
  1483. if (pidArr1[i].id == targetRow2.id) {
  1484. index = i - 1
  1485. }
  1486. }
  1487. }
  1488. pidArr1.splice(index + 1, 0, ...pidArr)
  1489. console.log(pidArr1)
  1490. that.$nextTick(() => {
  1491. that.table.list = pidArr1
  1492. })
  1493. }
  1494. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1495. if (targetRow2.pid == targetRow3.pid) {
  1496. that.$nextTick(() => {
  1497. that.$set(that.table, 'list', tableList)
  1498. })
  1499. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1500. return false
  1501. }
  1502. }
  1503. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  1504. if (targetRow2 !== undefined) {
  1505. console.log(targetRow3, targetRow2, 'zhidao')
  1506. if (targetRow3 !== undefined) {
  1507. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  1508. that.$nextTick(() => {
  1509. that.$set(that.table, 'list', tableList)
  1510. })
  1511. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1512. return false
  1513. } else {
  1514. console.log('wojinlaile', targetRow2, targetRow)
  1515. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  1516. that.$nextTick(() => {
  1517. that.$set(that.table, 'list', tableList)
  1518. })
  1519. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1520. return false
  1521. }
  1522. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  1523. that.$nextTick(() => {
  1524. that.$set(that.table, 'list', tableList)
  1525. })
  1526. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1527. return false
  1528. }
  1529. }
  1530. } else {
  1531. if (targetRow2.pid !== targetRow.pid) {
  1532. that.$nextTick(() => {
  1533. that.$set(that.table, 'list', tableList)
  1534. })
  1535. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1536. return false
  1537. } else {
  1538. if (targetRow2.pid !== targetRow.pid) {
  1539. that.$nextTick(() => {
  1540. that.$set(that.table, 'list', tableList)
  1541. })
  1542. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1543. return false
  1544. }
  1545. }
  1546. }
  1547. } else {
  1548. if (targetRow2 == undefined) {
  1549. that.$nextTick(() => {
  1550. that.$set(that.table, 'list', tableList)
  1551. })
  1552. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1553. return false
  1554. } else if (targetRow3.pid !== targetRow.pid) {
  1555. that.$nextTick(() => {
  1556. that.$set(that.table, 'list', tableList)
  1557. })
  1558. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1559. return false
  1560. } else {
  1561. if (targetRow3.lpplantype == 0) {
  1562. that.$nextTick(() => {
  1563. that.$set(that.table, 'list', tableList)
  1564. })
  1565. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1566. return false
  1567. }
  1568. }
  1569. }
  1570. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1571. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  1572. that.$nextTick(() => {
  1573. that.$set(that.table, 'list', tableList)
  1574. })
  1575. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1576. return false
  1577. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  1578. that.$nextTick(() => {
  1579. that.$set(that.table, 'list', tableList)
  1580. })
  1581. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1582. return false
  1583. }
  1584. }
  1585. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  1586. if (targetRow2 == undefined) {
  1587. if (targetRow3.pid !== targetRow.pid) {
  1588. that.$nextTick(() => {
  1589. that.$set(that.table, 'list', tableList)
  1590. })
  1591. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1592. return false
  1593. }
  1594. } else {
  1595. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  1596. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  1597. that.$nextTick(() => {
  1598. that.$set(that.table, 'list', tableList)
  1599. })
  1600. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  1601. return false
  1602. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  1603. console.log('正常拖动')
  1604. } else {
  1605. that.$nextTick(() => {
  1606. that.$set(that.table, 'list', tableList)
  1607. })
  1608. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1609. return false
  1610. }
  1611. }
  1612. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1613. if (targetRow2.pid == targetRow3.pid) {
  1614. that.$nextTick(() => {
  1615. that.$set(that.table, 'list', tableList)
  1616. })
  1617. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1618. return false
  1619. }
  1620. }
  1621. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  1622. console.log('遍历有相同的pid,一起跟着拖动3')
  1623. var pidArr = [] // pid相同的值
  1624. var pidArr1 = [] //
  1625. var index // 索引
  1626. for (let i = 0; i < tableList.length; i++) {
  1627. if (tableList[i].pid == targetRow.pid) {
  1628. pidArr.push(tableList[i])
  1629. } else {
  1630. pidArr1.push(tableList[i])
  1631. }
  1632. }
  1633. if (pidArr.length > 0) {
  1634. // 找到对应上方pid 的ID
  1635. // 比如说id 580243 找到对应的索引
  1636. if (targetRow3 !== undefined) {
  1637. for (let i = 0; i < pidArr1.length; i++) {
  1638. if (pidArr1[i].id == targetRow3.id) {
  1639. index = i
  1640. }
  1641. }
  1642. } else {
  1643. for (let i = 0; i < pidArr1.length; i++) {
  1644. if (pidArr1[i].id == targetRow2.id) {
  1645. index = i - 1
  1646. }
  1647. }
  1648. }
  1649. pidArr1.splice(index + 1, 0, ...pidArr)
  1650. console.log(pidArr1)
  1651. that.$nextTick(() => {
  1652. that.table.list = pidArr1
  1653. })
  1654. }
  1655. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1656. if (targetRow2.pid == targetRow3.pid) {
  1657. that.$nextTick(() => {
  1658. that.$set(that.table, 'list', tableList)
  1659. })
  1660. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  1661. return false
  1662. }
  1663. }
  1664. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  1665. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1666. if (targetRow2.pid == targetRow3.pid) {
  1667. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  1668. that.$nextTick(() => {
  1669. that.$set(that.table, 'list', tableList)
  1670. })
  1671. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  1672. return false
  1673. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  1674. console.log('剩料之间可以互相拖动')
  1675. console.log(tableList)
  1676. } else {
  1677. that.$nextTick(() => {
  1678. that.$set(that.table, 'list', tableList)
  1679. })
  1680. // 撒料计划0,
  1681. // 撒料计划-混料1
  1682. // 撒料计划-撒料2
  1683. // 剩料计划3
  1684. // 预混计划4
  1685. // 预称重计划5
  1686. if (targetRow3.lpplantype == 0) {
  1687. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  1688. } else if (targetRow3.lpplantype == 1) {
  1689. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  1690. } else if (targetRow3.lpplantype == 2) {
  1691. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  1692. } else if (targetRow3.lpplantype == 3) {
  1693. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  1694. } else if (targetRow3.lpplantype == 4) {
  1695. that.$set(targetRow3, 'mylpplantype', '预混计划')
  1696. } else if (targetRow3.lpplantype == 5) {
  1697. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  1698. }
  1699. if (targetRow2.lpplantype == 0) {
  1700. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  1701. } else if (targetRow2.lpplantype == 1) {
  1702. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  1703. } else if (targetRow2.lpplantype == 2) {
  1704. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  1705. } else if (targetRow2.lpplantype == 3) {
  1706. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  1707. } else if (targetRow2.lpplantype == 4) {
  1708. that.$set(targetRow2, 'mylpplantype', '预混计划')
  1709. } else if (targetRow2.lpplantype == 5) {
  1710. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  1711. }
  1712. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  1713. that.$message({ type: 'error', message: message, duration: 2000 })
  1714. return false
  1715. }
  1716. }
  1717. }
  1718. // ========
  1719. // var pidArr = [] // pid相同的值
  1720. // var pidArr1 = [] //
  1721. // var index // 索引
  1722. // for (let i = 0; i < tableList.length; i++) {
  1723. // if (tableList[i].pid == targetRow.pid) {
  1724. // pidArr.push(tableList[i])
  1725. // } else {
  1726. // pidArr1.push(tableList[i])
  1727. // }
  1728. // }
  1729. // if (pidArr.length > 0) {
  1730. // // 找到对应上方pid 的ID
  1731. // // 比如说id 580243 找到对应的索引
  1732. // if (targetRow3 !== undefined) {
  1733. // for (let i = 0; i < pidArr1.length; i++) {
  1734. // if (pidArr1[i].id == targetRow3.id) {
  1735. // index = i
  1736. // }
  1737. // }
  1738. // } else {
  1739. // for (let i = 0; i < pidArr1.length; i++) {
  1740. // if (pidArr1[i].id == targetRow2.id) {
  1741. // index = i - 1
  1742. // }
  1743. // }
  1744. // }
  1745. // pidArr1.splice(index + 1, 0, ...pidArr)
  1746. // console.log(pidArr1)
  1747. // that.$nextTick(() => {
  1748. // that.table.list = pidArr1
  1749. // })
  1750. // }
  1751. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1752. // if (targetRow2.pid == targetRow3.pid) {
  1753. // that.$nextTick(() => {
  1754. // that.$set(that.table, 'list', tableList)
  1755. // })
  1756. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  1757. // return false
  1758. // }
  1759. // }
  1760. }
  1761. // ===
  1762. }
  1763. })
  1764. },
  1765. // 复制
  1766. handleCopy() {
  1767. if (this.table.list.length > 0) {
  1768. this.newGeneration.temp = {}
  1769. this.newGeneration.dialogStatus = 'copy'
  1770. this.newGeneration.dialogFormVisible = true
  1771. } else {
  1772. this.$message({ type: 'error', message: '当前无计划可复制' })
  1773. }
  1774. },
  1775. copyData() {
  1776. console.log(this.newGeneration.temp.copyInputDatetime)
  1777. this.isokDisable = true
  1778. setTimeout(() => {
  1779. this.isokDisable = false
  1780. }, 5000)
  1781. this.$refs['temp'].validate(valid => {
  1782. if (valid) {
  1783. this.requestParam.name = 'copydownloadedplan'
  1784. this.requestParam.parammaps = {}
  1785. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1786. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1787. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  1788. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  1789. PostDataByName(this.requestParam).then(response => {
  1790. if (response.msg === 'fail') {
  1791. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1792. } else {
  1793. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1794. this.newGeneration.dialogFormVisible = false
  1795. this.getList()
  1796. }
  1797. })
  1798. }
  1799. })
  1800. },
  1801. handleChangeOrder() {
  1802. // 拖动顺序
  1803. this.isOrder = false
  1804. this.rowDrop()
  1805. },
  1806. saveChangeOrder() {
  1807. // 保存顺序
  1808. var sortList = []
  1809. for (let i = 0; i < this.table.list.length; i++) {
  1810. var obj = {}
  1811. obj.sort = i
  1812. obj.pastureid = this.table.list[i].pastureid
  1813. obj.id = this.table.list[i].id
  1814. sortList.push(obj)
  1815. }
  1816. console.log(sortList)
  1817. this.requestParam = {}
  1818. this.requestParam.common = { 'returnmap': '0' }
  1819. this.requestParam.data = []
  1820. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  1821. this.requestParam.data[0].children = []
  1822. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  1823. id: '@insertSpotList.id',
  1824. pastureid: '@insertSpotList.pastureid',
  1825. sort: '@insertSpotList.sort'
  1826. }}
  1827. ExecDataByConfig(this.requestParam).then(response => {
  1828. console.log('顺序切换保存发送参数', this.requestParam)
  1829. if (response.msg === 'fail') {
  1830. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1831. } else {
  1832. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1833. this.getList()
  1834. this.isOrder = true
  1835. }
  1836. })
  1837. },
  1838. cancelChangeOrder() {
  1839. // 取消顺序
  1840. this.getList()
  1841. this.isOrder = true
  1842. },
  1843. handleDataSynchronization() {
  1844. MessageBox.confirm('是否确认同步数据?', {
  1845. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1846. }).then(() => {
  1847. this.requestParam = {}
  1848. this.requestParam.pastureid = Cookies.get('pastureid')
  1849. // this.$alert('正在同步', { confirmButtonText: '确定' })
  1850. this.dataSynchronization.dialogFormVisible = true
  1851. getDorm(this.requestParam).then(response => {
  1852. console.log(response)
  1853. if (response.msg == 'ok') {
  1854. this.dataSynchronization.dialogFormVisible = false
  1855. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  1856. } else {
  1857. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  1858. this.dataSynchronization.dialogFormVisible = false
  1859. }
  1860. })
  1861. }).catch(() => {
  1862. this.$message({ type: 'info', message: '已取消数据同步' })
  1863. })
  1864. }
  1865. }
  1866. }
  1867. </script>
  1868. <style>
  1869. .el-table .warning-row {
  1870. background: oldlace;
  1871. }
  1872. .el-table .success-row {
  1873. background: #f0f9eb;
  1874. }
  1875. </style>
  1876. <style lang="scss" scoped>
  1877. .app-container{background: #fff;}
  1878. .operation{}
  1879. .search{margin-top:10px;}
  1880. .table{margin-bottom:20px;}
  1881. .template{
  1882. background: #fff;
  1883. position: relative;
  1884. }
  1885. .table2{
  1886. // float: left;width: 50%;
  1887. background: #fff;
  1888. position: relative;
  1889. .content-table{margin-top: 20px;}
  1890. .contentOperation{right: -50px;z-index: 1;}
  1891. }
  1892. .table3{
  1893. // float: left;width: 50%;
  1894. background: #fff;
  1895. position: relative;
  1896. .content-table{margin-top: 20px;}
  1897. .contentOperation{right: -50px;z-index: 1;}
  1898. }
  1899. </style>