index.vue 9.1 KB

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