index.vue 146 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216
  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="successBorder" @click="form_search">查询</el-button>
  34. <el-button class="export" icon="el-icon-upload2" @click="handleExport">导出</el-button>
  35. <el-button class="export" icon="el-icon-upload2" @click="handlePrint">打印</el-button>
  36. <el-button class="export" style="margin-left: -5px;" @click="form_deleteRecord">删除记录</el-button>
  37. </div>
  38. <div class="operation" style="margin-bottom: 10px;">
  39. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
  40. <el-button v-if="isRoleEdit" class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
  41. <el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
  42. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
  43. <div v-else style="margin-left: 10px;display: inline-block;">
  44. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  45. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  46. </div>
  47. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" @click="handleTakeEffect">生效</el-button>
  48. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" @click="handleDisable">禁用</el-button>
  49. <el-button v-if="dataSynchronization2.isDataSynchronization" class="success" icon="el-icon-plus" @click="form_updata">上传计划</el-button>
  50. <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" class="success" @click="handleDataSynchronization">数据同步</el-button>
  51. <el-button v-if="dataSynchronization3.isDataSynchronization&&isRoleEdit" class="success" @click="handleDataUpload">数据上传</el-button>
  52. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
  53. <el-button v-if="isRoleEdit && sapUpload.isSap" class="success" icon="el-icon-upload2" @click="handleSAPUpload">SAP上传</el-button>
  54. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd1">搅拌数据上传</el-button>
  55. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd2">剩料上传</el-button>
  56. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd3">撒料上传</el-button>
  57. <el-button v-if="isRoleEdit" class="success" icon="el-icon-circle-check" @click="handleQuickcompletion">快速完成</el-button>
  58. </div>
  59. <!-- 日执行计划 -->
  60. <div class="table">
  61. <el-table
  62. id="table1"
  63. ref="parent"
  64. :key="table.tableKey"
  65. v-loading="table.listLoading"
  66. element-loading-text="给我一点时间"
  67. :data="table.list"
  68. border
  69. fit
  70. highlight-current-row
  71. style="width: 98%;"
  72. row-key="sort"
  73. :row-style="rowStyle"
  74. :cell-style="cellStyle"
  75. class="elTable table-fixed"
  76. :row-class-name="tableRowClassName"
  77. :height="myheight"
  78. @row-click="tableRowClick"
  79. @selection-change="handleSelect"
  80. >
  81. <el-table-column type="selection" min-width="50" />
  82. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  83. <el-table-column label="计划名称" min-width="90px" align="center">
  84. <template slot-scope="scope">
  85. <span>{{ scope.row.projname }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  89. <el-table-column label="TMR编号" min-width="90px" align="center">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.tmrtname }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="驾驶员" min-width="150px" align="center">
  95. <template slot-scope="scope">
  96. <!-- <span>{{ scope.row.driver }}</span> -->
  97. <el-select v-model="scope.row.driverId" :disabled="scope.row.havebutton == 1" filterable placeholder="驾驶员" class="filter-item" style="width:95%;padding:10px 0;" :clearable="false" @change="(value)=> {changeDriver(value, scope.row)}">
  98. <el-option v-for="item in driverList" :key="item.id" :label="item.drivername" :value="item.id" />
  99. </el-select>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="已执行" min-width="70px" align="center">
  103. <template slot-scope="scope">
  104. <div v-if="scope.row.havebutton == 0" style="background: #009A69;color:#fff;line-height:30px;">否</div>
  105. <div v-else style="background: #FC2323;color:#000 ;line-height:30px;">是</div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="班次" min-width="80px" align="center">
  109. <template slot-scope="scope">
  110. <span>{{ scope.row.times }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="理论量" min-width="80px" align="center">
  114. <template slot-scope="scope">
  115. <span>{{ scope.row.lweight }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="启用" min-width="70px" align="center">
  119. <template slot-scope="scope">
  120. <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)" />
  121. <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)" />
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="时间" min-width="80px" align="center">
  125. <template slot-scope="scope">
  126. <span>{{ scope.row.plantime }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="配方名称" min-width="100px" align="center">
  130. <template slot-scope="scope">
  131. <b style="font-size: 26px;line-height: 30px;">{{ scope.row.ftname }}</b>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="牛头数" min-width="80px" align="center">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.cowcount }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="描述" min-width="80px" align="center">
  140. <template slot-scope="scope">
  141. <span>{{ scope.row.display }}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="发料位" min-width="80px" align="left">
  145. <template slot-scope="scope">
  146. <span>{{ scope.row.barnames }}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" width="100" label="操作" class-name="small-padding fixed-width" fixed="right">
  150. <template slot-scope="{row}">
  151. <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  152. <el-button class="miniDanger" icon="el-icon-sort" @click="handleRowSort(row)" />
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  157. </div>
  158. </div>
  159. <!-- maxHeight="enlargeHeight -->
  160. <div v-if="isDetail" style="position: relative;">
  161. <el-button class="hide" @click="handleCloseTable2" style="position: absolute;right: 0;top: -20px;">隐藏</el-button>
  162. <!-- 预混料 -->
  163. <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
  164. <el-row :gutter="20">
  165. <el-col :span="12">
  166. <div class="table2">
  167. <div class="contentOperation">
  168. <p>计划详情</p>
  169. </div>
  170. <div class="content-table">
  171. <el-table
  172. :key="table2.tableKey"
  173. v-loading="table2.listLoading"
  174. element-loading-text="给我一点时间"
  175. :data="table2.list"
  176. fit
  177. border
  178. highlight-current-row
  179. style="width: 100%;"
  180. height="450"
  181. :row-style="rowStyle"
  182. :cell-style="cellStyle"
  183. class="elTable table-fixed"
  184. :span-method="objectSpanMethod"
  185. >
  186. <el-table-column label="操作序号" width="90px" align="center">
  187. <template slot-scope="scope">
  188. <span>{{ scope.row.sort }}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  192. <template slot-scope="scope">
  193. <span>{{ scope.row.fname }}</span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  197. <template slot-scope="scope">
  198. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  199. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  203. <template slot-scope="scope">
  204. <span>{{ scope.row.subtotal }}</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  208. <template slot-scope="{row}">
  209. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  210. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  211. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  212. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  213. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  214. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  215. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  216. <svg-icon icon-class="clear" />
  217. </el-button>
  218. </template>
  219. </el-table-column>
  220. </el-table>
  221. </div>
  222. </div>
  223. </el-col>
  224. </el-row>
  225. </div>
  226. <!-- 撒料 -->
  227. <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
  228. <el-row :gutter="20">
  229. <el-col :span="12">
  230. <div class="table2">
  231. <div class="contentOperation">
  232. <p>计划详情</p>
  233. </div>
  234. <div class="content-table">
  235. <el-table
  236. :key="table2.tableKey"
  237. v-loading="table2.listLoading"
  238. element-loading-text="给我一点时间"
  239. :data="table2.list"
  240. fit
  241. border
  242. highlight-current-row
  243. style="width: 100%;"
  244. height="450"
  245. :row-style="rowStyle"
  246. :cell-style="cellStyle"
  247. class="elTable table-fixed"
  248. :span-method="objectSpanMethod"
  249. >
  250. <el-table-column label="操作序号" min-width="90px" align="center">
  251. <template slot-scope="scope">
  252. <span>{{ scope.row.sort }}</span>
  253. </template>
  254. </el-table-column>
  255. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  256. <template slot-scope="scope">
  257. <span>{{ scope.row.fname }}</span>
  258. </template>
  259. </el-table-column>
  260. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  261. <template slot-scope="scope">
  262. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  263. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  267. <template slot-scope="scope">
  268. <span>{{ scope.row.subtotal }}</span>
  269. </template>
  270. </el-table-column>
  271. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  272. <template slot-scope="{row}">
  273. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  274. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  275. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  276. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  277. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  278. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  279. <svg-icon icon-class="clear" />
  280. </el-button>
  281. </template>
  282. </el-table-column>
  283. </el-table>
  284. </div>
  285. </div>
  286. </el-col>
  287. <el-col :span="12">
  288. <div class="table3">
  289. <div class="contentOperation">
  290. <p>栏舍详情</p>
  291. </div>
  292. <div class="content-table">
  293. <el-table
  294. :key="table3.tableKey"
  295. v-loading="table3.listLoading"
  296. element-loading-text="给我一点时间"
  297. :data="table3.list"
  298. height="450"
  299. fit
  300. border
  301. highlight-current-row
  302. style="width: 100%;"
  303. :row-style="rowStyle"
  304. :cell-style="cellStyle"
  305. class="elTable table-fixed"
  306. >
  307. <el-table-column label=" 操作序号" min-width="90px" align="center">
  308. <template slot-scope="scope">
  309. <span>{{ scope.row.sort }}</span>
  310. </template>
  311. </el-table-column>
  312. <el-table-column label="栏舍" min-width="90px" align="center">
  313. <template slot-scope="scope">
  314. <span>{{ scope.row.fname }}</span>
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  318. <template slot-scope="scope">
  319. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  320. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  321. </template>
  322. </el-table-column>
  323. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  324. <template slot-scope="{row}">
  325. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  326. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'1')" />
  327. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  328. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  329. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  330. <e<el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  331. <svg-icon icon-class="clear" />
  332. </el-button>
  333. </template>
  334. </el-table-column>
  335. </el-table>
  336. </div>
  337. </div>
  338. </el-col>
  339. </el-row>
  340. </div>
  341. <!-- 剩料 -->
  342. <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
  343. <el-row :gutter="20">
  344. <el-col :span="12"><div class="table2">
  345. <div class="contentOperation">
  346. <p>计划详情</p>
  347. </div>
  348. <div class="content-table">
  349. <el-table
  350. :key="table2.tableKey"
  351. v-loading="table2.listLoading"
  352. element-loading-text="给我一点时间"
  353. :data="table2.list"
  354. fit
  355. border
  356. highlight-current-row
  357. style="width: 100%;"
  358. height="450"
  359. :row-style="rowStyle"
  360. :cell-style="cellStyle"
  361. class="elTable table-fixed"
  362. :span-method="objectSpanMethod"
  363. >
  364. <el-table-column label="操作序号" min-width="130px" align="center">
  365. <template slot-scope="scope">
  366. <span>{{ scope.row.sort }}</span>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="取料栏舍" prop="fname" min-width="130px" align="center">
  370. <template slot-scope="scope">
  371. <span>{{ scope.row.fname }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column label="处理方式" prop="useinbar" min-width="130px" align="center">
  375. <template slot-scope="scope">
  376. <span>{{ scope.row.useinbar }}</span>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  380. <template slot-scope="scope">
  381. <span>{{ scope.row.subtotal }}</span>
  382. </template>
  383. </el-table-column>
  384. </el-table>
  385. </div>
  386. </div>
  387. </el-col>
  388. <el-col :span="12">
  389. <div class="table3">
  390. <div class="contentOperation">
  391. <p>栏舍详情</p>
  392. </div>
  393. <div class="content-table">
  394. <el-table
  395. :key="table3.tableKey"
  396. v-loading="table3.listLoading"
  397. element-loading-text="给我一点时间"
  398. :data="table3.list"
  399. height="450"
  400. fit
  401. border
  402. highlight-current-row
  403. style="width: 100%;"
  404. :row-style="rowStyle"
  405. :cell-style="cellStyle"
  406. class="elTable table-fixed"
  407. >
  408. <el-table-column label="操作序号" min-width="130px" align="center">
  409. <template slot-scope="scope">
  410. <span>{{ scope.row.sort }}</span>
  411. </template>
  412. </el-table-column>
  413. <el-table-column label="转投栏舍" min-width="130px" align="center">
  414. <template slot-scope="scope">
  415. <span>{{ scope.row.fname }}</span>
  416. </template>
  417. </el-table-column>
  418. </el-table>
  419. </div>
  420. </div>
  421. </el-col>
  422. </el-row>
  423. </div>
  424. <!-- 撒料计划-混料 -->
  425. <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
  426. <el-row :gutter="20">
  427. <el-col :span="12">
  428. <div class="table2">
  429. <div class="contentOperation">
  430. <p>计划详情</p>
  431. </div>
  432. <div class="content-table">
  433. <el-table
  434. :key="table2.tableKey"
  435. v-loading="table2.listLoading"
  436. element-loading-text="给我一点时间"
  437. :data="table2.list"
  438. fit
  439. border
  440. highlight-current-row
  441. style="width: 100%;"
  442. height="450"
  443. :row-style="rowStyle"
  444. :cell-style="cellStyle"
  445. class="elTable table-fixed"
  446. :span-method="objectSpanMethod"
  447. >
  448. <el-table-column label="操作序号" min-width="90px" align="center">
  449. <template slot-scope="scope">
  450. <span>{{ scope.row.sort }}</span>
  451. </template>
  452. </el-table-column>
  453. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  454. <template slot-scope="scope">
  455. <span>{{ scope.row.fname }}</span>
  456. </template>
  457. </el-table-column>
  458. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  459. <template slot-scope="scope">
  460. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  461. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  462. </template>
  463. </el-table-column>
  464. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  465. <template slot-scope="scope">
  466. <span>{{ scope.row.subtotal }}</span>
  467. </template>
  468. </el-table-column>
  469. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  470. <template slot-scope="{row}">
  471. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  472. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  473. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  474. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  475. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  476. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  477. <svg-icon icon-class="clear" />
  478. </el-button>
  479. </template>
  480. </el-table-column>
  481. </el-table>
  482. </div>
  483. </div>
  484. </el-col>
  485. <el-col :span="12">
  486. <div class="table3">
  487. <div class="contentOperation">
  488. <p>栏舍详情</p>
  489. </div>
  490. <div class="content-table">
  491. <el-table
  492. :key="table3.tableKey"
  493. v-loading="table3.listLoading"
  494. element-loading-text="给我一点时间"
  495. :data="table3.list"
  496. height="450"
  497. fit
  498. border
  499. highlight-current-row
  500. style="width: 100%;"
  501. :row-style="rowStyle"
  502. :cell-style="cellStyle"
  503. class="elTable table-fixed"
  504. >
  505. <el-table-column label=" 操作序号" min-width="90px" align="center">
  506. <template slot-scope="scope">
  507. <span>{{ scope.row.sort }}</span>
  508. </template>
  509. </el-table-column>
  510. <el-table-column label="撒料车辆" min-width="90px" align="center">
  511. <template slot-scope="scope">
  512. <span>{{ scope.row.fname }}</span>
  513. </template>
  514. </el-table-column>
  515. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  516. <template slot-scope="scope">
  517. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  518. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  522. <template slot-scope="{row}">
  523. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  524. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'1')" />
  525. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  526. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  527. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  528. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  529. <svg-icon icon-class="clear" />
  530. </el-button>
  531. </template>
  532. </el-table-column>
  533. </el-table>
  534. </div>
  535. </div>
  536. </el-col>
  537. </el-row>
  538. </div>
  539. <!-- 撒料计划-撒料 -->
  540. <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
  541. <el-row :gutter="20">
  542. <el-col :span="12">
  543. <div class="table3">
  544. <div class="contentOperation">
  545. <p>栏舍详情</p>
  546. </div>
  547. <div class="content-table">
  548. <el-table
  549. :key="table3.tableKey"
  550. v-loading="table3.listLoading"
  551. element-loading-text="给我一点时间"
  552. :data="table3.list"
  553. height="450"
  554. fit
  555. border
  556. highlight-current-row
  557. style="width: 100%;"
  558. :row-style="rowStyle"
  559. :cell-style="cellStyle"
  560. class="elTable table-fixed"
  561. >
  562. <el-table-column label="操作序号" min-width="90px" align="center">
  563. <template slot-scope="scope">
  564. <span>{{ scope.row.sort }}</span>
  565. </template>
  566. </el-table-column>
  567. <el-table-column label="撒料车辆" min-width="90px" align="center">
  568. <template slot-scope="scope">
  569. <span>{{ scope.row.fname }}</span>
  570. </template>
  571. </el-table-column>
  572. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  573. <template slot-scope="scope">
  574. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  575. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  576. </template>
  577. </el-table-column>
  578. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  579. <template slot-scope="scope">
  580. <span>{{ scope.row.subtotal }}</span>
  581. </template>
  582. </el-table-column>
  583. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  584. <template slot-scope="{row}">
  585. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  586. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'0')" />
  587. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  588. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  589. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  590. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  591. <svg-icon icon-class="clear" />
  592. </el-button>
  593. </template>
  594. </el-table-column>
  595. </el-table>
  596. </div>
  597. </div>
  598. </el-col>
  599. <el-col :span="12">
  600. <div class="table2">
  601. <div class="contentOperation">
  602. <p>计划详情</p>
  603. </div>
  604. <div class="content-table">
  605. <el-table
  606. :key="table2.tableKey"
  607. v-loading="table2.listLoading"
  608. element-loading-text="给我一点时间"
  609. :data="table2.list"
  610. fit
  611. border
  612. highlight-current-row
  613. style="width: 100%;"
  614. height="450"
  615. :row-style="rowStyle"
  616. :cell-style="cellStyle"
  617. class="elTable table-fixed"
  618. >
  619. <el-table-column label="操作序号" min-width="90px" align="center">
  620. <template slot-scope="scope">
  621. <span>{{ scope.row.sort }}</span>
  622. </template>
  623. </el-table-column>
  624. <el-table-column label="栏舍名称" prop="fname" min-width="90px" align="center">
  625. <template slot-scope="scope">
  626. <span>{{ scope.row.fname }}</span>
  627. </template>
  628. </el-table-column>
  629. <el-table-column label="设计重量(KG)" prop="weight" width="130px" align="center">
  630. <template slot-scope="scope">
  631. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  632. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  633. </template>
  634. </el-table-column>
  635. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  636. <template slot-scope="{row}">
  637. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  638. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'1')" />
  639. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  640. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  641. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  642. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  643. <svg-icon icon-class="clear" />
  644. </el-button>
  645. </template>
  646. </el-table-column>
  647. </el-table>
  648. </div>
  649. </div>
  650. </el-col>
  651. </el-row>
  652. </div>
  653. </div>
  654. <!-- 新生成 -->
  655. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  656. <div class="newGeneration" v-loading="newGenerationLoading" >
  657. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  658. <el-row v-if="newGeneration.dialogStatus== 'newGeneration'">
  659. <el-col :span="24">
  660. <el-form-item label="时间范围:" prop="inputDatetime">
  661. <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" />
  662. </el-form-item>
  663. </el-col>
  664. </el-row>
  665. <el-row v-else>
  666. <el-col :span="24">
  667. <el-form-item label="时间范围:" prop="copyInputDatetime">
  668. <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" />
  669. </el-form-item>
  670. </el-col>
  671. </el-row>
  672. <p v-if="newGeneration.temp.tips == true || newGeneration.dialogStatus == 'copy'" style="font-weight: 700;color: red;text-align: center;">注:撒料计划中存在未分配完栏舍,如下所示;建议及时进行分配</p>
  673. <div style="height: 200px;overflow: auto;">
  674. <div v-if="myMaxTimes == 1">
  675. <div>第一班:</div>
  676. <div v-for="(item,index) in tipsList.one" :key="index+'A'" >
  677. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  678. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  679. <span v-for="(item2,index2) in item.arrList" :key="index2+'a'">
  680. {{item2.barname}}
  681. </span>
  682. </span>
  683. </div>
  684. </div>
  685. <div v-else-if="myMaxTimes == 2">
  686. <div>第一班:</div>
  687. <div v-for="(item,index) in tipsList.one" :key="index+'B'" >
  688. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  689. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  690. <span v-for="(item2,index2) in item.arrList" :key="index2+'b'">
  691. {{item2.barname}}
  692. </span>
  693. </span>
  694. </div>
  695. <div>第二班:</div>
  696. <div v-for="(item,index) in tipsList.two" :key="index+'C'" >
  697. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  698. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  699. <span v-for="(item2,index2) in item.arrList" :key="index2+'c'">
  700. {{item2.barname}}
  701. </span>
  702. </span>
  703. </div>
  704. </div>
  705. <div v-else-if="myMaxTimes == 3">
  706. <div>第一班:</div>
  707. <div v-for="(item,index) in tipsList.one" :key="index+'D'" >
  708. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  709. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  710. <span v-for="(item2,index2) in item.arrList" :key="index2+'d'">
  711. {{item2.barname}}
  712. </span>
  713. </span>
  714. </div>
  715. <div>第二班:</div>
  716. <div v-for="(item,index) in tipsList.two" :key="index+'E'" >
  717. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  718. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  719. <span v-for="(item2,index2) in item.arrList" :key="index2+'e'">
  720. {{item2.barname}}
  721. </span>
  722. </span>
  723. </div>
  724. <div>第三班:</div>
  725. <div v-for="(item,index) in tipsList.three" :key="index+'F'" >
  726. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  727. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  728. <span v-for="(item2,index2) in item.arrList" :key="index2+'f'">
  729. {{item2.barname}}
  730. </span>
  731. </span>
  732. </div>
  733. </div>
  734. <div v-else>
  735. <div>第一班:</div>
  736. <div v-for="(item,index) in tipsList.one" :key="index+'G'" >
  737. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  738. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  739. <span v-for="(item2,index2) in item.arrList" :key="index2+'g'">
  740. {{item2.barname}}
  741. </span>
  742. </span>
  743. </div>
  744. <div>第二班:</div>
  745. <div v-for="(item,index) in tipsList.two" :key="index+'H'" >
  746. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  747. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  748. <span v-for="(item2,index2) in item.arrList" :key="index2+'h'">
  749. {{item2.barname}}
  750. </span>
  751. </span>
  752. </div>
  753. <div>第三班:</div>
  754. <div v-for="(item,index) in tipsList.three" :key="index+'I'" >
  755. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  756. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  757. <span v-for="(item2,index2) in item.arrList" :key="index2+'i'">
  758. {{item2.barname}}
  759. </span>
  760. </span>
  761. </div>
  762. <div>第四班:</div>
  763. <div v-for="(item,index) in tipsList.four" :key="index+'J'" >
  764. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  765. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  766. <span v-for="(item2,index2) in item.arrList" :key="index2+'j'">
  767. {{item2.barname}}
  768. </span>
  769. </span>
  770. </div>
  771. </div>
  772. </div>
  773. </el-form>
  774. <div slot="footer" class="dialog-footer" style="bottom:20px">
  775. <el-button class="cancelClose" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  776. <el-button v-if="newGeneration.dialogStatus== 'newGeneration'" class="save" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  777. <el-button v-else class="save" :disabled="isokDisable" @click="copyData()">确认</el-button>
  778. </div>
  779. </div>
  780. </el-dialog>
  781. <!-- 历史记录 -->
  782. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  783. <template slot="title">
  784. <div class="avue-crud__dialog__header">
  785. <span class="el-dialog__title">
  786. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  787. {{ textMap[historyRecord.dialogStatus] }}
  788. </span>
  789. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  790. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  791. <svg-icon v-else icon-class="fullscreen" />
  792. </div>
  793. </div>
  794. </template>
  795. <div class="historyRecord">
  796. <keep-alive>
  797. <component :is="historyRecord.myComponent" ref="historyRecord" />
  798. </keep-alive>
  799. </div>
  800. <div slot="footer" class="dialog-footer">
  801. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  802. </div>
  803. </el-dialog>
  804. <!-- 正在同步中 -->
  805. <el-dialog :destroy-on-close="true" :visible.sync="dataSynchronization.dialogFormVisible" :close-on-click-modal="false" width="30%">
  806. <div class="dataSynchronization" style="text-align: center;font-size: 18px;">
  807. <i class="el-icon-loading" />
  808. <span>正在同步</span>
  809. <div slot="footer" class="dialog-footer" style="bottom:10px">
  810. <el-button class="miniPrimary" @click="dataSynchronization.dialogFormVisible = false;">确认</el-button>
  811. </div>
  812. </div>
  813. </el-dialog>
  814. <!-- 修改计划 -->
  815. <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
  816. <!-- 删除记录 -->
  817. <el-dialog :title="textMap[deleteRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="deleteRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  818. <div class="deleteRecord">
  819. <div class="search">
  820. <el-date-picker v-model="deleteRecord.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDeleteRecordDate" />
  821. </div>
  822. <div class="table">
  823. <el-table
  824. :key="deleteRecord.tableKey"
  825. v-loading="deleteRecord.listLoading"
  826. element-loading-text="给我一点时间"
  827. :data="deleteRecord.list"
  828. border
  829. fit
  830. highlight-current-row
  831. style="width: 98%;"
  832. row-key="sort"
  833. :row-style="rowStyle"
  834. :cell-style="cellStyle"
  835. class="elTable table-fixed"
  836. :height="370"
  837. >
  838. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  839. <el-table-column label="计划名称" min-width="90px" align="center" prop="projname" />
  840. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  841. <el-table-column label="TMR编号" min-width="90px" align="center" prop="tmrtname" />
  842. <el-table-column label="驾驶员" min-width="90px" align="center" prop="driver" />
  843. <el-table-column label="已执行" min-width="70px" align="center">
  844. <template slot-scope="scope">
  845. <span v-if="scope.row.havebutton == 0">否</span>
  846. <span v-else>是</span>
  847. </template>
  848. </el-table-column>
  849. <el-table-column label="班次" min-width="80px" align="center" prop="times" />
  850. <el-table-column label="理论量" min-width="80px" align="center" prop="lweight" />
  851. <el-table-column label="启用" min-width="70px" align="center">
  852. <template slot-scope="scope">
  853. <el-switch v-if="dataDisabled == false" disabled v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  854. <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)" />
  855. </template>
  856. </el-table-column>
  857. <el-table-column label="时间" min-width="80px" align="center" prop="plantime" />
  858. <el-table-column label="配方名称" min-width="100px" align="center" prop="ftname" />
  859. <el-table-column label="牛头数" min-width="80px" align="center" prop="cowcount" />
  860. <el-table-column label="描述" min-width="80px" align="center" prop="display" />
  861. <el-table-column label="发料位" min-width="80px" align="left" prop="barnames" />
  862. </el-table>
  863. <span v-if="deleteRecord.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ deleteRecord.total }}条</span>
  864. </div>
  865. <div slot="footer" class="dialog-footer" style="bottom:20px">
  866. <el-button class="cancelClose1" @click="deleteRecord.dialogFormVisible = false;getList()">取消</el-button>
  867. </div>
  868. </div>
  869. </el-dialog>
  870. <el-dialog :title="textMap[sapUpload.dialogStatus]" :destroy-on-close="true" :visible.sync="sapUpload.dialogFormVisible" :close-on-click-modal="false" width="30%">
  871. <div class="sapUpload">
  872. <el-form ref="sapUpload" :rules="sapUpload.rules" :model="sapUpload.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  873. <el-row>
  874. <el-col :span="24">
  875. <el-form-item label="时间:" prop="date">
  876. <el-date-picker v-model="sapUpload.temp.date" :clearable="false" class="filter-item" type="date" />
  877. </el-form-item>
  878. </el-col>
  879. </el-row>
  880. </el-form>
  881. <div slot="footer" class="dialog-footer" style="bottom:20px">
  882. <el-button class="cancelClose" @click="sapUpload.dialogFormVisible = false;getList()">取消</el-button>
  883. <el-button class="save" v-if="sapUpload.dialogStatus == 'sapUpload'" :disabled="isokDisable" @click="sapUploadData()">确认</el-button>
  884. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload1'" :disabled="isokDisable" @click="udData1()">确认</el-button>
  885. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload2'" :disabled="isokDisable" @click="udData2()">确认</el-button>
  886. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload3'" :disabled="isokDisable" @click="udData3()">确认</el-button>
  887. </div>
  888. </div>
  889. </el-dialog>
  890. </div>
  891. </template>
  892. <script>
  893. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, getDorm, GetReportform, checkButtons,postJson,postJson2,SyncSCJH } from '@/api/common'
  894. import RevisePlan from './revisePlan.vue'
  895. import printJS from 'print-js'
  896. import { parseTime, json2excel,handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  897. import Cookies from 'js-cookie'
  898. import Sortable from 'sortablejs'
  899. import { MessageBox } from 'element-ui'
  900. export default {
  901. name: 'DailyExecutionPlan',
  902. components: {
  903. RevisePlan
  904. },
  905. data() {
  906. return {
  907. myheight: document.documentElement.clientHeight - 280,
  908. // myheight: 500,
  909. enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  910. isDetail:false,
  911. newGenerationLoading:false,
  912. dialogFull: false,
  913. isRoleEdit: [],
  914. dataDisabled: false,
  915. requestParams: [
  916. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  917. ],
  918. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  919. printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  920. frequencyList: [], // 班次
  921. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  922. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
  923. iscompletedList: [{ lable: '是', value: '1' },{ lable: '否', value: '0' } ],
  924. // 班次
  925. maxTime: {
  926. getMaxTimesParm: {
  927. name: 'getSysoptEnable',
  928. page: 1,
  929. offset: 1,
  930. pagecount: 1,
  931. returntype: 'Map',
  932. parammaps: {
  933. pastureid: Cookies.get('pastureid'),
  934. inforname: 'times'
  935. }
  936. }
  937. },
  938. isOrder: true,
  939. table: {
  940. getdataListParm: {
  941. name: 'getDownloadedplanList',
  942. page: 1,
  943. offset: 1,
  944. pagecount: '',
  945. returntype: 'Map',
  946. parammaps: {
  947. pastureid: Cookies.get('pastureid'),
  948. barid: '',
  949. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  950. times: '',
  951. lpplantype: '',
  952. printType: '',
  953. plandimen: '0',
  954. enable3: '0',
  955. iscompleted:"",
  956. tmrname:"",
  957. }
  958. },
  959. tableKey: 0,
  960. list: [],
  961. total: 0,
  962. listLoading: false
  963. },
  964. // 计划内容操作详情
  965. table2: {
  966. getdataListParm: {
  967. name: 'getDownloadplandtl1ListV2',
  968. page: 1,
  969. offset: 1,
  970. returntype: 'Map',
  971. parammaps: {
  972. pastureid: Cookies.get('pastureid'),
  973. date: '',
  974. id: ''
  975. }
  976. },
  977. tableKey: 0,
  978. list: [],
  979. total: 0,
  980. listLoading: false
  981. },
  982. // 计划内容 舍栏详情
  983. table3: {
  984. getdataListParm: {
  985. name: 'getDownloadplandt2ListV2',
  986. page: 1,
  987. offset: 1,
  988. returntype: 'Map',
  989. parammaps: {
  990. pastureid: Cookies.get('pastureid'),
  991. date: '',
  992. id: ''
  993. }
  994. },
  995. tableKey: 0,
  996. list: [],
  997. total: 0,
  998. listLoading: false
  999. },
  1000. // 新生成
  1001. newGeneration: {
  1002. dialogFormVisible: false,
  1003. dialogStatus: '',
  1004. getdataListParm: {
  1005. name: 'checkLLPIsDistribution',
  1006. page: 1,
  1007. offset: 1,
  1008. pagecount: 1,
  1009. returntype: 'Map',
  1010. parammaps: {
  1011. pastureid: Cookies.get('pastureid')
  1012. }
  1013. },
  1014. temp: {
  1015. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
  1016. tips:''
  1017. },
  1018. rules: {
  1019. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
  1020. copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  1021. }
  1022. },
  1023. pickerMinDate: '',
  1024. pickerOptions: {
  1025. onPick: ({ maxDate, minDate }) => {
  1026. this.pickerMinDate = minDate.getTime()
  1027. if (maxDate) {
  1028. this.pickerMinDate = ''
  1029. }
  1030. },
  1031. disabledDate: (time) => {
  1032. if (this.pickerMinDate !== '') {
  1033. const one = 31 * 24 * 3600 * 1000
  1034. const minTime = this.pickerMinDate
  1035. const maxTime = this.pickerMinDate + one
  1036. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  1037. }
  1038. return time.getTime() < Date.now() - 8.64e7
  1039. }
  1040. },
  1041. pickerOptions2: {
  1042. onPick: ({ maxDate, minDate }) => {
  1043. this.pickerMinDate = minDate.getTime()
  1044. if (maxDate) {
  1045. this.pickerMinDate = ''
  1046. }
  1047. },
  1048. disabledDate: (time) => {
  1049. if (this.pickerMinDate !== '') {
  1050. const one = 14 * 24 * 3600 * 1000
  1051. const minTime = this.pickerMinDate
  1052. const maxTime = this.pickerMinDate + one
  1053. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  1054. }
  1055. return time.getTime() < Date.now() - 8.64e7
  1056. }
  1057. },
  1058. historyRecord: {
  1059. dialogFormVisible: false,
  1060. dialogStatus: '',
  1061. myComponent: null
  1062. },
  1063. dataSynchronization: {
  1064. dialogFormVisible: false,
  1065. dialogStatus: '',
  1066. getdataListParm: {
  1067. name: 'getSysoptEnable',
  1068. page: 1,
  1069. offset: 1,
  1070. pagecount: 1,
  1071. returntype: 'Map',
  1072. parammaps: {
  1073. pastureid: Cookies.get('pastureid'),
  1074. inforname: 'isDataSync'
  1075. }
  1076. },
  1077. isDataSynchronization: false
  1078. },
  1079. dataSynchronization2: {
  1080. dialogFormVisible: false,
  1081. dialogStatus: '',
  1082. getdataListParm: {
  1083. name: 'getSysoptEnable',
  1084. page: 1,
  1085. offset: 1,
  1086. pagecount: 1,
  1087. returntype: 'Map',
  1088. parammaps: {
  1089. pastureid: Cookies.get('pastureid'),
  1090. inforname: 'zcSync'
  1091. }
  1092. },
  1093. isDataSynchronization: false
  1094. },
  1095. dataSynchronization3: {
  1096. dialogFormVisible: false,
  1097. dialogStatus: '',
  1098. getdataListParm: {
  1099. name: 'getSysoptEnable',
  1100. page: 1,
  1101. offset: 1,
  1102. pagecount: 1,
  1103. returntype: 'Map',
  1104. parammaps: {
  1105. pastureid: Cookies.get('pastureid'),
  1106. inforname: 'wgSap'
  1107. }
  1108. },
  1109. isDataSynchronization: false
  1110. },
  1111. textMap: {
  1112. newGeneration: '新生成',
  1113. historyRecord: '历史记录',
  1114. revisePlan: '修改计划',
  1115. copy: '复制计划',
  1116. deleteRecord:'删除记录',
  1117. sapUpload:'SAP上传',
  1118. udload1:'搅拌数据上传',
  1119. udload2:'剩料上传',
  1120. udload3:'撒料上传',
  1121. },
  1122. isokDisable: false,
  1123. requestParam: {},
  1124. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1125. cellStyle: { padding: 0 + 'px' },
  1126. isShowDialog: false,
  1127. activeName: '栏舍配方',
  1128. parentDate: '',
  1129. downLoad: {
  1130. getdataListParm: {
  1131. name: '',
  1132. page: 1,
  1133. offset: 1,
  1134. pagecount: '',
  1135. returntype: 'Map',
  1136. parammaps: {
  1137. pastureid: Cookies.get('pastureid'),
  1138. date: ''
  1139. }
  1140. },
  1141. list: [],
  1142. labelList: []
  1143. },
  1144. tmrDownList:[],
  1145. getTmrListParam: {
  1146. name: 'getDownloadedplanTmrNameUnfinished',
  1147. page: 1,
  1148. offset: 1,
  1149. pagecount: 10,
  1150. returntype: 'Map',
  1151. parammaps: {
  1152. pastureid: Cookies.get('pastureid'),
  1153. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  1154. }
  1155. },
  1156. myMaxTimes:'',
  1157. tipsList:[],
  1158. spanObj: {},
  1159. mergekeys: ['sort', 'description'],
  1160. deleteRecord:{
  1161. dialogFormVisible: false,
  1162. dialogStatus: '',
  1163. total:0,
  1164. tableKey:0,
  1165. listLoading:false,
  1166. list:[],
  1167. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  1168. },
  1169. selectList: [],
  1170. driverList:[],
  1171. sapUpload:{
  1172. dialogFormVisible: false,
  1173. dialogStatus: '',
  1174. temp:{
  1175. date: parseTime(new Date(), '{y}-{m}-{d}')
  1176. },
  1177. rules: {
  1178. date: [{ required: true, message: '必填', trigger: 'blur' }],
  1179. },
  1180. getdataListParm: {
  1181. name: 'getSysoptEnable',
  1182. page: 1,
  1183. offset: 1,
  1184. pagecount: 1,
  1185. returntype: 'Map',
  1186. parammaps: {
  1187. pastureid: Cookies.get('pastureid'),
  1188. inforname: 'xdmysapupload'
  1189. }
  1190. },
  1191. isSap: false,
  1192. },
  1193. ispalyUd: false
  1194. }
  1195. },
  1196. created() {
  1197. this.getIspalyUd()
  1198. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1199. console.log(this.parentDate, 'this.parentDate')
  1200. this.getDataSynchronization()
  1201. this.getDataSynchronization2()
  1202. this.getDataSynchronization3()
  1203. this.getButtons()
  1204. this.getList()
  1205. this.getDownList()
  1206. this.getIsDisplay()
  1207. this.getIsSap()
  1208. this.getTMRList()
  1209. this.getDriverList()
  1210. },
  1211. mounted() {
  1212. this.getTmrListParam.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
  1213. },
  1214. methods: {
  1215. getDriverList(){
  1216. const url = 'authdata/GetDataByName'
  1217. const data = {
  1218. "name":"getDriverList",
  1219. "page":1,"offset":1,"pagecount":50,
  1220. "returntype":"Map",
  1221. "parammaps":{"pastureid":Cookies.get('pastureid')}
  1222. }
  1223. postJson(url, data).then(response => {
  1224. if(response.data !== null){
  1225. this.driverList = response.data.list
  1226. }else{
  1227. this.driverList = []
  1228. }
  1229. })
  1230. },
  1231. getTMRList(){
  1232. this.getTmrListParam.parammaps.mydate = this.table.getdataListParm.parammaps.mydate
  1233. GetDataByName(this.getTmrListParam).then(response => {
  1234. if (response.data.list !== null) {
  1235. this.tmrDownList = response.data.list
  1236. }
  1237. })
  1238. },
  1239. getButtons() {
  1240. const Edit = 'DailyExecutionPlan'
  1241. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1242. this.isRoleEdit = isRoleEdit
  1243. },
  1244. getDataSynchronization() {
  1245. GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
  1246. // console.log(response.data.list[0])
  1247. if(response.data.list !== null){
  1248. if (response.data.list[0].inforvalue == 0) {
  1249. this.dataSynchronization.isDataSynchronization = false
  1250. } else {
  1251. this.dataSynchronization.isDataSynchronization = true
  1252. }
  1253. }
  1254. })
  1255. },
  1256. getDataSynchronization2() {
  1257. GetDataByName(this.dataSynchronization2.getdataListParm).then(response => {
  1258. if(response.data.list !== null){
  1259. if (response.data.list[0].inforvalue == 0) {
  1260. this.dataSynchronization2.isDataSynchronization = false
  1261. } else {
  1262. this.dataSynchronization2.isDataSynchronization = true
  1263. }
  1264. }
  1265. })
  1266. },
  1267. getDataSynchronization3() {
  1268. GetDataByName(this.dataSynchronization3.getdataListParm).then(response => {
  1269. // console.log(response.data.list[0])
  1270. if (response.data.list[0].inforvalue == 0) {
  1271. this.dataSynchronization3.isDataSynchronization = false
  1272. } else {
  1273. this.dataSynchronization3.isDataSynchronization = true
  1274. }
  1275. })
  1276. },
  1277. form_updata() {
  1278. var send_data = {
  1279. name: 'syncSCJH',
  1280. page: 1,
  1281. offset: 1,
  1282. pagecount: 1,
  1283. returntype: 'Map',
  1284. parammaps: {
  1285. // pastureid: Cookies.get('pastureid'),
  1286. // inforname: 'isDataSync'
  1287. }
  1288. }
  1289. SyncSCJH(send_data).then(response => {
  1290. if (response.msg === 'fail') {
  1291. this.$notify({ title: '上传失败', message: response.data, type: 'warning', duration: 2000 })
  1292. } else {
  1293. this.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  1294. }
  1295. })
  1296. },
  1297. getIsDisplay() {
  1298. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  1299. console.log(response.data.list[0].inforvalue)
  1300. this.myMaxTimes = response.data.list[0].inforvalue
  1301. if (response.data.list[0].inforvalue == 1) {
  1302. this.frequencyList = [{ id: '1', name: '第一班' }]
  1303. } else if (response.data.list[0].inforvalue == 2) {
  1304. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  1305. } else if (response.data.list[0].inforvalue == 3) {
  1306. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  1307. } else if (response.data.list[0].inforvalue == 4) {
  1308. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  1309. } else if (response.data.list[0].inforvalue == 5) {
  1310. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }, { id: '5', name: '第五班' }]
  1311. } else if (response.data.list[0].inforvalue == 6) {
  1312. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }, { id: '5', name: '第五班' }, { id: '6', name: '第六班' }]
  1313. }
  1314. })
  1315. },
  1316. getDownList() {
  1317. GetDataByNames(this.requestParams).then(response => {
  1318. // this.livestockTypeList = response.data.getDictByName.list
  1319. })
  1320. },
  1321. // -------------------日执行计划-----------------------------
  1322. handleBefore() {
  1323. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1324. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1325. var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
  1326. // var start = this.table.getdataListParm.parammaps.mydate - 1
  1327. this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
  1328. // this.$forceUpdate()
  1329. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1330. this.getTMRList()
  1331. this.getList()
  1332. }
  1333. var d = this.table.getdataListParm.parammaps.mydate
  1334. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1335. if (d < curDate) {
  1336. this.dataDisabled = true
  1337. } else {
  1338. this.dataDisabled = false
  1339. }
  1340. console.log(this.dataDisabled)
  1341. },
  1342. handleNext() {
  1343. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1344. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1345. var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
  1346. this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
  1347. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1348. this.getTMRList()
  1349. this.getList()
  1350. }
  1351. var d = this.table.getdataListParm.parammaps.mydate
  1352. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1353. if (d < curDate) {
  1354. this.dataDisabled = true
  1355. } else {
  1356. this.dataDisabled = false
  1357. }
  1358. console.log(this.dataDisabled)
  1359. },
  1360. getList() {
  1361. this.table.listLoading = true
  1362. GetDataByName(this.table.getdataListParm).then(response => {
  1363. console.log('table数据', response.data.list)
  1364. if (response.data.list !== null) {
  1365. // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
  1366. // response.data.list[6] = obj
  1367. this.getIsColor(response.data.list)
  1368. this.table.list = response.data.list
  1369. this.table.pageNum = response.data.pageNum
  1370. this.table.pageSize = response.data.pageSize
  1371. this.table.total = response.data.total
  1372. console.log('计划类型', response.data.list[0].lpplantype)
  1373. this.table2.getdataListParm.parammaps.havebutton = response.data.list[0].havebutton
  1374. this.table3.getdataListParm.parammaps.havebutton = response.data.list[0].havebutton
  1375. if (response.data.list[0].lpplantype == 0) {
  1376. // 撒料
  1377. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1378. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1379. this.table2.getdataListParm.parammaps.useinbartype = ''
  1380. this.table3.getdataListParm.parammaps.useinbartype = ''
  1381. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1382. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1383. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1384. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1385. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1386. this.getList2()
  1387. this.getList3()
  1388. } else if (response.data.list[0].lpplantype == 1) {
  1389. // 撒料计划-混料
  1390. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1391. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1392. this.table2.getdataListParm.parammaps.useinbartype = ''
  1393. this.table3.getdataListParm.parammaps.useinbartype = ''
  1394. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1395. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1396. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1397. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1398. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1399. this.getList2()
  1400. this.getList3()
  1401. } else if (response.data.list[0].lpplantype == 2) {
  1402. // 撒料计划-撒料
  1403. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1404. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1405. this.table2.getdataListParm.parammaps.useinbartype = ''
  1406. this.table3.getdataListParm.parammaps.useinbartype = ''
  1407. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1408. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1409. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1410. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1411. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1412. this.getList2()
  1413. this.getList3()
  1414. } else if (response.data.list[0].lpplantype == 3) {
  1415. // 剩料
  1416. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1417. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1418. this.table2.getdataListParm.parammaps.useinbartype = 0
  1419. this.table3.getdataListParm.parammaps.useinbartype = 1
  1420. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1421. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1422. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1423. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1424. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1425. this.getList2()
  1426. this.getList3()
  1427. } else if (response.data.list[0].lpplantype == 4) {
  1428. // 预混
  1429. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1430. this.table2.getdataListParm.parammaps.useinbartype = ''
  1431. this.table3.getdataListParm.parammaps.useinbartype = ''
  1432. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1433. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1434. this.getList2()
  1435. } else if (response.data.list[0].lpplantype == 5) {
  1436. // 预称重计划
  1437. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1438. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1439. this.table2.getdataListParm.parammaps.useinbartype = ''
  1440. this.table3.getdataListParm.parammaps.useinbartype = ''
  1441. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1442. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1443. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1444. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1445. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1446. this.getList2()
  1447. this.getList3()
  1448. }
  1449. } else {
  1450. this.table.list = []
  1451. this.table3.getdataListParm.parammaps.lpplantype = ''
  1452. this.table2.getdataListParm.parammaps.id = ''
  1453. this.table3.getdataListParm.parammaps.id = ''
  1454. // this.getList2()
  1455. // this.getList3()
  1456. this.table2.list = []
  1457. this.table3.list = []
  1458. }
  1459. setTimeout(() => {
  1460. this.table.listLoading = false
  1461. }, 100)
  1462. })
  1463. },
  1464. form_search() {
  1465. this.getTMRList()
  1466. this.table.getdataListParm.offset = 1
  1467. this.getList()
  1468. },
  1469. handleEnableChange(row) {
  1470. this.requestParam.name = 'updatedownloadenable'
  1471. this.requestParam.parammaps = {}
  1472. this.requestParam.parammaps.pastureid = row.pastureid
  1473. this.requestParam.parammaps.id = row.id
  1474. this.requestParam.parammaps.enable = row.enable
  1475. PostDataByName(this.requestParam).then(response => {
  1476. if (response.msg === 'fail') {
  1477. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1478. } else {
  1479. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1480. this.getList()
  1481. }
  1482. })
  1483. },
  1484. getIsColor(arr) {
  1485. var map = {}
  1486. var dest = []
  1487. for (var i = 0; i < arr.length; i++) {
  1488. var ai = arr[i]
  1489. if (!map[ai.pid]) {
  1490. dest.push({
  1491. pid: ai.pid,
  1492. data: [ai]
  1493. })
  1494. map[ai.pid] = ai
  1495. } else {
  1496. for (var j = 0; j < dest.length; j++) {
  1497. var dj = dest[j]
  1498. if (dj.pid == ai.pid) {
  1499. dj.data.push(ai)
  1500. break
  1501. }
  1502. }
  1503. }
  1504. }
  1505. console.log(dest)
  1506. var newArr1 = []
  1507. for (var i = 0; i < dest.length; i++) {
  1508. var newArr = dest[i].data
  1509. for (var j = 0; j < dest[i].data.length; j++) {
  1510. dest[i].data[j].isColor = i
  1511. newArr1.push(dest[i].data[j])
  1512. }
  1513. }
  1514. console.log(newArr1)
  1515. this.table.list = newArr1
  1516. },
  1517. tableRowClassName({ row }) {
  1518. if (row.isColor % 2 == 0) {
  1519. return 'warning-row'
  1520. } else {
  1521. return 'success-row'
  1522. }
  1523. },
  1524. lpplantype: function(cellValue) {
  1525. if (cellValue.lpplantype == 0) {
  1526. return '撒料计划'
  1527. } else if (cellValue.lpplantype == 1) {
  1528. return '撒料计划-混料'
  1529. } else if (cellValue.lpplantype == 2) {
  1530. return '撒料计划-撒料'
  1531. } else if (cellValue.lpplantype == 3) {
  1532. return '剩料计划'
  1533. } else if (cellValue.lpplantype == 4) {
  1534. return '预混计划'
  1535. } else if (cellValue.lpplantype == 5) {
  1536. return '预称重计划'
  1537. }
  1538. },
  1539. changeDate(val) {
  1540. console.log('选择了日期', val)
  1541. this.getList()
  1542. // this.getList2()
  1543. // this.getList3()
  1544. var d = this.table.getdataListParm.parammaps.mydate
  1545. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1546. if (d < curDate) {
  1547. this.dataDisabled = true
  1548. } else {
  1549. this.dataDisabled = false
  1550. }
  1551. console.log(this.dataDisabled)
  1552. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1553. console.log(this.parentDate, 'this.parentDate')
  1554. },
  1555. changePlanType(val) {
  1556. console.log('选择了计划类型', val)
  1557. this.getList()
  1558. this.getList2()
  1559. this.getList3()
  1560. },
  1561. changeFrequency(val) {
  1562. console.log('选择了班次', val)
  1563. this.getList()
  1564. this.getList2()
  1565. this.getList3()
  1566. },
  1567. // 日执行计划行点击
  1568. tableRowClick(row, column, event) {
  1569. console.log(row, column, event)
  1570. console.log('点击计划类型', row.lpplantype)
  1571. if (this.isOrder == false) {
  1572. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1573. } else {
  1574. if (column.label !== '操作') {
  1575. this.isDetail = true // 点击行显示详情
  1576. this.myheight = document.documentElement.clientHeight - 85 - 265 - 230
  1577. }
  1578. }
  1579. this.table2.getdataListParm.parammaps.havebutton = row.havebutton
  1580. this.table3.getdataListParm.parammaps.havebutton = row.havebutton
  1581. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
  1582. if (row.lpplantype == 0) {
  1583. // 撒料
  1584. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1585. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1586. this.table2.getdataListParm.parammaps.useinbartype = ''
  1587. this.table3.getdataListParm.parammaps.useinbartype = ''
  1588. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1589. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1590. this.table2.getdataListParm.parammaps.id = row.id
  1591. this.table3.getdataListParm.parammaps.id = row.id
  1592. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1593. this.getList2()
  1594. this.getList3()
  1595. } else if (row.lpplantype == 1) {
  1596. // 撒料计划-混料
  1597. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1598. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1599. this.table2.getdataListParm.parammaps.useinbartype = ''
  1600. this.table3.getdataListParm.parammaps.useinbartype = ''
  1601. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1602. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1603. this.table2.getdataListParm.parammaps.id = row.id
  1604. this.table3.getdataListParm.parammaps.id = row.id
  1605. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1606. this.getList2()
  1607. this.getList3()
  1608. } else if (row.lpplantype == 2) {
  1609. // 撒料计划-撒料
  1610. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1611. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1612. this.table2.getdataListParm.parammaps.useinbartype = ''
  1613. this.table3.getdataListParm.parammaps.useinbartype = ''
  1614. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1615. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1616. this.table2.getdataListParm.parammaps.id = row.id
  1617. this.table3.getdataListParm.parammaps.id = row.id
  1618. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1619. this.getList2()
  1620. this.getList3()
  1621. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1622. } else if (row.lpplantype == 3) {
  1623. // 剩料
  1624. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1625. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1626. this.table2.getdataListParm.parammaps.useinbartype = 0
  1627. this.table3.getdataListParm.parammaps.useinbartype = 1
  1628. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1629. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1630. this.table2.getdataListParm.parammaps.id = row.id
  1631. this.table3.getdataListParm.parammaps.id = row.id
  1632. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1633. this.getList2()
  1634. this.getList3()
  1635. } else if (row.lpplantype == 4) {
  1636. // 预混
  1637. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1638. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1639. this.table2.getdataListParm.parammaps.useinbartype = ''
  1640. this.table3.getdataListParm.parammaps.useinbartype = ''
  1641. this.table2.getdataListParm.parammaps.id = row.id
  1642. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1643. this.getList2()
  1644. } else if (row.lpplantype == 5) {
  1645. // 预称重计划
  1646. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1647. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1648. this.table2.getdataListParm.parammaps.useinbartype = ''
  1649. this.table3.getdataListParm.parammaps.useinbartype = ''
  1650. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1651. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1652. this.table2.getdataListParm.parammaps.id = row.id
  1653. this.table3.getdataListParm.parammaps.id = row.id
  1654. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1655. this.getList2()
  1656. this.getList3()
  1657. }
  1658. this.$forceUpdate()
  1659. },
  1660. handleCloseTable2() {
  1661. this.isDetail = false
  1662. this.myheight = document.documentElement.clientHeight - 280
  1663. },
  1664. // 计划内容操作详情
  1665. getList2() {
  1666. this.table2.listLoading = true
  1667. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1668. GetDataByName(this.table2.getdataListParm).then(response => {
  1669. console.log('table数据', response.data.list)
  1670. if (response.data.list !== null) {
  1671. for (let i = 0; i < response.data.list.length; i++) {
  1672. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1673. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1674. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1675. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1676. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1677. }
  1678. this.table2.list = response.data.list
  1679. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1680. if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
  1681. const arr = []
  1682. var a = 0
  1683. let b = this.table2.list[0].sort
  1684. let c = 0
  1685. for (let i = 0; i < this.table2.list.length; i++) {
  1686. if (b !== parseInt(this.table2.list[i].sort)) {
  1687. b = this.table2.list[i].sort
  1688. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1689. a = 0
  1690. }
  1691. a = a + parseFloat(this.table2.list[i].weight)
  1692. c = c + parseFloat(this.table2.list[i].weight)
  1693. arr.push(this.table2.list[i])
  1694. }
  1695. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1696. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1697. this.table2.list = arr
  1698. }
  1699. if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
  1700. const arr = []
  1701. var aa = 0
  1702. let bb = this.table2.list[0].sort
  1703. let cc = 0
  1704. for (let i = 0; i < this.table2.list.length; i++) {
  1705. if (bb !== parseInt(this.table2.list[i].sort)) {
  1706. bb = this.table2.list[i].sort
  1707. aa = 0
  1708. }
  1709. aa = aa + parseFloat(this.table2.list[i].weight)
  1710. cc = cc + parseFloat(this.table2.list[i].weight)
  1711. arr.push(this.table2.list[i])
  1712. }
  1713. arr.push({ 'sort': '总计', 'weight': cc.toFixed(parseInt(Cookies.get('decimal'))) })
  1714. this.table2.list = arr
  1715. console.log('this.table2.list', this.table2.list)
  1716. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1717. }
  1718. console.log(this.table2.list)
  1719. this.table2.pageNum = response.data.pageNum
  1720. this.table2.pageSize = response.data.pageSize
  1721. this.table2.total = response.data.total
  1722. } else {
  1723. this.table2.list = []
  1724. }
  1725. this.handleSpan()
  1726. setTimeout(() => {
  1727. this.table2.listLoading = false
  1728. }, 100)
  1729. })
  1730. },
  1731. // 计划内容栏舍详情
  1732. getList3() {
  1733. this.table3.listLoading = true
  1734. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1735. GetDataByName(this.table3.getdataListParm).then(response => {
  1736. console.log('table数据', response.data.list)
  1737. if (response.data.list !== null) {
  1738. for (let i = 0; i < response.data.list.length; i++) {
  1739. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1740. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1741. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1742. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1743. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1744. }
  1745. this.table3.list = response.data.list
  1746. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1747. const arr = []
  1748. var a = 0
  1749. let b = this.table3.list[0].sort
  1750. let c = 0
  1751. for (let i = 0; i < this.table3.list.length; i++) {
  1752. if (b !== parseInt(this.table3.list[i].sort)) {
  1753. b = this.table3.list[i].sort
  1754. a = 0
  1755. }
  1756. a = a + parseFloat(this.table3.list[i].weight)
  1757. c = c + parseFloat(this.table3.list[i].weight)
  1758. arr.push(this.table3.list[i])
  1759. }
  1760. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1761. this.table3.list = arr
  1762. }
  1763. this.table3.pageNum = response.data.pageNum
  1764. this.table3.pageSize = response.data.pageSize
  1765. this.table3.total = response.data.total
  1766. } else {
  1767. this.table3.list = []
  1768. }
  1769. setTimeout(() => {
  1770. this.table3.listLoading = false
  1771. }, 100)
  1772. })
  1773. },
  1774. // 新生成
  1775. handleCreate() {
  1776. console.log('点击了新生成')
  1777. this.newGeneration.temp.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  1778. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  1779. console.log('table数据', response.data.list)
  1780. if (response.data.list !== null) {
  1781. if (response.data.list[0].vmsg == '存在未分配') {
  1782. this.newGeneration.temp.tips = true
  1783. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  1784. this.getTips()
  1785. }else{
  1786. this.newGeneration.temp.tips = false
  1787. this.newGeneration.dialogStatus = 'newGeneration'
  1788. this.newGeneration.dialogFormVisible = true
  1789. }
  1790. }
  1791. })
  1792. },
  1793. getTips(){
  1794. const url = 'authdata/feedp/undistribute'
  1795. const data = {}
  1796. // data.times = 1
  1797. data.times = this.myMaxTimes
  1798. data.pastureid = Cookies.get('pastureid')
  1799. this.tipsList = []
  1800. postJson(url, data).then(response => {
  1801. if(response.data !== null){
  1802. this.tipsList = response.data
  1803. // if(this.myMaxTimes == 1){
  1804. // this.tipsList = response.data.one
  1805. // }else if(this.myMaxTimes == 2){
  1806. // this.tipsList.push(response.data.one,response.data.two)
  1807. // }else if(this.myMaxTimes == 3){
  1808. // this.tipsList.push(response.data.one,response.data.two,response.data.three)
  1809. // }else if(this.myMaxTimes == 4){
  1810. // this.tipsList.push(response.data.one,response.data.two,response.data.three,response.data.four)
  1811. // }
  1812. }else{
  1813. this.tipsList = []
  1814. }
  1815. console.log('this.tipsList==>',this.tipsList)
  1816. this.newGeneration.dialogStatus = 'newGeneration'
  1817. this.newGeneration.dialogFormVisible = true
  1818. })
  1819. },
  1820. DateDiff(sDate1, sDate2) {
  1821. console.log(sDate1, sDate2)
  1822. var aDate, oDate1, oDate2, iDays
  1823. aDate = sDate1.split('-')
  1824. oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
  1825. aDate = sDate2.split('-')
  1826. oDate2 = new Date(aDate[0], aDate[1], aDate[2])
  1827. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
  1828. this.newGeneration.temp.days = parseInt(iDays) + 1
  1829. return iDays
  1830. },
  1831. newGenerationData() {
  1832. console.log('点击了新生成保存', this.newGeneration.temp)
  1833. this.newGenerationLoading = true
  1834. this.isokDisable = true
  1835. this.$refs['temp'].validate(valid => {
  1836. if (valid) {
  1837. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  1838. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  1839. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  1840. this.requestParam = {}
  1841. this.requestParam.common = { 'returnmap': '0' }
  1842. this.requestParam.data = []
  1843. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  1844. pastureid: Cookies.get('pastureid'),
  1845. startTime: this.newGeneration.temp.startTime
  1846. }}
  1847. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  1848. pastureid: Cookies.get('pastureid'),
  1849. days: this.newGeneration.temp.days
  1850. }}
  1851. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  1852. pastureid: Cookies.get('pastureid'),
  1853. startTime: this.newGeneration.temp.startTime,
  1854. stopTime: this.newGeneration.temp.stopTime
  1855. }}
  1856. ExecDataByConfig(this.requestParam).then(response => {
  1857. console.log('新生成保存发送参数', this.requestParam)
  1858. if (response.msg === 'fail') {
  1859. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1860. this.isokDisable = false
  1861. this.newGenerationLoading = false
  1862. } else {
  1863. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1864. this.newGeneration.dialogFormVisible = false
  1865. this.getList()
  1866. this.isokDisable = false
  1867. this.newGenerationLoading = false
  1868. }
  1869. })
  1870. }
  1871. })
  1872. },
  1873. // 修改计划
  1874. handleRevisePlan(data) {
  1875. this.dialogFull = false
  1876. var arr = []
  1877. if (this.table.list.length > 0) {
  1878. for (let i = 0; i < this.table.list.length; i++) {
  1879. if (this.table.list[i].havebutton == 1) {
  1880. arr.push(this.table.list[i])
  1881. }
  1882. }
  1883. }
  1884. if (arr.length !== this.table.list.length) {
  1885. console.log('点击了修改计划1', this.activeName)
  1886. this.isShowDialog = true
  1887. this.activeName = '栏舍配方'
  1888. console.log('点击了修改计划2', this.activeName)
  1889. } else {
  1890. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  1891. }
  1892. },
  1893. handleExport() {
  1894. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1895. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  1896. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  1897. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  1898. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  1899. var exportTitle = ''
  1900. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  1901. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1902. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  1903. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1904. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1905. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  1906. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1907. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1908. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  1909. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1910. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1911. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  1912. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1913. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1914. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  1915. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1916. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1917. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  1918. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1919. } else {
  1920. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  1921. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1922. }
  1923. } else {
  1924. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  1925. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  1926. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  1927. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  1928. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  1929. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  1930. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  1931. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  1932. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  1933. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  1934. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  1935. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  1936. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  1937. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  1938. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  1939. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  1940. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  1941. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  1942. } else {
  1943. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  1944. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  1945. }
  1946. }
  1947. GetReportform(this.downLoad.getdataListParm).then(response => {
  1948. if (response.data.list !== null) {
  1949. this.downLoad.labelList = []
  1950. var filterValArr = []
  1951. for (let i = 0; i < response.data.list.data1.length; i++) {
  1952. this.downLoad.labelList.push(response.data.list.data1[i].label)
  1953. filterValArr.push(response.data.list.data1[i].prop)
  1954. }
  1955. this.downLoad.list = response.data.list.data2
  1956. } else {
  1957. this.downLoad.list = []
  1958. }
  1959. var multiHeaderArr = []
  1960. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  1961. if (i == 0) {
  1962. multiHeaderArr.push(exportTitle)
  1963. } else {
  1964. multiHeaderArr.push('')
  1965. }
  1966. }
  1967. import('@/vendor/Export5Excel').then(excel => {
  1968. const multiHeader = [
  1969. multiHeaderArr
  1970. ]
  1971. const multiHeader2 = [
  1972. this.downLoad.labelList
  1973. ]
  1974. const filterVal = filterValArr
  1975. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  1976. const merges = []
  1977. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  1978. })
  1979. })
  1980. },
  1981. rowDrop() {
  1982. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  1983. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  1984. // this.sorTable()
  1985. const that = this
  1986. var sortable = Sortable.create(tbody, {
  1987. disabled: that.dropState,
  1988. onChoose({ newIndex, oldIndex }) {
  1989. console.log(that.isOrder, 'that.isOrder == false')
  1990. console.log(that.dropState, 'that.dropState')
  1991. if (that.dropState == true || that.isOrder == true) {
  1992. sortable.destroy()
  1993. }
  1994. },
  1995. onEnd(evt) {
  1996. var tableList = [...that.table.list] // 保留拖动前数据
  1997. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  1998. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  1999. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  2000. console.log(targetRow, 'targetRow')
  2001. console.log(targetRow2, 'targetRow2')
  2002. console.log(targetRow3, 'targetRow3')
  2003. that.table.list.splice(evt.newIndex, 0, targetRow)
  2004. // ==========
  2005. // 已执行的计划不可拖动
  2006. if (targetRow.havebutton == 1) {
  2007. that.$nextTick(() => {
  2008. that.$set(that.table, 'list', tableList)
  2009. })
  2010. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  2011. return false
  2012. }
  2013. // 相同班次之间可以拖动
  2014. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2015. // if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  2016. // that.$nextTick(() => {
  2017. // that.$set(that.table, 'list', tableList)
  2018. // })
  2019. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2020. // return false
  2021. // }
  2022. // } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  2023. // if (targetRow.times !== targetRow2.times) {
  2024. // that.$nextTick(() => {
  2025. // that.$set(that.table, 'list', tableList)
  2026. // })
  2027. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2028. // return false
  2029. // }
  2030. // } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  2031. // if (targetRow.times !== targetRow3.times) {
  2032. // that.$nextTick(() => {
  2033. // that.$set(that.table, 'list', tableList)
  2034. // })
  2035. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2036. // return false
  2037. // }
  2038. // }
  2039. // 撒料计划0,
  2040. // 撒料计划-混料1
  2041. // 撒料计划-撒料2
  2042. // 剩料计划3
  2043. // 预混计划4
  2044. // 预称重计划5
  2045. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  2046. if (targetRow2 == undefined) {
  2047. that.$nextTick(() => {
  2048. that.$set(that.table, 'list', tableList)
  2049. })
  2050. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  2051. that.$nextTick(() => {
  2052. that.$set(that.table, 'list', tableList)
  2053. })
  2054. } else {
  2055. var pidArr = [] // pid相同的值
  2056. var pidArr1 = [] //
  2057. var index // 索引
  2058. for (let i = 0; i < tableList.length; i++) {
  2059. if (tableList[i].pid == targetRow.pid) {
  2060. pidArr.push(tableList[i])
  2061. } else {
  2062. pidArr1.push(tableList[i])
  2063. }
  2064. }
  2065. // 找到对应上方pid 的ID
  2066. // 比如说id 580243 找到对应的索引
  2067. if (targetRow3 !== undefined) {
  2068. for (let i = 0; i < pidArr1.length; i++) {
  2069. if (pidArr1[i].id == targetRow3.id) {
  2070. index = i
  2071. }
  2072. }
  2073. } else {
  2074. for (let i = 0; i < pidArr1.length; i++) {
  2075. if (pidArr1[i].id == targetRow2.id) {
  2076. index = i - 1
  2077. }
  2078. }
  2079. }
  2080. pidArr1.splice(index + 1, 0, ...pidArr)
  2081. console.log(pidArr1)
  2082. that.$nextTick(() => {
  2083. that.table.list = pidArr1
  2084. })
  2085. }
  2086. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2087. if (targetRow2.pid == targetRow3.pid) {
  2088. that.$nextTick(() => {
  2089. that.$set(that.table, 'list', tableList)
  2090. })
  2091. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2092. return false
  2093. }
  2094. }
  2095. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  2096. if (targetRow2 !== undefined) {
  2097. console.log(targetRow3, targetRow2, 'zhidao')
  2098. if (targetRow3 !== undefined) {
  2099. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  2100. that.$nextTick(() => {
  2101. that.$set(that.table, 'list', tableList)
  2102. })
  2103. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2104. return false
  2105. } else {
  2106. console.log('wojinlaile', targetRow2, targetRow)
  2107. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  2108. that.$nextTick(() => {
  2109. that.$set(that.table, 'list', tableList)
  2110. })
  2111. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2112. return false
  2113. }
  2114. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  2115. that.$nextTick(() => {
  2116. that.$set(that.table, 'list', tableList)
  2117. })
  2118. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2119. return false
  2120. }
  2121. }
  2122. } else {
  2123. if (targetRow2.pid !== targetRow.pid) {
  2124. that.$nextTick(() => {
  2125. that.$set(that.table, 'list', tableList)
  2126. })
  2127. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2128. return false
  2129. } else {
  2130. if (targetRow2.pid !== targetRow.pid) {
  2131. that.$nextTick(() => {
  2132. that.$set(that.table, 'list', tableList)
  2133. })
  2134. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2135. return false
  2136. }
  2137. }
  2138. }
  2139. } else {
  2140. if (targetRow2 == undefined) {
  2141. that.$nextTick(() => {
  2142. that.$set(that.table, 'list', tableList)
  2143. })
  2144. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2145. return false
  2146. } else if (targetRow3.pid !== targetRow.pid) {
  2147. that.$nextTick(() => {
  2148. that.$set(that.table, 'list', tableList)
  2149. })
  2150. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2151. return false
  2152. } else {
  2153. if (targetRow3.lpplantype == 0) {
  2154. that.$nextTick(() => {
  2155. that.$set(that.table, 'list', tableList)
  2156. })
  2157. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2158. return false
  2159. }
  2160. }
  2161. }
  2162. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2163. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  2164. that.$nextTick(() => {
  2165. that.$set(that.table, 'list', tableList)
  2166. })
  2167. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2168. return false
  2169. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  2170. that.$nextTick(() => {
  2171. that.$set(that.table, 'list', tableList)
  2172. })
  2173. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2174. return false
  2175. }
  2176. }
  2177. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  2178. if (targetRow2 == undefined) {
  2179. if (targetRow3.pid !== targetRow.pid) {
  2180. that.$nextTick(() => {
  2181. that.$set(that.table, 'list', tableList)
  2182. })
  2183. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  2184. return false
  2185. }
  2186. } else {
  2187. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  2188. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  2189. that.$nextTick(() => {
  2190. that.$set(that.table, 'list', tableList)
  2191. })
  2192. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  2193. return false
  2194. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  2195. console.log('正常拖动')
  2196. } else {
  2197. that.$nextTick(() => {
  2198. that.$set(that.table, 'list', tableList)
  2199. })
  2200. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  2201. return false
  2202. }
  2203. }
  2204. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2205. if (targetRow2.pid == targetRow3.pid) {
  2206. that.$nextTick(() => {
  2207. that.$set(that.table, 'list', tableList)
  2208. })
  2209. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2210. return false
  2211. }
  2212. }
  2213. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  2214. console.log('遍历有相同的pid,一起跟着拖动3')
  2215. var pidArr = [] // pid相同的值
  2216. var pidArr1 = [] //
  2217. var index // 索引
  2218. for (let i = 0; i < tableList.length; i++) {
  2219. if (tableList[i].pid == targetRow.pid) {
  2220. pidArr.push(tableList[i])
  2221. } else {
  2222. pidArr1.push(tableList[i])
  2223. }
  2224. }
  2225. if (pidArr.length > 0) {
  2226. // 找到对应上方pid 的ID
  2227. // 比如说id 580243 找到对应的索引
  2228. if (targetRow3 !== undefined) {
  2229. for (let i = 0; i < pidArr1.length; i++) {
  2230. if (pidArr1[i].id == targetRow3.id) {
  2231. index = i
  2232. }
  2233. }
  2234. } else {
  2235. for (let i = 0; i < pidArr1.length; i++) {
  2236. if (pidArr1[i].id == targetRow2.id) {
  2237. index = i - 1
  2238. }
  2239. }
  2240. }
  2241. pidArr1.splice(index + 1, 0, ...pidArr)
  2242. console.log(pidArr1)
  2243. that.$nextTick(() => {
  2244. that.table.list = pidArr1
  2245. })
  2246. }
  2247. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2248. if (targetRow2.pid == targetRow3.pid) {
  2249. that.$nextTick(() => {
  2250. that.$set(that.table, 'list', tableList)
  2251. })
  2252. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  2253. return false
  2254. }
  2255. }
  2256. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  2257. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2258. if (targetRow2.pid == targetRow3.pid) {
  2259. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  2260. that.$nextTick(() => {
  2261. that.$set(that.table, 'list', tableList)
  2262. })
  2263. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  2264. return false
  2265. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  2266. console.log('剩料之间可以互相拖动')
  2267. console.log(tableList)
  2268. } else {
  2269. that.$nextTick(() => {
  2270. that.$set(that.table, 'list', tableList)
  2271. })
  2272. // 撒料计划0,
  2273. // 撒料计划-混料1
  2274. // 撒料计划-撒料2
  2275. // 剩料计划3
  2276. // 预混计划4
  2277. // 预称重计划5
  2278. if (targetRow3.lpplantype == 0) {
  2279. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  2280. } else if (targetRow3.lpplantype == 1) {
  2281. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  2282. } else if (targetRow3.lpplantype == 2) {
  2283. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  2284. } else if (targetRow3.lpplantype == 3) {
  2285. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  2286. } else if (targetRow3.lpplantype == 4) {
  2287. that.$set(targetRow3, 'mylpplantype', '预混计划')
  2288. } else if (targetRow3.lpplantype == 5) {
  2289. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  2290. }
  2291. if (targetRow2.lpplantype == 0) {
  2292. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  2293. } else if (targetRow2.lpplantype == 1) {
  2294. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  2295. } else if (targetRow2.lpplantype == 2) {
  2296. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  2297. } else if (targetRow2.lpplantype == 3) {
  2298. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  2299. } else if (targetRow2.lpplantype == 4) {
  2300. that.$set(targetRow2, 'mylpplantype', '预混计划')
  2301. } else if (targetRow2.lpplantype == 5) {
  2302. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  2303. }
  2304. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  2305. that.$message({ type: 'error', message: message, duration: 2000 })
  2306. return false
  2307. }
  2308. }
  2309. }
  2310. // ========
  2311. // var pidArr = [] // pid相同的值
  2312. // var pidArr1 = [] //
  2313. // var index // 索引
  2314. // for (let i = 0; i < tableList.length; i++) {
  2315. // if (tableList[i].pid == targetRow.pid) {
  2316. // pidArr.push(tableList[i])
  2317. // } else {
  2318. // pidArr1.push(tableList[i])
  2319. // }
  2320. // }
  2321. // if (pidArr.length > 0) {
  2322. // // 找到对应上方pid 的ID
  2323. // // 比如说id 580243 找到对应的索引
  2324. // if (targetRow3 !== undefined) {
  2325. // for (let i = 0; i < pidArr1.length; i++) {
  2326. // if (pidArr1[i].id == targetRow3.id) {
  2327. // index = i
  2328. // }
  2329. // }
  2330. // } else {
  2331. // for (let i = 0; i < pidArr1.length; i++) {
  2332. // if (pidArr1[i].id == targetRow2.id) {
  2333. // index = i - 1
  2334. // }
  2335. // }
  2336. // }
  2337. // pidArr1.splice(index + 1, 0, ...pidArr)
  2338. // console.log(pidArr1)
  2339. // that.$nextTick(() => {
  2340. // that.table.list = pidArr1
  2341. // })
  2342. // }
  2343. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2344. // if (targetRow2.pid == targetRow3.pid) {
  2345. // that.$nextTick(() => {
  2346. // that.$set(that.table, 'list', tableList)
  2347. // })
  2348. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  2349. // return false
  2350. // }
  2351. // }
  2352. }
  2353. // ===
  2354. }
  2355. })
  2356. },
  2357. // 复制
  2358. handleCopy() {
  2359. if (this.table.list.length > 0) {
  2360. this.newGeneration.temp = {}
  2361. this.newGeneration.dialogStatus = 'copy'
  2362. this.newGeneration.dialogFormVisible = true
  2363. } else {
  2364. this.$message({ type: 'error', message: '当前无计划可复制' })
  2365. }
  2366. },
  2367. copyData() {
  2368. console.log(this.newGeneration.temp.copyInputDatetime)
  2369. this.isokDisable = true
  2370. setTimeout(() => {
  2371. this.isokDisable = false
  2372. }, 5000)
  2373. this.$refs['temp'].validate(valid => {
  2374. if (valid) {
  2375. this.requestParam.name = 'copydownloadedplan'
  2376. this.requestParam.parammaps = {}
  2377. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2378. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2379. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  2380. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  2381. PostDataByName(this.requestParam).then(response => {
  2382. if (response.msg === 'fail') {
  2383. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2384. } else {
  2385. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2386. this.newGeneration.dialogFormVisible = false
  2387. this.getList()
  2388. }
  2389. })
  2390. }
  2391. })
  2392. },
  2393. handleChangeOrder() {
  2394. // 拖动顺序
  2395. this.isOrder = false
  2396. this.rowDrop()
  2397. },
  2398. saveChangeOrder() {
  2399. // 保存顺序
  2400. var sortList = []
  2401. for (let i = 0; i < this.table.list.length; i++) {
  2402. var obj = {}
  2403. obj.sort = i
  2404. obj.pastureid = this.table.list[i].pastureid
  2405. obj.id = this.table.list[i].id
  2406. sortList.push(obj)
  2407. }
  2408. console.log(sortList)
  2409. this.requestParam = {}
  2410. this.requestParam.common = { 'returnmap': '0' }
  2411. this.requestParam.data = []
  2412. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  2413. this.requestParam.data[0].children = []
  2414. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  2415. id: '@insertSpotList.id',
  2416. pastureid: '@insertSpotList.pastureid',
  2417. sort: '@insertSpotList.sort'
  2418. }}
  2419. ExecDataByConfig(this.requestParam).then(response => {
  2420. console.log('顺序切换保存发送参数', this.requestParam)
  2421. if (response.msg === 'fail') {
  2422. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2423. } else {
  2424. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2425. this.getList()
  2426. this.isOrder = true
  2427. }
  2428. })
  2429. },
  2430. cancelChangeOrder() {
  2431. // 取消顺序
  2432. this.getList()
  2433. this.isOrder = true
  2434. },
  2435. handleDataSynchronization() {
  2436. MessageBox.confirm('是否确认同步数据?', {
  2437. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2438. }).then(() => {
  2439. this.requestParam = {}
  2440. this.requestParam.pastureid = Cookies.get('pastureid')
  2441. // this.$alert('正在同步', { confirmButtonText: '确定' })
  2442. this.dataSynchronization.dialogFormVisible = true
  2443. getDorm(this.requestParam).then(response => {
  2444. console.log(response)
  2445. if (response.msg == 'ok') {
  2446. this.dataSynchronization.dialogFormVisible = false
  2447. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  2448. } else {
  2449. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  2450. this.dataSynchronization.dialogFormVisible = false
  2451. }
  2452. })
  2453. }).catch(() => {
  2454. this.$message({ type: 'info', message: '已取消数据同步' })
  2455. })
  2456. },
  2457. handleRowDelete(row) {
  2458. console.log('删除')
  2459. MessageBox.confirm('是否确认删除此信息?', {
  2460. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2461. }).then(() => {
  2462. this.selectList = []
  2463. this.requestParam = {}
  2464. this.requestParam.name = 'delDownloadedplan'
  2465. this.requestParam.parammaps = {}
  2466. this.requestParam.parammaps.pastureid = row.pastureid
  2467. this.requestParam.parammaps.id = row.id
  2468. PostDataByName(this.requestParam).then(response => {
  2469. if (response.msg === 'fail') {
  2470. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2471. } else {
  2472. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2473. this.getList()
  2474. }
  2475. })
  2476. }).catch(() => {
  2477. this.$message({ type: 'info', message: '已取消删除' })
  2478. })
  2479. },
  2480. handleRowSort(row){
  2481. this.$prompt('由于混料车和撒料车是一体的,插入顺序不能隔开', '排序', {
  2482. inputPlaceholder:'请输入您要插入的位置',
  2483. confirmButtonText: '确定',
  2484. cancelButtonText: '取消',
  2485. inputPattern: /^\d+$/ ,
  2486. inputErrorMessage: '请检查插入位置序号是否正确'
  2487. }).then(({ value }) => {
  2488. const url = 'authdata/plan/sort/edit'
  2489. const data = {
  2490. planId:row.id,
  2491. mydate:row.mydate,
  2492. sort:value
  2493. }
  2494. postJson(url, data).then(response => {
  2495. if (response.msg === 'fail') {
  2496. this.$notify({ title: '失败', message: response.data, type: 'error', duration: 2000 })
  2497. } else {
  2498. this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
  2499. this.getList()
  2500. }
  2501. })
  2502. }).catch(() => {
  2503. this.$message({
  2504. type: 'info',
  2505. message: '取消排序'
  2506. });
  2507. });
  2508. },
  2509. handleSpan() {
  2510. this.mergekeys.forEach(key => {
  2511. this.spanObj[key] = []
  2512. let position = 0
  2513. this.table2.list.forEach((item, index) => {
  2514. if (index === 0) {
  2515. this.spanObj[key].push(1)
  2516. position = 0
  2517. } else {
  2518. if (key == 'description') {
  2519. if (this.table2.list[index][key] === this.table2.list[index - 1][key] && this.table2.list[index]['sort'] === this.table2.list[index - 1]['sort']) {
  2520. this.spanObj[key][position] += 1
  2521. this.spanObj[key].push(0)
  2522. } else {
  2523. this.spanObj[key].push(1)
  2524. position = index
  2525. }
  2526. } else {
  2527. if (this.table2.list[index][key] === this.table2.list[index - 1][key]) {
  2528. this.spanObj[key][position] += 1
  2529. this.spanObj[key].push(0)
  2530. } else {
  2531. this.spanObj[key].push(1)
  2532. position = index
  2533. }
  2534. }
  2535. }
  2536. })
  2537. })
  2538. },
  2539. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  2540. for (let i = 0; i < this.mergekeys.length; i++) {
  2541. if (column.property === this.mergekeys[i]) {
  2542. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  2543. const _col = _row > 0 ? 1 : 0
  2544. return {
  2545. rowspan: _row,
  2546. colspan: _col
  2547. }
  2548. }
  2549. }
  2550. },
  2551. form_deleteRecord(){
  2552. this.deleteRecord.dialogStatus = 'deleteRecord'
  2553. this.deleteRecord.dialogFormVisible = true
  2554. this.deleteRecord.mydate = this.table.getdataListParm.parammaps.mydate
  2555. this.getDeleteRecordList()
  2556. },
  2557. changeDeleteRecordDate(){
  2558. this.getDeleteRecordList()
  2559. },
  2560. getDeleteRecordList(){
  2561. const url = 'authdata/GetDataByName'
  2562. const data = {}
  2563. data.name = 'getDownloadedplanDeleteList'
  2564. data.page = 1
  2565. data.offset = 1
  2566. data.pagecount = ""
  2567. data.returntype = "Map"
  2568. data.parammaps = {}
  2569. data.parammaps.pastureid = Cookies.get('pastureid')
  2570. data.parammaps.mydate = this.deleteRecord.mydate
  2571. postJson(url, data).then(response => {
  2572. if(response.data !== null){
  2573. this.deleteRecord.list = response.data.list
  2574. }else{
  2575. this.deleteRecord.list = []
  2576. }
  2577. this.deleteRecord.total = response.data.total
  2578. })
  2579. },
  2580. handleSelect(val) {
  2581. console.log('勾选数据', val)
  2582. this.selectList = val
  2583. },
  2584. handleTakeEffect() {
  2585. if (this.selectList.length == 0) {
  2586. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  2587. } else {
  2588. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  2589. confirmButtonText: '确认',
  2590. cancelButtonText: '取消',
  2591. type: 'warning'
  2592. }).then(() => {
  2593. for (let i = 0; i < this.selectList.length; i++) {
  2594. // this.$set(this.selectList[i], 'enable', '1')
  2595. this.selectList[i].enable = 1
  2596. }
  2597. console.log('生效', this.selectList)
  2598. this.requestParam.common = {
  2599. 'returnmap': '0'
  2600. }
  2601. this.requestParam.data = []
  2602. this.requestParam.data[0] = {
  2603. 'name': 'insertSpotList',
  2604. 'resultmaps': {
  2605. 'list': this.selectList
  2606. }
  2607. }
  2608. this.requestParam.data[0].children = []
  2609. this.requestParam.data[0].children[0] = {
  2610. 'name': 'updateDownloadedplanEnable',
  2611. 'type': 'e',
  2612. 'parammaps': {
  2613. enable: '@insertSpotList.enable',
  2614. id: '@insertSpotList.id',
  2615. pastureid: '@insertSpotList.pastureid'
  2616. }
  2617. }
  2618. ExecDataByConfig(this.requestParam).then(response => {
  2619. console.log('生效保存发送参数', this.requestParam)
  2620. if (response.msg === 'fail') {
  2621. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  2622. } else {
  2623. this.$notify({ title: '成功', message: '生效成功', type: 'success', duration: 2000 })
  2624. this.getList()
  2625. }
  2626. })
  2627. })
  2628. }
  2629. },
  2630. handleDisable() {
  2631. if (this.selectList.length == 0) {
  2632. this.$message({type: 'error', message: '请选择车次信息', duration: 2000 })
  2633. } else {
  2634. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  2635. confirmButtonText: '确认',
  2636. cancelButtonText: '取消',
  2637. type: 'warning'
  2638. }).then(() => {
  2639. for (let i = 0; i < this.selectList.length; i++) {
  2640. // this.$set(this.selectList[i], 'enable', '1')
  2641. this.selectList[i].enable = 0
  2642. }
  2643. console.log('禁用', this.selectList)
  2644. this.requestParam.common = {
  2645. 'returnmap': '0'
  2646. }
  2647. this.requestParam.data = []
  2648. this.requestParam.data[0] = {
  2649. 'name': 'insertSpotList',
  2650. 'resultmaps': {
  2651. 'list': this.selectList
  2652. }
  2653. }
  2654. this.requestParam.data[0].children = []
  2655. this.requestParam.data[0].children[0] = {
  2656. 'name': 'updateDownloadedplanEnable',
  2657. 'type': 'e',
  2658. 'parammaps': {
  2659. enable: '@insertSpotList.enable',
  2660. id: '@insertSpotList.id',
  2661. pastureid: '@insertSpotList.pastureid'
  2662. }
  2663. }
  2664. ExecDataByConfig(this.requestParam).then(response => {
  2665. console.log('禁用保存发送参数', this.requestParam)
  2666. if (response.msg === 'fail') {
  2667. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  2668. } else {
  2669. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  2670. this.getList()
  2671. }
  2672. })
  2673. })
  2674. }
  2675. },
  2676. handlePrint() {
  2677. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2678. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  2679. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  2680. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  2681. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  2682. var exportTitle = ''
  2683. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  2684. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2685. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  2686. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2687. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2688. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  2689. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2690. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2691. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  2692. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2693. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2694. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  2695. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2696. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2697. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  2698. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2699. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2700. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  2701. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2702. } else {
  2703. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  2704. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2705. }
  2706. } else {
  2707. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2708. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  2709. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2710. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2711. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  2712. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2713. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2714. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  2715. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2716. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2717. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  2718. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2719. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2720. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  2721. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2722. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2723. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  2724. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2725. } else {
  2726. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  2727. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2728. }
  2729. }
  2730. GetReportform(this.downLoad.getdataListParm).then(response => {
  2731. if (response.data.list !== null) {
  2732. this.downLoad.labelList = []
  2733. var filterValArr = []
  2734. for (let i = 0; i < response.data.list.data1.length; i++) {
  2735. this.downLoad.labelList.push(response.data.list.data1[i].label)
  2736. filterValArr.push(response.data.list.data1[i].prop)
  2737. }
  2738. this.downLoad.list = response.data.list.data2
  2739. } else {
  2740. this.downLoad.list = []
  2741. }
  2742. let data = []
  2743. for(let i=0;i<filterValArr.length;i++){
  2744. let obj = {}
  2745. obj.field = filterValArr[i]
  2746. obj.columnSize = i
  2747. for(let j=i;j<this.downLoad.labelList.length;j++){
  2748. obj.displayName = this.downLoad.labelList[i]
  2749. }
  2750. if(obj.field !== undefined && obj.displayName !== undefined){
  2751. data.push(obj)
  2752. }
  2753. for(let i=0;i<this.downLoad.list.length;i++){
  2754. if(this.downLoad.list[i][obj.displayName] == null || this.downLoad.list[i][obj.displayName] == undefined){
  2755. this.downLoad.list[i][obj.displayName] = ''
  2756. }
  2757. }
  2758. }
  2759. console.log(this.downLoad.list)
  2760. printJS({
  2761. printable:this.downLoad.list,
  2762. properties:data,
  2763. type:'json',
  2764. header:exportTitle,
  2765. //样式设置
  2766. gridStyle:'border:1px solid #ccc;',
  2767. gridHeaderStyle:'border:1px solid #ccc;text-align:center'
  2768. })
  2769. })
  2770. },
  2771. handleDelete(){
  2772. if (this.selectList.length == 0) {
  2773. this.$message({ type: 'error', message: '请选择计划', duration: 2000 })
  2774. } else {
  2775. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  2776. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2777. }).then(() => {
  2778. console.log(this.selectList)
  2779. this.requestParam.common = { 'returnmap': '0' }
  2780. this.requestParam.data = []
  2781. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  2782. this.requestParam.data[0].children = []
  2783. this.requestParam.data[0].children[0] = { 'name': 'delDownloadedplan', 'type': 'e', 'parammaps': {
  2784. id: '@insertSpotList.id',
  2785. pastureid: '@insertSpotList.pastureid'
  2786. }}
  2787. ExecDataByConfig(this.requestParam).then(response => {
  2788. console.log('删除保存发送参数', this.requestParam)
  2789. if (response.msg === 'fail') {
  2790. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2791. } else {
  2792. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  2793. this.getList()
  2794. }
  2795. })
  2796. })
  2797. }
  2798. },
  2799. handleDataUpload(){
  2800. let a = Cookies.get('url')
  2801. let b = a.search(8081)
  2802. let c = a.substring(0,a.search(8081)) + '8082'
  2803. let d = a.substring(0,a.lastIndexOf('/'))
  2804. console.log(d)
  2805. let url = ''
  2806. if(b == -1){
  2807. url = d + ':8082'
  2808. }else{
  2809. url = c
  2810. }
  2811. let _url = url + '/authdata/feeding/push'
  2812. let data = {
  2813. date:parseTime(new Date(), '{y}-{m}-{d}'),
  2814. pastureId:Cookies.get('pastureid')
  2815. }
  2816. console.log(_url,'_url')
  2817. postJson2(_url, data).then(response => {
  2818. if(response.msg == 'ok'){
  2819. this.$notify({ title: '', message: response.data, type: 'success', duration: 2000 })
  2820. }else{
  2821. this.$notify({ title: '上传失败', message: response.data, type: 'warning', duration: 2000 })
  2822. }
  2823. })
  2824. },
  2825. handleUpdate2(row){
  2826. for (let i = 0; i < this.table2.list.length; i++) {
  2827. if (this.table2.list[i].Edit == true) {
  2828. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2829. return false
  2830. }
  2831. }
  2832. // 编辑true,不可编辑false
  2833. row.Edit = true
  2834. row.NoEdit = false
  2835. // 新增false,编辑false,编辑保存true
  2836. row.isUpdate = false
  2837. row.isUpdateSave = true
  2838. },
  2839. updateData2(row,type){
  2840. const url = 'authdata/dailydata/edit'
  2841. const data = {}
  2842. data.pid = row.pid
  2843. data.weight = row.weight
  2844. data.sort = row.sort
  2845. // 饲料
  2846. if(type == '0'){
  2847. data.location = 0
  2848. data.fid = row.fid
  2849. }else{
  2850. // 车辆||栏舍
  2851. data.location = 1
  2852. data.fbarid = row.fbarid
  2853. }
  2854. data.date = this.table.getdataListParm.parammaps.mydate
  2855. data.sort = row.sort
  2856. postJson(url, data).then(response => {
  2857. if(response.msg == 'ok'){
  2858. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  2859. this.getList2()
  2860. this.getList3()
  2861. }else{
  2862. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2863. }
  2864. })
  2865. },
  2866. updateCancel2(row){
  2867. row.Edit = false
  2868. row.NoEdit = true
  2869. // 新增false,编辑true,编辑保存false
  2870. row.isCreate = false
  2871. row.isUpdate = true
  2872. row.isUpdateSave = false
  2873. this.getList2()
  2874. },
  2875. handleUpdate3(row){
  2876. for (let i = 0; i < this.table3.list.length; i++) {
  2877. if (this.table3.list[i].Edit == true) {
  2878. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2879. return false
  2880. }
  2881. }
  2882. // 编辑true,不可编辑false
  2883. row.Edit = true
  2884. row.NoEdit = false
  2885. // 新增false,编辑false,编辑保存true
  2886. row.isUpdate = false
  2887. row.isUpdateSave = true
  2888. },
  2889. updateData3(row,type){
  2890. const url = 'authdata/dailydata/edit'
  2891. const data = {}
  2892. data.pid = row.pid
  2893. data.weight = row.weight
  2894. data.sort = row.sort
  2895. // 饲料
  2896. if(type == '0'){
  2897. data.location = 0
  2898. data.fid = row.fid
  2899. }else{
  2900. // 车辆||栏舍
  2901. data.location = 1
  2902. data.fbarid = row.fbarid
  2903. }
  2904. data.date = this.table.getdataListParm.parammaps.mydate
  2905. data.sort = row.sort
  2906. postJson(url, data).then(response => {
  2907. if(response.msg == 'ok'){
  2908. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  2909. this.getList2()
  2910. this.getList3()
  2911. }else{
  2912. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2913. }
  2914. })
  2915. },
  2916. updateCancel3(row){
  2917. row.Edit = false
  2918. row.NoEdit = true
  2919. // 新增false,编辑true,编辑保存false
  2920. row.isCreate = false
  2921. row.isUpdate = true
  2922. row.isUpdateSave = false
  2923. this.getList3()
  2924. },
  2925. changeDriver(value,row){
  2926. const url = 'authdata/PostDataByName'
  2927. const data = {
  2928. name:'updateDownloadedplanDriver',
  2929. parammaps:{
  2930. driverId:value,
  2931. id:row.id
  2932. }
  2933. }
  2934. postJson(url, data).then(response => {
  2935. if(response.msg == 'ok'){
  2936. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  2937. this.getList()
  2938. }else{
  2939. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2940. }
  2941. })
  2942. },
  2943. getIsSap() {
  2944. GetDataByName(this.sapUpload.getdataListParm).then(response => {
  2945. // console.log()
  2946. if(response.data.list !== null){
  2947. if(response.data.list[0].inforvalue == 1){
  2948. this.sapUpload.isSap = true
  2949. }else{
  2950. this.sapUpload.isSap = false
  2951. }
  2952. console.log(this.sapUpload.isSap)
  2953. }
  2954. })
  2955. },
  2956. handleSAPUpload(){
  2957. this.sapUpload.dialogStatus = 'sapUpload'
  2958. this.sapUpload.dialogFormVisible = true
  2959. },
  2960. sapUploadData(){
  2961. this.$refs['sapUpload'].validate(valid => {
  2962. if (valid) {
  2963. const url = 'authdata/sap/material'
  2964. const data = {
  2965. // "name":"xdmysapupload",
  2966. "pastureid":Cookies.get('pastureid'),date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  2967. }
  2968. postJson(url, data).then(response => {
  2969. if(response.msg == 'ok'){
  2970. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  2971. this.sapUpload.dialogFormVisible = false
  2972. this.getList()
  2973. }else{
  2974. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2975. }
  2976. })
  2977. }
  2978. })
  2979. },
  2980. getIspalyUd(){
  2981. let url = 'authdata/GetDataByName'
  2982. let data = {
  2983. "name":"getSysoptEnable","page":1,"offset":1,"pagecount":1,"returntype":"Map",
  2984. "parammaps":{"pastureid":Cookies.get('pastureid'),"inforname":"gmUdSync"}
  2985. }
  2986. postJson(url,data).then(response => {
  2987. if (response.msg !== 'fail') {
  2988. if(response.data.list[0].inforvalue == 0){
  2989. this.ispalyUd = false
  2990. }else{
  2991. this.ispalyUd = true
  2992. }
  2993. } else {
  2994. this.$notify({ title: '请求失败', message: response.data, type: 'warning', duration: 2000 })
  2995. }
  2996. })
  2997. },
  2998. handleGetUd1(){
  2999. this.sapUpload.dialogStatus = 'udload1'
  3000. this.sapUpload.dialogFormVisible = true
  3001. },
  3002. udData1(){
  3003. this.$refs['sapUpload'].validate(valid => {
  3004. if (valid) {
  3005. let url = 'authdata/gm/udutir/push'
  3006. let data = {
  3007. pastureId:Cookies.get('pastureid'),
  3008. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3009. }
  3010. postJson(url,data).then(response => {
  3011. if (response.msg !== 'fail') {
  3012. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3013. this.sapUpload.dialogFormVisible = false
  3014. this.getList()
  3015. } else {
  3016. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3017. }
  3018. })
  3019. }
  3020. })
  3021. },
  3022. handleGetUd2(){
  3023. this.sapUpload.dialogStatus = 'udload2'
  3024. this.sapUpload.dialogFormVisible = true
  3025. },
  3026. udData2(){
  3027. this.$refs['sapUpload'].validate(valid => {
  3028. if (valid) {
  3029. let url = 'authdata/gm/udbarfeedremain/push'
  3030. let data = {
  3031. pastureId:Cookies.get('pastureid'),
  3032. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3033. }
  3034. postJson(url,data).then(response => {
  3035. if (response.msg !== 'fail') {
  3036. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3037. this.sapUpload.dialogFormVisible = false
  3038. this.getList()
  3039. } else {
  3040. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3041. }
  3042. })
  3043. }
  3044. })
  3045. },
  3046. handleGetUd3(){
  3047. this.sapUpload.dialogStatus = 'udload3'
  3048. this.sapUpload.dialogFormVisible = true
  3049. },
  3050. udData3(){
  3051. this.$refs['sapUpload'].validate(valid => {
  3052. if (valid) {
  3053. let url = 'authdata/gm/udmaterialIssue/push'
  3054. let data = {
  3055. pastureId:Cookies.get('pastureid'),
  3056. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3057. }
  3058. postJson(url,data).then(response => {
  3059. if (response.msg !== 'fail') {
  3060. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3061. this.sapUpload.dialogFormVisible = false
  3062. this.getList()
  3063. } else {
  3064. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3065. }
  3066. })
  3067. }
  3068. })
  3069. },
  3070. handleRowEmpty(row,plan){
  3071. console.log(row,'row')
  3072. MessageBox.confirm('您确定清空该操作序号以下的所有数据,如果您清空的是搅拌车数据,将会同步清空撒料车数据?', {
  3073. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3074. }).then(() => {
  3075. console.log(this.selectList)
  3076. this.requestParam.common = { 'returnmap': '0' }
  3077. this.requestParam.data = []
  3078. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  3079. this.requestParam.data[0].children = []
  3080. this.requestParam.data[0].children[0] = { 'name': 'delDownloadedplan', 'type': 'e', 'parammaps': {
  3081. id: '@insertSpotList.id',
  3082. pastureid: '@insertSpotList.pastureid'
  3083. }}
  3084. const url = 'authdata/PostDataByName'
  3085. const data = {
  3086. name:'clearDeleteDownloadedplan',
  3087. parammaps:{
  3088. pid:row.pid,
  3089. lpplantype:this.table3.getdataListParm.parammaps.lpplantype,
  3090. plan:plan,
  3091. sort:row.sort
  3092. }
  3093. }
  3094. postJson(url,data).then(response => {
  3095. console.log('清空保存发送参数', this.requestParam)
  3096. if (response.msg === 'fail') {
  3097. this.$notify({ title: '清除失败', message: response.data, type: 'warning', duration: 2000 })
  3098. } else {
  3099. this.$notify({ title: '', message: '清除成功', type: 'success', duration: 2000 })
  3100. // this.getList()
  3101. this.getList2()
  3102. this.getList3()
  3103. }
  3104. })
  3105. })
  3106. },
  3107. handleQuickcompletion(){
  3108. if (this.selectList.length == 0) {
  3109. this.$message({ type: 'error', message: '请先选择计划', duration: 2000 })
  3110. } else {
  3111. MessageBox.confirm('您是否确定勾选的状态改为已执行的计划?', {
  3112. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3113. }).then(() => {
  3114. console.log(this.selectList)
  3115. let arr = []
  3116. for(let i=0;i<this.selectList.length;i++){
  3117. arr.push(this.selectList[i].id)
  3118. }
  3119. const url = '/authdata/plan/artificial/edit'
  3120. const data = {
  3121. planId:arr.join()
  3122. }
  3123. postJson(url,data).then(response => {
  3124. console.log('快速完成保存发送参数', this.requestParam)
  3125. if (response.msg === 'fail') {
  3126. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3127. } else {
  3128. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3129. this.getList()
  3130. }
  3131. })
  3132. })
  3133. }
  3134. }
  3135. }
  3136. }
  3137. </script>
  3138. <style>
  3139. .el-table .warning-row {
  3140. background: oldlace;
  3141. }
  3142. .el-table .success-row {
  3143. background: #f0f9eb;
  3144. }
  3145. @page{
  3146. size: auto A4 landscape;
  3147. margin: 3mm;
  3148. }
  3149. .agreeCon {
  3150. background: #fff;
  3151. box-sizing: border-box;
  3152. padding: 2rem 3rem 4rem;
  3153. }
  3154. </style>
  3155. <style lang="scss" scoped>
  3156. .app-container{background: #fff;}
  3157. .operation{}
  3158. .search{margin-top:10px;}
  3159. .table{margin-bottom:20px;}
  3160. .template{
  3161. background: #fff;
  3162. position: relative;
  3163. }
  3164. .table2{
  3165. // float: left;width: 50%;
  3166. background: #fff;
  3167. position: relative;
  3168. .content-table{margin-top: 20px;}
  3169. .contentOperation{right: -50px;z-index: 1;}
  3170. }
  3171. .table3{
  3172. // float: left;width: 50%;
  3173. background: #fff;
  3174. position: relative;
  3175. .content-table{margin-top: 20px;}
  3176. .contentOperation{right: -50px;z-index: 1;}
  3177. }
  3178. /deep/.el-input.is-disabled .el-input__inner{
  3179. color:#000
  3180. }
  3181. </style>