index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. :table-loading="loading"
  12. :cell-style="cellStyle"
  13. @selection-change="selectionChange"
  14. @search-change="searchChange"
  15. @current-change="currentChange"
  16. @size-change="sizeChange"
  17. @refresh-change="refreshChange"
  18. @on-load="onLoad"
  19. @search-criteria-switch="searchCriteriaSwitch"
  20. @saveColumn="saveColumn"
  21. @resetColumn="resetColumn"
  22. >
  23. <template slot="menuLeft">
  24. <el-button
  25. type="primary"
  26. icon="el-icon-plus"
  27. size="small"
  28. @click.stop="newAdd()"
  29. >创建单据</el-button>
  30. <el-button
  31. type="success"
  32. size="small"
  33. icon="el-icon-plus"
  34. @click.stop="copyDoc()"
  35. :disabled="selection.length != 1"
  36. v-if="false"
  37. >复制单据</el-button>
  38. </template>
  39. <template slot-scope="scope" slot="menu">
  40. <el-button
  41. type="text"
  42. icon="el-icon-delete"
  43. size="small"
  44. @click.stop="rowDel(scope.row, scope.index)"
  45. :disabled="scope.row.status == 3 || scope.row.confirmStatus === 1"
  46. >删除
  47. </el-button>
  48. </template>
  49. <template slot="corpNameSearch">
  50. <crop-select
  51. v-model="search.corpId"
  52. corpType="KH"
  53. ></crop-select>
  54. </template>
  55. <template slot="serialNo" slot-scope="scope">
  56. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.serialNo }}</span>
  57. </template>
  58. <template slot="chargeStatus" slot-scope="scope">
  59. <span v-if="scope.row.chargeStatus === 0">否</span>
  60. <span v-else>是</span>
  61. </template>
  62. <template slot="confirmStatus" slot-scope="scope">
  63. <span v-if="scope.row.confirmStatus === 0">否</span>
  64. <span v-else>是</span>
  65. </template>
  66. <template slot="external" slot-scope="scope">
  67. <span v-if="scope.row.external === 0">否</span>
  68. <span v-else>是</span>
  69. </template>
  70. </avue-crud>
  71. </basic-container>
  72. <detail-page
  73. @goBack="goBack"
  74. @copyOrder="copyOrder"
  75. :detailData="detailData"
  76. v-if="!show"
  77. />
  78. </div>
  79. </template>
  80. <script>
  81. import option from "./config/mainList.json";
  82. import detailPage from "./detail";
  83. import { gainUser } from "@/api/basicData/customerInquiry";
  84. import {getList, deleteList} from "@/api/standAlone/handoverSheet";
  85. export default {
  86. name: "index",
  87. components: {
  88. detailPage,
  89. },
  90. data() {
  91. return {
  92. option: {},
  93. dataList: [],
  94. form: {},
  95. page: {
  96. pageSize: 10,
  97. currentPage: 1,
  98. total: 0,
  99. pageSizes: [10, 50, 100, 200, 300, 400, 500]
  100. },
  101. search: {},
  102. show: true,
  103. loading: false,
  104. selection: [],
  105. detailData: {},
  106. userOption: [],
  107. }
  108. },
  109. async created() {
  110. this.option = await this.getColumnData(this.getColumnName(103), option);
  111. gainUser().then(res => {
  112. this.userOption = res.data.data;
  113. })
  114. },
  115. activated() {
  116. if (this.$route.query.check) {
  117. this.show = true
  118. this.detailData = {
  119. id: this.$route.query.check.billId,
  120. check: this.$route.query.check,
  121. auditId: this.$route.query.check.id,
  122. };
  123. this.show = false;
  124. this.$store.commit("JJD_IN_DETAIL");
  125. }
  126. },
  127. methods: {
  128. searchCriteriaSwitch(type) {
  129. if (type){
  130. this.option.height = this.option.height - 90
  131. }else {
  132. this.option.height = this.option.height + 90
  133. }
  134. this.$refs.crud.getTableHeight()
  135. },
  136. newAdd() {
  137. this.show = false;
  138. this.$store.commit("JJD_IN_DETAIL");
  139. },
  140. onLoad(page, params) {
  141. // 重置掉展开
  142. this.dataList.forEach(item => {
  143. this.$refs.crud.toggleRowExpansion(item, false)
  144. })
  145. let queryParams = Object.assign({}, this.search, params, {
  146. size: page.pageSize,
  147. current: page.currentPage,
  148. })
  149. if (queryParams.handoverDate && queryParams.handoverDate.length > 0) {
  150. queryParams = {
  151. ...queryParams,
  152. beginHandoverDate: queryParams.handoverDate[0] + ' 00:00:00',
  153. endHandoverDate: queryParams.handoverDate[1] + ' 23:59:59',
  154. }
  155. }
  156. delete queryParams.handoverDate;
  157. this.loading = true;
  158. getList(queryParams).then(res => {
  159. this.dataList = res.data.data.records;
  160. this.page.total = res.data.data.total;
  161. this.option.height = window.innerHeight - 240;
  162. this.$nextTick(() => {
  163. this.$refs.crud.doLayout()
  164. })
  165. }).finally(() => {
  166. this.loading = false;
  167. })
  168. },
  169. async saveColumn() {
  170. const inSave = await this.saveColumnData(
  171. this.getColumnName(103),
  172. this.option
  173. );
  174. if (inSave) {
  175. this.$message.success("保存成功");
  176. //关闭窗口
  177. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  178. this.$nextTick(() => {
  179. this.$refs.crud.doLayout()
  180. })
  181. }
  182. },
  183. async resetColumn() {
  184. this.option = option;
  185. const inSave = await this.delColumnData(this.getColumnName(103), option);
  186. if (inSave) {
  187. this.$nextTick(() => {
  188. this.$refs.crud.doLayout()
  189. })
  190. this.$message.success("重置成功");
  191. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  192. }
  193. },
  194. //点击搜索按钮触发
  195. searchChange(params, done) {
  196. this.onLoad(this.page, params);
  197. done();
  198. },
  199. currentChange(val) {
  200. this.page.currentPage = val;
  201. },
  202. sizeChange(val) {
  203. this.page.currentPage = 1;
  204. this.page.pageSize = val;
  205. },
  206. refreshChange() {
  207. this.onLoad(this.page, this.search);
  208. },
  209. cellStyle() {
  210. return "padding:0;height:40px;";
  211. },
  212. copyDoc() {},
  213. selectionChange(list) {
  214. this.selection = list;
  215. },
  216. goBack() {
  217. if (this.$route.query.check) {
  218. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  219. this.$router.push({
  220. path: "/workManagement/handoverSheet/index"
  221. });
  222. }
  223. this.detailData = this.$options.data().detailData;
  224. this.show = true;
  225. this.onLoad(this.page, this.search);
  226. },
  227. copyOrder(id) {
  228. this.show = true;
  229. this.detailData = {
  230. id: id,
  231. status: "copy"
  232. };
  233. this.$nextTick(() => {
  234. this.show = false;
  235. this.$store.commit("JJD_IN_DETAIL");
  236. });
  237. },
  238. // 详情打开
  239. beforeOpenPage(row, index) {
  240. this.show = false;
  241. this.detailData = {
  242. id: row.id,
  243. query: true, // 表示只是查询
  244. };
  245. this.$store.commit("JJD_IN_DETAIL");
  246. },
  247. //删除列表后面的删除按钮触发触发(row, index, done)
  248. rowDel(row, index, done) {
  249. this.$confirm("确定删除数据?", {
  250. confirmButtonText: "确定",
  251. cancelButtonText: "取消",
  252. type: "warning"
  253. }).then(res => {
  254. return deleteList(row.id)
  255. }).then(() => {
  256. this.dataList.splice(row.$index, 1)
  257. this.$message({
  258. type: "success",
  259. message: "删除成功!"
  260. });
  261. this.page.currentPage = 1;
  262. this.onLoad(this.page)
  263. })
  264. },
  265. },
  266. }
  267. </script>
  268. <style scoped>
  269. </style>