index.vue 99 KB

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