index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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-cascader
  7. class="filter-item form-search-input fl"
  8. v-model="queryParam.department_id"
  9. :options="departments"
  10. clearable
  11. :props="{
  12. emitPath:false,
  13. label: 'department_name',
  14. value: 'id',
  15. }"
  16. @change="handleChange"
  17. ></el-cascader>
  18. </div>
  19. <div class="search-item">
  20. <el-input
  21. v-model="queryParam.number"
  22. placeholder="编号"
  23. clearable
  24. class="filter-item form-search-input fl"
  25. @keyup.enter.native="handleSearch"
  26. />
  27. </div>
  28. <div class="search-item">
  29. <el-input
  30. v-model="queryParam.name"
  31. placeholder="名称"
  32. clearable
  33. class="filter-item form-search-input fl"
  34. @keyup.enter.native="handleSearch"
  35. />
  36. </div>
  37. <div class="search-item">
  38. <el-select
  39. v-model="queryParam.model"
  40. placeholder="模型"
  41. class="filter-item form-search-input fl"
  42. clearable
  43. >
  44. <el-option v-for="item in deviceModels"
  45. :key="item.value"
  46. :label="item.text"
  47. :value="item.value"></el-option>
  48. </el-select>
  49. </div>
  50. <div class="search-item">
  51. <el-select
  52. v-model="queryParam.is_used"
  53. placeholder="使用状态"
  54. class="filter-item form-search-input fl"
  55. clearable
  56. >
  57. <el-option value="-2" label="未使用">已报废</el-option>
  58. <el-option value="-1" label="未使用">未使用</el-option>
  59. <el-option value="1" label="已使用">已使用</el-option>
  60. </el-select>
  61. </div>
  62. </div>
  63. <div class="search-operate-area">
  64. <!-- <el-input v-model="queryParam.code" placeholder="唯一编码" clearable class="filter-item form-search-input fl" /> -->
  65. <el-button
  66. class="filter-item search fl"
  67. icon="el-icon-search"
  68. @click="handleSearch"
  69. >搜索</el-button
  70. >
  71. <el-button
  72. class="filter-item fl"
  73. icon="el-icon-refresh"
  74. @click="handleRefresh"
  75. >重置</el-button
  76. >
  77. <el-button
  78. class="filter-item search fl"
  79. :icon="this.searchDisplay ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
  80. @click="searchDis"
  81. >{{ word }}</el-button
  82. >
  83. </div>
  84. <div class="list-operate-area">
  85. <!-- <el-button size="mini" class="filter-item search fl" icon="el-icon-plus" @click="handleCreate">添加</el-button> -->
  86. <el-button
  87. class="filter-item search fl"
  88. icon="el-icon-setting"
  89. @click="showColumnOption"
  90. >列设置</el-button
  91. >
  92. <el-button
  93. class="filter-item search fl"
  94. icon="el-icon-refresh-right"
  95. @click="refresh"
  96. >刷新</el-button
  97. >
  98. </div>
  99. </div>
  100. <el-table
  101. :data="data"
  102. v-loading="loading"
  103. ref="multipleTable"
  104. @selection-change="hydraulicSelectMulti"
  105. @sort-change="sortChange"
  106. :dynamicColumnSetting="true"
  107. tooltip-effect="dark"
  108. style="width: 100%"
  109. border
  110. fit
  111. >
  112. <el-table-column
  113. type="selection"
  114. fixed="left"
  115. width="55"
  116. ></el-table-column>
  117. <el-table-column
  118. prop="wind_name"
  119. label="风场名称"
  120. align="center"
  121. v-if="showColumn.wind_name"
  122. :show-overflow-tooltip="true"
  123. />
  124. <el-table-column
  125. prop="fan_number"
  126. label="风机机位号"
  127. align="center"
  128. v-if="showColumn.fan_number"
  129. :show-overflow-tooltip="true"
  130. />
  131. <el-table-column
  132. prop="number"
  133. label="编号"
  134. align="center"
  135. v-if="showColumn.number"
  136. :show-overflow-tooltip="true"
  137. />
  138. <el-table-column
  139. prop="work_local_name"
  140. label="工作位置"
  141. align="center"
  142. v-if="showColumn.work_local"
  143. :show-overflow-tooltip="true"
  144. />
  145. <el-table-column
  146. prop="parts_name"
  147. label="所属部件"
  148. align="center"
  149. v-if="showColumn.parts"
  150. :show-overflow-tooltip="true"
  151. />
  152. <el-table-column
  153. prop="bolt_style_name"
  154. label="螺栓样式"
  155. align="center"
  156. v-if="showColumn.bolt_style"
  157. :show-overflow-tooltip="true"
  158. />
  159. <el-table-column
  160. prop="boit_type_name"
  161. label="螺栓型号"
  162. align="center"
  163. v-if="showColumn.boit_type"
  164. :show-overflow-tooltip="true"
  165. />
  166. <el-table-column
  167. prop="torque"
  168. label="扭矩"
  169. align="center"
  170. v-if="showColumn.torque"
  171. :show-overflow-tooltip="true"
  172. />
  173. <el-table-column
  174. prop="pressure"
  175. label="压力"
  176. align="center"
  177. v-if="showColumn.pressure"
  178. :show-overflow-tooltip="true"
  179. />
  180. <el-table-column
  181. prop="external_diameter"
  182. label="外径"
  183. align="center"
  184. v-if="showColumn.external_diameter"
  185. :show-overflow-tooltip="true"
  186. />
  187. <el-table-column
  188. prop="created_at"
  189. label="创建时间"
  190. align="center"
  191. v-if="showColumn.external_diameter"
  192. :show-overflow-tooltip="true"
  193. />
  194. <el-table-column
  195. label="操作"
  196. width="150"
  197. align="center"
  198. fixed="right"
  199. >
  200. <template slot-scope="record">
  201. <el-tooltip
  202. content="查看"
  203. placement="top"
  204. :enterable="false"
  205. >
  206. <el-button
  207. type="primary"
  208. size="mini"
  209. icon="el-icon-view"
  210. @click="handleView(record.row)"
  211. ></el-button>
  212. </el-tooltip>
  213. <!-- <el-tooltip
  214. content="查看"
  215. placement="top"
  216. :enterable="false"
  217. >
  218. <el-button
  219. type="primary"
  220. size="mini"
  221. icon="el-icon-view"
  222. @click="handleDetail(record.row)"
  223. ></el-button>
  224. </el-tooltip> -->
  225. </template>
  226. </el-table-column>
  227. </el-table>
  228. <transition name="fade">
  229. <div class="columnOption" v-show="isShowColumn">
  230. <div class="content">
  231. <div class="head">选择显示字段</div>
  232. <div class="body">
  233. <el-checkbox v-model="checkList.wind_name" disabled>风场名称</el-checkbox>
  234. <el-checkbox v-model="checkList.fan_number" disabled>风机机位号</el-checkbox>
  235. <el-checkbox v-model="checkList.number">编号</el-checkbox>
  236. <el-checkbox v-model="checkList.parts">所属部件</el-checkbox>
  237. <el-checkbox v-model="checkList.bolt_style">螺丝样式</el-checkbox>
  238. <el-checkbox v-model="checkList.boit_type">螺栓型号</el-checkbox>
  239. <el-checkbox v-model="checkList.torque">扭矩</el-checkbox>
  240. <el-checkbox v-model="checkList.pressure">压力</el-checkbox>
  241. <el-checkbox v-model="checkList.external_diameter">外径</el-checkbox>
  242. <el-checkbox v-model="checkList.created_at">创建时间</el-checkbox>
  243. </div>
  244. <div class="footer">
  245. <el-button size="small" type="primary" plain @click="saveColumn"
  246. >保存列配置</el-button
  247. >
  248. </div>
  249. </div>
  250. </div>
  251. </transition>
  252. <el-button
  253. type="primary"
  254. icon="el-icon-plus"
  255. :loading="downloadLoading"
  256. style="margin-top: 15px"
  257. @click="handleCreate"
  258. >添加</el-button
  259. >
  260. <el-button
  261. type="danger"
  262. icon="el-icon-delete"
  263. v-if="selectedIds.length > 0"
  264. style="margin-top: 15px"
  265. @click="handleMultiDelete()"
  266. >删除</el-button
  267. >
  268. <el-pagination
  269. background
  270. class="pagination-container"
  271. @size-change="handleSizeChange"
  272. @current-change="handleCurrentChange"
  273. :current-page="paginate.current"
  274. :page-sizes="paginate.sizes"
  275. :page-size="paginate.limit"
  276. :layout="paginate.layout"
  277. :total="paginate.total"
  278. />
  279. <form-model
  280. @sendVal="closeDialog"
  281. :formModelVisible="formVisible"
  282. :title="title"
  283. :ref="formName"
  284. />
  285. <detail
  286. :detailVisible="detailVisible"
  287. @sendVal="closeDrawer"
  288. :data="detail"
  289. />
  290. </div>
  291. </template>
  292. <script>
  293. import rlListOperate from "@/layout/rl-list-operate/rlListOperate";
  294. import { action } from "@/directive/permission/index.js";
  295. import formModel from './formModel.vue'
  296. export default {
  297. name: "workLocation",
  298. directives: { action },
  299. mixins: [rlListOperate],
  300. components: {
  301. formModel,
  302. detail,
  303. },
  304. data() {
  305. return {
  306. url: "workLocation",
  307. queryParam: {
  308. number: "",
  309. department_id: [],
  310. name: "",
  311. model: "",
  312. is_used: "",
  313. },
  314. defaultQueryParam:['type'],
  315. current_type: {
  316. 0: "success",
  317. 1: "danger",
  318. },
  319. formName:'workLocation',
  320. formVisible:false,
  321. //搜索
  322. searchDisplay: true,
  323. departments: [],
  324. deviceModels:[],
  325. //详情
  326. detailVisible:false,
  327. detail:{},
  328. isShowColumn: false,
  329. // 列的配置化对象,存储配置信息
  330. checkList: {},
  331. showColumn: {
  332. wind_name:true,
  333. fan_number:true,
  334. number: true,
  335. work_local: true,
  336. parts:true,
  337. bolt_style: true,
  338. boit_type: true,
  339. torque:true,
  340. pressure:true,
  341. external_diameter:true,
  342. created_at:true
  343. }
  344. };
  345. },
  346. created() {
  347. this.$http.get("departments").then((response) => {
  348. this.departments = response.data;
  349. });
  350. this.$http.get("get_device_mold",{ params: {type:2} }).then(resp => {
  351. this.deviceModels = resp.data
  352. });
  353. },
  354. methods: {
  355. //重置
  356. handleChange(val) {
  357. this.queryParam.department_id = val;
  358. this.handleSearch();
  359. },
  360. hydraulicSelectMulti(data) {
  361. this.selectedIds = [];
  362. data.forEach((item) => {
  363. this.selectedIds.push(item.id);
  364. });
  365. },
  366. refresh() {
  367. this.queryParam.page = this.paginate.current;
  368. this.getList();
  369. },
  370. searchDis() {
  371. this.searchDisplay = !this.searchDisplay;
  372. var searchBoxHeght = document.getElementById("searchBox");
  373. if (this.searchDisplay == false) {
  374. searchBoxHeght.style.height = 40 + "px";
  375. } else {
  376. searchBoxHeght.style.height = "auto";
  377. }
  378. },
  379. showColumnOption() {
  380. this.isShowColumn = true;
  381. },
  382. saveColumn() {
  383. localStorage.setItem("WorklocalSet", JSON.stringify(this.checkList));
  384. this.isShowColumn = false;
  385. },
  386. handleDetail(row){
  387. this.detailVisible = true,
  388. this.detail = row
  389. },
  390. closeDrawer(){
  391. this.detailVisible = false
  392. }
  393. },
  394. watch: {
  395. // 监听复选框配置列所有的变化
  396. checkList: {
  397. handler: function (newnew, oldold) {
  398. // console.log(newnew);
  399. this.showColumn = newnew;
  400. // 这里需要让表格重新绘制一下,否则会产生固定列错位的情况
  401. this.$nextTick(() => {
  402. this.$refs.multipleTable.doLayout();
  403. });
  404. },
  405. deep: true,
  406. immediate: true,
  407. },
  408. },
  409. computed: {
  410. word: function () {
  411. if (this.searchDisplay == false) {
  412. //对文字进行处理
  413. return "展开";
  414. } else {
  415. return "收起";
  416. }
  417. },
  418. },
  419. mounted() {
  420. // this.getIsUseVoice();
  421. this.$nextTick(function () {
  422. this.searchDis();
  423. });
  424. // 发请求得到checkListInitData的列的名字
  425. if (localStorage.getItem("WorklocalSet")) {
  426. this.checkList = JSON.parse(localStorage.getItem("WorklocalSet"));
  427. } else {
  428. this.checkList = {
  429. wind_name:true,
  430. fan_number:true,
  431. number: true,
  432. work_local: true,
  433. parts:true,
  434. bolt_style: true,
  435. boit_type: true,
  436. torque:true,
  437. pressure:true,
  438. external_diameter:true,
  439. created_at:true
  440. };
  441. }
  442. },
  443. };
  444. </script>
  445. <style lang="scss" scoped>
  446. @import "@/views/device/hydraulic/index.scss";
  447. </style>