index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" size="mini" @click.stop="newAdd()">新建设备档案
  10. </el-button>
  11. </template>
  12. <template slot="corpIdSearch">
  13. <crop-select v-model="search.corpId" corpType="GYS"></crop-select>
  14. </template>
  15. <template slot-scope="{ row, index }" slot="corpId">
  16. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.corpsName }}
  17. </span>
  18. </template>
  19. <template slot-scope="{ row, index }" slot="sysNo">
  20. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.sysNo }}
  21. </span>
  22. </template>
  23. <template slot-scope="{ row, index }" slot="menu">
  24. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  25. <i class="tradingIcon icon-edit" @click.stop="editOpen(row, 2)"/>
  26. </el-tooltip>
  27. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  28. <i class="tradingIcon icon-del" @click.stop="rowDel(row, index)"/>
  29. </el-tooltip>
  30. </template>
  31. </avue-crud>
  32. </basic-container>
  33. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  34. </div>
  35. </template>
  36. <script>
  37. import detailsPage from "./detailsPage";
  38. import { option } from "./js/optionList";
  39. import { maintenanceList, maintenanceRemove} from "@/api/basicData/maintenanceQ";
  40. import {
  41. allCropList,
  42. } from "@/api/basicData/customerInformation";
  43. import {getCustomerCode} from "@/enums/management-type";
  44. export default {
  45. name: "index",
  46. data() {
  47. return {
  48. src: '',
  49. show: true,
  50. loading: false,
  51. search: {},
  52. detailData: {},
  53. dataList: [],
  54. selectionList: [],
  55. page: {
  56. pageSize: 20,
  57. currentPage: 1,
  58. total: 0,
  59. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  60. },
  61. option: {},
  62. };
  63. },
  64. components: {
  65. detailsPage
  66. },
  67. async created() {
  68. this.option = option
  69. this.option.height = window.innerHeight - 210;
  70. this.allCropListfun()
  71. },
  72. activated() {
  73. this.$refs.crud.refreshTable();
  74. if (!this.$store.getters.pjcgStatus&&!this.show) {
  75. this.show = true;
  76. }
  77. if (this.$route.query.orderId) {
  78. setTimeout(() => {
  79. this.editOpen({ id: this.$route.query.orderId }, 1);
  80. }, 100);
  81. }
  82. },
  83. methods: {
  84. // 客户查询
  85. allCropListfun(){
  86. let userObj = JSON.parse(localStorage.getItem("saber-userInfo")).content;
  87. allCropList({
  88. corpType: "KH",
  89. adminProfiles: userObj.role_name != "admin" ? userObj.user_id : null,
  90. }).then(res=>{
  91. this.findObject(this.option.column, "corpName").dicData = res.data.data
  92. })
  93. },
  94. searchCriteriaSwitch(type) {
  95. if (type) {
  96. this.option.height = this.option.height - 138;
  97. } else {
  98. this.option.height = this.option.height + 138;
  99. }
  100. this.$refs.crud.getTableHeight();
  101. },
  102. cellStyle() {
  103. return "padding:0;height:40px;";
  104. },
  105. //点击搜索按钮触发
  106. searchChange(params, done) {
  107. this.page.currentPage = 1;
  108. this.onLoad(this.page, params);
  109. done();
  110. },
  111. refreshChange() {
  112. this.onLoad(this.page, this.search);
  113. },
  114. newAdd() {
  115. this.show = false;
  116. // this.$store.commit("IN_PJCG_STATUS");
  117. },
  118. // 列表数据
  119. onLoad(page, params = {}) {
  120. let data = this.deepClone(Object.assign(params, this.search));
  121. this.loading = true;
  122. maintenanceList(
  123. page.currentPage,
  124. page.pageSize,
  125. data
  126. ).then(res => {
  127. this.dataList = res.data.data.records ? res.data.data.records : [];
  128. this.page.total = res.data.data.total;
  129. this.$nextTick(() => {
  130. this.$refs.crud.doLayout();
  131. });
  132. }).finally(() => {
  133. this.loading = false;
  134. });
  135. },
  136. editOpen(row, status) {
  137. this.detailData = {
  138. id: row.id,
  139. status: status
  140. };
  141. this.show = false;
  142. // this.$store.commit("IN_PJCG_STATUS");
  143. },
  144. currentChange(val) {
  145. this.page.currentPage = val;
  146. },
  147. sizeChange(val) {
  148. this.page.currentPage = 1;
  149. this.page.pageSize = val;
  150. },
  151. rowDel(row, index, done) {
  152. this.$confirm("确定删除数据?", {
  153. confirmButtonText: "确定",
  154. cancelButtonText: "取消",
  155. type: "warning"
  156. }).then(() => {
  157. maintenanceRemove({ids:row.id}).then(res => {
  158. if (res.data.code == 200) {
  159. this.$message({
  160. type: "success",
  161. message: "删除成功!"
  162. });
  163. this.onLoad(this.page, this.search);
  164. }
  165. });
  166. });
  167. },
  168. async saveColumn() {
  169. const inSave = await this.saveColumnData(
  170. this.getColumnName(213),
  171. this.option
  172. );
  173. if (inSave) {
  174. this.$nextTick(() => {
  175. this.$refs.crud.doLayout();
  176. });
  177. this.$message.success("保存成功");
  178. //关闭窗口
  179. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  180. }
  181. },
  182. async resetColumn() {
  183. this.option = option;
  184. const inSave = option
  185. if (inSave) {
  186. this.$nextTick(() => {
  187. this.$refs.crud.doLayout();
  188. });
  189. this.getAllWorkDicts()
  190. this.$message.success("重置成功");
  191. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  192. }
  193. },
  194. //返回列表
  195. goBack() {
  196. this.detailData = this.$options.data().detailData;
  197. this.show = true;
  198. this.onLoad(this.page, this.search);
  199. // this.$store.commit("OUT_PJCG_STATUS");
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .page-crad ::v-deep .basic-container__card {
  206. height: 94.2vh;
  207. }
  208. .stat-td {
  209. text-align: center;
  210. position: relative;
  211. }
  212. .stat-img {
  213. width: 95%;
  214. height: 100px;
  215. }
  216. .stat-tip {
  217. position: absolute;
  218. left: 15px;
  219. top: 5px;
  220. .money {
  221. color: #fff;
  222. font-size: 28px;
  223. text-align: left;
  224. font-weight: 600;
  225. }
  226. .title {
  227. color: #fff;
  228. font-size: 14px;
  229. text-align: left;
  230. margin-top: 5px;
  231. margin-bottom: 0px;
  232. }
  233. }
  234. </style>