index.vue 7.7 KB

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