index.vue 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420
  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-select v-model="table.getdataListParm.parammaps.tmrname" filterable placeholder="TMR名称" class="filter-item" style="width: 120px;" :clearable="false">
  28. <el-option v-for="item in tmrDownList" :key="item.tmrname" :label="item.tmrname" :value="item.tmrtname" />
  29. </el-select>
  30. <el-select v-model="table.getdataListParm.parammaps.iscompleted" filterable placeholder="执行状态" class="filter-item" style="width: 120px;" :clearable="false">
  31. <el-option v-for="item in iscompletedList" :key="item.value" :label="item.lable" :value="item.value" />
  32. </el-select>
  33. <el-button class="export" icon="el-icon-upload2" @click="handleExport">导出</el-button>
  34. <el-button class="export" style="margin-left: -5px;" @click="handleDeleteRecord">删除记录</el-button>
  35. </div>
  36. <div class="operation" style="margin-bottom: 10px;">
  37. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
  38. <el-button v-if="isRoleEdit" class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
  39. <el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
  40. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
  41. <div v-else style="margin-left: 10px;display: inline-block;">
  42. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  43. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  44. </div>
  45. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" @click="handleTakeEffect">生效</el-button>
  46. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" @click="handleDisable">禁用</el-button>
  47. <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" class="success" @click="handleDataSynchronization">数据同步</el-button>
  48. </div>
  49. <!-- 日执行计划 -->
  50. <div class="table">
  51. <el-table
  52. id="table1"
  53. ref="parent"
  54. :key="table.tableKey"
  55. v-loading="table.listLoading"
  56. element-loading-text="给我一点时间"
  57. :data="table.list"
  58. border
  59. fit
  60. highlight-current-row
  61. style="width: 98%;"
  62. row-key="sort"
  63. :row-style="rowStyle"
  64. :cell-style="cellStyle"
  65. class="elTable table-fixed"
  66. :row-class-name="tableRowClassName"
  67. :height="370"
  68. @row-click="tableRowClick"
  69. @selection-change="handleSelect"
  70. >
  71. <el-table-column type="selection" min-width="50" />
  72. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  73. <el-table-column label="计划名称" min-width="90px" align="center">
  74. <template slot-scope="scope">
  75. <span>{{ scope.row.projname }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  79. <el-table-column label="TMR编号" min-width="90px" align="center">
  80. <template slot-scope="scope">
  81. <span>{{ scope.row.tmrtname }}</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.driver }}</span>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="已执行" min-width="70px" align="center">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.havebutton == 0">否</span>
  92. <span v-else>是</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="班次" min-width="80px" align="center">
  96. <template slot-scope="scope">
  97. <span>{{ scope.row.times }}</span>
  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.lweight }}</span>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="启用" min-width="70px" align="center">
  106. <template slot-scope="scope">
  107. <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)" />
  108. <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)" />
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="时间" min-width="80px" align="center">
  112. <template slot-scope="scope">
  113. <span>{{ scope.row.plantime }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="配方名称" min-width="100px" align="center">
  117. <template slot-scope="scope">
  118. <span>{{ scope.row.ftname }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="牛头数" min-width="80px" align="center">
  122. <template slot-scope="scope">
  123. <span>{{ scope.row.cowcount }}</span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="描述" min-width="80px" align="center">
  127. <template slot-scope="scope">
  128. <span>{{ scope.row.display }}</span>
  129. </template>
  130. </el-table-column>
  131. <el-table-column label="发料位" min-width="80px" align="left">
  132. <template slot-scope="scope">
  133. <span>{{ scope.row.barnames }}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column align="center" width="100" label="操作" class-name="small-padding fixed-width" fixed="right">
  137. <template slot-scope="{row}">
  138. <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  143. </div>
  144. </div>
  145. <!-- 预混料 -->
  146. <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
  147. <el-row :gutter="20">
  148. <el-col :span="12">
  149. <div class="table2">
  150. <div class="contentOperation">
  151. <p>计划详情</p>
  152. </div>
  153. <div class="content-table">
  154. <el-table
  155. :key="table2.tableKey"
  156. v-loading="table2.listLoading"
  157. element-loading-text="给我一点时间"
  158. :data="table2.list"
  159. fit
  160. border
  161. highlight-current-row
  162. style="width: 100%;"
  163. height="450"
  164. :row-style="rowStyle"
  165. :cell-style="cellStyle"
  166. class="elTable table-fixed"
  167. :span-method="objectSpanMethod"
  168. >
  169. <el-table-column label="操作序号" min-width="130px" align="center">
  170. <template slot-scope="scope">
  171. <span>{{ scope.row.sort }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  175. <template slot-scope="scope">
  176. <span>{{ scope.row.fname }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  180. <template slot-scope="scope">
  181. <span>{{ scope.row.weight }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  185. <template slot-scope="scope">
  186. <span>{{ scope.row.subtotal }}</span>
  187. </template>
  188. </el-table-column>
  189. </el-table>
  190. </div>
  191. </div>
  192. </el-col>
  193. </el-row>
  194. </div>
  195. <!-- 撒料 -->
  196. <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
  197. <el-row :gutter="20">
  198. <el-col :span="12">
  199. <div class="table2">
  200. <div class="contentOperation">
  201. <p>计划详情</p>
  202. </div>
  203. <div class="content-table">
  204. <el-table
  205. :key="table2.tableKey"
  206. v-loading="table2.listLoading"
  207. element-loading-text="给我一点时间"
  208. :data="table2.list"
  209. fit
  210. border
  211. highlight-current-row
  212. style="width: 100%;"
  213. height="450"
  214. :row-style="rowStyle"
  215. :cell-style="cellStyle"
  216. class="elTable table-fixed"
  217. :span-method="objectSpanMethod"
  218. >
  219. <el-table-column label="操作序号" min-width="130px" align="center">
  220. <template slot-scope="scope">
  221. <span>{{ scope.row.sort }}</span>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  225. <template slot-scope="scope">
  226. <span>{{ scope.row.fname }}</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  230. <template slot-scope="scope">
  231. <span>{{ scope.row.weight }}</span>
  232. </template>
  233. </el-table-column>
  234. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  235. <template slot-scope="scope">
  236. <span>{{ scope.row.subtotal }}</span>
  237. </template>
  238. </el-table-column>
  239. </el-table>
  240. </div>
  241. </div>
  242. </el-col>
  243. <el-col :span="12">
  244. <div class="table3">
  245. <div class="contentOperation">
  246. <p>栏舍详情</p>
  247. </div>
  248. <div class="content-table">
  249. <el-table
  250. :key="table3.tableKey"
  251. v-loading="table3.listLoading"
  252. element-loading-text="给我一点时间"
  253. :data="table3.list"
  254. height="450"
  255. fit
  256. border
  257. highlight-current-row
  258. style="width: 100%;"
  259. :row-style="rowStyle"
  260. :cell-style="cellStyle"
  261. class="elTable table-fixed"
  262. >
  263. <el-table-column label=" 操作序号" min-width="130px" align="center">
  264. <template slot-scope="scope">
  265. <span>{{ scope.row.sort }}</span>
  266. </template>
  267. </el-table-column>
  268. <el-table-column label="栏舍" min-width="130px" align="center">
  269. <template slot-scope="scope">
  270. <span>{{ scope.row.fname }}</span>
  271. </template>
  272. </el-table-column>
  273. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  274. <template slot-scope="scope">
  275. <span>{{ scope.row.weight }}</span>
  276. </template>
  277. </el-table-column>
  278. </el-table>
  279. </div>
  280. </div>
  281. </el-col>
  282. </el-row>
  283. </div>
  284. <!-- 剩料 -->
  285. <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
  286. <el-row :gutter="20">
  287. <el-col :span="12"><div class="table2">
  288. <div class="contentOperation">
  289. <p>计划详情</p>
  290. </div>
  291. <div class="content-table">
  292. <el-table
  293. :key="table2.tableKey"
  294. v-loading="table2.listLoading"
  295. element-loading-text="给我一点时间"
  296. :data="table2.list"
  297. fit
  298. border
  299. highlight-current-row
  300. style="width: 100%;"
  301. height="450"
  302. :row-style="rowStyle"
  303. :cell-style="cellStyle"
  304. class="elTable table-fixed"
  305. :span-method="objectSpanMethod"
  306. >
  307. <el-table-column label="操作序号" min-width="130px" align="center">
  308. <template slot-scope="scope">
  309. <span>{{ scope.row.sort }}</span>
  310. </template>
  311. </el-table-column>
  312. <el-table-column label="取料栏舍" prop="fname" min-width="130px" align="center">
  313. <template slot-scope="scope">
  314. <span>{{ scope.row.fname }}</span>
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="处理方式" prop="useinbar" min-width="130px" align="center">
  318. <template slot-scope="scope">
  319. <span>{{ scope.row.useinbar }}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  323. <template slot-scope="scope">
  324. <span>{{ scope.row.subtotal }}</span>
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. </div>
  329. </div>
  330. </el-col>
  331. <el-col :span="12">
  332. <div class="table3">
  333. <div class="contentOperation">
  334. <p>栏舍详情</p>
  335. </div>
  336. <div class="content-table">
  337. <el-table
  338. :key="table3.tableKey"
  339. v-loading="table3.listLoading"
  340. element-loading-text="给我一点时间"
  341. :data="table3.list"
  342. height="450"
  343. fit
  344. border
  345. highlight-current-row
  346. style="width: 100%;"
  347. :row-style="rowStyle"
  348. :cell-style="cellStyle"
  349. class="elTable table-fixed"
  350. >
  351. <el-table-column label="操作序号" min-width="130px" align="center">
  352. <template slot-scope="scope">
  353. <span>{{ scope.row.sort }}</span>
  354. </template>
  355. </el-table-column>
  356. <el-table-column label="转投栏舍" min-width="130px" align="center">
  357. <template slot-scope="scope">
  358. <span>{{ scope.row.fname }}</span>
  359. </template>
  360. </el-table-column>
  361. </el-table>
  362. </div>
  363. </div>
  364. </el-col>
  365. </el-row>
  366. </div>
  367. <!-- 撒料计划-混料 -->
  368. <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
  369. <el-row :gutter="20">
  370. <el-col :span="12">
  371. <div class="table2">
  372. <div class="contentOperation">
  373. <p>计划详情</p>
  374. </div>
  375. <div class="content-table">
  376. <el-table
  377. :key="table2.tableKey"
  378. v-loading="table2.listLoading"
  379. element-loading-text="给我一点时间"
  380. :data="table2.list"
  381. fit
  382. border
  383. highlight-current-row
  384. style="width: 100%;"
  385. height="450"
  386. :row-style="rowStyle"
  387. :cell-style="cellStyle"
  388. class="elTable table-fixed"
  389. :span-method="objectSpanMethod"
  390. >
  391. <el-table-column label="操作序号" min-width="130px" align="center">
  392. <template slot-scope="scope">
  393. <span>{{ scope.row.sort }}</span>
  394. </template>
  395. </el-table-column>
  396. <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
  397. <template slot-scope="scope">
  398. <span>{{ scope.row.fname }}</span>
  399. </template>
  400. </el-table-column>
  401. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  402. <template slot-scope="scope">
  403. <span>{{ scope.row.weight }}</span>
  404. </template>
  405. </el-table-column>
  406. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  407. <template slot-scope="scope">
  408. <span>{{ scope.row.subtotal }}</span>
  409. </template>
  410. </el-table-column>
  411. </el-table>
  412. </div>
  413. </div>
  414. </el-col>
  415. <el-col :span="12">
  416. <div class="table3">
  417. <div class="contentOperation">
  418. <p>栏舍详情</p>
  419. </div>
  420. <div class="content-table">
  421. <el-table
  422. :key="table3.tableKey"
  423. v-loading="table3.listLoading"
  424. element-loading-text="给我一点时间"
  425. :data="table3.list"
  426. height="450"
  427. fit
  428. border
  429. highlight-current-row
  430. style="width: 100%;"
  431. :row-style="rowStyle"
  432. :cell-style="cellStyle"
  433. class="elTable table-fixed"
  434. >
  435. <el-table-column label=" 操作序号" min-width="130px" align="center">
  436. <template slot-scope="scope">
  437. <span>{{ scope.row.sort }}</span>
  438. </template>
  439. </el-table-column>
  440. <el-table-column label="撒料车辆" min-width="130px" align="center">
  441. <template slot-scope="scope">
  442. <span>{{ scope.row.fname }}</span>
  443. </template>
  444. </el-table-column>
  445. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  446. <template slot-scope="scope">
  447. <span>{{ scope.row.weight }}</span>
  448. </template>
  449. </el-table-column>
  450. </el-table>
  451. </div>
  452. </div>
  453. </el-col>
  454. </el-row>
  455. </div>
  456. <!-- 撒料计划-撒料 -->
  457. <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
  458. <el-row :gutter="20">
  459. <el-col :span="12">
  460. <div class="table3">
  461. <div class="contentOperation">
  462. <p>栏舍详情</p>
  463. </div>
  464. <div class="content-table">
  465. <el-table
  466. :key="table3.tableKey"
  467. v-loading="table3.listLoading"
  468. element-loading-text="给我一点时间"
  469. :data="table3.list"
  470. height="450"
  471. fit
  472. border
  473. highlight-current-row
  474. style="width: 100%;"
  475. :row-style="rowStyle"
  476. :cell-style="cellStyle"
  477. class="elTable table-fixed"
  478. >
  479. <el-table-column label=" 操作序号" min-width="130px" align="center">
  480. <template slot-scope="scope">
  481. <span>{{ scope.row.sort }}</span>
  482. </template>
  483. </el-table-column>
  484. <el-table-column label="撒料车辆" min-width="130px" align="center">
  485. <template slot-scope="scope">
  486. <span>{{ scope.row.fname }}</span>
  487. </template>
  488. </el-table-column>
  489. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  490. <template slot-scope="scope">
  491. <span>{{ scope.row.weight }}</span>
  492. </template>
  493. </el-table-column>
  494. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  495. <template slot-scope="scope">
  496. <span>{{ scope.row.subtotal }}</span>
  497. </template>
  498. </el-table-column>
  499. </el-table>
  500. </div>
  501. </div>
  502. </el-col>
  503. <el-col :span="12">
  504. <div class="table2">
  505. <div class="contentOperation">
  506. <p>计划详情</p>
  507. </div>
  508. <div class="content-table">
  509. <el-table
  510. :key="table2.tableKey"
  511. v-loading="table2.listLoading"
  512. element-loading-text="给我一点时间"
  513. :data="table2.list"
  514. fit
  515. border
  516. highlight-current-row
  517. style="width: 100%;"
  518. height="450"
  519. :row-style="rowStyle"
  520. :cell-style="cellStyle"
  521. class="elTable table-fixed"
  522. >
  523. <el-table-column label="操作序号" min-width="130px" align="center">
  524. <template slot-scope="scope">
  525. <span>{{ scope.row.sort }}</span>
  526. </template>
  527. </el-table-column>
  528. <el-table-column label="栏舍名称" prop="fname" min-width="130px" align="center">
  529. <template slot-scope="scope">
  530. <span>{{ scope.row.fname }}</span>
  531. </template>
  532. </el-table-column>
  533. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  534. <template slot-scope="scope">
  535. <span>{{ scope.row.weight }}</span>
  536. </template>
  537. </el-table-column>
  538. </el-table>
  539. </div>
  540. </div>
  541. </el-col>
  542. </el-row>
  543. </div>
  544. <!-- 新生成 -->
  545. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  546. <div class="newGeneration" v-loading="newGenerationLoading" >
  547. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  548. <el-row v-if="newGeneration.dialogStatus== 'newGeneration'">
  549. <el-col :span="24">
  550. <el-form-item label="时间范围:" prop="inputDatetime">
  551. <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" />
  552. </el-form-item>
  553. </el-col>
  554. </el-row>
  555. <el-row v-else>
  556. <el-col :span="24">
  557. <el-form-item label="时间范围:" prop="copyInputDatetime">
  558. <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" />
  559. </el-form-item>
  560. </el-col>
  561. </el-row>
  562. <p v-if="newGeneration.temp.tips == true" style="font-weight: 700;color: red;text-align: center;">注:撒料计划中存在未分配完栏舍,如下所示;建议及时进行分配</p>
  563. <div style="height: 200px;overflow: auto;">
  564. <div v-if="myMaxTimes == 1">
  565. <div>第一班:</div>
  566. <div v-for="(item,index) in tipsList.one" :key="index+'A'" >
  567. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  568. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  569. <span v-for="(item2,index2) in item.arrList" :key="index2+'a'">
  570. {{item2.barname}}
  571. </span>
  572. </span>
  573. </div>
  574. </div>
  575. <div v-else-if="myMaxTimes == 2">
  576. <div>第一班:</div>
  577. <div v-for="(item,index) in tipsList.one" :key="index+'B'" >
  578. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  579. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  580. <span v-for="(item2,index2) in item.arrList" :key="index2+'b'">
  581. {{item2.barname}}
  582. </span>
  583. </span>
  584. </div>
  585. <div>第二班:</div>
  586. <div v-for="(item,index) in tipsList.two" :key="index+'C'" >
  587. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  588. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  589. <span v-for="(item2,index2) in item.arrList" :key="index2+'c'">
  590. {{item2.barname}}
  591. </span>
  592. </span>
  593. </div>
  594. </div>
  595. <div v-else-if="myMaxTimes == 3">
  596. <div>第一班:</div>
  597. <div v-for="(item,index) in tipsList.one" :key="index+'D'" >
  598. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  599. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  600. <span v-for="(item2,index2) in item.arrList" :key="index2+'d'">
  601. {{item2.barname}}
  602. </span>
  603. </span>
  604. </div>
  605. <div>第二班:</div>
  606. <div v-for="(item,index) in tipsList.two" :key="index+'E'" >
  607. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  608. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  609. <span v-for="(item2,index2) in item.arrList" :key="index2+'e'">
  610. {{item2.barname}}
  611. </span>
  612. </span>
  613. </div>
  614. <div>第三班:</div>
  615. <div v-for="(item,index) in tipsList.three" :key="index+'F'" >
  616. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  617. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  618. <span v-for="(item2,index2) in item.arrList" :key="index2+'f'">
  619. {{item2.barname}}
  620. </span>
  621. </span>
  622. </div>
  623. </div>
  624. <div v-else>
  625. <div>第一班:</div>
  626. <div v-for="(item,index) in tipsList.one" :key="index+'G'" >
  627. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  628. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  629. <span v-for="(item2,index2) in item.arrList" :key="index2+'g'">
  630. {{item2.barname}}
  631. </span>
  632. </span>
  633. </div>
  634. <div>第二班:</div>
  635. <div v-for="(item,index) in tipsList.two" :key="index+'H'" >
  636. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  637. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  638. <span v-for="(item2,index2) in item.arrList" :key="index2+'h'">
  639. {{item2.barname}}
  640. </span>
  641. </span>
  642. </div>
  643. <div>第三班:</div>
  644. <div v-for="(item,index) in tipsList.three" :key="index+'I'" >
  645. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  646. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  647. <span v-for="(item2,index2) in item.arrList" :key="index2+'i'">
  648. {{item2.barname}}
  649. </span>
  650. </span>
  651. </div>
  652. <div>第四班:</div>
  653. <div v-for="(item,index) in tipsList.four" :key="index+'J'" >
  654. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  655. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  656. <span v-for="(item2,index2) in item.arrList" :key="index2+'j'">
  657. {{item2.barname}}
  658. </span>
  659. </span>
  660. </div>
  661. </div>
  662. </div>
  663. </el-form>
  664. <div slot="footer" class="dialog-footer" style="bottom:20px">
  665. <el-button class="cancelClose" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  666. <el-button v-if="newGeneration.dialogStatus== 'newGeneration'" class="save" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  667. <el-button v-else class="save" :disabled="isokDisable" @click="copyData()">确认</el-button>
  668. </div>
  669. </div>
  670. </el-dialog>
  671. <!-- 历史记录 -->
  672. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  673. <template slot="title">
  674. <div class="avue-crud__dialog__header">
  675. <span class="el-dialog__title">
  676. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  677. {{ textMap[historyRecord.dialogStatus] }}
  678. </span>
  679. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  680. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  681. <svg-icon v-else icon-class="fullscreen" />
  682. </div>
  683. </div>
  684. </template>
  685. <div class="historyRecord">
  686. <keep-alive>
  687. <component :is="historyRecord.myComponent" ref="historyRecord" />
  688. </keep-alive>
  689. </div>
  690. <div slot="footer" class="dialog-footer">
  691. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  692. </div>
  693. </el-dialog>
  694. <!-- 正在同步中 -->
  695. <el-dialog :destroy-on-close="true" :visible.sync="dataSynchronization.dialogFormVisible" :close-on-click-modal="false" width="30%">
  696. <div class="dataSynchronization" style="text-align: center;font-size: 18px;">
  697. <i class="el-icon-loading" />
  698. <span>正在同步</span>
  699. <div slot="footer" class="dialog-footer" style="bottom:10px">
  700. <el-button class="miniPrimary" @click="dataSynchronization.dialogFormVisible = false;">确认</el-button>
  701. </div>
  702. </div>
  703. </el-dialog>
  704. <!-- 修改计划 -->
  705. <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
  706. <!-- 删除记录 -->
  707. <el-dialog :title="textMap[deleteRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="deleteRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  708. <div class="deleteRecord">
  709. <div class="search">
  710. <el-date-picker v-model="deleteRecord.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDeleteRecordDate" />
  711. </div>
  712. <div class="table">
  713. <el-table
  714. :key="deleteRecord.tableKey"
  715. v-loading="deleteRecord.listLoading"
  716. element-loading-text="给我一点时间"
  717. :data="deleteRecord.list"
  718. border
  719. fit
  720. highlight-current-row
  721. style="width: 98%;"
  722. row-key="sort"
  723. :row-style="rowStyle"
  724. :cell-style="cellStyle"
  725. class="elTable table-fixed"
  726. :height="370"
  727. >
  728. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  729. <el-table-column label="计划名称" min-width="90px" align="center" prop="projname" />
  730. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  731. <el-table-column label="TMR编号" min-width="90px" align="center" prop="tmrtname" />
  732. <el-table-column label="驾驶员" min-width="90px" align="center" prop="driver" />
  733. <el-table-column label="已执行" min-width="70px" align="center">
  734. <template slot-scope="scope">
  735. <span v-if="scope.row.havebutton == 0">否</span>
  736. <span v-else>是</span>
  737. </template>
  738. </el-table-column>
  739. <el-table-column label="班次" min-width="80px" align="center" prop="times" />
  740. <el-table-column label="理论量" min-width="80px" align="center" prop="lweight" />
  741. <el-table-column label="启用" min-width="70px" align="center">
  742. <template slot-scope="scope">
  743. <el-switch v-if="dataDisabled == false" disabled v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  744. <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)" />
  745. </template>
  746. </el-table-column>
  747. <el-table-column label="时间" min-width="80px" align="center" prop="plantime" />
  748. <el-table-column label="配方名称" min-width="100px" align="center" prop="ftname" />
  749. <el-table-column label="牛头数" min-width="80px" align="center" prop="cowcount" />
  750. <el-table-column label="描述" min-width="80px" align="center" prop="display" />
  751. <el-table-column label="发料位" min-width="80px" align="left" prop="barnames" />
  752. </el-table>
  753. <span v-if="deleteRecord.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ deleteRecord.total }}条</span>
  754. </div>
  755. <div slot="footer" class="dialog-footer" style="bottom:20px">
  756. <el-button class="cancelClose1" @click="deleteRecord.dialogFormVisible = false;getList()">取消</el-button>
  757. </div>
  758. </div>
  759. </el-dialog>
  760. </div>
  761. </template>
  762. <script>
  763. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, getDorm, GetReportform, checkButtons,postJson } from '@/api/common'
  764. import RevisePlan from './revisePlan.vue'
  765. import { parseTime, json2excel,handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  766. import Cookies from 'js-cookie'
  767. import Sortable from 'sortablejs'
  768. import { MessageBox } from 'element-ui'
  769. export default {
  770. name: 'DailyExecutionPlan',
  771. components: {
  772. RevisePlan
  773. },
  774. data() {
  775. return {
  776. newGenerationLoading:false,
  777. dialogFull: false,
  778. isRoleEdit: [],
  779. dataDisabled: false,
  780. requestParams: [
  781. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  782. ],
  783. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  784. printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  785. frequencyList: [], // 班次
  786. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  787. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
  788. iscompletedList: [{ lable: '是', value: '1' },{ lable: '否', value: '0' } ],
  789. // 班次
  790. maxTime: {
  791. getMaxTimesParm: {
  792. name: 'getSysoptEnable',
  793. page: 1,
  794. offset: 1,
  795. pagecount: 1,
  796. returntype: 'Map',
  797. parammaps: {
  798. pastureid: Cookies.get('pastureid'),
  799. inforname: 'times'
  800. }
  801. }
  802. },
  803. isOrder: true,
  804. table: {
  805. getdataListParm: {
  806. name: 'getDownloadedplanList',
  807. page: 1,
  808. offset: 1,
  809. pagecount: '',
  810. returntype: 'Map',
  811. parammaps: {
  812. pastureid: Cookies.get('pastureid'),
  813. barid: '',
  814. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  815. times: '',
  816. lpplantype: '',
  817. printType: '',
  818. plandimen: '0',
  819. enable3: '0',
  820. iscompleted:"",
  821. tmrname:"",
  822. }
  823. },
  824. tableKey: 0,
  825. list: [],
  826. total: 0,
  827. listLoading: false
  828. },
  829. // 计划内容操作详情
  830. table2: {
  831. getdataListParm: {
  832. name: 'getDownloadplandtl1ListV2',
  833. page: 1,
  834. offset: 1,
  835. returntype: 'Map',
  836. parammaps: {
  837. pastureid: Cookies.get('pastureid'),
  838. date: '',
  839. id: ''
  840. }
  841. },
  842. tableKey: 0,
  843. list: [],
  844. total: 0,
  845. listLoading: false
  846. },
  847. // 计划内容 舍栏详情
  848. table3: {
  849. getdataListParm: {
  850. name: 'getDownloadplandt2ListV2',
  851. page: 1,
  852. offset: 1,
  853. returntype: 'Map',
  854. parammaps: {
  855. pastureid: Cookies.get('pastureid'),
  856. date: '',
  857. id: ''
  858. }
  859. },
  860. tableKey: 0,
  861. list: [],
  862. total: 0,
  863. listLoading: false
  864. },
  865. // 新生成
  866. newGeneration: {
  867. dialogFormVisible: false,
  868. dialogStatus: '',
  869. getdataListParm: {
  870. name: 'checkLLPIsDistribution',
  871. page: 1,
  872. offset: 1,
  873. pagecount: 1,
  874. returntype: 'Map',
  875. parammaps: {
  876. pastureid: Cookies.get('pastureid')
  877. }
  878. },
  879. temp: {
  880. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
  881. tips:''
  882. },
  883. rules: {
  884. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
  885. copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  886. }
  887. },
  888. pickerMinDate: '',
  889. pickerOptions: {
  890. onPick: ({ maxDate, minDate }) => {
  891. this.pickerMinDate = minDate.getTime()
  892. if (maxDate) {
  893. this.pickerMinDate = ''
  894. }
  895. },
  896. disabledDate: (time) => {
  897. if (this.pickerMinDate !== '') {
  898. const one = 31 * 24 * 3600 * 1000
  899. const minTime = this.pickerMinDate
  900. const maxTime = this.pickerMinDate + one
  901. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  902. }
  903. return time.getTime() < Date.now() - 8.64e7
  904. }
  905. },
  906. pickerOptions2: {
  907. onPick: ({ maxDate, minDate }) => {
  908. this.pickerMinDate = minDate.getTime()
  909. if (maxDate) {
  910. this.pickerMinDate = ''
  911. }
  912. },
  913. disabledDate: (time) => {
  914. if (this.pickerMinDate !== '') {
  915. const one = 14 * 24 * 3600 * 1000
  916. const minTime = this.pickerMinDate
  917. const maxTime = this.pickerMinDate + one
  918. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  919. }
  920. return time.getTime() < Date.now() - 8.64e7
  921. }
  922. },
  923. historyRecord: {
  924. dialogFormVisible: false,
  925. dialogStatus: '',
  926. myComponent: null
  927. },
  928. dataSynchronization: {
  929. dialogFormVisible: false,
  930. dialogStatus: '',
  931. getdataListParm: {
  932. name: 'getSysoptEnable',
  933. page: 1,
  934. offset: 1,
  935. pagecount: 1,
  936. returntype: 'Map',
  937. parammaps: {
  938. pastureid: Cookies.get('pastureid'),
  939. inforname: 'isDataSync'
  940. }
  941. },
  942. isDataSynchronization: false
  943. },
  944. textMap: {
  945. newGeneration: '新生成',
  946. historyRecord: '历史记录',
  947. revisePlan: '修改计划',
  948. copy: '复制计划',
  949. deleteRecord:'删除记录'
  950. },
  951. isokDisable: false,
  952. requestParam: {},
  953. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  954. cellStyle: { padding: 0 + 'px' },
  955. isShowDialog: false,
  956. activeName: '栏舍配方',
  957. parentDate: '',
  958. downLoad: {
  959. getdataListParm: {
  960. name: '',
  961. page: 1,
  962. offset: 1,
  963. pagecount: '',
  964. returntype: 'Map',
  965. parammaps: {
  966. pastureid: Cookies.get('pastureid'),
  967. date: ''
  968. }
  969. },
  970. list: [],
  971. labelList: []
  972. },
  973. tmrDownList:[],
  974. getTmrListParam: {
  975. name: 'getDownloadedplanTmrNameUnfinished',
  976. page: 1,
  977. offset: 1,
  978. pagecount: 10,
  979. returntype: 'Map',
  980. parammaps: {
  981. pastureid: Cookies.get('pastureid'),
  982. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  983. }
  984. },
  985. myMaxTimes:'',
  986. tipsList:[],
  987. spanObj: {},
  988. mergekeys: ['sort', 'description'],
  989. deleteRecord:{
  990. dialogFormVisible: false,
  991. dialogStatus: '',
  992. total:0,
  993. tableKey:0,
  994. listLoading:false,
  995. list:[],
  996. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  997. },
  998. selectList: [],
  999. }
  1000. },
  1001. created() {
  1002. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1003. console.log(this.parentDate, 'this.parentDate')
  1004. this.getDataSynchronization()
  1005. this.getButtons()
  1006. this.getList()
  1007. this.getDownList()
  1008. this.getIsDisplay()
  1009. this.getTMRList()
  1010. },
  1011. mounted() {
  1012. this.getTmrListParam.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
  1013. },
  1014. methods: {
  1015. getTMRList(){
  1016. console.log('11111111')
  1017. this.getTmrListParam.parammaps.mydate = this.table.getdataListParm.parammaps.mydate
  1018. GetDataByName(this.getTmrListParam).then(response => {
  1019. if (response.data.list !== null) {
  1020. console.log('11111111',response)
  1021. this.tmrDownList = response.data.list
  1022. }
  1023. })
  1024. },
  1025. getButtons() {
  1026. const Edit = 'DailyExecutionPlan'
  1027. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1028. this.isRoleEdit = isRoleEdit
  1029. },
  1030. getDataSynchronization() {
  1031. GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
  1032. // console.log(response.data.list[0])
  1033. if (response.data.list[0].inforvalue == 0) {
  1034. this.dataSynchronization.isDataSynchronization = false
  1035. } else {
  1036. this.dataSynchronization.isDataSynchronization = true
  1037. }
  1038. })
  1039. },
  1040. getIsDisplay() {
  1041. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  1042. console.log(response.data.list[0].inforvalue)
  1043. this.myMaxTimes = response.data.list[0].inforvalue
  1044. if (response.data.list[0].inforvalue == 1) {
  1045. this.frequencyList = [{ id: '1', name: '第一班' }]
  1046. } else if (response.data.list[0].inforvalue == 2) {
  1047. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  1048. } else if (response.data.list[0].inforvalue == 3) {
  1049. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  1050. } else if (response.data.list[0].inforvalue == 4) {
  1051. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  1052. }
  1053. })
  1054. },
  1055. getDownList() {
  1056. GetDataByNames(this.requestParams).then(response => {
  1057. // this.livestockTypeList = response.data.getDictByName.list
  1058. })
  1059. },
  1060. // -------------------日执行计划-----------------------------
  1061. handleBefore() {
  1062. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1063. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1064. var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
  1065. // var start = this.table.getdataListParm.parammaps.mydate - 1
  1066. this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
  1067. // this.$forceUpdate()
  1068. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1069. this.getTMRList()
  1070. this.getList()
  1071. }
  1072. var d = this.table.getdataListParm.parammaps.mydate
  1073. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1074. if (d < curDate) {
  1075. this.dataDisabled = true
  1076. } else {
  1077. this.dataDisabled = false
  1078. }
  1079. console.log(this.dataDisabled)
  1080. },
  1081. handleNext() {
  1082. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1083. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1084. var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
  1085. this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
  1086. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1087. this.getTMRList()
  1088. this.getList()
  1089. }
  1090. var d = this.table.getdataListParm.parammaps.mydate
  1091. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1092. if (d < curDate) {
  1093. this.dataDisabled = true
  1094. } else {
  1095. this.dataDisabled = false
  1096. }
  1097. console.log(this.dataDisabled)
  1098. },
  1099. getList() {
  1100. this.table.listLoading = true
  1101. GetDataByName(this.table.getdataListParm).then(response => {
  1102. console.log('table数据', response.data.list)
  1103. if (response.data.list !== null) {
  1104. // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
  1105. // response.data.list[6] = obj
  1106. this.getIsColor(response.data.list)
  1107. this.table.list = response.data.list
  1108. this.table.pageNum = response.data.pageNum
  1109. this.table.pageSize = response.data.pageSize
  1110. this.table.total = response.data.total
  1111. console.log('计划类型', response.data.list[0].lpplantype)
  1112. if (response.data.list[0].lpplantype == 0) {
  1113. // 撒料
  1114. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1115. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1116. this.table2.getdataListParm.parammaps.useinbartype = ''
  1117. this.table3.getdataListParm.parammaps.useinbartype = ''
  1118. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1119. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1120. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1121. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1122. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1123. this.getList2()
  1124. this.getList3()
  1125. } else if (response.data.list[0].lpplantype == 1) {
  1126. // 撒料计划-混料
  1127. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1128. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1129. this.table2.getdataListParm.parammaps.useinbartype = ''
  1130. this.table3.getdataListParm.parammaps.useinbartype = ''
  1131. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1132. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1133. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1134. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1135. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1136. this.getList2()
  1137. this.getList3()
  1138. } else if (response.data.list[0].lpplantype == 2) {
  1139. // 撒料计划-撒料
  1140. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1141. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1142. this.table2.getdataListParm.parammaps.useinbartype = ''
  1143. this.table3.getdataListParm.parammaps.useinbartype = ''
  1144. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1145. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1146. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1147. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1148. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1149. this.getList2()
  1150. this.getList3()
  1151. } else if (response.data.list[0].lpplantype == 3) {
  1152. // 剩料
  1153. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1154. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1155. this.table2.getdataListParm.parammaps.useinbartype = 0
  1156. this.table3.getdataListParm.parammaps.useinbartype = 1
  1157. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1158. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1159. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1160. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1161. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1162. this.getList2()
  1163. this.getList3()
  1164. } else if (response.data.list[0].lpplantype == 4) {
  1165. // 预混
  1166. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1167. this.table2.getdataListParm.parammaps.useinbartype = ''
  1168. this.table3.getdataListParm.parammaps.useinbartype = ''
  1169. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1170. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1171. this.getList2()
  1172. } else if (response.data.list[0].lpplantype == 5) {
  1173. // 预称重计划
  1174. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1175. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1176. this.table2.getdataListParm.parammaps.useinbartype = ''
  1177. this.table3.getdataListParm.parammaps.useinbartype = ''
  1178. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1179. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1180. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1181. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1182. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1183. this.getList2()
  1184. this.getList3()
  1185. }
  1186. } else {
  1187. this.table.list = []
  1188. this.table3.getdataListParm.parammaps.lpplantype = ''
  1189. this.table2.getdataListParm.parammaps.id = ''
  1190. this.table3.getdataListParm.parammaps.id = ''
  1191. // this.getList2()
  1192. // this.getList3()
  1193. this.table2.list = []
  1194. this.table3.list = []
  1195. }
  1196. setTimeout(() => {
  1197. this.table.listLoading = false
  1198. }, 100)
  1199. })
  1200. },
  1201. handleEnableChange(row) {
  1202. this.requestParam.name = 'updatedownloadenable'
  1203. this.requestParam.parammaps = {}
  1204. this.requestParam.parammaps.pastureid = row.pastureid
  1205. this.requestParam.parammaps.id = row.id
  1206. this.requestParam.parammaps.enable = row.enable
  1207. PostDataByName(this.requestParam).then(response => {
  1208. if (response.msg === 'fail') {
  1209. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1210. } else {
  1211. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1212. this.getList()
  1213. }
  1214. })
  1215. },
  1216. getIsColor(arr) {
  1217. var map = {}
  1218. var dest = []
  1219. for (var i = 0; i < arr.length; i++) {
  1220. var ai = arr[i]
  1221. if (!map[ai.pid]) {
  1222. dest.push({
  1223. pid: ai.pid,
  1224. data: [ai]
  1225. })
  1226. map[ai.pid] = ai
  1227. } else {
  1228. for (var j = 0; j < dest.length; j++) {
  1229. var dj = dest[j]
  1230. if (dj.pid == ai.pid) {
  1231. dj.data.push(ai)
  1232. break
  1233. }
  1234. }
  1235. }
  1236. }
  1237. console.log(dest)
  1238. var newArr1 = []
  1239. for (var i = 0; i < dest.length; i++) {
  1240. var newArr = dest[i].data
  1241. for (var j = 0; j < dest[i].data.length; j++) {
  1242. dest[i].data[j].isColor = i
  1243. newArr1.push(dest[i].data[j])
  1244. }
  1245. }
  1246. console.log(newArr1)
  1247. this.table.list = newArr1
  1248. },
  1249. tableRowClassName({ row }) {
  1250. if (row.isColor % 2 == 0) {
  1251. return 'warning-row'
  1252. } else {
  1253. return 'success-row'
  1254. }
  1255. },
  1256. lpplantype: function(cellValue) {
  1257. if (cellValue.lpplantype == 0) {
  1258. return '撒料计划'
  1259. } else if (cellValue.lpplantype == 1) {
  1260. return '撒料计划-混料'
  1261. } else if (cellValue.lpplantype == 2) {
  1262. return '撒料计划-撒料'
  1263. } else if (cellValue.lpplantype == 3) {
  1264. return '剩料计划'
  1265. } else if (cellValue.lpplantype == 4) {
  1266. return '预混计划'
  1267. } else if (cellValue.lpplantype == 5) {
  1268. return '预称重计划'
  1269. }
  1270. },
  1271. changeDate(val) {
  1272. console.log('选择了日期', val)
  1273. this.getList()
  1274. // this.getList2()
  1275. // this.getList3()
  1276. var d = this.table.getdataListParm.parammaps.mydate
  1277. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1278. if (d < curDate) {
  1279. this.dataDisabled = true
  1280. } else {
  1281. this.dataDisabled = false
  1282. }
  1283. console.log(this.dataDisabled)
  1284. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1285. console.log(this.parentDate, 'this.parentDate')
  1286. },
  1287. changePlanType(val) {
  1288. console.log('选择了计划类型', val)
  1289. this.getList()
  1290. this.getList2()
  1291. this.getList3()
  1292. },
  1293. changeFrequency(val) {
  1294. console.log('选择了班次', val)
  1295. this.getList()
  1296. this.getList2()
  1297. this.getList3()
  1298. },
  1299. // 日执行计划行点击
  1300. tableRowClick(row, column, event) {
  1301. console.log(row, column, event)
  1302. console.log('点击计划类型', row.lpplantype)
  1303. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
  1304. if (row.lpplantype == 0) {
  1305. // 撒料
  1306. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1307. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1308. this.table2.getdataListParm.parammaps.useinbartype = ''
  1309. this.table3.getdataListParm.parammaps.useinbartype = ''
  1310. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1311. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1312. this.table2.getdataListParm.parammaps.id = row.id
  1313. this.table3.getdataListParm.parammaps.id = row.id
  1314. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1315. this.getList2()
  1316. this.getList3()
  1317. } else if (row.lpplantype == 1) {
  1318. // 撒料计划-混料
  1319. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1320. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1321. this.table2.getdataListParm.parammaps.useinbartype = ''
  1322. this.table3.getdataListParm.parammaps.useinbartype = ''
  1323. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1324. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1325. this.table2.getdataListParm.parammaps.id = row.id
  1326. this.table3.getdataListParm.parammaps.id = row.id
  1327. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1328. this.getList2()
  1329. this.getList3()
  1330. } else if (row.lpplantype == 2) {
  1331. // 撒料计划-撒料
  1332. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1333. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1334. this.table2.getdataListParm.parammaps.useinbartype = ''
  1335. this.table3.getdataListParm.parammaps.useinbartype = ''
  1336. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1337. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1338. this.table2.getdataListParm.parammaps.id = row.id
  1339. this.table3.getdataListParm.parammaps.id = row.id
  1340. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1341. this.getList2()
  1342. this.getList3()
  1343. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1344. } else if (row.lpplantype == 3) {
  1345. // 剩料
  1346. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1347. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1348. this.table2.getdataListParm.parammaps.useinbartype = 0
  1349. this.table3.getdataListParm.parammaps.useinbartype = 1
  1350. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1351. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1352. this.table2.getdataListParm.parammaps.id = row.id
  1353. this.table3.getdataListParm.parammaps.id = row.id
  1354. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1355. this.getList2()
  1356. this.getList3()
  1357. } else if (row.lpplantype == 4) {
  1358. // 预混
  1359. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1360. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1361. this.table2.getdataListParm.parammaps.useinbartype = ''
  1362. this.table3.getdataListParm.parammaps.useinbartype = ''
  1363. this.table2.getdataListParm.parammaps.id = row.id
  1364. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1365. this.getList2()
  1366. } else if (row.lpplantype == 5) {
  1367. // 预称重计划
  1368. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1369. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1370. this.table2.getdataListParm.parammaps.useinbartype = ''
  1371. this.table3.getdataListParm.parammaps.useinbartype = ''
  1372. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1373. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1374. this.table2.getdataListParm.parammaps.id = row.id
  1375. this.table3.getdataListParm.parammaps.id = row.id
  1376. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1377. this.getList2()
  1378. this.getList3()
  1379. }
  1380. this.$forceUpdate()
  1381. },
  1382. // 计划内容操作详情
  1383. getList2() {
  1384. this.table2.listLoading = true
  1385. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1386. GetDataByName(this.table2.getdataListParm).then(response => {
  1387. console.log('table数据', response.data.list)
  1388. if (response.data.list !== null) {
  1389. this.table2.list = response.data.list
  1390. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1391. if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
  1392. const arr = []
  1393. var a = 0
  1394. let b = this.table2.list[0].sort
  1395. let c = 0
  1396. for (let i = 0; i < this.table2.list.length; i++) {
  1397. if (b !== parseInt(this.table2.list[i].sort)) {
  1398. b = this.table2.list[i].sort
  1399. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1400. a = 0
  1401. }
  1402. a = a + parseFloat(this.table2.list[i].weight)
  1403. c = c + parseFloat(this.table2.list[i].weight)
  1404. arr.push(this.table2.list[i])
  1405. }
  1406. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1407. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1408. this.table2.list = arr
  1409. }
  1410. if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
  1411. const arr = []
  1412. var aa = 0
  1413. let bb = this.table2.list[0].sort
  1414. let cc = 0
  1415. for (let i = 0; i < this.table2.list.length; i++) {
  1416. if (bb !== parseInt(this.table2.list[i].sort)) {
  1417. bb = this.table2.list[i].sort
  1418. aa = 0
  1419. }
  1420. aa = aa + parseFloat(this.table2.list[i].weight)
  1421. cc = cc + parseFloat(this.table2.list[i].weight)
  1422. arr.push(this.table2.list[i])
  1423. }
  1424. arr.push({ 'sort': '总计', 'weight': cc.toFixed(parseInt(Cookies.get('decimal'))) })
  1425. this.table2.list = arr
  1426. console.log('this.table2.list', this.table2.list)
  1427. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1428. }
  1429. console.log(this.table2.list)
  1430. this.table2.pageNum = response.data.pageNum
  1431. this.table2.pageSize = response.data.pageSize
  1432. this.table2.total = response.data.total
  1433. } else {
  1434. this.table2.list = []
  1435. }
  1436. this.handleSpan()
  1437. setTimeout(() => {
  1438. this.table2.listLoading = false
  1439. }, 100)
  1440. })
  1441. },
  1442. // 计划内容栏舍详情
  1443. getList3() {
  1444. this.table3.listLoading = true
  1445. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1446. GetDataByName(this.table3.getdataListParm).then(response => {
  1447. console.log('table数据', response.data.list)
  1448. if (response.data.list !== null) {
  1449. this.table3.list = response.data.list
  1450. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1451. const arr = []
  1452. var a = 0
  1453. let b = this.table3.list[0].sort
  1454. let c = 0
  1455. for (let i = 0; i < this.table3.list.length; i++) {
  1456. if (b !== parseInt(this.table3.list[i].sort)) {
  1457. b = this.table3.list[i].sort
  1458. a = 0
  1459. }
  1460. a = a + parseFloat(this.table3.list[i].weight)
  1461. c = c + parseFloat(this.table3.list[i].weight)
  1462. arr.push(this.table3.list[i])
  1463. }
  1464. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1465. this.table3.list = arr
  1466. }
  1467. this.table3.pageNum = response.data.pageNum
  1468. this.table3.pageSize = response.data.pageSize
  1469. this.table3.total = response.data.total
  1470. } else {
  1471. this.table3.list = []
  1472. }
  1473. setTimeout(() => {
  1474. this.table3.listLoading = false
  1475. }, 100)
  1476. })
  1477. },
  1478. // 新生成
  1479. handleCreate() {
  1480. console.log('点击了新生成')
  1481. this.newGeneration.temp.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  1482. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  1483. console.log('table数据', response.data.list)
  1484. if (response.data.list !== null) {
  1485. if (response.data.list[0].vmsg == '存在未分配') {
  1486. this.newGeneration.temp.tips = true
  1487. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  1488. this.getTips()
  1489. }else{
  1490. this.newGeneration.temp.tips = false
  1491. this.newGeneration.dialogStatus = 'newGeneration'
  1492. this.newGeneration.dialogFormVisible = true
  1493. }
  1494. }
  1495. })
  1496. },
  1497. getTips(){
  1498. const url = 'authdata/feedp/undistribute'
  1499. const data = {}
  1500. // data.times = 1
  1501. data.times = this.myMaxTimes
  1502. data.pastureid = Cookies.get('pastureid')
  1503. this.tipsList = []
  1504. postJson(url, data).then(response => {
  1505. if(response.data !== null){
  1506. this.tipsList = response.data
  1507. // if(this.myMaxTimes == 1){
  1508. // this.tipsList = response.data.one
  1509. // }else if(this.myMaxTimes == 2){
  1510. // this.tipsList.push(response.data.one,response.data.two)
  1511. // }else if(this.myMaxTimes == 3){
  1512. // this.tipsList.push(response.data.one,response.data.two,response.data.three)
  1513. // }else if(this.myMaxTimes == 4){
  1514. // this.tipsList.push(response.data.one,response.data.two,response.data.three,response.data.four)
  1515. // }
  1516. }else{
  1517. this.tipsList = []
  1518. }
  1519. console.log('this.tipsList==>',this.tipsList)
  1520. this.newGeneration.dialogStatus = 'newGeneration'
  1521. this.newGeneration.dialogFormVisible = true
  1522. })
  1523. },
  1524. DateDiff(sDate1, sDate2) {
  1525. console.log(sDate1, sDate2)
  1526. var aDate, oDate1, oDate2, iDays
  1527. aDate = sDate1.split('-')
  1528. oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
  1529. aDate = sDate2.split('-')
  1530. oDate2 = new Date(aDate[0], aDate[1], aDate[2])
  1531. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
  1532. this.newGeneration.temp.days = parseInt(iDays) + 1
  1533. return iDays
  1534. },
  1535. newGenerationData() {
  1536. console.log('点击了新生成保存', this.newGeneration.temp)
  1537. this.newGenerationLoading = true
  1538. this.isokDisable = true
  1539. this.$refs['temp'].validate(valid => {
  1540. if (valid) {
  1541. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  1542. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  1543. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  1544. this.requestParam = {}
  1545. this.requestParam.common = { 'returnmap': '0' }
  1546. this.requestParam.data = []
  1547. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  1548. pastureid: Cookies.get('pastureid'),
  1549. startTime: this.newGeneration.temp.startTime
  1550. }}
  1551. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  1552. pastureid: Cookies.get('pastureid'),
  1553. days: this.newGeneration.temp.days
  1554. }}
  1555. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  1556. pastureid: Cookies.get('pastureid'),
  1557. startTime: this.newGeneration.temp.startTime,
  1558. stopTime: this.newGeneration.temp.stopTime
  1559. }}
  1560. ExecDataByConfig(this.requestParam).then(response => {
  1561. console.log('新生成保存发送参数', this.requestParam)
  1562. if (response.msg === 'fail') {
  1563. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1564. this.isokDisable = false
  1565. this.newGenerationLoading = false
  1566. } else {
  1567. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1568. this.newGeneration.dialogFormVisible = false
  1569. this.getList()
  1570. this.isokDisable = false
  1571. this.newGenerationLoading = false
  1572. }
  1573. })
  1574. }
  1575. })
  1576. },
  1577. // 修改计划
  1578. handleRevisePlan(data) {
  1579. this.dialogFull = false
  1580. var arr = []
  1581. if (this.table.list.length > 0) {
  1582. for (let i = 0; i < this.table.list.length; i++) {
  1583. if (this.table.list[i].havebutton == 1) {
  1584. arr.push(this.table.list[i])
  1585. }
  1586. }
  1587. }
  1588. if (arr.length !== this.table.list.length) {
  1589. console.log('点击了修改计划1', this.activeName)
  1590. this.isShowDialog = true
  1591. this.activeName = '栏舍配方'
  1592. console.log('点击了修改计划2', this.activeName)
  1593. } else {
  1594. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  1595. }
  1596. },
  1597. handleExport() {
  1598. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1599. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  1600. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  1601. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  1602. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  1603. var exportTitle = ''
  1604. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  1605. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1606. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  1607. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1608. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1609. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  1610. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1611. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1612. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  1613. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1614. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1615. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  1616. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1617. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1618. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  1619. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1620. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1621. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  1622. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1623. } else {
  1624. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  1625. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1626. }
  1627. } else {
  1628. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1629. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  1630. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1631. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1632. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  1633. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1634. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1635. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  1636. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1637. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1638. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  1639. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1640. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1641. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  1642. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1643. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1644. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  1645. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1646. } else {
  1647. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  1648. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1649. }
  1650. }
  1651. GetReportform(this.downLoad.getdataListParm).then(response => {
  1652. if (response.data.list !== null) {
  1653. this.downLoad.labelList = []
  1654. var filterValArr = []
  1655. for (let i = 0; i < response.data.list.data1.length; i++) {
  1656. this.downLoad.labelList.push(response.data.list.data1[i].label)
  1657. filterValArr.push(response.data.list.data1[i].prop)
  1658. }
  1659. this.downLoad.list = response.data.list.data2
  1660. } else {
  1661. this.downLoad.list = []
  1662. }
  1663. var multiHeaderArr = []
  1664. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  1665. if (i == 0) {
  1666. multiHeaderArr.push(exportTitle)
  1667. } else {
  1668. multiHeaderArr.push('')
  1669. }
  1670. }
  1671. import('@/vendor/Export5Excel').then(excel => {
  1672. const multiHeader = [
  1673. multiHeaderArr
  1674. ]
  1675. const multiHeader2 = [
  1676. this.downLoad.labelList
  1677. ]
  1678. const filterVal = filterValArr
  1679. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  1680. const merges = []
  1681. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  1682. })
  1683. })
  1684. },
  1685. rowDrop() {
  1686. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  1687. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  1688. // this.sorTable()
  1689. const that = this
  1690. var sortable = Sortable.create(tbody, {
  1691. disabled: that.dropState,
  1692. onChoose({ newIndex, oldIndex }) {
  1693. console.log(that.isOrder, 'that.isOrder == false')
  1694. console.log(that.dropState, 'that.dropState')
  1695. if (that.dropState == true || that.isOrder == true) {
  1696. sortable.destroy()
  1697. }
  1698. },
  1699. onEnd(evt) {
  1700. var tableList = [...that.table.list] // 保留拖动前数据
  1701. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  1702. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  1703. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  1704. console.log(targetRow, 'targetRow')
  1705. console.log(targetRow2, 'targetRow2')
  1706. console.log(targetRow3, 'targetRow3')
  1707. that.table.list.splice(evt.newIndex, 0, targetRow)
  1708. // ==========
  1709. // 已执行的计划不可拖动
  1710. if (targetRow.havebutton == 1) {
  1711. that.$nextTick(() => {
  1712. that.$set(that.table, 'list', tableList)
  1713. })
  1714. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  1715. return false
  1716. }
  1717. // 相同班次之间可以拖动
  1718. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1719. if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  1720. that.$nextTick(() => {
  1721. that.$set(that.table, 'list', tableList)
  1722. })
  1723. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1724. return false
  1725. }
  1726. } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  1727. if (targetRow.times !== targetRow2.times) {
  1728. that.$nextTick(() => {
  1729. that.$set(that.table, 'list', tableList)
  1730. })
  1731. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1732. return false
  1733. }
  1734. } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  1735. if (targetRow.times !== targetRow3.times) {
  1736. that.$nextTick(() => {
  1737. that.$set(that.table, 'list', tableList)
  1738. })
  1739. that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  1740. return false
  1741. }
  1742. }
  1743. // 撒料计划0,
  1744. // 撒料计划-混料1
  1745. // 撒料计划-撒料2
  1746. // 剩料计划3
  1747. // 预混计划4
  1748. // 预称重计划5
  1749. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  1750. if (targetRow2 == undefined) {
  1751. that.$nextTick(() => {
  1752. that.$set(that.table, 'list', tableList)
  1753. })
  1754. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  1755. that.$nextTick(() => {
  1756. that.$set(that.table, 'list', tableList)
  1757. })
  1758. } else {
  1759. var pidArr = [] // pid相同的值
  1760. var pidArr1 = [] //
  1761. var index // 索引
  1762. for (let i = 0; i < tableList.length; i++) {
  1763. if (tableList[i].pid == targetRow.pid) {
  1764. pidArr.push(tableList[i])
  1765. } else {
  1766. pidArr1.push(tableList[i])
  1767. }
  1768. }
  1769. // 找到对应上方pid 的ID
  1770. // 比如说id 580243 找到对应的索引
  1771. if (targetRow3 !== undefined) {
  1772. for (let i = 0; i < pidArr1.length; i++) {
  1773. if (pidArr1[i].id == targetRow3.id) {
  1774. index = i
  1775. }
  1776. }
  1777. } else {
  1778. for (let i = 0; i < pidArr1.length; i++) {
  1779. if (pidArr1[i].id == targetRow2.id) {
  1780. index = i - 1
  1781. }
  1782. }
  1783. }
  1784. pidArr1.splice(index + 1, 0, ...pidArr)
  1785. console.log(pidArr1)
  1786. that.$nextTick(() => {
  1787. that.table.list = pidArr1
  1788. })
  1789. }
  1790. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1791. if (targetRow2.pid == targetRow3.pid) {
  1792. that.$nextTick(() => {
  1793. that.$set(that.table, 'list', tableList)
  1794. })
  1795. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1796. return false
  1797. }
  1798. }
  1799. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  1800. if (targetRow2 !== undefined) {
  1801. console.log(targetRow3, targetRow2, 'zhidao')
  1802. if (targetRow3 !== undefined) {
  1803. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  1804. that.$nextTick(() => {
  1805. that.$set(that.table, 'list', tableList)
  1806. })
  1807. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1808. return false
  1809. } else {
  1810. console.log('wojinlaile', targetRow2, targetRow)
  1811. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  1812. that.$nextTick(() => {
  1813. that.$set(that.table, 'list', tableList)
  1814. })
  1815. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1816. return false
  1817. }
  1818. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  1819. that.$nextTick(() => {
  1820. that.$set(that.table, 'list', tableList)
  1821. })
  1822. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1823. return false
  1824. }
  1825. }
  1826. } else {
  1827. if (targetRow2.pid !== targetRow.pid) {
  1828. that.$nextTick(() => {
  1829. that.$set(that.table, 'list', tableList)
  1830. })
  1831. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1832. return false
  1833. } else {
  1834. if (targetRow2.pid !== targetRow.pid) {
  1835. that.$nextTick(() => {
  1836. that.$set(that.table, 'list', tableList)
  1837. })
  1838. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1839. return false
  1840. }
  1841. }
  1842. }
  1843. } else {
  1844. if (targetRow2 == undefined) {
  1845. that.$nextTick(() => {
  1846. that.$set(that.table, 'list', tableList)
  1847. })
  1848. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1849. return false
  1850. } else if (targetRow3.pid !== targetRow.pid) {
  1851. that.$nextTick(() => {
  1852. that.$set(that.table, 'list', tableList)
  1853. })
  1854. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1855. return false
  1856. } else {
  1857. if (targetRow3.lpplantype == 0) {
  1858. that.$nextTick(() => {
  1859. that.$set(that.table, 'list', tableList)
  1860. })
  1861. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  1862. return false
  1863. }
  1864. }
  1865. }
  1866. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1867. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  1868. that.$nextTick(() => {
  1869. that.$set(that.table, 'list', tableList)
  1870. })
  1871. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1872. return false
  1873. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  1874. that.$nextTick(() => {
  1875. that.$set(that.table, 'list', tableList)
  1876. })
  1877. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  1878. return false
  1879. }
  1880. }
  1881. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  1882. if (targetRow2 == undefined) {
  1883. if (targetRow3.pid !== targetRow.pid) {
  1884. that.$nextTick(() => {
  1885. that.$set(that.table, 'list', tableList)
  1886. })
  1887. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1888. return false
  1889. }
  1890. } else {
  1891. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  1892. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  1893. that.$nextTick(() => {
  1894. that.$set(that.table, 'list', tableList)
  1895. })
  1896. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  1897. return false
  1898. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  1899. console.log('正常拖动')
  1900. } else {
  1901. that.$nextTick(() => {
  1902. that.$set(that.table, 'list', tableList)
  1903. })
  1904. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  1905. return false
  1906. }
  1907. }
  1908. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1909. if (targetRow2.pid == targetRow3.pid) {
  1910. that.$nextTick(() => {
  1911. that.$set(that.table, 'list', tableList)
  1912. })
  1913. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  1914. return false
  1915. }
  1916. }
  1917. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  1918. console.log('遍历有相同的pid,一起跟着拖动3')
  1919. var pidArr = [] // pid相同的值
  1920. var pidArr1 = [] //
  1921. var index // 索引
  1922. for (let i = 0; i < tableList.length; i++) {
  1923. if (tableList[i].pid == targetRow.pid) {
  1924. pidArr.push(tableList[i])
  1925. } else {
  1926. pidArr1.push(tableList[i])
  1927. }
  1928. }
  1929. if (pidArr.length > 0) {
  1930. // 找到对应上方pid 的ID
  1931. // 比如说id 580243 找到对应的索引
  1932. if (targetRow3 !== undefined) {
  1933. for (let i = 0; i < pidArr1.length; i++) {
  1934. if (pidArr1[i].id == targetRow3.id) {
  1935. index = i
  1936. }
  1937. }
  1938. } else {
  1939. for (let i = 0; i < pidArr1.length; i++) {
  1940. if (pidArr1[i].id == targetRow2.id) {
  1941. index = i - 1
  1942. }
  1943. }
  1944. }
  1945. pidArr1.splice(index + 1, 0, ...pidArr)
  1946. console.log(pidArr1)
  1947. that.$nextTick(() => {
  1948. that.table.list = pidArr1
  1949. })
  1950. }
  1951. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1952. if (targetRow2.pid == targetRow3.pid) {
  1953. that.$nextTick(() => {
  1954. that.$set(that.table, 'list', tableList)
  1955. })
  1956. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  1957. return false
  1958. }
  1959. }
  1960. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  1961. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  1962. if (targetRow2.pid == targetRow3.pid) {
  1963. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  1964. that.$nextTick(() => {
  1965. that.$set(that.table, 'list', tableList)
  1966. })
  1967. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  1968. return false
  1969. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  1970. console.log('剩料之间可以互相拖动')
  1971. console.log(tableList)
  1972. } else {
  1973. that.$nextTick(() => {
  1974. that.$set(that.table, 'list', tableList)
  1975. })
  1976. // 撒料计划0,
  1977. // 撒料计划-混料1
  1978. // 撒料计划-撒料2
  1979. // 剩料计划3
  1980. // 预混计划4
  1981. // 预称重计划5
  1982. if (targetRow3.lpplantype == 0) {
  1983. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  1984. } else if (targetRow3.lpplantype == 1) {
  1985. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  1986. } else if (targetRow3.lpplantype == 2) {
  1987. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  1988. } else if (targetRow3.lpplantype == 3) {
  1989. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  1990. } else if (targetRow3.lpplantype == 4) {
  1991. that.$set(targetRow3, 'mylpplantype', '预混计划')
  1992. } else if (targetRow3.lpplantype == 5) {
  1993. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  1994. }
  1995. if (targetRow2.lpplantype == 0) {
  1996. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  1997. } else if (targetRow2.lpplantype == 1) {
  1998. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  1999. } else if (targetRow2.lpplantype == 2) {
  2000. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  2001. } else if (targetRow2.lpplantype == 3) {
  2002. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  2003. } else if (targetRow2.lpplantype == 4) {
  2004. that.$set(targetRow2, 'mylpplantype', '预混计划')
  2005. } else if (targetRow2.lpplantype == 5) {
  2006. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  2007. }
  2008. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  2009. that.$message({ type: 'error', message: message, duration: 2000 })
  2010. return false
  2011. }
  2012. }
  2013. }
  2014. // ========
  2015. // var pidArr = [] // pid相同的值
  2016. // var pidArr1 = [] //
  2017. // var index // 索引
  2018. // for (let i = 0; i < tableList.length; i++) {
  2019. // if (tableList[i].pid == targetRow.pid) {
  2020. // pidArr.push(tableList[i])
  2021. // } else {
  2022. // pidArr1.push(tableList[i])
  2023. // }
  2024. // }
  2025. // if (pidArr.length > 0) {
  2026. // // 找到对应上方pid 的ID
  2027. // // 比如说id 580243 找到对应的索引
  2028. // if (targetRow3 !== undefined) {
  2029. // for (let i = 0; i < pidArr1.length; i++) {
  2030. // if (pidArr1[i].id == targetRow3.id) {
  2031. // index = i
  2032. // }
  2033. // }
  2034. // } else {
  2035. // for (let i = 0; i < pidArr1.length; i++) {
  2036. // if (pidArr1[i].id == targetRow2.id) {
  2037. // index = i - 1
  2038. // }
  2039. // }
  2040. // }
  2041. // pidArr1.splice(index + 1, 0, ...pidArr)
  2042. // console.log(pidArr1)
  2043. // that.$nextTick(() => {
  2044. // that.table.list = pidArr1
  2045. // })
  2046. // }
  2047. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2048. // if (targetRow2.pid == targetRow3.pid) {
  2049. // that.$nextTick(() => {
  2050. // that.$set(that.table, 'list', tableList)
  2051. // })
  2052. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  2053. // return false
  2054. // }
  2055. // }
  2056. }
  2057. // ===
  2058. }
  2059. })
  2060. },
  2061. // 复制
  2062. handleCopy() {
  2063. if (this.table.list.length > 0) {
  2064. this.newGeneration.temp = {}
  2065. this.newGeneration.dialogStatus = 'copy'
  2066. this.newGeneration.dialogFormVisible = true
  2067. } else {
  2068. this.$message({ type: 'error', message: '当前无计划可复制' })
  2069. }
  2070. },
  2071. copyData() {
  2072. console.log(this.newGeneration.temp.copyInputDatetime)
  2073. this.isokDisable = true
  2074. setTimeout(() => {
  2075. this.isokDisable = false
  2076. }, 5000)
  2077. this.$refs['temp'].validate(valid => {
  2078. if (valid) {
  2079. this.requestParam.name = 'copydownloadedplan'
  2080. this.requestParam.parammaps = {}
  2081. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2082. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2083. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  2084. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  2085. PostDataByName(this.requestParam).then(response => {
  2086. if (response.msg === 'fail') {
  2087. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2088. } else {
  2089. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2090. this.newGeneration.dialogFormVisible = false
  2091. this.getList()
  2092. }
  2093. })
  2094. }
  2095. })
  2096. },
  2097. handleChangeOrder() {
  2098. // 拖动顺序
  2099. this.isOrder = false
  2100. this.rowDrop()
  2101. },
  2102. saveChangeOrder() {
  2103. // 保存顺序
  2104. var sortList = []
  2105. for (let i = 0; i < this.table.list.length; i++) {
  2106. var obj = {}
  2107. obj.sort = i
  2108. obj.pastureid = this.table.list[i].pastureid
  2109. obj.id = this.table.list[i].id
  2110. sortList.push(obj)
  2111. }
  2112. console.log(sortList)
  2113. this.requestParam = {}
  2114. this.requestParam.common = { 'returnmap': '0' }
  2115. this.requestParam.data = []
  2116. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  2117. this.requestParam.data[0].children = []
  2118. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  2119. id: '@insertSpotList.id',
  2120. pastureid: '@insertSpotList.pastureid',
  2121. sort: '@insertSpotList.sort'
  2122. }}
  2123. ExecDataByConfig(this.requestParam).then(response => {
  2124. console.log('顺序切换保存发送参数', this.requestParam)
  2125. if (response.msg === 'fail') {
  2126. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2127. } else {
  2128. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2129. this.getList()
  2130. this.isOrder = true
  2131. }
  2132. })
  2133. },
  2134. cancelChangeOrder() {
  2135. // 取消顺序
  2136. this.getList()
  2137. this.isOrder = true
  2138. },
  2139. handleDataSynchronization() {
  2140. MessageBox.confirm('是否确认同步数据?', {
  2141. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2142. }).then(() => {
  2143. this.requestParam = {}
  2144. this.requestParam.pastureid = Cookies.get('pastureid')
  2145. // this.$alert('正在同步', { confirmButtonText: '确定' })
  2146. this.dataSynchronization.dialogFormVisible = true
  2147. getDorm(this.requestParam).then(response => {
  2148. console.log(response)
  2149. if (response.msg == 'ok') {
  2150. this.dataSynchronization.dialogFormVisible = false
  2151. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  2152. } else {
  2153. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  2154. this.dataSynchronization.dialogFormVisible = false
  2155. }
  2156. })
  2157. }).catch(() => {
  2158. this.$message({ type: 'info', message: '已取消数据同步' })
  2159. })
  2160. },
  2161. handleRowDelete(row) {
  2162. console.log('删除')
  2163. MessageBox.confirm('是否确认删除此信息?', {
  2164. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2165. }).then(() => {
  2166. this.selectList = []
  2167. this.requestParam = {}
  2168. this.requestParam.name = 'delDownloadedplan'
  2169. this.requestParam.parammaps = {}
  2170. this.requestParam.parammaps.pastureid = row.pastureid
  2171. this.requestParam.parammaps.id = row.id
  2172. PostDataByName(this.requestParam).then(response => {
  2173. if (response.msg === 'fail') {
  2174. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2175. } else {
  2176. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2177. this.getList()
  2178. }
  2179. })
  2180. }).catch(() => {
  2181. this.$message({ type: 'info', message: '已取消删除' })
  2182. })
  2183. },
  2184. handleSpan() {
  2185. this.mergekeys.forEach(key => {
  2186. this.spanObj[key] = []
  2187. let position = 0
  2188. this.table2.list.forEach((item, index) => {
  2189. if (index === 0) {
  2190. this.spanObj[key].push(1)
  2191. position = 0
  2192. } else {
  2193. if (key == 'description') {
  2194. if (this.table2.list[index][key] === this.table2.list[index - 1][key] && this.table2.list[index]['sort'] === this.table2.list[index - 1]['sort']) {
  2195. this.spanObj[key][position] += 1
  2196. this.spanObj[key].push(0)
  2197. } else {
  2198. this.spanObj[key].push(1)
  2199. position = index
  2200. }
  2201. } else {
  2202. if (this.table2.list[index][key] === this.table2.list[index - 1][key]) {
  2203. this.spanObj[key][position] += 1
  2204. this.spanObj[key].push(0)
  2205. } else {
  2206. this.spanObj[key].push(1)
  2207. position = index
  2208. }
  2209. }
  2210. }
  2211. })
  2212. })
  2213. },
  2214. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  2215. for (let i = 0; i < this.mergekeys.length; i++) {
  2216. if (column.property === this.mergekeys[i]) {
  2217. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  2218. const _col = _row > 0 ? 1 : 0
  2219. return {
  2220. rowspan: _row,
  2221. colspan: _col
  2222. }
  2223. }
  2224. }
  2225. },
  2226. handleDeleteRecord(){
  2227. this.deleteRecord.dialogStatus = 'deleteRecord'
  2228. this.deleteRecord.dialogFormVisible = true
  2229. this.deleteRecord.mydate = this.table.getdataListParm.parammaps.mydate
  2230. this.getDeleteRecordList()
  2231. },
  2232. changeDeleteRecordDate(){
  2233. this.getDeleteRecordList()
  2234. },
  2235. getDeleteRecordList(){
  2236. const url = 'authdata/GetDataByName'
  2237. const data = {}
  2238. data.name = 'getDownloadedplanDeleteList'
  2239. data.page = 1
  2240. data.offset = 1
  2241. data.pagecount = ""
  2242. data.returntype = "Map"
  2243. data.parammaps = {}
  2244. data.parammaps.pastureid = Cookies.get('pastureid')
  2245. data.parammaps.mydate = this.deleteRecord.mydate
  2246. postJson(url, data).then(response => {
  2247. if(response.data !== null){
  2248. this.deleteRecord.list = response.data.list
  2249. }else{
  2250. this.deleteRecord.list = []
  2251. }
  2252. this.deleteRecord.total = response.data.total
  2253. })
  2254. },
  2255. handleSelect(val) {
  2256. console.log('勾选数据', val)
  2257. this.selectList = val
  2258. },
  2259. handleTakeEffect() {
  2260. if (this.selectList.length == 0) {
  2261. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  2262. } else {
  2263. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  2264. confirmButtonText: '确认',
  2265. cancelButtonText: '取消',
  2266. type: 'warning'
  2267. }).then(() => {
  2268. for (let i = 0; i < this.selectList.length; i++) {
  2269. // this.$set(this.selectList[i], 'enable', '1')
  2270. this.selectList[i].enable = 1
  2271. }
  2272. console.log('生效', this.selectList)
  2273. this.requestParam.common = {
  2274. 'returnmap': '0'
  2275. }
  2276. this.requestParam.data = []
  2277. this.requestParam.data[0] = {
  2278. 'name': 'insertSpotList',
  2279. 'resultmaps': {
  2280. 'list': this.selectList
  2281. }
  2282. }
  2283. this.requestParam.data[0].children = []
  2284. this.requestParam.data[0].children[0] = {
  2285. 'name': 'updateDownloadedplanEnable',
  2286. 'type': 'e',
  2287. 'parammaps': {
  2288. enable: '@insertSpotList.enable',
  2289. id: '@insertSpotList.id',
  2290. pastureid: '@insertSpotList.pastureid'
  2291. }
  2292. }
  2293. ExecDataByConfig(this.requestParam).then(response => {
  2294. console.log('生效保存发送参数', this.requestParam)
  2295. if (response.msg === 'fail') {
  2296. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  2297. } else {
  2298. this.$notify({ title: '成功', message: '生效成功', type: 'success', duration: 2000 })
  2299. this.getList()
  2300. }
  2301. })
  2302. })
  2303. }
  2304. },
  2305. handleDisable() {
  2306. if (this.selectList.length == 0) {
  2307. this.$message({type: 'error', message: '请选择车次信息', duration: 2000 })
  2308. } else {
  2309. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  2310. confirmButtonText: '确认',
  2311. cancelButtonText: '取消',
  2312. type: 'warning'
  2313. }).then(() => {
  2314. for (let i = 0; i < this.selectList.length; i++) {
  2315. // this.$set(this.selectList[i], 'enable', '1')
  2316. this.selectList[i].enable = 0
  2317. }
  2318. console.log('禁用', this.selectList)
  2319. this.requestParam.common = {
  2320. 'returnmap': '0'
  2321. }
  2322. this.requestParam.data = []
  2323. this.requestParam.data[0] = {
  2324. 'name': 'insertSpotList',
  2325. 'resultmaps': {
  2326. 'list': this.selectList
  2327. }
  2328. }
  2329. this.requestParam.data[0].children = []
  2330. this.requestParam.data[0].children[0] = {
  2331. 'name': 'updateDownloadedplanEnable',
  2332. 'type': 'e',
  2333. 'parammaps': {
  2334. enable: '@insertSpotList.enable',
  2335. id: '@insertSpotList.id',
  2336. pastureid: '@insertSpotList.pastureid'
  2337. }
  2338. }
  2339. ExecDataByConfig(this.requestParam).then(response => {
  2340. console.log('禁用保存发送参数', this.requestParam)
  2341. if (response.msg === 'fail') {
  2342. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  2343. } else {
  2344. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  2345. this.getList()
  2346. }
  2347. })
  2348. })
  2349. }
  2350. }
  2351. }
  2352. }
  2353. </script>
  2354. <style>
  2355. .el-table .warning-row {
  2356. background: oldlace;
  2357. }
  2358. .el-table .success-row {
  2359. background: #f0f9eb;
  2360. }
  2361. </style>
  2362. <style lang="scss" scoped>
  2363. .app-container{background: #fff;}
  2364. .operation{}
  2365. .search{margin-top:10px;}
  2366. .table{margin-bottom:20px;}
  2367. .template{
  2368. background: #fff;
  2369. position: relative;
  2370. }
  2371. .table2{
  2372. // float: left;width: 50%;
  2373. background: #fff;
  2374. position: relative;
  2375. .content-table{margin-top: 20px;}
  2376. .contentOperation{right: -50px;z-index: 1;}
  2377. }
  2378. .table3{
  2379. // float: left;width: 50%;
  2380. background: #fff;
  2381. position: relative;
  2382. .content-table{margin-top: 20px;}
  2383. .contentOperation{right: -50px;z-index: 1;}
  2384. }
  2385. </style>