370326d593565d6dacf23691981f2d401ab2423a.svn-base 60 KB

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