041bc9a958c37cf55f8429a6d271488c6eb78da0.svn-base 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533
  1. <template>
  2. <div class="app-container">
  3. <div class="menuList">
  4. <div class="menuList-t">
  5. <div class="menuList-t-l">
  6. <span>班次:</span>
  7. <el-radio-group v-model="menuRadio" size="small" @change="changeMenu">
  8. <el-radio-button v-if="maxTime.isTime1" label="一班">一班</el-radio-button>
  9. <el-radio-button v-if="maxTime.isTime2" label="二班">二班</el-radio-button>
  10. <el-radio-button v-if="maxTime.isTime3" label="三班">三班</el-radio-button>
  11. <el-radio-button v-if="maxTime.isTime4" label="四班">四班</el-radio-button>
  12. </el-radio-group>
  13. </div>
  14. <div class="menuList-t-r">
  15. <div v-if="!isBarracks" class="menuList-t-r-l" @click="clickBarracks(2);">栏舍计划统计-展开<i class="el-icon-arrow-down" /></div>
  16. <div v-if="isBarracks" class="menuList-t-r-r" @click="clickBarracks(1);">栏舍计划统计-收起<i class="el-icon-arrow-up" /></div>
  17. <div v-if="isBarracks" class="columnHouse">
  18. <div class="smallTable">
  19. <el-table
  20. :list-loading="smallMenu.listLoading"
  21. element-loading-text="给我一点时间"
  22. :data="smallMenu.list"
  23. :row-style="rowStyle2"
  24. :cell-style="cellStyle2"
  25. :header-row-style="headerRowStyle2"
  26. :header-cell-style="headerCellStyle2"
  27. show-summary
  28. sum-text="总栏舍"
  29. class="elTable"
  30. >
  31. <el-table-column label="配方/班次" min-width="80px" align="center" prop="tname" />
  32. <el-table-column label="总数" min-width="50px" align="center" prop="usedsum" />
  33. <el-table-column v-if="maxTime.isTime1" label="第一班未分配" min-width="105px" align="center" prop="onetime" />
  34. <el-table-column v-if="maxTime.isTime2" label="第二班未分配" min-width="105px" align="center" prop="twotime" />
  35. <el-table-column v-if="maxTime.isTime3" label="第三班未分配" min-width="105px" align="center" prop="threetime" />
  36. <el-table-column v-if="maxTime.isTime4" label="第四班未分配" min-width="105px" align="center" prop="fourtime" />
  37. </el-table>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="menuList-b">
  43. <ul v-loading="listLoadingTimes" class="draggableList">
  44. <li v-for="element in MenuList" :key="element.arrid">
  45. <span v-if="element.isShowTitle" class="draggableTitle">{{ element.ftname }}:</span>
  46. <draggable id="1" data-source="juju1" :list="element.arrList" class="list-group1" draggable=".item" group="a" :move="move" @change="changeLog" @start="start" @end="end">
  47. <div v-for="item in element.arrList" :key="item.id" class="list-group-item1 item" style="width: 88px;float: left;margin:5px 5px;height: 36px;">
  48. <el-tooltip placement="top" class="list-group-item1 item" style="height: 18px;line-height: 18px;" :style="{'background':item.background}">
  49. <div slot="content">{{ item.barname }}</div>
  50. <div class="draggableName">{{ item.barname }}</div>
  51. </el-tooltip>
  52. <div class="draggableWeight" :style="{ background: 'rgba('+item.background2+ ',0.1)' }"> {{ item.weight }} </div>
  53. </div>
  54. </draggable>
  55. </li>
  56. </ul>
  57. </div>
  58. </div>
  59. <div ref="list" class="list">
  60. <div class="operation">
  61. <el-button class="success" icon="el-icon-plus" style="float:left;" @click="handleCreate">新增车次</el-button>
  62. <el-button class="danger" icon="el-icon-delete" style="float:left;" @click="handleReduceTrains">减少车次</el-button>
  63. <el-button class="success" icon="el-icon-download" style="float:left;" @click="handleAutomaticGeneration">自动生成</el-button>
  64. <el-button v-if="isOrder" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  65. <div v-else style="float: left;margin-left: 10px;">
  66. <el-button class="success" @click="saveChangeOrder">保存</el-button>
  67. <el-button class="success" @click="cancelChangeOrder">取消</el-button>
  68. </div>
  69. <el-button class="success" icon="el-icon-time" style="float:right;" @click="handleHistoryRecord">历史记录</el-button>
  70. </div>
  71. <div class="table">
  72. <el-table
  73. id="table"
  74. :key="table.tableKey"
  75. ref="table"
  76. v-loading="table.listLoading"
  77. element-loading-text="给我一点时间"
  78. :data="table.list"
  79. border
  80. highlight-current-row
  81. style="width: 100%;"
  82. :height="height"
  83. :row-style="rowStyle"
  84. :cell-style="cellStyle"
  85. class="elTable"
  86. row-key="id"
  87. @selection-change="handleSelect"
  88. >
  89. <el-table-column type="selection" width="50" />
  90. <el-table-column label="车次" width="85px" align="center">
  91. <template slot-scope="scope">
  92. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  93. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" type="number" placeholder="车次" class="filter-item" style="display: inline-block;width: 95%;" />
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="TMR编号" width="110px" align="center">
  97. <template slot-scope="scope">
  98. <span v-if="scope.row.NoEdit">{{ scope.row.tmrname }}</span>
  99. <el-select v-if="scope.row.Edit" v-model="scope.row.tmrid" placeholder="TMR编号" class="filter-item" style="width:95%;" @change="(value)=> {changeTMRNumber(value, scope.row)}">
  100. <el-option v-for="item in TMRNumberList" :key="item.id" :label="item.eqcode" :value="item.id" />
  101. </el-select>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="描述" width="110px" align="center">
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.NoEdit">{{ scope.row.display }}</span>
  107. <el-input v-if="scope.row.Edit" v-model="scope.row.display" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" placeholder="描述" maxlength="255" class="filter-item" style="display: inline-block;width: 95%;" />
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="生效" width="100px" align="center">
  111. <template slot-scope="scope">
  112. <el-switch v-model="scope.row.sel" :disabled="scope.row.NoEdit" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleTakeEffectChange(scope.$index, scope.row)" />
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="班次" width="100px" align="center">
  116. <template slot-scope="scope">
  117. <span v-if="scope.row.NoEdit">{{ scope.row.timesstr }}</span>
  118. <el-select v-if="scope.row.Edit" v-model="scope.row.times" :disabled="scope.row.Disabled" placeholder="班次" class="filter-item" style="width:95%;">
  119. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  120. </el-select>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="时间" width="150px" align="center">
  124. <template slot-scope="scope">
  125. <span v-if="scope.row.NoEdit">{{ scope.row.begintime }}</span>
  126. <el-time-picker v-if="scope.row.Edit" v-model="scope.row.begintime" type="datetime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="display: inline-block;width: 95%;" />
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="最大重量" width="80px" align="center">
  130. <template slot-scope="scope">
  131. <span>{{ scope.row.maxweight }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="合计重量" width="80px" align="center">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.sumweight }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="模板配方" width="120px" align="center">
  140. <template slot-scope="scope">
  141. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  142. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" :disabled="scope.row.Disabled" placeholder="模板配方" class="filter-item" style="width:95%;" @change="(value)=> {changeTemplateFormulation(value, scope.row)}">
  143. <el-option v-for="item in templateFormulationList" :key="item.id" :label="item.tname" :value="item.id" />
  144. </el-select>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="是否提前小料拆分" width="100px" align="center">
  148. <template slot-scope="scope">
  149. <el-switch v-model="scope.row.issplit" :disabled="scope.row.NoEdit" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleIssplitChange(scope.$index, scope.row)" />
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="撒料" width="950px" align="center">
  153. <template slot-scope="scope">
  154. <draggable id="2" data-source="juju" :list="scope.row.arrList" class="list-group2" draggable=".item" group="a" :move="move2" @change="changeLog2(scope.row)" @start="start2" @end="end2(scope.row)">
  155. <div v-for="element in scope.row.arrList" :key="element.name" class="list-group-item2 item">
  156. <div class="arr-l">
  157. <div class="arr-l-t">
  158. <div class="arr-l-t-t" />
  159. <el-select v-model="element.tmrid" placeholder="撒料设备" class="arr-l-t-b el-icon-arrow-down" @change="(value)=> {changeEquipment(value, scope.row,element.fttype,element.id)}">
  160. <el-option v-for="item in equipmentList" :key="item.id" :label="item.tmrmix" :value="item.id" />
  161. </el-select>
  162. </div>
  163. <div class="arr-l-b">
  164. <el-tooltip placement="top" class="list-group-item1 item" style="height: 18px;line-height: 18px;">
  165. <div slot="content">{{ element.tmrname }}</div>
  166. <div class="tmrname">{{ element.tmrname }}</div>
  167. </el-tooltip>
  168. </div>
  169. </div>
  170. <div class="arr-r">
  171. <div class="arr-r-l">
  172. <el-tooltip placement="top">
  173. <div slot="content">{{ element.barname }}</div>
  174. <div class="barname">{{ element.barname }}</div>
  175. </el-tooltip>
  176. </div>
  177. <div class="arr-r-c">-</div>
  178. <div class="arr-r-r">
  179. <el-tooltip v-show="!element.isWeight" placement="top">
  180. <div slot="content">{{ element.weight }}</div>
  181. <div class="weight" @dblclick="dbclickWeight(element)">{{ element.weight }}</div>
  182. </el-tooltip>
  183. <el-tooltip v-show="element.isWeight" placement="top">
  184. <div slot="content">{{ element.weight }}</div>
  185. <input ref="weight" v-model="element.weight" v-focus="element.focusState" type="number" placeholder="重量" step="0.01" class="filter-item2" style="display: inline-block;width: 95%;border: 1px solid #e6e6e6;" @blur="(value)=> {blurWeight(scope.row,element.fttype,element.id)}">
  186. </el-tooltip>
  187. </div>
  188. </div>
  189. <div class="arr-t" :style="{'background':element.background}">
  190. <i class="el-icon-close" style="position: absolute;right: 0;" @click="handleFLDelete(element,scope.row)" />
  191. </div>
  192. </div>
  193. </draggable>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width" fixed="right">
  197. <template slot-scope="{row}">
  198. <el-button v-if="row.isCreate" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  199. <el-button v-if="row.isCreate" class="minCancel" icon="el-icon-close" @click="createCancel(row)">取消</el-button>
  200. <el-button v-if="row.isUpdate" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  201. <el-button v-if="row.isUpdate" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  202. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  203. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. </div>
  208. <!-- 自动生成 -->
  209. <el-dialog :title="textMap[automaticGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="automaticGeneration.dialogFormVisible" :close-on-click-modal="false" width="40%">
  210. <div class="app-automaticGeneration" style="margin: 0 auto;">
  211. <div style="width: 210px;margin:60px auto 120px;">
  212. 请选择自动生成方式:<br>
  213. 清空计划并生成新计划;<br>
  214. 当前计划基础上继续生成计划;<br>
  215. </div>
  216. <div slot="footer" class="dialog-footer">
  217. <el-button class="cancelClose" @click="automaticGeneration.dialogFormVisible = false; ">关闭</el-button>
  218. <el-button class="success" :disabled="isokDisable" @click="continueData(0)">继续生成</el-button>
  219. <el-button class="success" :disabled="isokDisable" @click="continueData(1)">重新生成</el-button>
  220. </div>
  221. </div>
  222. </el-dialog>
  223. <!-- 历史记录 -->
  224. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  225. <div class="historyRecord">
  226. <keep-alive>
  227. <component :is="historyRecord.myComponent" ref="historyRecord" />
  228. </keep-alive>
  229. </div>
  230. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  231. <el-button class="cancelClose" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  232. </div>
  233. </el-dialog>
  234. </div>
  235. </div>
  236. </div>
  237. </template>
  238. <script>
  239. import { GetDataByName, GetArrList, PostDataByName, failproccess, ExecDataByConfig } from '@/api/common'
  240. import draggable from 'vuedraggable'
  241. import Sortable from 'sortablejs'
  242. import Cookies from 'js-cookie'
  243. import { MessageBox } from 'element-ui'
  244. // const id = 1
  245. export default {
  246. name: 'MaterialIssuancePlan',
  247. display: 'Two list header slot',
  248. order: 14,
  249. components: { draggable },
  250. directives: {
  251. focus: {
  252. update: function(el, { value }) {
  253. if (value) {
  254. el.focus()
  255. }
  256. }
  257. }
  258. },
  259. data() {
  260. return {
  261. isBarracks: false,
  262. requestParams: {
  263. name: 'getTMRListEnableType', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '1' }
  264. },
  265. requestParams2: {
  266. name: 'getTMRListEnableTypeAll', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '1' }
  267. },
  268. requestParams3: {
  269. name: 'getFTSWList', offset: 0, parammaps: { pastureid: Cookies.get('pastureid') }
  270. },
  271. equipmentList: [], // 撒料设备
  272. TMRNumberList: [], // TMR编号
  273. frequencyList: [], // 班次
  274. templateFormulationList: [], // 模板配方
  275. // 班次
  276. maxTime: {
  277. getMaxTimesParm: {
  278. name: 'getSysoptEnable',
  279. page: 1,
  280. offset: 1,
  281. pagecount: 1,
  282. returntype: 'Map',
  283. parammaps: {
  284. pastureid: Cookies.get('pastureid'),
  285. inforname: 'times'
  286. }
  287. },
  288. // 班次
  289. isTime1: false,
  290. isTime2: false,
  291. isTime3: false,
  292. isTime4: false
  293. },
  294. table: {
  295. getdataListParm: {
  296. name: 'getLppList',
  297. name1: 'getLppdList',
  298. page: 1,
  299. offset: 1,
  300. returntype: 'Map',
  301. parammaps: {
  302. pastureid: Cookies.get('pastureid')
  303. }
  304. },
  305. list: [],
  306. total: 0,
  307. tableKey: 0,
  308. listLoading: false,
  309. tabClickIndex: null, // 点击的单元格
  310. tabClickLabel: '', // 当前点击的列名
  311. temp: {},
  312. move1: '',
  313. changeList: [],
  314. startObj: {},
  315. isGoing: false
  316. },
  317. selectList: [], // 选中数据
  318. // 班次
  319. menuRadio: '一班',
  320. MenuList: [], // 配单列表
  321. getdataListParmTimes: {
  322. name: 'geFTListByFP',
  323. name1: 'geFTListByFPDetail',
  324. page: 1,
  325. offset: 1,
  326. returntype: 'Map',
  327. parammaps: {
  328. pastureid: Cookies.get('pastureid'),
  329. times: '1'
  330. }
  331. },
  332. listLoadingTimes: false,
  333. // 栏舍统计
  334. isLeftButton: true, // 向左
  335. isRightButton: false, // 向右
  336. rowStyle2: { maxHeight: 20 + 'px', height: 20 + 'px' },
  337. cellStyle2: { padding: 0 + 'px' },
  338. headerRowStyle2: { maxHeight: 20 + 'px', height: 20 + 'px' },
  339. headerCellStyle2: { padding: 0 + 'px' },
  340. smallMenu: {
  341. getdataListParm: {
  342. name: 'getLppUseSUMList',
  343. page: 1,
  344. offset: 1,
  345. pagecount: 10,
  346. returntype: 'Map',
  347. parammaps: {
  348. pastureid: Cookies.get('pastureid')
  349. }
  350. },
  351. total: 0,
  352. tableKey: 0,
  353. listLoading: false,
  354. list: []
  355. },
  356. // 自动生成
  357. automaticGeneration: {
  358. dialogFormVisible: false,
  359. dialogStatus: ''
  360. },
  361. historyRecord: {
  362. dialogFormVisible: false,
  363. dialogStatus: '',
  364. myComponent: null
  365. },
  366. textMap: {
  367. automaticGeneration: '提示',
  368. historyRecord: '历史记录'
  369. },
  370. isokDisable: false,
  371. requestParam: {},
  372. height: document.body.clientHeight - 210 - 50, // table高度
  373. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  374. cellStyle: { padding: 0 + 'px' },
  375. dropState: false,
  376. isOrder: true
  377. }
  378. },
  379. created() {
  380. this.getIsDisplay()
  381. this.getDownList()
  382. },
  383. methods: {
  384. clickBarracks(item) {
  385. this.isBarracks = !this.isBarracks
  386. },
  387. // 下拉列表
  388. getDownList() {
  389. GetDataByName(this.requestParams).then(response => {
  390. if (response.data !== null) {
  391. this.TMRNumberList = response.data.list
  392. } else {
  393. this.TMRNumberList = []
  394. }
  395. })
  396. GetDataByName(this.requestParams2).then(response => {
  397. if (response.data !== null) {
  398. this.equipmentList = response.data.list
  399. } else {
  400. this.equipmentList = []
  401. }
  402. })
  403. GetDataByName(this.requestParams3).then(response => {
  404. if (response.data !== null) {
  405. this.templateFormulationList = response.data.list
  406. } else {
  407. this.templateFormulationList = []
  408. }
  409. })
  410. },
  411. // 显示班次
  412. getIsDisplay() {
  413. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  414. console.log(response.data.list[0].inforvalue)
  415. if (response.data.list[0].inforvalue == 1) {
  416. this.frequencyList = [{ id: '1', name: '第一班' }]
  417. } else if (response.data.list[0].inforvalue == 2) {
  418. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  419. } else if (response.data.list[0].inforvalue == 3) {
  420. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  421. } else if (response.data.list[0].inforvalue == 4) {
  422. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  423. }
  424. if (response.data.list !== null) {
  425. if (response.data.list[0].inforvalue == 1) {
  426. this.maxTime.isTime1 = true
  427. this.maxTime.isTime2 = false
  428. this.maxTime.isTime3 = false
  429. this.maxTime.isTime4 = false
  430. } else if (response.data.list[0].inforvalue == 2) {
  431. this.maxTime.isTime1 = true
  432. this.maxTime.isTime2 = true
  433. this.maxTime.isTime3 = false
  434. this.maxTime.isTime4 = false
  435. } else if (response.data.list[0].inforvalue == 3) {
  436. this.maxTime.isTime1 = true
  437. this.maxTime.isTime2 = true
  438. this.maxTime.isTime3 = true
  439. this.maxTime.isTime4 = false
  440. } else if (response.data.list[0].inforvalue == 4) {
  441. this.maxTime.isTime1 = true
  442. this.maxTime.isTime2 = true
  443. this.maxTime.isTime3 = true
  444. this.maxTime.isTime4 = true
  445. }
  446. } else {
  447. this.maxTime.isTime1 = false
  448. this.maxTime.isTime2 = false
  449. this.maxTime.isTime3 = false
  450. this.maxTime.isTime4 = false
  451. }
  452. })
  453. this.getList()
  454. this.getSmallMenuList() // 栏舍统计
  455. this.getTimesList() // 班次
  456. },
  457. // 头部班次
  458. getTimesList() {
  459. this.listLoadingTimes = true
  460. GetArrList(this.getdataListParmTimes).then(response => {
  461. if (response.data.list !== null) {
  462. for (let i = 0; i < response.data.list.length; i++) {
  463. this.$set(response.data.list[i], 'isShowTitle', true)
  464. if (response.data.list[i].arrList == null) {
  465. this.$set(response.data.list[i], 'isShowTitle', false)
  466. } else {
  467. for (let j = 0; j < response.data.list[i].arrList.length; j++) {
  468. this.$set(response.data.list[i].arrList[j], 'background2', this.colorRgb(response.data.list[i].arrList[j].background))
  469. }
  470. }
  471. // console.log(response.data.list[i])
  472. }
  473. this.MenuList = response.data.list
  474. } else {
  475. this.MenuList = []
  476. }
  477. })
  478. setTimeout(() => {
  479. this.listLoadingTimes = false
  480. }, 100)
  481. },
  482. colorRgb(sColor) {
  483. sColor = sColor.toLowerCase()
  484. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
  485. // 如果是16进制颜色
  486. if (sColor && reg.test(sColor)) {
  487. if (sColor.length === 4) {
  488. var sColorNew = '#'
  489. for (var i = 1; i < 4; i += 1) {
  490. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
  491. }
  492. sColor = sColorNew
  493. }
  494. // 处理六位的颜色值
  495. var sColorChange = []
  496. for (var i = 1; i < 7; i += 2) {
  497. sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
  498. }
  499. return sColorChange.join(',')
  500. }
  501. return 'rgba(' + sColorChange.join(',') + ')'
  502. },
  503. // 切换班次
  504. changeMenu(val) {
  505. console.log(val)
  506. if (this.menuRadio === '一班') {
  507. this.getdataListParmTimes.parammaps.times = '1'
  508. this.getTimesList()
  509. } else if (this.menuRadio === '二班') {
  510. this.getdataListParmTimes.parammaps.times = '2'
  511. this.getTimesList()
  512. this.MenuList = this.twoMenuList
  513. } else if (this.menuRadio === '三班') {
  514. this.getdataListParmTimes.parammaps.times = '3'
  515. this.getTimesList()
  516. } else if (this.menuRadio === '四班') {
  517. this.getdataListParmTimes.parammaps.times = '4'
  518. this.getTimesList()
  519. }
  520. },
  521. // 右侧栏舍统计
  522. getSmallMenuList() {
  523. this.smallMenu.listLoading = true
  524. GetDataByName(this.smallMenu.getdataListParm).then(response => {
  525. if (response.data.list !== null) {
  526. for (let i = 0; i < response.data.list.length; i++) {
  527. if (response.data.list[i].onetime == undefined) { this.$set(response.data.list[i], 'onetime', 0) } else { response.data.list[i].onetime = parseFloat(response.data.list[i].onetime) }
  528. if (response.data.list[i].twotime == undefined) { this.$set(response.data.list[i], 'twotime', 0) } else { response.data.list[i].twotime = parseFloat(response.data.list[i].twotime) }
  529. if (response.data.list[i].threetime == undefined) { this.$set(response.data.list[i], 'threetime', 0) } else { response.data.list[i].threetime = parseFloat(response.data.list[i].threetime) }
  530. if (response.data.list[i].fourtime == undefined) { this.$set(response.data.list[i], 'fourtime', 0) } else { response.data.list[i].fourtime = parseFloat(response.data.list[i].fourtime) }
  531. this.$set(response.data.list[i], 'usedsum', response.data.list[i].onetime + response.data.list[i].twotime + response.data.list[i].threetime + response.data.list[i].fourtime)
  532. this.$set(response.data.list[i], 'all', '')
  533. }
  534. this.smallMenu.list = response.data.list
  535. this.smallMenu.total = response.data.total
  536. } else {
  537. this.smallMenu.list = []
  538. }
  539. console.log('smallMenu数据', response.data.list)
  540. setTimeout(() => {
  541. this.smallMenu.listLoading = false
  542. }, 100)
  543. })
  544. },
  545. // table
  546. getList() {
  547. this.table.listLoading = true
  548. GetArrList(this.table.getdataListParm).then(response => {
  549. if (response.data.list !== null) {
  550. console.log('table数据', response.data.list)
  551. for (let i = 0; i < response.data.list.length; i++) {
  552. this.$set(response.data.list[i], 'Edit', false) // 编辑
  553. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  554. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  555. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  556. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  557. this.$set(response.data.list[i], 'Disabled', true) // 班次/模板配方不可输入
  558. if (response.data.list[i].arrList == null) {
  559. this.$set(response.data.list[i], 'Disabled', false)
  560. this.$set(response.data.list[i], 'arrList', [])
  561. } else {
  562. for (let j = 0; j < response.data.list[i].arrList.length; j++) {
  563. this.$set(response.data.list[i].arrList[j], 'isWeight', false)
  564. this.$set(response.data.list[i].arrList[j], 'focusState', false)
  565. }
  566. }
  567. }
  568. this.table.list = response.data.list
  569. // this.rowDrop()
  570. this.table.changeList = []
  571. this.table.startObj = {}
  572. if (response.data.total) {
  573. this.table.total = response.data.total
  574. }
  575. } else {
  576. this.table.list = []
  577. }
  578. setTimeout(() => {
  579. this.table.listLoading = false
  580. }, 100)
  581. })
  582. },
  583. handleChangeOrder() {
  584. this.isOrder = false
  585. this.rowDrop()
  586. },
  587. // 行拖拽
  588. rowDrop() {
  589. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  590. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  591. const that = this
  592. var sortable = Sortable.create(tbody, {
  593. disabled: that.dropState,
  594. onChoose({ newIndex, oldIndex }) {
  595. console.log(that.isOrder, 'that.isOrder == false')
  596. console.log(that.dropState, 'that.dropState')
  597. if (that.dropState == true || that.isOrder == true) {
  598. sortable.destroy()
  599. }
  600. },
  601. onEnd({ newIndex, oldIndex }) {
  602. const currRow = that.table.list.splice(oldIndex, 1)[0]
  603. that.table.list.splice(newIndex, 0, currRow)
  604. console.log('索引', newIndex)
  605. console.log('拖动数据', currRow)
  606. console.log('上', that.table.list[newIndex - 1])
  607. console.log('下', that.table.list[newIndex + 1])
  608. }
  609. })
  610. },
  611. saveChangeOrder() {
  612. // 保存顺序
  613. var sortArr = []
  614. for (let i = 0; i < this.table.list.length; i++) {
  615. var obj = {}
  616. obj.sort = i + 1
  617. obj.id = this.table.list[i].id
  618. obj.pastureid = this.table.list[i].pastureid
  619. sortArr.push(obj)
  620. }
  621. this.requestParam = {}
  622. this.requestParam.common = { 'returnmap': '0' }
  623. this.requestParam.data = []
  624. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortArr }}
  625. this.requestParam.data[0].children = []
  626. this.requestParam.data[0].children[0] = { 'name': 'updateLppSort', 'type': 'e', 'parammaps': {
  627. id: '@insertSpotList.id',
  628. pastureid: '@insertSpotList.pastureid',
  629. sort: '@insertSpotList.sort'
  630. }}
  631. ExecDataByConfig(this.requestParam).then(response => {
  632. console.log('顺序切换保存发送参数', this.requestParam)
  633. if (response.msg === 'fail') {
  634. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  635. } else {
  636. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  637. this.getList()
  638. this.isOrder = true
  639. }
  640. })
  641. },
  642. cancelChangeOrder() {
  643. // 取消顺序
  644. this.getList()
  645. this.isOrder = true
  646. },
  647. // TMR编号
  648. changeTMRNumber(item, row) {
  649. row.tmrname = this.TMRNumberList.find(obj => obj.id === item).eqcode
  650. row.maxweight = this.TMRNumberList.find(obj => obj.id === item).maxstirfeed
  651. },
  652. // 配方模板
  653. changeTemplateFormulation(item, row) {
  654. row.ftname = this.templateFormulationList.find(obj => obj.id === item).tname
  655. },
  656. // 增加车次
  657. handleCreate() {
  658. console.log(this.table.list)
  659. for (let i = 0; i < this.table.list.length; i++) {
  660. if (this.table.list[i].Edit === true) {
  661. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  662. return false
  663. }
  664. }
  665. if (this.table.list.length == 0) {
  666. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'tmrname': '', 'tmrid': '', 'sort': 1, 'sel': 1, 'issplit': 1, 'times': '', 'display': '', 'begintime': '', 'ftname': '', 'ftid': '', 'sumweight': '', 'sumcowcount': '', 'maxweight': '', 'arrList': [] })
  667. } else {
  668. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'tmrname': '', 'tmrid': '', 'sort': parseInt(this.table.list[this.table.list.length - 1].sort) + 1, 'sel': 1, 'issplit': 1, 'times': '', 'display': '', 'begintime': '', 'ftname': '', 'ftid': '', 'sumweight': '', 'sumcowcount': '', 'maxweight': '', 'arrList': [] })
  669. }
  670. // this.$refs.box.scrollTop = 0
  671. this.$refs.table.bodyWrapper.scrollTop = 0
  672. this.dropState = true
  673. },
  674. createData(row) {
  675. console.log('点击了新增保存', row)
  676. if (row.begintime == null || row.begintime == 'null') {
  677. row.begintime = ''
  678. }
  679. this.table.temp.pastureid = Cookies.get('pastureid')
  680. this.table.temp.tmrname = row.tmrname
  681. this.table.temp.tmrid = row.tmrid
  682. this.table.temp.sort = row.sort
  683. this.table.temp.sel = row.sel
  684. this.table.temp.issplit = row.issplit
  685. this.table.temp.times = row.times
  686. this.table.temp.display = row.display
  687. this.table.temp.begintime = row.begintime
  688. this.table.temp.ftname = row.ftname
  689. this.table.temp.ftid = row.ftid
  690. this.table.temp.sumweight = 0
  691. this.table.temp.maxweight = row.maxweight
  692. if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  693. this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })
  694. return false
  695. } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  696. this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })
  697. return false
  698. } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {
  699. this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })
  700. return false
  701. } else if (this.table.temp.ftid == '') {
  702. this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })
  703. return false
  704. } else if (this.table.temp.times == '') {
  705. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  706. return false
  707. }
  708. for (let i = 0; i < this.table.list.length; i++) {
  709. if (row.sort == this.table.list[i].sort) {
  710. if (row.myId !== this.table.list[i].myId) {
  711. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  712. return false
  713. }
  714. }
  715. }
  716. var isInteger = /^\d+$/
  717. if (this.table.temp.sort !== '') {
  718. if (!isInteger.test(parseFloat(this.table.temp.sort))) {
  719. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  720. return false
  721. }
  722. }
  723. this.isokDisable = true
  724. setTimeout(() => {
  725. this.isokDisable = false
  726. }, 1000)
  727. this.requestParam = {}
  728. this.requestParam.name = 'insertLpp'
  729. this.requestParam.parammaps = this.table.temp
  730. PostDataByName(this.requestParam).then(response => {
  731. console.log('新增保存发送参数', this.requestParam)
  732. if (response.msg !== 'fail') {
  733. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  734. this.getList()
  735. this.dropState = false
  736. } else {
  737. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  738. }
  739. })
  740. },
  741. createCancel(row) {
  742. console.log('点击了新增取消')
  743. this.dropState = false
  744. for (let i = 0; i < this.table.list.length; i++) {
  745. if (row.myId === this.table.list[i].myId) {
  746. var listIndex = this.table.list.indexOf(this.table.list[i])
  747. }
  748. if (listIndex > -1) {
  749. this.table.list.splice(listIndex, 1)
  750. return
  751. }
  752. }
  753. },
  754. // 编辑
  755. handleUpdate(row) {
  756. console.log(row, '点击了行编辑')
  757. for (let i = 0; i < this.table.list.length; i++) {
  758. if (this.table.list[i].Edit == true) {
  759. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  760. return false
  761. }
  762. }
  763. // 编辑true,不可编辑false
  764. row.Edit = true
  765. row.NoEdit = false
  766. // 新增false,编辑false,编辑保存true
  767. row.isCreate = false
  768. row.isUpdate = false
  769. row.isUpdateSave = true
  770. row.times = String(row.times)
  771. if (row.sort == undefined) { row.sort = '' }
  772. if (row.tmrid == undefined || row.tmrname == undefined) {
  773. row.tmrid = ''
  774. row.tmrname = ''
  775. }
  776. if (row.display == undefined) { row.display = '' }
  777. if (row.times == undefined) { row.times = '' }
  778. if (row.begintime == undefined) { row.begintime = '' }
  779. if (row.ftid == undefined || row.ftname == undefined) {
  780. row.ftid = ''
  781. row.ftname = ''
  782. }
  783. this.dropState = true
  784. },
  785. updateData(row) {
  786. console.log('点击了编辑保存', row)
  787. if (row.begintime == null || row.begintime == 'null') {
  788. row.begintime = ''
  789. }
  790. this.table.temp.pastureid = row.pastureid
  791. this.table.temp.id = row.id
  792. this.table.temp.tmrname = row.tmrname
  793. this.table.temp.tmrid = row.tmrid
  794. this.table.temp.sort = row.sort
  795. this.table.temp.sel = row.sel
  796. this.table.temp.issplit = row.issplit
  797. this.table.temp.times = row.times
  798. this.table.temp.display = row.display
  799. this.table.temp.begintime = row.begintime
  800. this.table.temp.ftname = row.ftname
  801. this.table.temp.ftid = row.ftid
  802. this.table.temp.sumweight = row.sumweight
  803. this.table.temp.sumcowcount = row.sumcowcount
  804. this.table.temp.maxweight = row.maxweight
  805. if (this.table.temp.sort == '' && this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  806. this.$message({ type: 'error', message: '车次/TMR编号/班次/模板配方不能为空', duration: 2000 })
  807. return false
  808. } else if (this.table.temp.tmrid == '' && this.table.temp.times == '' && this.table.temp.ftid == '') {
  809. this.$message({ type: 'error', message: 'TMR编号/班次/模板配方不能为空', duration: 2000 })
  810. return false
  811. } else if (this.table.temp.times == '' && this.table.temp.ftid == '') {
  812. this.$message({ type: 'error', message: '班次/模板配方不能为空', duration: 2000 })
  813. return false
  814. } else if (this.table.temp.ftid == '') {
  815. this.$message({ type: 'error', message: '模板配方不能为空', duration: 2000 })
  816. return false
  817. }
  818. for (let i = 0; i < this.table.list.length; i++) {
  819. if (row.sort == this.table.list[i].sort) {
  820. if (row.id !== this.table.list[i].id) {
  821. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  822. return false
  823. }
  824. }
  825. }
  826. var isInteger = /^\d+$/
  827. if (this.table.temp.sort !== '') {
  828. if (!isInteger.test(parseFloat(this.table.temp.sort))) {
  829. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  830. return false
  831. }
  832. }
  833. this.isokDisable = true
  834. setTimeout(() => {
  835. this.isokDisable = false
  836. }, 1000)
  837. this.requestParam = {}
  838. this.requestParam.name = 'updateLpp'
  839. this.requestParam.parammaps = this.table.temp
  840. PostDataByName(this.requestParam).then(response => {
  841. console.log('编辑保存发送参数', this.requestParam)
  842. if (response.msg !== 'fail') {
  843. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  844. this.getList()
  845. this.dropState = false
  846. } else {
  847. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  848. }
  849. })
  850. },
  851. updateCancel(row) {
  852. console.log('点击了编辑取消')
  853. // 编辑false,不可编辑true
  854. row.Edit = false
  855. row.NoEdit = true
  856. // 新增false,编辑true,编辑保存false
  857. row.isCreate = false
  858. row.isUpdate = true
  859. row.isUpdateSave = false
  860. this.dropState = false
  861. this.getList()
  862. },
  863. // 自动生成
  864. handleAutomaticGeneration() {
  865. this.automaticGeneration.dialogStatus = 'automaticGeneration'
  866. this.automaticGeneration.dialogFormVisible = true
  867. },
  868. continueData(item) {
  869. if (item == 0) {
  870. console.log('点击继续生成')
  871. this.requestParam = {}
  872. this.requestParam.common = { 'returnmap': '0' }
  873. this.requestParam.data = []
  874. this.requestParam.data[0] = { 'name': 'autoCreateLPP', 'type': 'e', 'parammaps': {
  875. 'pastureid': Cookies.get('pastureid'),
  876. 'type': 0
  877. }}
  878. ExecDataByConfig(this.requestParam).then(response => {
  879. console.log('保存发送参数', this.requestParam)
  880. if (response.msg === 'fail') {
  881. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  882. } else {
  883. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  884. this.automaticGeneration.dialogFormVisible = false
  885. this.getIsDisplay()
  886. this.getDownList()
  887. }
  888. })
  889. } else {
  890. console.log('点击重新生成')
  891. this.requestParam = {}
  892. this.requestParam.common = { 'returnmap': '0' }
  893. this.requestParam.data = []
  894. this.requestParam.data[0] = { 'name': 'autoCreateLPP', 'type': 'e', 'parammaps': {
  895. 'pastureid': Cookies.get('pastureid'),
  896. 'type': 1
  897. }}
  898. ExecDataByConfig(this.requestParam).then(response => {
  899. console.log('保存发送参数', this.requestParam)
  900. if (response.msg === 'fail') {
  901. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  902. } else {
  903. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  904. this.automaticGeneration.dialogFormVisible = false
  905. this.getIsDisplay()
  906. this.getDownList()
  907. }
  908. })
  909. }
  910. },
  911. // 检验
  912. // handleCheck() {
  913. // console.log('点击检验')
  914. // },
  915. // 历史记录
  916. handleHistoryRecord() {
  917. console.log('点击历史记录')
  918. this.historyRecord.dialogStatus = 'historyRecord'
  919. this.historyRecord.dialogFormVisible = true
  920. const vue = this
  921. var myComponent = () => import('./historyRecord.vue')
  922. return vue.historyRecord.myComponent = myComponent
  923. },
  924. // 配方
  925. changeLog: function(evt) {
  926. console.log('change1', evt)
  927. },
  928. start(evt) {
  929. console.log('start1', evt)
  930. this.$set(this.table.startObj, 'from', evt.from.className)
  931. this.$set(this.table.startObj, 'to', evt.from.className)
  932. },
  933. end(evt) {
  934. console.log('end1', evt)
  935. },
  936. move(evt, originalEvent) {
  937. if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {
  938. return false
  939. }
  940. console.log(evt)
  941. this.table.move1 = evt.draggedContext.element
  942. },
  943. start2(evt) {
  944. console.log('start2', evt)
  945. this.$set(this.table.startObj, 'from', evt.from.className)
  946. this.$set(this.table.startObj, 'to', evt.from.className)
  947. },
  948. move2(evt, originalEvent) {
  949. // console.log(evt, originalEvent)
  950. if (originalEvent.target.className === 'list-group-item1 item' || originalEvent.target.className === 'draggableWeight') {
  951. return false
  952. }
  953. this.table.move1 = evt.draggedContext.element
  954. },
  955. end2(evt) {
  956. // console.log(evt)
  957. console.log('end2', evt)
  958. },
  959. // 撒料位
  960. changeLog2(evt) {
  961. // console.log(this.table.startObj)
  962. console.log(evt, 'evt-----')
  963. // var _evt = [...evt]
  964. this.table.changeList.push(evt)
  965. evt = this.table.changeList[0]
  966. if (evt.arrList.length == 1) {
  967. evt.arrList[0].sort = 0
  968. } else if (evt.arrList.length > 1) {
  969. for (let i = 0; i < evt.arrList.length; i++) {
  970. if (evt.arrList[i].id == this.table.move1.id && evt.arrList[i].fttype == this.table.move1.fttype) {
  971. if (evt.arrList[i - 1] == undefined) {
  972. evt.arrList[i].sort = 0
  973. evt.sort = 0
  974. } else {
  975. evt.arrList[i].sort = parseFloat(evt.arrList[i - 1].sort) + 1
  976. evt.sort = parseFloat(evt.arrList[i - 1].sort) + 1
  977. }
  978. }
  979. }
  980. }
  981. console.log(evt.arrList, '==========1')
  982. console.log(evt, '==========2')
  983. console.log(this.table.move1.times, 'this.table.move1.times-------')
  984. if (this.table.startObj.from == 'list-group1' && this.table.startObj.to == 'list-group1') {
  985. this.requestParam = {}
  986. this.requestParam.common = { 'returnmap': '0' }
  987. this.requestParam.data = []
  988. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {
  989. pastureid: this.table.move1.pastureid,
  990. barid: this.table.move1.barid,
  991. lppid: evt.id,
  992. times: evt.times,
  993. ftid: this.table.move1.ftid,
  994. ptsid: this.table.move1.ptsid,
  995. ptid: this.table.move1.ptid,
  996. fttype: this.table.move1.fttype,
  997. timesTem: this.table.move1.times
  998. }}
  999. this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {
  1000. pastureid: evt.pastureid,
  1001. sort: evt.sort,
  1002. lppid: evt.id
  1003. }}
  1004. this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  1005. pastureid: evt.pastureid,
  1006. lppid: evt.id,
  1007. barid: this.table.move1.barid,
  1008. barname: this.table.move1.barname,
  1009. fpdid: this.table.move1.id,
  1010. fttype: this.table.move1.fttype,
  1011. lweight: this.table.move1.weight,
  1012. sort: evt.sort,
  1013. tmrid: evt.tmrid,
  1014. tmrname: evt.tmrname,
  1015. background: this.table.move1.background,
  1016. ccountradio: this.table.move1.ccountradio,
  1017. cowcount: this.table.move1.cowcount
  1018. }}
  1019. this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1020. pastureid: this.table.move1.pastureid,
  1021. id: this.table.move1.id,
  1022. fttype: this.table.move1.fttype,
  1023. lweight: this.table.move1.weight
  1024. }}
  1025. console.log('撒料位上-下新增', this.requestParam)
  1026. ExecDataByConfig(this.requestParam).then(response => {
  1027. console.log('撒料位新增保存发送参数', this.requestParam)
  1028. if (response.msg === 'fail') {
  1029. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1030. this.getTimesList()
  1031. this.getSmallMenuList()
  1032. this.getList()
  1033. } else {
  1034. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1035. this.getIsDisplay()
  1036. }
  1037. })
  1038. } else if (this.table.startObj.from == 'list-group2' && this.table.startObj.to == 'list-group2') {
  1039. if (this.table.changeList.length == 1) {
  1040. this.requestParam = {}
  1041. this.requestParam.common = { 'returnmap': '0' }
  1042. this.requestParam.data = []
  1043. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'v', 'parammaps': {
  1044. pastureid: this.table.move1.pastureid,
  1045. barid: this.table.move1.barid,
  1046. lppid: evt.id,
  1047. times: evt.times,
  1048. ftid: this.table.move1.ftid,
  1049. ptsid: this.table.move1.ptsid,
  1050. ptid: this.table.move1.ptid,
  1051. fttype: this.table.move1.fttype,
  1052. timesTem: this.table.move1.times
  1053. }}
  1054. this.requestParam.data[1] = { 'name': 'updateLpplandtlSorts', 'type': 'e', 'parammaps': {
  1055. pastureid: evt.pastureid,
  1056. sort: evt.sort,
  1057. lppid: evt.id
  1058. }}
  1059. this.requestParam.data[2] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  1060. pastureid: evt.pastureid,
  1061. id: this.table.move1.id
  1062. }}
  1063. this.requestParam.data[3] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  1064. pastureid: evt.pastureid,
  1065. lppid: evt.id,
  1066. barid: this.table.move1.barid,
  1067. barname: this.table.move1.barname,
  1068. fpdid: this.table.move1.fpdid,
  1069. fttype: this.table.move1.fttype,
  1070. lweight: this.table.move1.weight,
  1071. sort: evt.sort,
  1072. tmrid: evt.tmrid,
  1073. tmrname: evt.tmrname,
  1074. background: this.table.move1.background,
  1075. ccountradio: this.table.move1.ccountradio,
  1076. cowcount: this.table.move1.cowcount
  1077. }}
  1078. console.log('撒料位下-下新增', this.requestParam)
  1079. ExecDataByConfig(this.requestParam).then(response => {
  1080. console.log('撒料位新增保存发送参数', this.requestParam)
  1081. if (response.msg === 'fail') {
  1082. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1083. this.getTimesList()
  1084. this.getSmallMenuList()
  1085. this.getList()
  1086. } else {
  1087. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1088. this.getIsDisplay()
  1089. }
  1090. })
  1091. } else if (this.table.changeList.length == 1) {
  1092. if (this.table.isGoing == true) {
  1093. console.log(11111)
  1094. this.requestParam.common = { 'returnmap': '0' }
  1095. this.requestParam.data = []
  1096. this.requestParam.data[0] = { 'name': 'checkLLPDetailInsert', 'type': 'e', 'parammaps': {
  1097. pastureid: evt.pastureid,
  1098. sort: evt.sort,
  1099. lppid: evt.id
  1100. }}
  1101. this.requestParam.data[1] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  1102. pastureid: evt.pastureid,
  1103. id: this.table.move1.id
  1104. }}
  1105. this.requestParam.data[2] = { 'name': 'insertLppd', 'type': 'e', 'parammaps': {
  1106. pastureid: evt.pastureid,
  1107. lppid: evt.id,
  1108. barid: this.table.move1.barid,
  1109. barname: this.table.move1.barname,
  1110. fpdid: this.table.move1.id,
  1111. fttype: this.table.move1.fttype,
  1112. lweight: this.table.move1.weight,
  1113. sort: evt.sort,
  1114. tmrid: evt.tmrid,
  1115. tmrname: evt.tmrname,
  1116. background: this.table.move1.background
  1117. }}
  1118. this.requestParam.data[3] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1119. pastureid: this.table.move1.pastureid,
  1120. id: this.table.move1.id,
  1121. fttype: this.table.move1.fttype,
  1122. statue: 1
  1123. }}
  1124. console.log('撒料位新增', this.requestParam)
  1125. ExecDataByConfig(this.requestParam).then(response => {
  1126. console.log('撒料位新增保存发送参数', this.requestParam)
  1127. if (response.msg === 'fail') {
  1128. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1129. this.getTimesList()
  1130. this.getList()
  1131. } else {
  1132. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1133. this.getIsDisplay()
  1134. }
  1135. })
  1136. this.table.isGoing = false
  1137. } else {
  1138. this.table.isGoing = true
  1139. }
  1140. }
  1141. }
  1142. },
  1143. // 编辑-撒料设备
  1144. changeEquipment(item, row, fttype, myid) {
  1145. var objList = {}
  1146. for (let i = 0; i < row.arrList.length; i++) {
  1147. row.arrList[i].tmrname = this.equipmentList.find(obj => obj.id === item).tname
  1148. if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {
  1149. objList = row.arrList[i]
  1150. }
  1151. if (row.tmrid == row.arrList[i].tmrid) {
  1152. if (row.tmrid !== item) {
  1153. this.$message({ type: 'warning', message: '混料设备不可与其它撒料设备同时选择', duration: 2000 })
  1154. this.getList()
  1155. return false
  1156. }
  1157. } else {
  1158. if (row.tmrid == item) {
  1159. this.$message({ type: 'warning', message: '混料设备不可与其它撒料设备同时选择', duration: 2000 })
  1160. this.getList()
  1161. return false
  1162. }
  1163. }
  1164. }
  1165. console.log(row)
  1166. this.requestParam = {}
  1167. this.requestParam.common = { 'returnmap': '0' }
  1168. this.requestParam.data = []
  1169. this.requestParam.data[0] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {
  1170. pastureid: row.pastureid,
  1171. lppid: row.id,
  1172. barid: objList.barid,
  1173. barname: objList.barname,
  1174. fpdid: objList.fpdid,
  1175. fttype: objList.fttype,
  1176. lweight: objList.weight,
  1177. sort: objList.sort,
  1178. tmrid: objList.tmrid,
  1179. tmrname: objList.tmrname,
  1180. background: objList.background,
  1181. id: objList.id
  1182. }}
  1183. ExecDataByConfig(this.requestParam).then(response => {
  1184. console.log('编辑保存发送参数', this.requestParam)
  1185. if (response.msg === 'fail') {
  1186. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1187. } else {
  1188. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1189. this.getList()
  1190. this.getTimesList()
  1191. }
  1192. })
  1193. },
  1194. dbclickWeight(row) {
  1195. console.log(row)
  1196. row.isWeight = true
  1197. row.focusState = true
  1198. },
  1199. // 编辑-重量
  1200. blurWeight(row, fttype, myid) {
  1201. var objList = {}
  1202. for (let i = 0; i < row.arrList.length; i++) {
  1203. if (row.arrList[i].fttype == fttype && row.arrList[i].id == myid) {
  1204. objList = row.arrList[i]
  1205. }
  1206. }
  1207. if (objList.weight !== '') {
  1208. if (parseFloat(objList.weight) <= 0) {
  1209. this.$message({ type: 'error', message: '重量不可输入小于0的数据', duration: 2000 })
  1210. return false
  1211. }
  1212. }
  1213. if (objList.weight == '') { objList.weight = 0 }
  1214. this.requestParam = {}
  1215. this.requestParam.common = { 'returnmap': '0' }
  1216. this.requestParam.data = []
  1217. this.requestParam.data[0] = { 'name': 'checkFPdLeftW', 'type': 'v', 'parammaps': {
  1218. pastureid: objList.pastureid,
  1219. fpdid: objList.fpdid,
  1220. fttype: objList.fttype,
  1221. lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))
  1222. }}
  1223. this.requestParam.data[1] = { 'name': 'updateLppd', 'type': 'e', 'parammaps': {
  1224. pastureid: row.pastureid,
  1225. lppid: row.id,
  1226. barid: objList.barid,
  1227. barname: objList.barname,
  1228. fpdid: objList.fpdid,
  1229. fttype: objList.fttype,
  1230. lweight: objList.weight,
  1231. sort: objList.sort,
  1232. tmrid: objList.tmrid,
  1233. tmrname: objList.tmrname,
  1234. background: objList.background,
  1235. id: objList.id
  1236. }}
  1237. this.requestParam.data[2] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1238. pastureid: objList.pastureid,
  1239. id: objList.fpdid,
  1240. fttype: objList.fttype,
  1241. lweight: String(parseFloat(objList.weight) - parseFloat(objList.lweight))
  1242. }}
  1243. ExecDataByConfig(this.requestParam).then(response => {
  1244. console.log('编辑保存发送参数', this.requestParam)
  1245. if (response.msg === 'fail') {
  1246. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1247. this.getList()
  1248. this.getTimesList()
  1249. } else {
  1250. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1251. this.getList()
  1252. this.getTimesList()
  1253. this.isWeight = false
  1254. }
  1255. })
  1256. },
  1257. handleTakeEffectChange() {
  1258. console.log('点击了生效')
  1259. },
  1260. handleIssplitChange() {
  1261. console.log('是否提前小料拆分')
  1262. },
  1263. // 撒料位删除
  1264. handleFLDelete(ele, row) {
  1265. console.log(ele, row, '点击了撒料删除')
  1266. this.selectList = []
  1267. this.requestParam = {}
  1268. this.requestParam.common = { 'returnmap': '0' }
  1269. this.requestParam.data = []
  1270. this.requestParam.data[0] = { 'name': 'deleteLppd', 'type': 'e', 'parammaps': {
  1271. pastureid: ele.pastureid,
  1272. id: ele.id
  1273. }}
  1274. this.requestParam.data[1] = { 'name': 'updateFpdetailUse', 'type': 'e', 'parammaps': {
  1275. pastureid: ele.pastureid,
  1276. id: ele.fpdid,
  1277. fttype: ele.fttype,
  1278. lweight: '-' + parseFloat(ele.weight)
  1279. }}
  1280. ExecDataByConfig(this.requestParam).then(response => {
  1281. console.log('删除保存发送参数', this.requestParam)
  1282. if (response.msg === 'fail') {
  1283. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1284. } else {
  1285. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1286. this.getList()
  1287. this.getTimesList()
  1288. }
  1289. })
  1290. },
  1291. handleSelect(val) {
  1292. console.log('勾选数据', val)
  1293. this.selectList = val
  1294. },
  1295. // 减少车次
  1296. handleReduceTrains() {
  1297. if (this.selectList.length == 0) {
  1298. this.$message({ type: 'error', message: '请选择车次', duration: 2000 })
  1299. return false
  1300. } else {
  1301. // 减少对应车次
  1302. for (let i = 0; i < this.selectList.length; i++) {
  1303. if (this.selectList[i].arrList.length > 0) {
  1304. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1305. return false
  1306. }
  1307. }
  1308. MessageBox.confirm('是否确认删除此信息?', {
  1309. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1310. }).then(() => {
  1311. console.log(this.selectList)
  1312. this.requestParam = {}
  1313. this.requestParam.common = { 'returnmap': '0' }
  1314. this.requestParam.data = []
  1315. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1316. this.requestParam.data[0].children = []
  1317. this.requestParam.data[0].children[0] = { 'name': 'deleteLpp', 'type': 'e', 'parammaps': {
  1318. id: '@insertSpotList.id',
  1319. pastureid: '@insertSpotList.pastureid'
  1320. }}
  1321. ExecDataByConfig(this.requestParam).then(response => {
  1322. console.log('删除保存发送参数', this.requestParam)
  1323. if (response.msg === 'fail') {
  1324. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1325. } else {
  1326. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1327. this.getList()
  1328. }
  1329. })
  1330. })
  1331. }
  1332. },
  1333. // 行内删除
  1334. handleRowDelete(row) {
  1335. console.log(row, '点击了行删除')
  1336. if (row.arrList.length == 0) {
  1337. MessageBox.confirm('是否确认删除此信息?', {
  1338. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1339. }).then(() => {
  1340. this.selectList = []
  1341. this.requestParam = {}
  1342. this.requestParam.name = 'deleteLpp'
  1343. this.requestParam.parammaps = {}
  1344. this.requestParam.parammaps.pastureid = row.pastureid
  1345. this.requestParam.parammaps.id = row.id
  1346. PostDataByName(this.requestParam).then(response => {
  1347. if (response.msg === 'fail') {
  1348. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1349. } else {
  1350. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1351. this.getList()
  1352. }
  1353. })
  1354. }).catch(() => {
  1355. this.$message({ type: 'info', message: '已取消删除' })
  1356. })
  1357. } else {
  1358. this.$message({ type: 'error', message: '本车次已添加栏舍不可删除', duration: 2000 })
  1359. return false
  1360. }
  1361. },
  1362. handleLeftButton() { // 向左
  1363. console.log('向左', this.isLeftButton)
  1364. this.isLeftButton = false
  1365. this.isRightButton = true
  1366. this.$refs.listR.style.width = '46%'
  1367. this.$refs.listR.style.zIndex = 4
  1368. // this.$refs.listRight.style.zIndex = 4
  1369. // this.$refs.listRight2.style.zIndex = 4
  1370. this.getSmallMenuList()
  1371. },
  1372. handleRightButton() { // 向右
  1373. console.log('向右', this.isLeftButton)
  1374. this.isLeftButton = true
  1375. this.isRightButton = false
  1376. this.$refs.list.style.zIndex = 1
  1377. this.$refs.listR.style.width = '50px'
  1378. this.$refs.listR.style.zIndex = 1
  1379. this.$nextTick(() => {
  1380. this.$refs.listRight.style.zIndex = 1
  1381. this.$refs.listRight2.style.zIndex = 1
  1382. })
  1383. }
  1384. }
  1385. }
  1386. </script>
  1387. <style lang="scss" scoped>
  1388. /deep/ .el-radio-button__orig-radio:checked+.el-radio-button__inner {
  1389. color: #fff;
  1390. background-color: #009C69;
  1391. border-color: #009C69;
  1392. -webkit-box-shadow: -1px 0 0 0 #009C69;
  1393. box-shadow: -1px 0 0 0 #009C69;
  1394. }
  1395. </style>
  1396. <style lang="scss">
  1397. /deep/ :focus {
  1398. outline: 0;
  1399. }
  1400. :focus-visible {
  1401. outline: 0 !important;
  1402. }
  1403. // 下拉框
  1404. .filter-item2 .el-input--suffix .el-input__inner{
  1405. height: 30px !important;
  1406. font-size: 8px;
  1407. padding: 0 2px;
  1408. }
  1409. .filter-item2 .el-input--suffix .el-input__suffix .el-input__suffix-inner .el-input__icon{
  1410. line-height: 30px !important;
  1411. }
  1412. // 输入框
  1413. .filter-item2 .el-input__inner{
  1414. height: 30px !important;
  1415. font-size: 8px;
  1416. padding: 0 2px;
  1417. }
  1418. </style>
  1419. <style lang="scss">
  1420. .menuList{
  1421. height: 190px;background: red;border-bottom: 2px solid #d8dce5; box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
  1422. .menuList-t{
  1423. height: 60px;background: #fff;display: flex;justify:center;align-items:center;display:-webkit-flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between;
  1424. .menuList-t-l{}
  1425. .menuList-t-r{
  1426. display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between;position: relative;
  1427. .menuList-t-r-l{
  1428. margin-right:10px;cursor:pointer;width:150px;height: 20px;line-height:20px; text-align: center; background: rgba(25, 138, 244, 0); border: 1px solid #1BBD89; border-radius: 2px;font-size:12px;color: #1BBD89;
  1429. }
  1430. .menuList-t-r-r{
  1431. margin-right:10px;cursor:pointer;width:150px;height: 20px;line-height:20px; text-align: center; background: rgba(25, 138, 244, 0); border: 1px solid #1BBD89; border-radius: 2px;font-size:12px;color: #1BBD89;
  1432. }
  1433. .columnHouse{
  1434. width:650px;background: #fff; box-shadow: 0 0 6px 6px rgba(0, 0, 0, 0.04), 0 0 6px 6px rgba(0, 0, 0, 0.04);position: absolute;right: 0;top: 25px;z-index: 5;
  1435. .el-table {
  1436. height: 250px;
  1437. overflow: auto;
  1438. }
  1439. }
  1440. }
  1441. }
  1442. .menuList-b{
  1443. height: 130px;background: #fff;position: relative;
  1444. ::-webkit-scrollbar{ width: 7px; height: 7px; background-color: #F5F5F5; }
  1445. ::-webkit-scrollbar-track { box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); border-radius: 10px; background-color: #F5F5F5; }
  1446. ::-webkit-scrollbar-thumb{ border-radius: 10px; box-shadow: inset 0 0 6px rgba(0, 0, 0, .1); -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .1); background-color: #c8c8c8; }
  1447. .draggableList{position: absolute;width: 100%;margin: 0 0; height: 130px; list-style: none;padding:0 0;overflow: auto;font-size: 12px;
  1448. .draggableTitle{float: left;width: 105px;white-space: nowrap;overflow: hidden; text-overflow: ellipsis;margin:5px 5px;border-radius: 7px;text-align: center;color:#000;height: 36px;line-height: 36px;}
  1449. li{
  1450. text-align: center;color:#fff;
  1451. .draggableName{display:block;width: 100%;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}
  1452. }
  1453. }
  1454. }
  1455. }
  1456. .list-group2{
  1457. .list-group-item2{
  1458. width: 220px;height: 50px;overflow: hidden; float: left;margin: 5px 5px;position: relative;
  1459. .arr-t{height: 50px;border-radius:5px 5px;}
  1460. .arr-l{
  1461. float: left;width: 60px;height: 50px;overflow: hidden;background: red;border-radius:5px 50% 50% 5px;
  1462. .arr-l-t{
  1463. position: relative;
  1464. .arr-l-t-t{
  1465. width: 0;height: 0; border-top: 26px solid #3479f2; border-right: 26px solid transparent;
  1466. }
  1467. .arr-l-t-b{
  1468. position: absolute;top: 4px;left: 1px;color: #fff;width: 10px; height: 10px;
  1469. .el-input--suffix{
  1470. opacity:0;
  1471. .el-input__inner{height: 10px;}
  1472. }
  1473. }
  1474. }
  1475. .arr-l-b{
  1476. width: 45px;position: absolute;top: 15px;left: 10px;color: #333;font-size: 12px;
  1477. .tmrname{width: 100%;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}
  1478. }
  1479. }
  1480. .arr-c{position: absolute;top: 0px;left: 0;}
  1481. .arr-r{
  1482. float: right;width: 160px;height: 50px;overflow: hidden;line-height: 50px;
  1483. .arr-r-l{
  1484. float: left;width: 85px;
  1485. .barname{width: 100%;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}
  1486. }
  1487. .arr-r-c{float: left;width: 10px;}
  1488. .arr-r-r{
  1489. float: left;width: 65px;
  1490. .weight{width: 100%;overflow: hidden; text-overflow:ellipsis; white-space: nowrap;}
  1491. }
  1492. }
  1493. }
  1494. }
  1495. </style>
  1496. <style>
  1497. .draggableWeight{display:block;line-height: 18px;height: 18px; color: #000; width: 100%; margin: 0 auto;}
  1498. </style>