2d22038f868024ed7c0968c12c31ed35143990c4.svn-base 25 KB

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