30fa877759e4a87aef9b98a94ccd0e6019b2ac0a.svn-base 73 KB

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