index.vue 81 KB

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