497fccc7aa0629827634b4bd31b9e2f8fb7f30ba.svn-base 85 KB

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