3e22fcde7749950c99b264db6756503557c42ebd.svn-base 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <template>
  2. <div class="app-container">
  3. <div class="search">
  4. <el-input v-model="table.getdataListParm.parammaps.bname" placeholder="栏舍名称" style="width: 180px;" class="filter-item" clearable />
  5. <el-input v-model="table.getdataListParm.parammaps.bcode" placeholder="栏舍编号" style="width: 180px;" class="filter-item" clearable />
  6. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  7. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  8. </el-select>
  9. <div ref="selectInput" class="filter-item selectInput">
  10. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  11. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  12. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  13. <ul v-if="arrowUp" class="selectUl">
  14. <li><a>允许误差数</a><el-input v-model="table.getdataListParm.parammaps.allowratio" type="text" style="width: 245px;" /></li>
  15. <li><a>跳转重量域</a><el-input v-model="table.getdataListParm.parammaps.autozone" type="text" style="width: 245px;" /></li>
  16. <li>
  17. <a>跳转延时</a>
  18. <el-select v-model="table.getdataListParm.parammaps.autosecond" filterable class="filter-item" style="width: 245px;" clearable>
  19. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  20. </el-select>
  21. </li>
  22. <li>
  23. <div style="float: right;">
  24. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  25. <el-button class="miniPrimary" @click="handleSearch">搜索</el-button>
  26. </div>
  27. </li>
  28. </ul>
  29. </div>
  30. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  31. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  32. </div>
  33. <div class="operation">
  34. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
  35. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
  36. </div>
  37. <div class="table">
  38. <el-table
  39. :key="table.tableKey"
  40. v-loading="table.listLoading"
  41. element-loading-text="给我一点时间"
  42. :data="table.list"
  43. border
  44. fit
  45. highlight-current-row
  46. style="width: 100%;"
  47. :row-style="rowStyle"
  48. :cell-style="cellStyle"
  49. class="elTable table-fixed"
  50. @selection-change="handleSelectionChange"
  51. >
  52. <el-table-column type="selection" align="center" width="50" />
  53. <el-table-column label="序号" align="center" type="index" width="50px">
  54. <template slot-scope="scope">
  55. <span v-if="table.pageNum">{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  56. <span v-else>1</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="栏舍名称" min-width="130px" align="center">
  60. <template slot-scope="scope">
  61. <span v-if="scope.row.NoEdit">{{ scope.row.bname }}</span>
  62. <el-input v-if="scope.row.Edit" v-model="scope.row.bname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:95%;padding:10px 0;" maxlength="32" />
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="栏舍编号" min-width="130px" align="center">
  66. <template slot-scope="scope">
  67. <span v-if="scope.row.NoEdit">{{ scope.row.bcode }}</span>
  68. <el-input v-if="scope.row.Edit" v-model="scope.row.bcode" placeholder="1-32个字符" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="允许误差数(kg)" min-width="150px" align="center">
  72. <template slot-scope="scope">
  73. <span v-if="scope.row.NoEdit">{{ scope.row.allowratio }}</span>
  74. <el-input v-if="scope.row.Edit" v-model="scope.row.allowratio" style="width:95%;padding:10px 0;" />
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="跳转重量域(kg)" min-width="150px" align="center">
  78. <template slot-scope="scope">
  79. <span v-if="scope.row.NoEdit">{{ scope.row.autozone }}</span>
  80. <el-input v-if="scope.row.Edit" v-model="scope.row.autozone" :disabled="scope.row.autosecond=='0'" style="width:95%;padding:10px 0;" />
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="跳转延时(s)" min-width="150px" align="center">
  84. <template slot-scope="scope">
  85. <span v-if="scope.row.NoEdit">{{ scope.row.autosecondname }}</span>
  86. <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable class="filter-item" style="width: 95%;padding:10px 0;" @change="changeAutosecond">
  87. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  88. </el-select>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="确认开始" min-width="110px" align="center">
  92. <template slot-scope="scope">
  93. <el-switch v-model="scope.row.isstart" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleConfirmStartChange(scope.$index, scope.row)" />
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="是否启用" min-width="110px" align="center">
  97. <template slot-scope="scope">
  98. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  102. <template slot-scope="{row}">
  103. <!-- 新增 -->
  104. <el-button v-if="row.isCreate" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  105. <span v-if="row.isCreate" class="centerSpan">|</span>
  106. <el-button v-if="row.isCreate" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  107. <!-- 编辑 -->
  108. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  109. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  110. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  111. <!-- 编辑保存 -->
  112. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  113. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  114. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  119. </div>
  120. </div>
  121. </template>
  122. <script>
  123. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
  124. import Cookies from 'js-cookie'
  125. import Pagination from '@/components/Pagination'
  126. import { MessageBox } from 'element-ui'
  127. export default {
  128. name: 'GroupColumn',
  129. components: { Pagination },
  130. data() {
  131. return {
  132. isRoleEdit: [],
  133. requestParams: [
  134. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] }
  135. ],
  136. enableList: [{ id: '1', name: '是' }, { id: '0', name: '否' }],
  137. jumpDelayList: [],
  138. table: {
  139. getdataListParm: {
  140. name: 'getBarList',
  141. page: 1,
  142. offset: 1,
  143. pagecount: parseInt(Cookies.get('pageCount')),
  144. returntype: 'Map',
  145. parammaps: {
  146. pastureid: Cookies.get('pastureid'),
  147. bcode: '',
  148. bname: '',
  149. allowratio: '',
  150. autozone: '',
  151. autosecond: '',
  152. enable: ''
  153. }
  154. },
  155. tableKey: 0,
  156. list: [],
  157. total: 0,
  158. listLoading: true,
  159. temp: {}
  160. },
  161. requestParam: {},
  162. isokDisable: false,
  163. selectList: [],
  164. arrowDown: true,
  165. arrowUp: false,
  166. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  167. cellStyle: { padding: 0 + 'px' }
  168. }
  169. },
  170. created() {
  171. this.getList()
  172. this.getDownList()
  173. this.getButtons()
  174. },
  175. mounted() {
  176. document.addEventListener('click', (e) => {
  177. if (this.$refs.selectInput !== undefined) {
  178. if (!this.$refs.selectInput.contains(e.target)) {
  179. this.arrowDown = true
  180. this.arrowUp = false
  181. } else {
  182. this.arrowDown = false
  183. this.arrowUp = true
  184. }
  185. }
  186. })
  187. },
  188. methods: {
  189. getButtons() {
  190. const Edit = 'GroupColumn'
  191. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  192. this.isRoleEdit = isRoleEdit
  193. },
  194. getDownList() {
  195. GetDataByNames(this.requestParams).then(response => {
  196. this.jumpDelayList = response.data.getDictByName.list
  197. })
  198. },
  199. getList() {
  200. this.table.listLoading = true
  201. GetDataByName(this.table.getdataListParm).then(response => {
  202. console.log('table数据', response.data.list)
  203. if (response.data.list !== null) {
  204. for (let i = 0; i < response.data.list.length; i++) {
  205. this.$set(response.data.list[i], 'Edit', false) // 编辑
  206. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  207. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  208. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  209. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  210. }
  211. this.table.list = response.data.list
  212. this.table.pageNum = response.data.pageNum
  213. this.table.pageSize = response.data.pageSize
  214. this.table.total = response.data.total
  215. } else {
  216. this.table.list = []
  217. }
  218. setTimeout(() => {
  219. this.table.listLoading = false
  220. }, 100)
  221. })
  222. },
  223. handleEnableChange() {
  224. console.log('点击了是否启用')
  225. },
  226. handleConfirmStartChange() {
  227. console.log('点击了确认开始')
  228. },
  229. handleSearch() {
  230. console.log('点击了查询')
  231. this.table.getdataListParm.offset = 1
  232. this.getList()
  233. this.arrowDown = true
  234. this.arrowUp = false
  235. },
  236. handleRefresh() {
  237. console.log('点击了重置')
  238. this.table.getdataListParm.parammaps.bcode = ''
  239. this.table.getdataListParm.parammaps.bname = ''
  240. this.table.getdataListParm.parammaps.allowratio = ''
  241. this.table.getdataListParm.parammaps.autozone = ''
  242. this.table.getdataListParm.parammaps.autosecond = ''
  243. this.table.getdataListParm.parammaps.enable = ''
  244. this.table.getdataListParm.offset = 1
  245. this.getList()
  246. },
  247. changeAutosecond(item) {
  248. this.table.temp.autosecondname = this.jumpDelayList.find(obj => obj.value === item).label
  249. console.log(this.table.temp.autosecondname)
  250. },
  251. handleCreate() {
  252. console.log('点击了新增')
  253. // 编辑true/不可编辑false
  254. // 新增操true,编辑false,编辑保存false
  255. for (let i = 0; i < this.table.list.length; i++) {
  256. if (this.table.list[i].Edit == true) {
  257. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  258. return false
  259. }
  260. }
  261. this.table.temp.autosecondname = ''
  262. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'isstart': 1, 'bname': '', 'bcode': '', 'allowratio': '', 'autozone': '', 'autosecond': '0', 'autosecondname': '禁用' })
  263. },
  264. createData(row) {
  265. console.log('点击了新增保存', row)
  266. this.table.temp.pastureid = Cookies.get('pastureid')
  267. this.table.temp.bcode = row.bcode
  268. this.table.temp.bname = row.bname
  269. this.table.temp.allowratio = row.allowratio
  270. this.table.temp.autozone = row.autozone
  271. this.table.temp.autosecond = row.autosecond
  272. if (this.table.temp.autosecondname == '') {
  273. this.table.temp.autosecondname = row.autosecondname
  274. } else {
  275. this.table.temp.autosecondname = this.table.temp.autosecondname
  276. }
  277. this.table.temp.isstart = row.isstart
  278. this.table.temp.enable = row.enable
  279. // 检验用户名称/角色是否为空
  280. if (this.table.temp.bname == '' && this.table.temp.bcode == '') {
  281. this.$message({ type: 'error', message: '栏舍名称/栏舍编号不能为空', duration: 2000 })
  282. return false
  283. } else if (this.table.temp.bname == '') {
  284. this.$message({ type: 'error', message: '栏舍名称不能为空', duration: 2000 })
  285. return false
  286. } else if (this.table.temp.bcode == '') {
  287. this.$message({ type: 'error', message: '栏舍编号不能为空', duration: 2000 })
  288. return false
  289. }
  290. // if (this.table.temp.bcode.length > 8) {
  291. // this.$message({ type: 'error', message: '栏舍编号请输入1-8位数字', duration: 2000 })
  292. // return false
  293. // }
  294. if (this.table.temp.allowratio !== '') {
  295. console.log(this.table.temp.allowratio)
  296. const allowratio = /^[0-9]\d*$/
  297. if (!allowratio.test(parseFloat(this.table.temp.allowratio))) {
  298. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  299. return false
  300. }
  301. } else {
  302. this.table.temp.allowratio = '0'
  303. }
  304. if (this.table.temp.autozone !== '') {
  305. console.log(this.table.temp.autozone)
  306. const autozone = /^(\d|[1-9]\d|1[0-1]\d|120)$/
  307. if (!autozone.test(parseFloat(this.table.temp.autozone))) {
  308. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于120的整数', duration: 2000 })
  309. return false
  310. }
  311. } else {
  312. this.table.temp.autozone = '0'
  313. }
  314. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  315. if (pattern.test(this.table.temp.eqcode)) {
  316. this.$message({ type: 'error', message: 'TMR设备编号不可输入特殊字符', duration: 2000 })
  317. return false
  318. }
  319. if (pattern.test(this.table.temp.tname)) {
  320. this.$message({ type: 'error', message: 'TMR设备名称不可输入特殊字符', duration: 2000 })
  321. return false
  322. }
  323. this.isokDisable = true
  324. setTimeout(() => {
  325. this.isokDisable = false
  326. }, 1000)
  327. this.requestParam.name = 'insertBar'
  328. this.requestParam.parammaps = this.table.temp
  329. PostDataByName(this.requestParam).then(response => {
  330. console.log('新增保存发送参数', this.requestParam)
  331. if (response.msg !== 'fail') {
  332. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  333. this.getList()
  334. } else {
  335. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  336. }
  337. })
  338. },
  339. createCancel(row) {
  340. console.log('点击了新增取消')
  341. for (let i = 0; i < this.table.list.length; i++) {
  342. if (row.myId === this.table.list[i].myId) {
  343. var listIndex = this.table.list.indexOf(this.table.list[i])
  344. }
  345. if (listIndex > -1) {
  346. this.table.list.splice(listIndex, 1)
  347. return
  348. }
  349. }
  350. },
  351. handleUpdate(row) {
  352. console.log('点击了编辑', row)
  353. for (let i = 0; i < this.table.list.length; i++) {
  354. if (this.table.list[i].Edit == true) {
  355. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  356. return false
  357. }
  358. }
  359. // 编辑true,不可编辑false
  360. row.Edit = true
  361. row.NoEdit = false
  362. // 新增false,编辑false,编辑保存true
  363. row.isCreate = false
  364. row.isUpdate = false
  365. row.isUpdateSave = true
  366. row.autosecond = String(row.autosecond)
  367. this.table.temp.autosecondname = row.autosecondname
  368. this.table.temp.autosecond = row.autosecond
  369. },
  370. updateData(row) {
  371. console.log('点击了编辑保存', row)
  372. this.table.temp.pastureid = Cookies.get('pastureid')
  373. this.table.temp.bcode = row.bcode
  374. this.table.temp.bname = row.bname
  375. this.table.temp.allowratio = row.allowratio
  376. this.table.temp.autozone = row.autozone
  377. this.table.temp.autosecond = row.autosecond
  378. this.table.temp.autosecondname = this.table.temp.autosecondname
  379. this.table.temp.isstart = row.isstart
  380. this.table.temp.enable = row.enable
  381. this.table.temp.id = row.id
  382. // 检验用户名称/角色是否为空
  383. if (this.table.temp.bname == '' && this.table.temp.bcode == '') {
  384. this.$message({ type: 'error', message: '栏舍名称/栏舍编号不能为空', duration: 2000 })
  385. return false
  386. } else if (this.table.temp.bname == '') {
  387. this.$message({ type: 'error', message: '栏舍名称不能为空', duration: 2000 })
  388. return false
  389. } else if (this.table.temp.bcode == '') {
  390. this.$message({ type: 'error', message: '栏舍编号不能为空', duration: 2000 })
  391. return false
  392. }
  393. // if (this.table.temp.bcode.length > 8) {
  394. // this.$message({ type: 'error', message: '栏舍编号请输入1-8位数字', duration: 2000 })
  395. // return false
  396. // }
  397. if (this.table.temp.allowratio !== '') {
  398. console.log(this.table.temp.allowratio)
  399. const allowratio = /^[0-9]\d*$/
  400. if (!allowratio.test(parseFloat(this.table.temp.allowratio))) {
  401. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  402. return false
  403. }
  404. } else {
  405. this.table.temp.allowratio = '0'
  406. }
  407. if (this.table.temp.autozone !== '') {
  408. console.log(this.table.temp.autozone)
  409. const autozone = /^(\d|[1-9]\d|1[0-1]\d|120)$/
  410. if (!autozone.test(parseFloat(this.table.temp.autozone))) {
  411. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于120的整数', duration: 2000 })
  412. return false
  413. }
  414. } else {
  415. this.table.temp.autozone = '0'
  416. }
  417. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  418. if (pattern.test(this.table.temp.eqcode)) {
  419. this.$message({ type: 'error', message: 'TMR设备编号不可输入特殊字符', duration: 2000 })
  420. return false
  421. }
  422. if (pattern.test(this.table.temp.tname)) {
  423. this.$message({ type: 'error', message: 'TMR设备名称不可输入特殊字符', duration: 2000 })
  424. return false
  425. }
  426. this.isokDisable = true
  427. setTimeout(() => {
  428. this.isokDisable = false
  429. }, 1000)
  430. this.requestParam.name = 'updateBar'
  431. this.requestParam.parammaps = this.table.temp
  432. PostDataByName(this.requestParam).then(response => {
  433. console.log('新增保存发送参数', this.requestParam)
  434. if (response.msg !== 'fail') {
  435. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  436. this.getList()
  437. } else {
  438. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  439. }
  440. })
  441. },
  442. updateCancel(row) {
  443. console.log('点击了编辑取消')
  444. // 编辑false,不可编辑true
  445. row.Edit = false
  446. row.NoEdit = true
  447. // 新增false,编辑true,编辑保存false
  448. row.isCreate = false
  449. row.isUpdate = true
  450. row.isUpdateSave = false
  451. this.getList()
  452. },
  453. handleRowDelete(row) {
  454. console.log('点击了行内删除')
  455. MessageBox.confirm('是否确认删除此信息?', {
  456. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  457. }).then(() => {
  458. this.selectList = []
  459. this.requestParam = {}
  460. this.requestParam.common = { 'returnmap': '0' }
  461. this.requestParam.data = []
  462. this.requestParam.data[0] = { 'name': 'checkDeleteBar', 'type': 'v', 'parammaps': {
  463. 'pastureid': row.pastureid,
  464. 'id': row.id
  465. }}
  466. this.requestParam.data[1] = { 'name': 'deleteBar', 'type': 'e', 'parammaps': {
  467. 'pastureid': row.pastureid,
  468. 'id': row.id
  469. }}
  470. ExecDataByConfig(this.requestParam).then(response => {
  471. console.log('删除保存发送参数', this.requestParam)
  472. if (response.msg === 'fail') {
  473. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  474. } else {
  475. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  476. this.getList()
  477. }
  478. })
  479. }).catch(() => {
  480. this.$message({ type: 'info', message: '已取消删除' })
  481. })
  482. },
  483. handleSelectionChange(val) {
  484. console.log('勾选数据', val)
  485. this.selectList = val
  486. },
  487. handleDelete() {
  488. console.log('点击了删除')
  489. if (this.selectList.length == 0) {
  490. this.$message({ type: 'error', message: '请选择舍组栏信息', duration: 2000 })
  491. } else {
  492. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  493. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  494. }).then(() => {
  495. console.log(this.selectList)
  496. this.requestParam = {}
  497. this.requestParam.common = { 'returnmap': '0' }
  498. this.requestParam.data = []
  499. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  500. this.requestParam.data[0].children = []
  501. this.requestParam.data[0].children[0] = { 'name': 'checkDeleteBar', 'type': 'v', 'parammaps': {
  502. id: '@insertSpotList.id',
  503. pastureid: '@insertSpotList.pastureid'
  504. }}
  505. this.requestParam.data[0].children[1] = { 'name': 'deleteBar', 'type': 'e', 'parammaps': {
  506. id: '@insertSpotList.id',
  507. pastureid: '@insertSpotList.pastureid'
  508. }}
  509. ExecDataByConfig(this.requestParam).then(response => {
  510. console.log('删除保存发送参数', this.requestParam)
  511. if (response.msg === 'fail') {
  512. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  513. } else {
  514. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  515. this.getList()
  516. }
  517. })
  518. })
  519. }
  520. }
  521. }
  522. }
  523. </script>
  524. <style lang="scss" scoped>
  525. .search{margin-top:10px;}
  526. .table{margin-top:10px;}
  527. $width:350px;
  528. $left:325px;
  529. .selectInput{
  530. position: relative;
  531. display: inline-block;
  532. .Input{width: $width;position: relative;}
  533. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  534. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  535. .selectUl{
  536. z-index: 111;width: $width;background: #fff;border: 1px solid #E4E7ED;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);margin: -1px 0 0 0;padding: 6px 0; margin: 0;box-sizing: border-box;position: absolute;
  537. li{
  538. list-style: none;font-size: 14px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #606266; height: 50px; line-height: 50px; box-sizing: border-box; cursor: pointer;
  539. a{float:left;width: 80px;}
  540. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  541. }
  542. }
  543. }
  544. </style>