index.vue 8.7 KB

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