index.vue 75 KB

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