index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <div class="app-container">
  3. <div class="filter-container" style="padding-bottom: 0px">
  4. <div class="search-box-area" id="searchBox">
  5. <div class="search-item">
  6. <el-input
  7. v-model="queryParam.name"
  8. placeholder="名称"
  9. clearable
  10. class="filter-item form-search-input fl"
  11. @keyup.enter.native="handleSearch"
  12. />
  13. </div>
  14. </div>
  15. <div class="search-operate-area">
  16. <!-- <el-input v-model="queryParam.code" placeholder="唯一编码" clearable class="filter-item form-search-input fl" /> -->
  17. <el-button
  18. class="filter-item search fl"
  19. icon="el-icon-search"
  20. @click="handleSearch"
  21. >搜索</el-button
  22. >
  23. <el-button
  24. class="filter-item fl"
  25. icon="el-icon-refresh"
  26. @click="handleRefresh"
  27. >重置</el-button
  28. >
  29. <el-button
  30. class="filter-item search fl"
  31. :icon="this.searchDisplay ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
  32. @click="searchDis"
  33. >{{ word }}</el-button
  34. >
  35. </div>
  36. <div class="list-operate-area">
  37. <!-- <el-button size="mini" class="filter-item search fl" icon="el-icon-plus" @click="handleCreate">添加</el-button> -->
  38. <el-button
  39. class="filter-item search fl"
  40. icon="el-icon-setting"
  41. @click="showColumnOption"
  42. >列设置</el-button
  43. >
  44. <el-button
  45. class="filter-item search fl"
  46. icon="el-icon-refresh-right"
  47. @click="refresh"
  48. >刷新</el-button
  49. >
  50. </div>
  51. </div>
  52. <el-table
  53. :data="data"
  54. v-loading="loading"
  55. ref="multipleTable"
  56. @selection-change="hydraulicSelectMulti"
  57. @sort-change="sortChange"
  58. :dynamicColumnSetting="true"
  59. tooltip-effect="dark"
  60. style="width: 100%"
  61. border
  62. fit
  63. >
  64. <el-table-column
  65. type="selection"
  66. fixed="left"
  67. width="55"
  68. ></el-table-column>
  69. <el-table-column
  70. prop="name"
  71. label="名称"
  72. align="center"
  73. v-if="showColumn.name"
  74. :show-overflow-tooltip="true"
  75. />
  76. <el-table-column
  77. prop="hole"
  78. label="孔"
  79. align="center"
  80. v-if="showColumn.hole"
  81. :show-overflow-tooltip="true"
  82. />
  83. <el-table-column
  84. prop="step"
  85. label="步骤"
  86. align="center"
  87. v-if="showColumn.step"
  88. :show-overflow-tooltip="true"
  89. width="200"
  90. />
  91. <el-table-column
  92. label="操作"
  93. width="180"
  94. align="center"
  95. fixed="right"
  96. >
  97. <template slot-scope="record">
  98. <el-tooltip
  99. content="修改"
  100. placement="top"
  101. :enterable="false"
  102. >
  103. <el-button
  104. type="primary"
  105. size="mini"
  106. icon="el-icon-edit"
  107. @click="handleUpdate(record.row)"
  108. ></el-button>
  109. </el-tooltip>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <transition name="fade">
  114. <div class="columnOption" v-show="isShowColumn">
  115. <div class="content">
  116. <div class="head">选择显示字段</div>
  117. <div class="body">
  118. <el-checkbox v-model="checkList.name">名称</el-checkbox>
  119. <el-checkbox v-model="checkList.hole">孔</el-checkbox>
  120. <el-checkbox v-model="checkList.step">步骤</el-checkbox>
  121. </div>
  122. <div class="footer">
  123. <el-button size="small" type="primary" plain @click="saveColumn"
  124. >保存列配置</el-button
  125. >
  126. </div>
  127. </div>
  128. </div>
  129. </transition>
  130. <el-button
  131. type="primary"
  132. icon="el-icon-plus"
  133. :loading="downloadLoading"
  134. style="margin-top: 15px"
  135. @click="handleCreate"
  136. >添加</el-button
  137. >
  138. <el-button
  139. type="danger"
  140. icon="el-icon-delete"
  141. v-if="selectedIds.length > 0"
  142. style="margin-top: 15px"
  143. @click="handleMultiDelete()"
  144. >删除</el-button
  145. >
  146. <el-pagination
  147. background
  148. class="pagination-container"
  149. @size-change="handleSizeChange"
  150. @current-change="handleCurrentChange"
  151. :current-page="paginate.current"
  152. :page-sizes="paginate.sizes"
  153. :page-size="paginate.limit"
  154. :layout="paginate.layout"
  155. :total="paginate.total"
  156. />
  157. <form-model
  158. @sendVal="closeDialog"
  159. :formModelVisible="formVisible"
  160. :title="title"
  161. :ref="formName"
  162. />
  163. <detail
  164. :detailVisible="detailVisible"
  165. @sendVal="closeDrawer"
  166. :record="detail"
  167. />
  168. </div>
  169. </template>
  170. <script>
  171. import rlListOperate from "@/layout/rl-list-operate/rlListOperate";
  172. import { action } from "@/directive/permission/index.js";
  173. import formModel from './formModel.vue'
  174. export default {
  175. name: "synscheme",
  176. directives: { action },
  177. mixins: [rlListOperate],
  178. components: {
  179. formModel
  180. },
  181. data() {
  182. return {
  183. url: "synscheme",
  184. queryParam: {
  185. name: "",
  186. },
  187. deviceTypes:[],
  188. current_type: {
  189. 0: "success",
  190. 1: "danger",
  191. },
  192. formName:'synscheme',
  193. formVisible:false,
  194. //搜索
  195. searchDisplay: true,
  196. departments: [],
  197. //详情
  198. detailVisible:false,
  199. detail:{},
  200. isShowColumn: false,
  201. // 列的配置化对象,存储配置信息
  202. checkList: {},
  203. showColumn: {
  204. name: true,
  205. hole: true,
  206. step:true,
  207. }
  208. };
  209. },
  210. created() {
  211. },
  212. methods: {
  213. handleChange(val) {
  214. // console.log(val)
  215. this.queryParam.department_id = val;
  216. this.handleSearch();
  217. },
  218. hydraulicSelectMulti(data) {
  219. this.selectedIds = [];
  220. data.forEach((item) => {
  221. this.selectedIds.push(item.id);
  222. });
  223. },
  224. refresh() {
  225. this.queryParam.page = this.paginate.current;
  226. this.getList();
  227. },
  228. searchDis() {
  229. this.searchDisplay = !this.searchDisplay;
  230. var searchBoxHeght = document.getElementById("searchBox");
  231. if (this.searchDisplay == false) {
  232. searchBoxHeght.style.height = 40 + "px";
  233. } else {
  234. searchBoxHeght.style.height = "auto";
  235. }
  236. },
  237. showColumnOption() {
  238. this.isShowColumn = true;
  239. },
  240. saveColumn() {
  241. localStorage.setItem("synschemeSet", JSON.stringify(this.checkList));
  242. this.isShowColumn = false;
  243. },
  244. handleDetail(row){
  245. this.detailVisible = true,
  246. this.detail = row
  247. },
  248. closeDrawer(){
  249. this.detailVisible = false
  250. },
  251. changeUsedEvent(row,value){
  252. this.$http.put('synscheme/' + row.id, { is_used: value }).then(resp => {
  253. if (resp.code === 10000) {
  254. this.$message.success('操作成功')
  255. // row[field] = val
  256. // this.$emit('rowClick', row)
  257. }
  258. })
  259. }
  260. },
  261. watch: {
  262. // 监听复选框配置列所有的变化
  263. checkList: {
  264. handler: function (newnew, oldold) {
  265. // console.log(newnew);
  266. this.showColumn = newnew;
  267. // 这里需要让表格重新绘制一下,否则会产生固定列错位的情况
  268. this.$nextTick(() => {
  269. this.$refs.multipleTable.doLayout();
  270. });
  271. },
  272. deep: true,
  273. immediate: true,
  274. },
  275. },
  276. computed: {
  277. word: function () {
  278. if (this.searchDisplay == false) {
  279. //对文字进行处理
  280. return "展开";
  281. } else {
  282. return "收起";
  283. }
  284. },
  285. },
  286. mounted() {
  287. // this.getIsUseVoice();
  288. this.$nextTick(function () {
  289. this.searchDis();
  290. });
  291. // 发请求得到checkListInitData的列的名字
  292. if (localStorage.getItem("synschemeSet")) {
  293. this.checkList = JSON.parse(localStorage.getItem("synschemeSet"));
  294. } else {
  295. this.checkList = {
  296. name: true,
  297. hole: true,
  298. step:true,
  299. };
  300. }
  301. },
  302. };
  303. </script>
  304. <style lang="scss" scoped>
  305. @import "@/views/device/hydraulic/index.scss";
  306. </style>