index.vue 6.7 KB

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