index.vue 103 KB

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