index.vue 8.3 KB

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