c68f339a9845aaa99bc959f76b0ff5b66cc99015.svn-base 52 KB

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