72bd46744c769a7678824e5972c3102410347d2e.svn-base 57 KB

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