d50a9a8eb45ef594e35803e49f44fe99b7b9dd17.svn-base 85 KB

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