index.vue 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901
  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. },
  595. // // 栏舍
  596. // changeBars(val) {
  597. // console.log('点击了栏舍', val)
  598. // var arr = []
  599. // this.barsList.forEach(function(i) {
  600. // val.forEach(function(j) {
  601. // if (i.id == j) { arr.push(i) }
  602. // })
  603. // })
  604. // console.log('点击了栏舍', arr)
  605. // this.table.temp.barid = arr
  606. // this.barsNamesIdTempArr = arr
  607. // this.$forceUpdate()
  608. // },
  609. changeBars(val) {
  610. console.log(this.barsList)
  611. console.log('点击了栏舍1', val)
  612. var barSortList = []
  613. var barsList = this.barsList
  614. val.forEach(function(i){
  615. barsList.forEach(function(j){
  616. if(i == j.id){
  617. barSortList.push(j)
  618. }
  619. })
  620. })
  621. this.barSortList = barSortList
  622. console.log('点击了栏舍1', barSortList)
  623. this.table.temp.barid = barSortList
  624. this.barsNamesIdTempArr = barSortList
  625. this.$forceUpdate()
  626. },
  627. onStart(){
  628. console.log(2222)
  629. },
  630. onEnd(){
  631. console.log(this.barSortList)
  632. this.table.temp.barid = this.barSortList
  633. this.barsNamesIdTempArr = this.barSortList
  634. },
  635. // // TMR编号
  636. // changeTMRNumber(item, row) {
  637. // row.tmrcode = this.TMRNumberList.find(obj => obj.id == item).tname
  638. // },
  639. changeTMRNumber(item) {
  640. this.create.temp.tmrcode = this.TMRNumberList.find(obj => obj.id === item).eqcode
  641. },
  642. // // 撒料计划车次跟随列表
  643. // changeCarFollow(item, row) {
  644. // if (item == '') {
  645. // row.lppcode = ''
  646. // } else {
  647. // row.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  648. // }
  649. // },
  650. changeCarFollow(item, row) {
  651. if (item == '') {
  652. this.create.temp.lppcode = ''
  653. } else {
  654. this.create.temp.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  655. }
  656. },
  657. // 班次
  658. // changeTimes(item, row) {
  659. // console.log(item, row)
  660. // this.getCarFollowParm.parammaps.times = item
  661. // this.getCarFollowList(row)
  662. // },
  663. // 班次
  664. changeTimes(item) {
  665. console.log(item)
  666. this.getCarFollowParm.parammaps.times = item
  667. this.getCarFollowList()
  668. },
  669. // 撒料计划车次跟随列表
  670. // getCarFollowList(row) {
  671. // GetDataByName(this.getCarFollowParm).then(response => {
  672. // console.log('撒料计划车次跟随列表数据', response.data.list)
  673. // if (response.data.list !== null) {
  674. // this.carFollowList = response.data.list
  675. // row.lppid = this.carFollowList[0].id
  676. // row.lppcode = this.carFollowList[0].lppcode
  677. // }
  678. // })
  679. // },
  680. getCarFollowList() {
  681. GetDataByName(this.getCarFollowParm).then(response => {
  682. console.log('撒料计划车次跟随列表数据', response.data.list)
  683. if (response.data.list !== null) {
  684. this.carFollowList = response.data.list
  685. this.create.temp.lppid = this.carFollowList[0].id
  686. this.create.temp.lppcode = this.carFollowList[0].lppcode
  687. }
  688. })
  689. },
  690. // changeResidueDisposal(item, row) {
  691. // console.log(item, row)
  692. // this.getCarFollowParm.parammaps.times = item
  693. // this.getTransferbarsList()
  694. // },
  695. changeResidueDisposal(item) {
  696. console.log(item)
  697. this.getCarFollowParm.parammaps.times = item
  698. this.getTransferbarsList()
  699. if(item == "继续饲喂"){
  700. this.isDis = true
  701. } else {
  702. this.isDis = false
  703. }
  704. },
  705. getTransferbarsList() {
  706. GetDataByName(this.getTransferbarsParm).then(response => {
  707. if (response.data.list !== null) {
  708. this.transferbarsList = response.data.list
  709. }
  710. console.log(this.transferbarsList)
  711. })
  712. },
  713. // // 转头栏舍
  714. // changeTransferbars(val) {
  715. // console.log('点击了转头栏舍', val)
  716. // var arr2 = []
  717. // this.transferbarsList.forEach(function(i) {
  718. // val.forEach(function(j) {
  719. // if (i.id == j) { arr2.push(i) }
  720. // })
  721. // })
  722. // this.table.temp2.useinbar = arr2
  723. // this.useinbarNamesIdTempArr = arr2
  724. // this.$forceUpdate()
  725. // },
  726. // 转头栏舍
  727. changeTransferbars(val) {
  728. console.log('点击了转头栏舍', val)
  729. // var arr2 = []
  730. // this.transferbarsList.forEach(function(i) {
  731. // val.forEach(function(j) {
  732. // if (i.id == j) { arr2.push(i) }
  733. // })
  734. // })
  735. // this.table.temp2.useinbar = arr2
  736. // // this.useinbarNamesIdTempArr = arr2
  737. // this.$forceUpdate()
  738. },
  739. // createData(row) {
  740. // console.log('点击了新增保存', row)
  741. // if (row.rtime == null || row.rtime == 'null') {
  742. // row.rtime = ''
  743. // }
  744. // if (row.sort == '' && row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  745. // this.$message({ type: 'error', message: '车次/栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  746. // return false
  747. // } else if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  748. // this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  749. // return false
  750. // } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  751. // this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  752. // return false
  753. // } else if (row.times == '' && row.treatmethod == '') {
  754. // this.$message({ type: 'error', message: '班次/剩料处理方式不能为空', duration: 2000 })
  755. // return false
  756. // } else if (row.sort == '' || row.sort == 0) {
  757. // this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  758. // return false
  759. // } else if (row.barid == '') {
  760. // this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  761. // return false
  762. // } else if (row.tmrid == '') {
  763. // this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  764. // return false
  765. // } else if (row.times == '') {
  766. // this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  767. // return false
  768. // } else if (row.treatmethod == '') {
  769. // this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  770. // return false
  771. // }
  772. // if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  773. // if (row.useinbarid == '') {
  774. // this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  775. // return false
  776. // }
  777. // }
  778. // if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  779. // row.useinbarid = '0'
  780. // }
  781. // if (row.rtime == '' || row.rtime == null) {
  782. // row.rtime = ''
  783. // }
  784. // for (let i = 0; i < this.table.list.length; i++) {
  785. // if (row.sort == this.table.list[i].sort) {
  786. // if (row.myId !== this.table.list[i].myId) {
  787. // this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  788. // return false
  789. // }
  790. // }
  791. // }
  792. // var isInteger = /^\d+$/
  793. // if (row.sort !== '') {
  794. // if (!isInteger.test(parseFloat(row.sort))) {
  795. // this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  796. // return false
  797. // }
  798. // }
  799. // this.isokDisable = true
  800. // setTimeout(() => {
  801. // this.isokDisable = false
  802. // }, 1000)
  803. // this.requestParam.common = { 'returnmap': '0' }
  804. // this.requestParam.data = []
  805. // this.requestParam.data[0] = { 'name': 'insertRemainplan', 'type': 'e', 'parammaps': {
  806. // pastureid: Cookies.get('pastureid'),
  807. // sort: row.sort,
  808. // tmrid: row.tmrid,
  809. // tmrcode: row.tmrcode,
  810. // enable: row.enable,
  811. // times: row.times,
  812. // lppid: row.lppid,
  813. // lppcode: row.lppcode,
  814. // rtime: row.rtime,
  815. // treatmethod: row.treatmethod
  816. // }}
  817. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  818. // this.requestParam.data[1].children = []
  819. // this.requestParam.data[1].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  820. // pastureid: Cookies.get('pastureid'),
  821. // bigid: '@insertRemainplan.LastInsertId',
  822. // barid: '@insertSpotList.id',
  823. // bar: '@insertSpotList.bname',
  824. // type: 0
  825. // }}
  826. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  827. // this.requestParam.data[2].children = []
  828. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  829. // pastureid: Cookies.get('pastureid'),
  830. // bigid: '@insertRemainplan.LastInsertId',
  831. // barid: '@insertSpotList2.id',
  832. // bar: '@insertSpotList2.bname',
  833. // type: 1
  834. // }}
  835. // ExecDataByConfig(this.requestParam).then(response => {
  836. // console.log('新增保存发送参数', this.requestParam)
  837. // if (response.msg === 'fail') {
  838. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  839. // } else {
  840. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  841. // this.getList()
  842. // this.dropState = false
  843. // }
  844. // })
  845. // },
  846. createData() {
  847. console.log('点击了新增保存')
  848. this.isokDisable = true
  849. setTimeout(() => {
  850. this.isokDisable = false
  851. }, 1000)
  852. this.$refs['temp'].validate(valid => {
  853. if (valid) {
  854. if (this.create.temp.rtime == null || this.create.temp.rtime == 'null') {
  855. this.create.temp.rtime = ''
  856. }
  857. if (this.create.temp.sort == '' && this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  858. this.$message({ type: 'error', message: '车次/栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  859. return false
  860. } else if (this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  861. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  862. return false
  863. } else if (this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  864. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  865. return false
  866. } else if (this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  867. this.$message({ type: 'error', message: '班次/剩料处理方式不能为空', duration: 2000 })
  868. return false
  869. } else if (this.create.temp.sort == '' || this.create.temp.sort == 0) {
  870. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  871. return false
  872. } else if (this.create.temp.barid == '') {
  873. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  874. return false
  875. } else if (this.create.temp.tmrid == '') {
  876. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  877. return false
  878. } else if (this.create.temp.times == '') {
  879. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  880. return false
  881. } else if (this.create.temp.treatmethod == '') {
  882. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  883. return false
  884. }
  885. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '转投剩料') {
  886. if (this.create.temp.useinbarid == '') {
  887. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  888. return false
  889. }
  890. }
  891. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '继续饲喂') {
  892. // this.create.temp.useinbarid = '0'
  893. this.create.temp.useinbarid = '0'
  894. }
  895. if (this.create.temp.rtime == '' || this.create.temp.rtime == null) {
  896. this.create.temp.rtime = ''
  897. }
  898. for (let i = 0; i < this.table.list.length; i++) {
  899. if (this.create.temp.sort == this.table.list[i].sort) {
  900. if (this.create.temp.myId !== this.table.list[i].myId) {
  901. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  902. return false
  903. }
  904. }
  905. }
  906. var isInteger = /^\d+$/
  907. if (this.create.temp.sort !== '') {
  908. if (!isInteger.test(parseFloat(this.create.temp.sort))) {
  909. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  910. return false
  911. }
  912. }
  913. this.isokDisable = true
  914. setTimeout(() => {
  915. this.isokDisable = false
  916. }, 1000)
  917. console.log(this.create.temp)
  918. var ztlasArr = [{"bname": "","id": this.create.temp.useinbarid }]
  919. this.transferbarsList.forEach(function(item){
  920. if(item.id == ztlasArr[0].id){
  921. ztlasArr[0].bname = item.bname
  922. }
  923. })
  924. console.log("ztlasArr",ztlasArr)
  925. var ssss_data = {
  926.     "common": {
  927.         "returnmap": "0"
  928.     },
  929.     "data": [
  930.         {
  931.             "name": "insertRemainplan",
  932.             "type": "e",
  933.             "parammaps": {
  934.              
  935. pastureid: Cookies.get('pastureid'),
  936. sort: this.create.temp.sort,
  937. tmrid: this.create.temp.tmrid,
  938. tmrcode: this.create.temp.tmrcode,
  939. enable: this.create.temp.enable,
  940. times: this.create.temp.times,
  941. lppid: this.create.temp.lppid,
  942. lppcode: this.create.temp.lppcode,
  943. rtime: this.create.temp.rtime,
  944. treatmethod: this.create.temp.treatmethod
  945.             }
  946.         },
  947.         {
  948.             "name": "insertSpotList",
  949.             "resultmaps": {
  950.               'list': this.barsNamesIdTempArr
  951.             },
  952.             "children": [
  953.                 {
  954.                     "name": "insertRpdetail",
  955.                     "type": "e",
  956.                     "parammaps": {
  957.                         "pastureid":  Cookies.get('pastureid'),
  958.                         "bigid": "@insertRemainplan.LastInsertId",
  959.                         "barid": "@insertSpotList.id",
  960.                         "bar": "@insertSpotList.bname",
  961.                         "type": 0
  962.                     }
  963.                 }
  964.             ]
  965.         },
  966.         {
  967.             "name": "insertRpdetail",
  968.             "type": "e",
  969.             "parammaps": {
  970.                 "pastureid": "1647917519",
  971.                 "bigid": "@insertRemainplan.LastInsertId",
  972.                 "barid": ztlasArr[0].id,
  973.                 "bar": ztlasArr[0].bname ,
  974.                 "type": 1
  975.             }
  976.         }
  977.     ]
  978. }
  979. // this.requestParam.common = { 'returnmap': '0' }
  980. // this.requestParam.data = []
  981. // this.requestParam.data[0] = { 'name': 'insertRemainplan', 'type': 'e', 'parammaps': {
  982. // pastureid: Cookies.get('pastureid'),
  983. // sort: this.create.temp.sort,
  984. // tmrid: this.create.temp.tmrid,
  985. // tmrcode: this.create.temp.tmrcode,
  986. // enable: this.create.temp.enable,
  987. // times: this.create.temp.times,
  988. // lppid: this.create.temp.lppid,
  989. // lppcode: this.create.temp.lppcode,
  990. // rtime: this.create.temp.rtime,
  991. // treatmethod: this.create.temp.treatmethod
  992. // }}
  993. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  994. // this.requestParam.data[1].children = []
  995. // this.requestParam.data[1].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  996. // pastureid: Cookies.get('pastureid'),
  997. // bigid: '@insertRemainplan.LastInsertId',
  998. // barid: '@insertSpotList.id',
  999. // bar: '@insertSpotList.bname',
  1000. // type: 0
  1001. // }}
  1002. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1003. // this.requestParam.data[2].children = []
  1004. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1005. // pastureid: Cookies.get('pastureid'),
  1006. // bigid: '@insertRemainplan.LastInsertId',
  1007. // barid: '@insertSpotList2.id',
  1008. // bar: '@insertSpotList2.bname',
  1009. // type: 1
  1010. // }}
  1011. ExecDataByConfig(ssss_data).then(response => {
  1012. console.log('新增保存发送参数', this.requestParam)
  1013. if (response.msg === 'fail') {
  1014. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1015. } else {
  1016. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1017. this.create.dialogFormVisible = false
  1018. this.getList()
  1019. this.dropState = false
  1020. }
  1021. })
  1022. }
  1023. })
  1024. },
  1025. createCancel(row) {
  1026. console.log('点击了新增取消')
  1027. this.dropState = false
  1028. for (let i = 0; i < this.table.list.length; i++) {
  1029. if (row.myId === this.table.list[i].myId) {
  1030. var listIndex = this.table.list.indexOf(this.table.list[i])
  1031. }
  1032. if (listIndex > -1) {
  1033. this.table.list.splice(listIndex, 1)
  1034. return
  1035. }
  1036. }
  1037. },
  1038. // 模板编辑
  1039. // handleUpdate(row) {
  1040. // for (let i = 0; i < this.table.list.length; i++) {
  1041. // if (this.table.list[i].Edit == true) {
  1042. // this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1043. // return false
  1044. // }
  1045. // }
  1046. // console.log(row, '=========')
  1047. // // 编辑true,不可编辑false
  1048. // row.Edit = true
  1049. // row.NoEdit = false
  1050. // // 新增false,编辑false,编辑保存true
  1051. // row.isCreate = false
  1052. // row.isUpdate = false
  1053. // row.isUpdateSave = true
  1054. // row.temp = {}
  1055. // row.temp2 = {}
  1056. // if (row.useinbarid == '0') { row.useinbarid = [] }
  1057. // if (row.barid == undefined) { row.barid = [] }
  1058. // if (row.tmrid == undefined) { row.tmrid = '' }
  1059. // if (row.times == undefined) { row.times = '' }
  1060. // if (row.treatmethod == undefined) { row.treatmethod = '' }
  1061. // // this.getCarFollowParm.parammaps.times = row.times
  1062. // if (row.times == '第一班') {
  1063. // this.getCarFollowParm.parammaps.times = 1
  1064. // row.times = '1'
  1065. // } else if (row.times == '第二班') {
  1066. // this.getCarFollowParm.parammaps.times = 2
  1067. // row.times = '2'
  1068. // } else if (row.times == '第三班') {
  1069. // this.getCarFollowParm.parammaps.times = 3
  1070. // row.times = '3'
  1071. // } else if (row.times == '第四班') {
  1072. // this.getCarFollowParm.parammaps.times = 4
  1073. // row.times = '4'
  1074. // } else if (row.times == '第五班') {
  1075. // this.getCarFollowParm.parammaps.times = 5
  1076. // row.times = '5'
  1077. // }
  1078. // GetDataByName(this.getCarFollowParm).then(response => {
  1079. // console.log('撒料计划车次跟随列表数据', response.data.list)
  1080. // if (response.data.list !== null) {
  1081. // this.carFollowList = response.data.list
  1082. // }
  1083. // })
  1084. // console.log(row, '====')
  1085. // if (row.lppcode == undefined) {
  1086. // this.$set(row, 'lppid', '')
  1087. // }
  1088. // this.getTransferbarsList()
  1089. // // row.barid = row.qstrids.split(',')
  1090. // // row.useinbarid = row.hstrids.split(',')
  1091. // var arr3 = []
  1092. // for (let i = 0; i < row.barid.length; i++) {
  1093. // arr3.push(this.barsList.find(obj => obj.id == row.barid[i]))
  1094. // }
  1095. // this.barsNamesIdTempArr = arr3
  1096. // var arr4 = []
  1097. // setTimeout(() => {
  1098. // for (let i = 0; i < row.useinbarid.length; i++) {
  1099. // arr4.push(this.transferbarsList.find(obj => obj.id == row.useinbarid[i]))
  1100. // }
  1101. // }, 500)
  1102. // this.useinbarNamesIdTempArr = arr4
  1103. // console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr')
  1104. // this.dropState = true
  1105. // },
  1106. // 编辑
  1107. handleUpdate(row) {
  1108. console.log('点击了编辑', row)
  1109. this.create.dialogStatus = 'update'
  1110. this.dialogFull = false
  1111. this.create.dialogFormVisible = true
  1112. row.temp = {}
  1113. row.temp2 = {}
  1114. if(row.treatmethod == "继续饲喂"){
  1115. this.isDis = true
  1116. } else {
  1117. this.isDis = false
  1118. }
  1119. // if (row.useinbarid == '0') { row.useinbarid = "" }
  1120. if (row.barid == undefined) { row.barid = [] }
  1121. if (row.tmrid == undefined) { row.tmrid = '' }
  1122. if (row.times == undefined) { row.times = '' }
  1123. if (row.treatmethod == undefined) { row.treatmethod = '' }
  1124. // this.getCarFollowParm.parammaps.times = row.times
  1125. if (row.times == '第一班') {
  1126. this.getCarFollowParm.parammaps.times = 1
  1127. row.times = '1'
  1128. } else if (row.times == '第二班') {
  1129. this.getCarFollowParm.parammaps.times = 2
  1130. row.times = '2'
  1131. } else if (row.times == '第三班') {
  1132. this.getCarFollowParm.parammaps.times = 3
  1133. row.times = '3'
  1134. } else if (row.times == '第四班') {
  1135. this.getCarFollowParm.parammaps.times = 4
  1136. row.times = '4'
  1137. } else if (row.times == '第五班') {
  1138. this.getCarFollowParm.parammaps.times = 5
  1139. row.times = '5'
  1140. }
  1141. GetDataByName(this.getCarFollowParm).then(response => {
  1142. console.log('撒料计划车次跟随列表数据', response.data.list)
  1143. if (response.data.list !== null) {
  1144. this.carFollowList = response.data.list
  1145. }
  1146. })
  1147. console.log(row, '====')
  1148. if (row.lppcode == undefined) {
  1149. this.$set(row, 'lppid', '')
  1150. }
  1151. this.getTransferbarsList()
  1152. row.barid = row.qstrids.split(',')
  1153. row.useinbarid = row.hstrids
  1154. if (row.useinbarid == '0') { row.useinbarid = "" }
  1155. var arr3 = []
  1156. for (let i = 0; i < row.barid.length; i++) {
  1157. arr3.push(this.barsList.find(obj => obj.id == row.barid[i]))
  1158. }
  1159. this.barsNamesIdTempArr = arr3
  1160. this.barSortList = arr3
  1161. var arr4 = []
  1162. // setTimeout(() => {
  1163. // for (let i = 0; i < row.useinbarid.length; i++) {
  1164. // arr4.push(this.transferbarsList.find(obj => obj.id == row.useinbarid[i]))
  1165. // }
  1166. // }, 500)
  1167. // this.useinbarNamesIdTempArr = arr4
  1168. // console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr')
  1169. this.dropState = true
  1170. this.create.temp = Object.assign({}, row)
  1171. },
  1172. // updateData(row) {
  1173. // console.log('点击了编辑保存', row)
  1174. // console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr========')
  1175. // if (row.rtime == null || row.rtime == 'null') {
  1176. // row.rtime = ''
  1177. // }
  1178. // if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  1179. // this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1180. // return false
  1181. // } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  1182. // this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1183. // return false
  1184. // } else if (row.times == '' && row.treatmethod == '') {
  1185. // this.$message({ type: 'error', message: '班次/混剩料处理方式不能为空', duration: 2000 })
  1186. // return false
  1187. // } else if (row.barid == '') {
  1188. // this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  1189. // return false
  1190. // } else if (row.tmrid == '') {
  1191. // this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  1192. // return false
  1193. // } else if (row.times == '') {
  1194. // this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  1195. // return false
  1196. // } else if (row.treatmethod == '') {
  1197. // this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  1198. // return false
  1199. // }
  1200. // if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  1201. // if (row.useinbarid == '') {
  1202. // this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  1203. // return false
  1204. // }
  1205. // }
  1206. // if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  1207. // row.useinbarid = '0'
  1208. // }
  1209. // if (row.rtime == '' || row.rtime == null) {
  1210. // row.rtime = ''
  1211. // }
  1212. // for (let i = 0; i < this.table.list.length; i++) {
  1213. // if (row.sort == this.table.list[i].sort) {
  1214. // if (row.id !== this.table.list[i].id) {
  1215. // this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  1216. // return false
  1217. // }
  1218. // }
  1219. // }
  1220. // var isInteger = /^\d+$/
  1221. // if (row.sort !== '') {
  1222. // if (!isInteger.test(parseFloat(row.sort))) {
  1223. // this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  1224. // return false
  1225. // }
  1226. // }
  1227. // if (row.sort == '' || row.sort == 0) {
  1228. // this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  1229. // return false
  1230. // }
  1231. // if (row.times == '第一班') {
  1232. // row.times = 1
  1233. // } else if (row.times == '第二班') {
  1234. // row.times = 2
  1235. // } else if (row.times == '第三班') {
  1236. // row.times = 3
  1237. // } else if (row.times == '第四班') {
  1238. // row.times = 4
  1239. // } else if (row.times == '第五班') {
  1240. // row.times = 5
  1241. // }
  1242. // this.isokDisable = true
  1243. // setTimeout(() => {
  1244. // this.isokDisable = false
  1245. // }, 1000)
  1246. // this.requestParam = {}
  1247. // this.requestParam.common = { 'returnmap': '0' }
  1248. // this.requestParam.data = []
  1249. // this.requestParam.data[0] = { 'name': 'updateRemainplan', 'type': 'e', 'parammaps': {
  1250. // pastureid: row.pastureid,
  1251. // id: row.id,
  1252. // sort: row.sort,
  1253. // tmrid: row.tmrid,
  1254. // tmrcode: row.tmrcode,
  1255. // enable: row.enable,
  1256. // times: row.times,
  1257. // lppid: row.lppid,
  1258. // lppcode: row.lppcode,
  1259. // rtime: row.rtime,
  1260. // treatmethod: row.treatmethod
  1261. // }}
  1262. // this.requestParam.data[1] = { 'name': 'deleteRpdetail', 'type': 'e', 'parammaps': {
  1263. // pastureid: row.pastureid,
  1264. // bigid: row.id
  1265. // }}
  1266. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1267. // this.requestParam.data[2].children = []
  1268. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1269. // pastureid: row.pastureid,
  1270. // bigid: row.id,
  1271. // barid: '@insertSpotList2.id',
  1272. // bar: '@insertSpotList2.bname',
  1273. // type: 0
  1274. // }}
  1275. // this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1276. // this.requestParam.data[3].children = []
  1277. // this.requestParam.data[3].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1278. // pastureid: row.pastureid,
  1279. // bigid: row.id,
  1280. // barid: '@insertSpotList3.id',
  1281. // bar: '@insertSpotList3.bname',
  1282. // type: 1
  1283. // }}
  1284. // ExecDataByConfig(this.requestParam).then(response => {
  1285. // console.log('新增保存发送参数', this.requestParam)
  1286. // if (response.msg === 'fail') {
  1287. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1288. // } else {
  1289. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1290. // this.getList()
  1291. // this.dropState = false
  1292. // }
  1293. // })
  1294. // },
  1295. updateData() {
  1296. console.log('点击了编辑保存')
  1297. this.isokDisable = true
  1298. setTimeout(() => {
  1299. this.isokDisable = false
  1300. }, 1000)
  1301. this.$refs['temp'].validate(valid => {
  1302. if (valid) {
  1303. if (this.create.temp.rtime == null || this.create.temp.rtime == 'null') {
  1304. this.create.temp.rtime = ''
  1305. }
  1306. if (this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1307. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1308. return false
  1309. } else if (this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1310. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1311. return false
  1312. } else if (this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1313. this.$message({ type: 'error', message: '班次/混剩料处理方式不能为空', duration: 2000 })
  1314. return false
  1315. } else if (this.create.temp.barid == '') {
  1316. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  1317. return false
  1318. } else if (this.create.temp.tmrid == '') {
  1319. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  1320. return false
  1321. } else if (this.create.temp.times == '') {
  1322. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  1323. return false
  1324. } else if (this.create.temp.treatmethod == '') {
  1325. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  1326. return false
  1327. }
  1328. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '转投剩料') {
  1329. if (this.create.temp.useinbarid == '') {
  1330. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  1331. return false
  1332. }
  1333. }
  1334. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '继续饲喂') {
  1335. this.create.temp.useinbarid = '0'
  1336. }
  1337. if (this.create.temp.rtime == '' || this.create.temp.rtime == null) {
  1338. this.create.temp.rtime = ''
  1339. }
  1340. for (let i = 0; i < this.table.list.length; i++) {
  1341. if (this.create.temp.sort == this.table.list[i].sort) {
  1342. if (this.create.temp.id !== this.table.list[i].id) {
  1343. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  1344. return false
  1345. }
  1346. }
  1347. }
  1348. var isInteger = /^\d+$/
  1349. if (this.create.temp.sort !== '') {
  1350. if (!isInteger.test(parseFloat(this.create.temp.sort))) {
  1351. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  1352. return false
  1353. }
  1354. }
  1355. if (this.create.temp.sort == '' || this.create.temp.sort == 0) {
  1356. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  1357. return false
  1358. }
  1359. if (this.create.temp.times == '第一班') {
  1360. this.create.temp.times = 1
  1361. } else if (this.create.temp.times == '第二班') {
  1362. this.create.temp.times = 2
  1363. } else if (this.create.temp.times == '第三班') {
  1364. this.create.temp.times = 3
  1365. } else if (this.create.temp.times == '第四班') {
  1366. this.create.temp.times = 4
  1367. } else if (this.create.temp.times == '第五班') {
  1368. this.create.temp.times = 5
  1369. }
  1370. this.isokDisable = true
  1371. setTimeout(() => {
  1372. this.isokDisable = false
  1373. }, 1000)
  1374. var ztlasArr2 = [{"bname": "","id": this.create.temp.useinbarid }]
  1375. this.transferbarsList.forEach(function(item){
  1376. if(item.id == ztlasArr2[0].id){
  1377. ztlasArr2[0].bname = item.bname
  1378. }
  1379. })
  1380. console.log("ztlasArr2",ztlasArr2)
  1381. var ssss_data2 = {
  1382.     "common": {
  1383.         "returnmap": "0"
  1384.     },
  1385.     "data": [
  1386.         {
  1387.             "name": "updateRemainplan",
  1388.             "type": "e",
  1389.             "parammaps": {
  1390.                  pastureid: this.create.temp.pastureid,
  1391. id: this.create.temp.id,
  1392. sort: this.create.temp.sort,
  1393. tmrid: this.create.temp.tmrid,
  1394. tmrcode: this.create.temp.tmrcode,
  1395. enable: this.create.temp.enable,
  1396. times: this.create.temp.times,
  1397. lppid: this.create.temp.lppid,
  1398. lppcode: this.create.temp.lppcode,
  1399. rtime: this.create.temp.rtime,
  1400. treatmethod: this.create.temp.treatmethod
  1401.             }
  1402.         },
  1403.         {
  1404.             "name": "deleteRpdetail",
  1405.             "type": "e",
  1406.             "parammaps": {
  1407.                 pastureid: this.create.temp.pastureid,
  1408. bigid: this.create.temp.id
  1409.             }
  1410.         },
  1411.         {
  1412.             "name": "insertSpotList2",
  1413.             "resultmaps": {
  1414.                 "list":  this.barsNamesIdTempArr
  1415.                
  1416.             },
  1417.             "children": [
  1418.                 {
  1419.                     "name": "insertRpdetail",
  1420.                     "type": "e",
  1421.                     "parammaps": {
  1422.                         pastureid: this.create.temp.pastureid,
  1423. bigid: this.create.temp.id,
  1424.                         "barid": "@insertSpotList2.id",
  1425.                         "bar": "@insertSpotList2.bname",
  1426.                         "type": 0
  1427.                     }
  1428.                 }
  1429.             ]
  1430.         },
  1431.         {
  1432.             "name": "insertRpdetail",
  1433.             "type": "e",
  1434.             "parammaps": {
  1435.                 "pastureid": this.create.temp.pastureid,
  1436.                 "bigid": this.create.temp.id,
  1437.                
  1438.       "barid":ztlasArr2[0].id,
  1439.                 "bar":ztlasArr2[0].bname ,
  1440.                 "type": 1
  1441.             }
  1442.         }
  1443.     ]
  1444. }
  1445. // this.requestParam = {}
  1446. // this.requestParam.common = { 'returnmap': '0' }
  1447. // this.requestParam.data = []
  1448. // this.requestParam.data[0] = { 'name': 'updateRemainplan', 'type': 'e', 'parammaps': {
  1449. // pastureid: this.create.temp.pastureid,
  1450. // id: this.create.temp.id,
  1451. // sort: this.create.temp.sort,
  1452. // tmrid: this.create.temp.tmrid,
  1453. // tmrcode: this.create.temp.tmrcode,
  1454. // enable: this.create.temp.enable,
  1455. // times: this.create.temp.times,
  1456. // lppid: this.create.temp.lppid,
  1457. // lppcode: this.create.temp.lppcode,
  1458. // rtime: this.create.temp.rtime,
  1459. // treatmethod: this.create.temp.treatmethod
  1460. // }}
  1461. // this.requestParam.data[1] = { 'name': 'deleteRpdetail', 'type': 'e', 'parammaps': {
  1462. // pastureid: this.create.temp.pastureid,
  1463. // bigid: this.create.temp.id
  1464. // }}
  1465. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1466. // this.requestParam.data[2].children = []
  1467. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1468. // pastureid: this.create.temp.pastureid,
  1469. // bigid: this.create.temp.id,
  1470. // barid: '@insertSpotList2.id',
  1471. // bar: '@insertSpotList2.bname',
  1472. // type: 0
  1473. // }}
  1474. // // this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1475. // this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1476. // this.requestParam.data[3].children = []
  1477. // this.requestParam.data[3].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1478. // pastureid: this.create.temp.pastureid,
  1479. // bigid: this.create.temp.id,
  1480. // barid: '@insertSpotList3.id',
  1481. // bar: '@insertSpotList3.bname',
  1482. // type: 1
  1483. // }}
  1484. ExecDataByConfig(ssss_data2).then(response => {
  1485. console.log('保存发送参数', this.requestParam)
  1486. if (response.msg === 'fail') {
  1487. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1488. } else {
  1489. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1490. this.create.dialogFormVisible = false
  1491. this.getList()
  1492. this.dropState = false
  1493. }
  1494. })
  1495. }
  1496. })
  1497. },
  1498. updateCancel(row) {
  1499. console.log('点击了编辑取消')
  1500. // 编辑false,不可编辑true
  1501. row.Edit = false
  1502. row.NoEdit = true
  1503. // 新增false,编辑true,编辑保存false
  1504. row.isCreate = false
  1505. row.isUpdate = true
  1506. row.isUpdateSave = false
  1507. this.getList()
  1508. this.dropState = false
  1509. },
  1510. handleSelect(val) {
  1511. console.log('勾选数据', val)
  1512. this.selectList = val
  1513. },
  1514. // 行内删除
  1515. handleRowDelete(row) {
  1516. console.log(row, '点击了行删除')
  1517. MessageBox.confirm('是否确认删除此信息?', {
  1518. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1519. }).then(() => {
  1520. this.selectList = []
  1521. this.requestParam = {}
  1522. this.requestParam.name = 'deleteRemainplan'
  1523. this.requestParam.parammaps = {}
  1524. this.requestParam.parammaps.pastureid = row.pastureid
  1525. this.requestParam.parammaps.id = row.id
  1526. PostDataByName(this.requestParam).then(response => {
  1527. if (response.msg === 'fail') {
  1528. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1529. } else {
  1530. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1531. this.getList()
  1532. }
  1533. })
  1534. }).catch(() => {
  1535. this.$message({ type: 'info', message: '已取消删除' })
  1536. })
  1537. },
  1538. // 减少车次
  1539. handleDelete() {
  1540. if (this.selectList.length == 0) {
  1541. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1542. } else {
  1543. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  1544. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1545. }).then(() => {
  1546. console.log(this.selectList)
  1547. this.requestParam.common = { 'returnmap': '0' }
  1548. this.requestParam.data = []
  1549. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1550. this.requestParam.data[0].children = []
  1551. this.requestParam.data[0].children[0] = { 'name': 'deleteRemainplan', 'type': 'e', 'parammaps': {
  1552. id: '@insertSpotList.id',
  1553. pastureid: '@insertSpotList.pastureid'
  1554. }}
  1555. ExecDataByConfig(this.requestParam).then(response => {
  1556. console.log('删除保存发送参数', this.requestParam)
  1557. if (response.msg === 'fail') {
  1558. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1559. } else {
  1560. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1561. this.getList()
  1562. }
  1563. })
  1564. })
  1565. }
  1566. },
  1567. // 校验
  1568. handleCheck() {
  1569. console.log('点击了校验')
  1570. this.check.dialogStatus = 'check'
  1571. this.check.dialogFormVisible = true
  1572. this.getCheckList()
  1573. },
  1574. getCheckList() {
  1575. GetDataByName(this.check.getCheckParm).then(response => {
  1576. if (response.data.list[0].bnames !== undefined) {
  1577. this.check.temp.isDistribution = 0
  1578. this.check.temp.bnames = response.data.list[0].bnames
  1579. } else {
  1580. this.check.temp = {}
  1581. this.check.temp.isDistribution = 1
  1582. }
  1583. })
  1584. },
  1585. // 历史记录
  1586. handleHistoryRecords() {
  1587. console.log('点击了历史记录')
  1588. this.dialogFull = false
  1589. this.history.dialogStatus = 'history'
  1590. this.history.dialogFormVisible = true
  1591. this.getDateList()
  1592. },
  1593. // 历史时间
  1594. getDateList() {
  1595. GetDataByName(this.history.getdataDateParm).then(response => {
  1596. console.log('table数据', response.data.list)
  1597. if (response.data.list !== null) {
  1598. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1599. this.getHistoryList()
  1600. } else {
  1601. this.history.getdataListParm.parammaps.date = ''
  1602. }
  1603. })
  1604. },
  1605. changeDate() {
  1606. this.getHistoryList()
  1607. },
  1608. // 应用
  1609. handleApplication() {
  1610. console.log('点击了应用')
  1611. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1612. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1613. }).then(() => {
  1614. this.requestParam.name = 'applyFPdate'
  1615. this.requestParam.parammaps = {}
  1616. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1617. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  1618. PostDataByName(this.requestParam).then(response => {
  1619. if (response.msg === 'fail') {
  1620. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1621. } else {
  1622. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1623. this.getHistoryIsDisplay()
  1624. this.getList()
  1625. }
  1626. })
  1627. }).catch(() => {
  1628. this.$message({ type: 'info', message: '已取消应用' })
  1629. })
  1630. },
  1631. getHistoryList() {
  1632. this.history.listLoading = true
  1633. GetDataByName(this.history.getdataListParm).then(response => {
  1634. console.log('table数据', response.data.list)
  1635. if (response.data.list !== null) {
  1636. console.log('table数据', response.data.list)
  1637. this.history.list = response.data.list
  1638. this.history.pageNum = response.data.pageNum
  1639. this.history.pageSize = response.data.pageSize
  1640. this.history.total = response.data.total
  1641. } else {
  1642. this.history.list = []
  1643. }
  1644. setTimeout(() => {
  1645. this.history.listLoading = false
  1646. }, 100)
  1647. })
  1648. },
  1649. handleTakeEffect() {
  1650. if (this.selectList.length == 0) {
  1651. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1652. } else {
  1653. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1654. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1655. }).then(() => {
  1656. for (let i = 0; i < this.selectList.length; i++) {
  1657. // this.$set(this.selectList[i], 'enable', '1')
  1658. this.selectList[i].enable = 1
  1659. }
  1660. console.log('生效', this.selectList)
  1661. this.requestParam.common = { 'returnmap': '0' }
  1662. this.requestParam.data = []
  1663. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1664. this.requestParam.data[0].children = []
  1665. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1666. enable: '@insertSpotList.enable',
  1667. id: '@insertSpotList.id',
  1668. pastureid: '@insertSpotList.pastureid'
  1669. }}
  1670. ExecDataByConfig(this.requestParam).then(response => {
  1671. console.log('生效保存发送参数', this.requestParam)
  1672. if (response.msg === 'fail') {
  1673. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1674. } else {
  1675. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1676. this.getList()
  1677. }
  1678. })
  1679. })
  1680. }
  1681. },
  1682. handleDisable() {
  1683. if (this.selectList.length == 0) {
  1684. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1685. } else {
  1686. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1687. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1688. }).then(() => {
  1689. for (let i = 0; i < this.selectList.length; i++) {
  1690. // this.$set(this.selectList[i], 'enable', '1')
  1691. this.selectList[i].enable = 0
  1692. }
  1693. console.log('禁用', this.selectList)
  1694. this.requestParam.common = { 'returnmap': '0' }
  1695. this.requestParam.data = []
  1696. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1697. this.requestParam.data[0].children = []
  1698. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1699. enable: '@insertSpotList.enable',
  1700. id: '@insertSpotList.id',
  1701. pastureid: '@insertSpotList.pastureid'
  1702. }}
  1703. ExecDataByConfig(this.requestParam).then(response => {
  1704. console.log('禁用保存发送参数', this.requestParam)
  1705. if (response.msg === 'fail') {
  1706. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1707. } else {
  1708. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  1709. this.getList()
  1710. }
  1711. })
  1712. })
  1713. }
  1714. }
  1715. }
  1716. }
  1717. </script>
  1718. <style lang="scss" scoped>
  1719. .search{clear: both;}
  1720. .table{margin-top:10px;}
  1721. </style>