95ab905aace16e60a5c7e7a0b929504709ac8bfd.svn-base 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" style="float: left;margin-right:10px;" @click="handleCreate">分配</el-button>
  5. <el-button v-if="isRoleEdit" class="danger" style="float: left;margin-right:10px;" @click="handleDelete">删除</el-button>
  6. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleExport">导出</el-button>
  7. </div>
  8. <div class="search">
  9. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  10. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  11. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  12. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" clearable>
  13. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  14. </el-select>
  15. <el-select v-model="table.getdataListParm.parammaps.eqclass" placeholder="设备类别" class="filter-item" style="width: 120px;" clearable>
  16. <el-option v-for="item in equipmentCategoryList" :key="item.id" :label="item.name" :value="item.name" />
  17. </el-select>
  18. <el-input ref="eqcode" v-model="table.getdataListParm.parammaps.eqcode" class="filter-item" placeholder="设备编号" style="width: 120px;" />
  19. <el-input ref="driver" v-model="table.getdataListParm.parammaps.driver" class="filter-item" placeholder="驾驶员" style="width: 120px;" />
  20. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  21. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  22. </div>
  23. <div class="table">
  24. <el-table
  25. :key="table.tableKey"
  26. v-loading="table.listLoading"
  27. element-loading-text="给我一点时间"
  28. :data="table.list"
  29. border
  30. fit
  31. highlight-current-row
  32. style="width: 100%;"
  33. :row-style="rowStyle"
  34. :cell-style="cellStyle"
  35. class="elTable table-fixed"
  36. @selection-change="handleSelectionChange"
  37. >
  38. <el-table-column type="selection" align="center" width="50" />
  39. <el-table-column label="序号" align="center" type="index" width="50px">
  40. <template slot-scope="scope">
  41. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="生效日期" min-width="150px" align="center">
  45. <template slot-scope="scope">
  46. <span>{{ scope.row.operatetime }}</span>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="班次" min-width="150px" align="center">
  50. <template slot-scope="scope">
  51. <span>{{ scope.row.times }}</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="设备类别" min-width="90px" align="center">
  55. <template slot-scope="scope">
  56. <span>{{ scope.row.eqclass }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="设备编号" min-width="100px" align="center">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.eqcode }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="驾驶员" min-width="90px" align="center">
  65. <template slot-scope="scope">
  66. <span>{{ scope.row.driver }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="分配人" min-width="90px" align="center">
  70. <template slot-scope="scope">
  71. <span>{{ scope.row.emp }}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  75. <template slot-scope="{row}">
  76. <el-button v-if="isRoleEdit" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  81. </div>
  82. <!-- 新增/编辑 -->
  83. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  84. <div class="app-add">
  85. <el-tabs v-model="create.activeName" @tab-click="handleClick">
  86. <el-tab-pane label="TMR设备" name="first">
  87. <div class="TMR">
  88. <div class="table">
  89. <el-table
  90. :key="create.tableKey"
  91. v-loading="create.listLoading"
  92. element-loading-text="给我一点时间"
  93. :data="create.list"
  94. border
  95. fit
  96. highlight-current-row
  97. style="width: 100%;margin-bottom: 50px;"
  98. :row-style="rowStyle"
  99. :cell-style="cellStyle"
  100. class="elTable table-fixed"
  101. >
  102. <el-table-column label="班次" min-width="150px" align="center">
  103. <template slot-scope="scope">
  104. <span>{{ scope.row.timesstr }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="设备类别" min-width="90px" align="center">
  108. <template slot-scope="scope">
  109. <span>{{ scope.row.eqclass }}</span>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="设备编号" min-width="100px" align="center">
  113. <template slot-scope="scope">
  114. <span>{{ scope.row.eqcode }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="驾驶员" min-width="90px" align="center">
  118. <template slot-scope="scope">
  119. <el-select v-model="scope.row.driverid" filterable placeholder="驾驶员" class="filter-item" style="width: 100%;padding: 0 10px;" @change="(value)=> {changeDriver(value, scope.row)}">
  120. <el-option v-for="item in driverList" :key="item.id" :label="item.drivername" :value="item.id" />
  121. </el-select>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. </div>
  126. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  127. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  128. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="createData()">确认</el-button>
  129. </div>
  130. </div>
  131. </el-tab-pane>
  132. <el-tab-pane label="铲车" name="second">
  133. <div class="forklift">
  134. <div class="table">
  135. <el-table
  136. :key="create.tableKey2"
  137. v-loading="create.listLoading2"
  138. element-loading-text="给我一点时间"
  139. :data="create.list2"
  140. border
  141. fit
  142. highlight-current-row
  143. style="width: 100%;margin-bottom: 50px;"
  144. :row-style="rowStyle"
  145. :cell-style="cellStyle"
  146. class="elTable table-fixed"
  147. >
  148. <el-table-column label="班次" min-width="150px" align="center">
  149. <template slot-scope="scope">
  150. <span>{{ scope.row.timesstr }}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="设备类别" min-width="90px" align="center">
  154. <template slot-scope="scope">
  155. <span>{{ scope.row.eqclass }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="设备编号" min-width="100px" align="center">
  159. <template slot-scope="scope">
  160. <span>{{ scope.row.eqcode }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="驾驶员" min-width="90px" align="center">
  164. <template slot-scope="scope">
  165. <el-select v-model="scope.row.driverid" filterable placeholder="驾驶员" class="filter-item" style="width: 100%;padding: 0 10px;" @change="(value)=> {changeDriver(value, scope.row)}">
  166. <el-option v-for="item in driverList" :key="item.id" :label="item.drivername" :value="item.id" />
  167. </el-select>
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. </div>
  172. <div slot="footer" class="dialog-footer" style="bottom: 0;">
  173. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  174. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="createData2()">确认</el-button>
  175. </div>
  176. </div>
  177. </el-tab-pane>
  178. </el-tabs>
  179. </div>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. import { GetDataByName, PostDataByName, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
  185. import Cookies from 'js-cookie'
  186. import { parseTime, json2excel } from '@/utils/index.js'
  187. import Pagination from '@/components/Pagination'
  188. import { MessageBox } from 'element-ui'
  189. export default {
  190. name: 'DutyRecord',
  191. components: { Pagination },
  192. data() {
  193. return {
  194. isRoleEdit: [],
  195. requestParams: [
  196. { name: 'getSysoptEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid'), 'inforname': 'times' }},
  197. { name: 'getDriverListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }}
  198. ],
  199. equipmentCategoryList: [{ id: '1', name: 'TMR设备' }, { id: '2', name: '铲车' }], // 设备类别
  200. frequencyList: [], // 班次
  201. driverList: [], // 驾驶员
  202. table: {
  203. getdataListParm: {
  204. name: 'getDutyrecordList',
  205. page: 1,
  206. offset: 1,
  207. pagecount: 10,
  208. returntype: 'Map',
  209. parammaps: {
  210. pastureid: Cookies.get('pastureid'),
  211. barid: '',
  212. startTime: '',
  213. stopTime: '',
  214. inputDatetime: '',
  215. times: '',
  216. eqclass: ''
  217. }
  218. },
  219. tableKey: 0,
  220. list: [],
  221. total: 0,
  222. listLoading: true,
  223. temp: {}
  224. },
  225. // 新增/编辑
  226. create: {
  227. dialogFormVisible: false,
  228. dialogStatus: '',
  229. temp: { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d} {h}:{m}'), emp: Cookies.get('employename'), barid: '', barname: '', remain: '', times: '' },
  230. rules: {},
  231. tableKey: 0,
  232. list: [],
  233. total: 0,
  234. listLoading: true,
  235. getdataListParm: {
  236. name: 'geEqListByDplan',
  237. page: 1,
  238. offset: 1,
  239. pagecount: '',
  240. returntype: 'Map',
  241. parammaps: {
  242. pastureid: Cookies.get('pastureid')
  243. }
  244. },
  245. tableKey2: 0,
  246. list2: [],
  247. total2: 0,
  248. listLoading2: true,
  249. getdataListParm2: {
  250. name: 'geEqListByDplanCC',
  251. page: 1,
  252. offset: 1,
  253. pagecount: '',
  254. returntype: 'Map',
  255. parammaps: {
  256. pastureid: Cookies.get('pastureid')
  257. }
  258. },
  259. activeName: 'first'
  260. },
  261. textMap: {
  262. create: '分配'
  263. },
  264. requestParam: {},
  265. download: {
  266. getdataListParm: {
  267. name: 'getDutyrecordList',
  268. page: 1,
  269. offset: 1,
  270. pagecount: 0,
  271. returntype: 'Map',
  272. parammaps: {
  273. pastureid: Cookies.get('pastureid'),
  274. barid: '',
  275. startTime: '',
  276. stopTime: '',
  277. inputDatetime: '',
  278. times: '',
  279. eqclass: ''
  280. }
  281. },
  282. list: []
  283. },
  284. isokDisable: false,
  285. selectList: [],
  286. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  287. cellStyle: { padding: 0 + 'px' }
  288. }
  289. },
  290. created() {
  291. this.getList()
  292. this.getDownList()
  293. this.getButtons()
  294. },
  295. methods: {
  296. getButtons() {
  297. const Edit = 'DutyRecord'
  298. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  299. this.isRoleEdit = isRoleEdit
  300. },
  301. getDownList() {
  302. GetDataByNames(this.requestParams).then(response => {
  303. if (response.data.getSysoptEnable.list !== null) {
  304. for (let i = 1; i <= response.data.getSysoptEnable.list[0].inforvalue; i++) {
  305. const obj = {}
  306. obj.id = String(i)
  307. if (i == 1) { obj.name = '第一班' } else if (i == 2) { obj.name = '第二班' } else if (i == 3) { obj.name = '第三班' } else if (i == 4) { obj.name = '第四班' }
  308. this.frequencyList.push(obj)
  309. }
  310. } else {
  311. this.frequencyList = []
  312. }
  313. this.driverList = response.data.getDriverListEnable.list
  314. })
  315. },
  316. handleBefore() {
  317. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  318. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))
  319. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))
  320. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  321. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  322. this.$forceUpdate()
  323. }
  324. },
  325. handleNext() {
  326. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  327. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))
  328. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))
  329. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  330. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  331. this.$forceUpdate()
  332. }
  333. },
  334. getList() {
  335. this.table.listLoading = true
  336. GetDataByName(this.table.getdataListParm).then(response => {
  337. console.log('table数据', response.data.list)
  338. if (response.data.list !== null) {
  339. this.table.list = response.data.list
  340. this.table.pageNum = response.data.pageNum
  341. this.table.pageSize = response.data.pageSize
  342. this.table.total = response.data.total
  343. } else {
  344. this.table.list = []
  345. }
  346. setTimeout(() => {
  347. this.table.listLoading = false
  348. }, 100)
  349. })
  350. },
  351. handleSearch() {
  352. console.log('点击了查询')
  353. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  354. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  355. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  356. } else {
  357. this.table.getdataListParm.parammaps.inputDatetime = ''
  358. this.table.getdataListParm.parammaps.startTime = ''
  359. this.table.getdataListParm.parammaps.stopTime = ''
  360. }
  361. this.table.getdataListParm.offset = 1
  362. this.getList()
  363. },
  364. handleRefresh() {
  365. console.log('点击了重置')
  366. this.table.getdataListParm.parammaps.times = ''
  367. this.table.getdataListParm.parammaps.eqclass = ''
  368. this.table.getdataListParm.parammaps.eqcode = ''
  369. this.table.getdataListParm.parammaps.driver = ''
  370. this.table.getdataListParm.parammaps.startTime = ''
  371. this.table.getdataListParm.parammaps.stopTime = ''
  372. this.table.getdataListParm.parammaps.inputDatetime = ''
  373. this.table.getdataListParm.offset = 1
  374. this.getList()
  375. },
  376. // 新增
  377. handleCreate() {
  378. console.log('点击了分配')
  379. this.create.dialogStatus = 'create'
  380. this.create.dialogFormVisible = true
  381. this.getDialogList()
  382. },
  383. handleClick() {
  384. if (this.create.activeName == 'first') {
  385. this.getDialogList()
  386. } else if (this.create.activeName == 'second') {
  387. this.getDialogList2()
  388. }
  389. },
  390. getDialogList() {
  391. GetDataByName(this.create.getdataListParm).then(response => {
  392. console.log('table数据', response.data.list)
  393. if (response.data.list !== null) {
  394. for (let i = 0; i < response.data.list.length; i++) {
  395. if (response.data.list[i].driver == undefined || response.data.list[i].driverid == undefined) {
  396. this.$set(response.data.list[i], 'driver', '')
  397. this.$set(response.data.list[i], 'driverid', '')
  398. }
  399. }
  400. this.create.list = response.data.list
  401. } else {
  402. this.create.list = []
  403. }
  404. setTimeout(() => {
  405. this.create.listLoading = false
  406. }, 100)
  407. })
  408. },
  409. getDialogList2() {
  410. GetDataByName(this.create.getdataListParm2).then(response => {
  411. console.log('table2数据', response.data.list)
  412. if (response.data.list !== null) {
  413. for (let i = 0; i < response.data.list.length; i++) {
  414. if (response.data.list[i].driver == undefined || response.data.list[i].driverid == undefined) {
  415. this.$set(response.data.list[i], 'driver', '')
  416. this.$set(response.data.list[i], 'driverid', '')
  417. }
  418. }
  419. this.create.list2 = response.data.list
  420. } else {
  421. this.create.list2 = []
  422. }
  423. setTimeout(() => {
  424. this.create.listLoading2 = false
  425. }, 100)
  426. })
  427. },
  428. changeDriver(item, row) {
  429. row.driver = this.driverList.find(obj => obj.id == item).drivername
  430. },
  431. createData() {
  432. console.log('点击了新增保存', this.create.list)
  433. this.isokDisable = true
  434. setTimeout(() => {
  435. this.isokDisable = false
  436. }, 1000)
  437. for (var i = 0; i < this.create.list.length; i++) {
  438. if (this.create.list[i].driverid == '') {
  439. this.create.list.splice(i, 1)
  440. i = 0
  441. }
  442. }
  443. console.log('点击了新增保存', this.create.list)
  444. this.requestParam.common = { 'returnmap': '0' }
  445. this.requestParam.data = []
  446. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.create.list }}
  447. this.requestParam.data[0].children = []
  448. this.requestParam.data[0].children[0] = { 'name': 'insertDutyrecord', 'type': 'e', 'parammaps': {
  449. pastureid: '@insertSpotList.pastureid',
  450. eqid: '@insertSpotList.eqid',
  451. eqclass: '@insertSpotList.eqclass',
  452. eqcode: '@insertSpotList.eqcode',
  453. driver: '@insertSpotList.driver',
  454. driverid: '@insertSpotList.driverid',
  455. times: '@insertSpotList.times',
  456. operatedate: parseTime(new Date(), '{y}-{m}-{d}'),
  457. emp: Cookies.get('employename')
  458. }}
  459. ExecDataByConfig(this.requestParam).then(response => {
  460. console.log('分配TMR设备保存发送参数', this.requestParam)
  461. if (response.msg === 'fail') {
  462. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  463. } else {
  464. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  465. this.create.dialogFormVisible = false
  466. this.getList()
  467. }
  468. })
  469. },
  470. createData2() {
  471. console.log('分配铲车', this.create.list2)
  472. this.isokDisable = true
  473. setTimeout(() => {
  474. this.isokDisable = false
  475. }, 1000)
  476. for (var i = 0; i < this.create.list2.length; i++) {
  477. if (this.create.lis2t[i].driverid == '') {
  478. this.create.list2.splice(i, 1)
  479. i = 0
  480. }
  481. }
  482. console.log('点击了新增保存', this.create.list)
  483. this.requestParam.common = { 'returnmap': '0' }
  484. this.requestParam.data = []
  485. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.create.list2 }}
  486. this.requestParam.data[0].children = []
  487. this.requestParam.data[0].children[0] = { 'name': 'insertDutyrecord', 'type': 'e', 'parammaps': {
  488. pastureid: '@insertSpotList.pastureid',
  489. eqid: '@insertSpotList.eqid',
  490. eqclass: '@insertSpotList.eqclass',
  491. eqcode: '@insertSpotList.eqcode',
  492. driver: '@insertSpotList.driver',
  493. driverid: '@insertSpotList.driverid',
  494. times: '@insertSpotList.times',
  495. operatedate: parseTime(new Date(), '{y}-{m}-{d}'),
  496. emp: Cookies.get('employename')
  497. }}
  498. ExecDataByConfig(this.requestParam).then(response => {
  499. console.log('分配TMR设备保存发送参数', this.requestParam)
  500. if (response.msg === 'fail') {
  501. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  502. } else {
  503. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  504. this.create.dialogFormVisible = false
  505. this.getList()
  506. }
  507. })
  508. },
  509. // 删除
  510. handleRowDelete(row) {
  511. console.log('点击了行内删除')
  512. this.selectList = []
  513. MessageBox.confirm('是否确认删除此信息?', {
  514. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  515. }).then(() => {
  516. this.selectList = []
  517. this.requestParam.name = 'deleteDutyrecord'
  518. this.requestParam.parammaps = {}
  519. this.requestParam.parammaps.pastureid = row.pastureid
  520. this.requestParam.parammaps.id = row.id
  521. PostDataByName(this.requestParam).then(response => {
  522. if (response.msg === 'fail') {
  523. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  524. } else {
  525. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  526. this.getList()
  527. }
  528. })
  529. }).catch(() => {
  530. this.$message({ type: 'info', message: '已取消删除' })
  531. })
  532. },
  533. handleSelectionChange(val) {
  534. console.log('勾选数据', val)
  535. this.selectList = val
  536. },
  537. handleDelete() {
  538. console.log('点击了删除')
  539. if (this.selectList.length == 0) {
  540. this.$message({ type: 'error', message: '请选择值班记录', duration: 2000 })
  541. } else {
  542. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  543. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  544. }).then(() => {
  545. console.log(this.selectList)
  546. this.requestParam.common = { 'returnmap': '0' }
  547. this.requestParam.data = []
  548. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  549. this.requestParam.data[0].children = []
  550. this.requestParam.data[0].children[0] = { 'name': 'deleteDutyrecord', 'type': 'e', 'parammaps': {
  551. id: '@insertSpotList.id',
  552. pastureid: '@insertSpotList.pastureid'
  553. }}
  554. ExecDataByConfig(this.requestParam).then(response => {
  555. console.log('删除保存发送参数', this.requestParam)
  556. if (response.msg === 'fail') {
  557. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  558. } else {
  559. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  560. this.getList()
  561. }
  562. })
  563. })
  564. }
  565. },
  566. // 导出
  567. handleExport() {
  568. console.log('点击了导出')
  569. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  570. if (this.download.getdataListParm.parammaps.inputDatetime !== '' && this.download.getdataListParm.parammaps.inputDatetime !== null) {
  571. this.download.getdataListParm.parammaps.startTime = parseTime(this.download.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  572. this.download.getdataListParm.parammaps.stopTime = parseTime(this.download.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  573. } else {
  574. this.download.getdataListParm.parammaps.inputDatetime = ''
  575. this.download.getdataListParm.parammaps.startTime = ''
  576. this.download.getdataListParm.parammaps.stopTime = ''
  577. }
  578. GetDataByName(this.download.getdataListParm).then(response => {
  579. if (response.data.list !== null) {
  580. this.download.list = response.data.list
  581. } else {
  582. this.download.list = []
  583. }
  584. var excelDatas = [
  585. {
  586. tHeader: ['生效日期', '班次', '设备类别', '设备编号', '驾驶员', '分配人'],
  587. filterVal: ['operatetime', 'times', 'eqclass', 'eqcode', 'driver', 'emp'],
  588. tableDatas: this.download.list,
  589. sheetName: 'Sheet1'
  590. }
  591. ]
  592. json2excel(excelDatas, '值班记录', true, 'xlsx')
  593. })
  594. }
  595. }
  596. }
  597. </script>
  598. <style lang="scss" scoped>
  599. .search{padding-top:10px;clear: both;}
  600. .table{margin-top:10px;}
  601. </style>