f22fcdf3ff4264253590f6776bb80eb296804d91.svn-base 86 KB

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