index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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.option = await this.getColumnData(this.getColumnName(282), option);
  91. this.optionXiala = optionXiala
  92. this.option.height = window.innerHeight - 210;
  93. },
  94. activated() {
  95. this.$refs.crud.refreshTable();
  96. if (!this.$store.getters.pjcgStatus&&!this.show) {
  97. this.show = true;
  98. }
  99. if (this.$route.query.orderId) {
  100. setTimeout(() => {
  101. this.editOpen({ id: this.$route.query.orderId }, 1);
  102. }, 100);
  103. }
  104. },
  105. methods: {
  106. // 表格的下拉
  107. async expandChange(row, index){
  108. console.log(row,index,107)
  109. if (row.loading) {
  110. const {data} = await corpequipmentarchivesitemList({
  111. current: 1,
  112. size: 20,
  113. pid:row.id
  114. })
  115. row.orderItemsList = data.data.records
  116. row.loading = false
  117. }
  118. },
  119. // 导出设备
  120. openExport() {
  121. let params = JSON.parse(JSON.stringify(this.search))
  122. const routeData = this.$router.resolve({
  123. path: '/api/blade-client/corpequipmentarchives/export-out-info', //跳转目标窗口的地址
  124. query: {
  125. ...params //括号内是要传递给新窗口的参数
  126. }
  127. })
  128. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  129. },
  130. searchCriteriaSwitch(type) {
  131. if (type) {
  132. this.option.height = this.option.height - 138;
  133. } else {
  134. this.option.height = this.option.height + 138;
  135. }
  136. this.$refs.crud.getTableHeight();
  137. },
  138. cellStyle() {
  139. return "padding:0;height:40px;";
  140. },
  141. //点击搜索按钮触发
  142. searchChange(params, done) {
  143. this.page.currentPage = 1;
  144. this.onLoad(this.page, params);
  145. done();
  146. },
  147. refreshChange() {
  148. this.onLoad(this.page, this.search);
  149. },
  150. newAdd() {
  151. this.show = false;
  152. this.$store.commit("IN_PJCG_STATUS");
  153. },
  154. // 列表数据
  155. onLoad(page, params = {}) {
  156. let data = this.deepClone(Object.assign(params, this.search));
  157. this.loading = true;
  158. corpequipmentarchivesList(
  159. page.currentPage,
  160. page.pageSize,
  161. data
  162. ).then(res => {
  163. this.dataList = res.data.data.records ? res.data.data.records : [];
  164. this.dataList.forEach(item => {
  165. this.$set(item, "orderItemsList", []);
  166. this.$set(item, "loading", true);
  167. // 获取联系人名字
  168. getUser(item.updateUser).then(re=>{
  169. this.$set(item, "updateUserNM", re.data.data.name);
  170. })
  171. });
  172. this.page.total = res.data.data.total;
  173. this.$nextTick(() => {
  174. this.$refs.crud.doLayout();
  175. });
  176. }).finally(() => {
  177. this.loading = false;
  178. });
  179. },
  180. editOpen(row, status) {
  181. this.detailData = {
  182. id: row.id,
  183. status: status
  184. };
  185. this.show = false;
  186. this.$store.commit("IN_PJCG_STATUS");
  187. },
  188. currentChange(val) {
  189. this.page.currentPage = val;
  190. },
  191. sizeChange(val) {
  192. this.page.currentPage = 1;
  193. this.page.pageSize = val;
  194. },
  195. rowDel(row, index, done) {
  196. this.$confirm("确定删除数据?", {
  197. confirmButtonText: "确定",
  198. cancelButtonText: "取消",
  199. type: "warning"
  200. }).then(() => {
  201. corpequipmentarchivesRemove({ids:row.id}).then(res => {
  202. if (res.data.code == 200) {
  203. this.$message({
  204. type: "success",
  205. message: "删除成功!"
  206. });
  207. this.onLoad(this.page, this.search);
  208. }
  209. });
  210. });
  211. },
  212. async saveColumn() {
  213. const inSave = await this.saveColumnData(
  214. this.getColumnName(282),
  215. this.option
  216. );
  217. if (inSave) {
  218. this.$nextTick(() => {
  219. this.$refs.crud.doLayout();
  220. });
  221. this.$message.success("保存成功");
  222. //关闭窗口
  223. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  224. }
  225. },
  226. async resetColumn() {
  227. this.option = option;
  228. // const inSave = option
  229. const inSave = await this.delColumnData(this.getColumnName(282), option);
  230. if (inSave) {
  231. this.$nextTick(() => {
  232. this.$refs.crud.doLayout();
  233. });
  234. this.getAllWorkDicts()
  235. this.$message.success("重置成功");
  236. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  237. }
  238. },
  239. //返回列表
  240. goBack() {
  241. this.detailData = this.$options.data().detailData;
  242. this.show = true;
  243. this.onLoad(this.page, this.search);
  244. this.$store.commit("OUT_PJCG_STATUS");
  245. },
  246. }
  247. }
  248. </script>
  249. <style lang="scss" scoped>
  250. .page-crad ::v-deep .basic-container__card {
  251. height: 94.2vh;
  252. }
  253. .stat-td {
  254. text-align: center;
  255. position: relative;
  256. }
  257. .stat-img {
  258. width: 95%;
  259. height: 100px;
  260. }
  261. .stat-tip {
  262. position: absolute;
  263. left: 15px;
  264. top: 5px;
  265. .money {
  266. color: #fff;
  267. font-size: 28px;
  268. text-align: left;
  269. font-weight: 600;
  270. }
  271. .title {
  272. color: #fff;
  273. font-size: 14px;
  274. text-align: left;
  275. margin-top: 5px;
  276. margin-bottom: 0px;
  277. }
  278. }
  279. </style>