index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <basic-container v-if="show">
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. @row-del="rowDel"
  10. @row-update="rowUpdate"
  11. :before-open="beforeOpen"
  12. :before-close="beforeClose"
  13. @row-save="rowSave"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @saveColumn="saveColumn"
  20. @refresh-change="refreshChange"
  21. @on-load="onLoad
  22. ">
  23. <template slot="corpIdSearch">
  24. <select-component
  25. v-model="search.corpId"
  26. :configuration="configuration"
  27. ></select-component>
  28. </template>
  29. <template slot="storageIdSearch">
  30. <warehouse-select
  31. v-model="search.storageId"
  32. :configuration="sConfiguration"
  33. ></warehouse-select>
  34. </template>
  35. <template slot="menuLeft">
  36. <el-button size="small"
  37. type="success"
  38. :disabled="true"
  39. @click.stop=""
  40. >复制新单
  41. </el-button>
  42. <el-button size="small"
  43. type="info"
  44. @click.stop=""
  45. >报表
  46. </el-button>
  47. </template>
  48. <template slot-scope="scope" slot="menu">
  49. <el-button
  50. type="text"
  51. icon="el-icon-edit"
  52. size="small"
  53. @click.stop="editOpen(scope.row,2)"
  54. >编辑
  55. </el-button>
  56. <el-button
  57. type="text"
  58. icon="el-icon-delete"
  59. size="small"
  60. @click.stop="rowDel(scope.row,scope.index)"
  61. >删除
  62. </el-button>
  63. </template>
  64. </avue-crud>
  65. </basic-container>
  66. <detail-page
  67. ref="detail"
  68. @goBack="goBack"
  69. :detailData="detailData"
  70. v-else
  71. ></detail-page>
  72. </template>
  73. <script>
  74. import option from "./config/mainList.json";
  75. import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
  76. import {selectInvoiceList,
  77. removeInvoiceList,} from "@/api/importTrade/invoice"
  78. import detailPage from "./detailsPageEdit.vue";
  79. export default {
  80. name: "customerInformation",
  81. data() {
  82. return {
  83. form: {},
  84. option: option,
  85. parentId: 0,
  86. show:true,
  87. detailData:{},
  88. dataList: [],
  89. page: {
  90. pageSize: 10,
  91. pagerCount: 5,
  92. total: 0,
  93. },
  94. search: {},
  95. configuration:{
  96. multipleChoices:false,
  97. multiple:false,
  98. disabled:false,
  99. searchShow:true,
  100. collapseTags:false,
  101. clearable:true,
  102. placeholder:'请点击右边按钮选择',
  103. dicData:[]
  104. },
  105. sConfiguration:{
  106. multipleChoices:false,
  107. multiple:false,
  108. disabled:false,
  109. searchShow:true,
  110. collapseTags:false,
  111. clearable:true,
  112. placeholder:'请点击右边按钮选择',
  113. dicData:[]
  114. }
  115. }
  116. },
  117. components:{
  118. detailPage
  119. },
  120. async created() {
  121. // this.option = await this.getColumnData(this.getColumnName(43), option);
  122. },
  123. mounted() {
  124. this.option.height = window.innerHeight - 310;
  125. },
  126. activated() {
  127. setTimeout(() => {
  128. if(this.$route.query.form){
  129. this.detailData={
  130. form:this.$route.query.form
  131. }
  132. this.show = false;
  133. this.$store.commit("GO_IN_DETAIL");
  134. }
  135. }, 100);
  136. },
  137. methods: {
  138. //删除列表后面的删除按钮触发触发(row, index, done)
  139. rowDel(row, index, done) {
  140. this.$confirm("确定将选择数据删除?", {
  141. confirmButtonText: "确定",
  142. cancelButtonText: "取消",
  143. type: "warning"
  144. }).then(() => {
  145. return removeInvoiceList(row.id);
  146. }).then(() => {
  147. this.$message({
  148. type: "success",
  149. message: "操作成功!"
  150. });
  151. this.page.currentPage = 1;
  152. this.onLoad(this.page);
  153. });
  154. },
  155. //修改时的修改按钮点击触发
  156. rowUpdate(row, index, done, loading) {
  157. typeSave(row).then(() => {
  158. this.$message({
  159. type: "success",
  160. message: "操作成功!"
  161. });
  162. // 数据回调进行刷新
  163. done(row);
  164. }, error => {
  165. window.console.log(error);
  166. loading();
  167. });
  168. },
  169. //新增修改时保存触发
  170. rowSave(row, done, loading) {
  171. typeSave(row).then(res => {
  172. console.log(res)
  173. done()
  174. })
  175. },
  176. //查询全部
  177. initData() {
  178. customerList().then(res => {
  179. console.log(this.form);
  180. const column = this.findObject(this.option.column, "parentId");
  181. column.dicData = res.data.data.records;
  182. });
  183. },
  184. //新增子项触发
  185. handleAdd(row) {
  186. this.parentId = row.id;
  187. const column = this.findObject(this.option.column, "parentId");
  188. column.value = row.id;
  189. column.addDisabled = true;
  190. this.$refs.crud.rowAdd();
  191. },
  192. //查看跳转页面
  193. beforeOpenPage(row, status) {
  194. this.detailData = {
  195. id: row.id,
  196. status: status
  197. };
  198. this.show = false;
  199. this.$store.commit("GO_IN_DETAIL");
  200. },
  201. //新增跳转页面
  202. beforeOpen(row) {
  203. this.detailData = {
  204. id: row.id,
  205. status: 0
  206. };
  207. this.show = false;
  208. },
  209. editOpen(row, status) {
  210. this.detailData = {
  211. id: row.id,
  212. status: status
  213. };
  214. this.show = false;
  215. this.$store.commit("GO_IN_DETAIL");
  216. },
  217. //点击新增时触发
  218. beforeClose(done) {
  219. this.parentId = "";
  220. const column = this.findObject(this.option.column, "parentId");
  221. column.value = "";
  222. column.addDisabled = false;
  223. done();
  224. },
  225. //点击搜索按钮触发
  226. searchChange(params, done) {
  227. this.page.currentPage = 1;
  228. this.onLoad(this.page, params);
  229. done()
  230. },
  231. searchReset() {
  232. console.log('1')
  233. },
  234. selectionChange() {
  235. console.log('1')
  236. },
  237. currentChange() {
  238. console.log('1')
  239. },
  240. sizeChange() {
  241. console.log('1')
  242. },
  243. refreshChange() {
  244. console.log('1')
  245. },
  246. onLoad(page, params) {
  247. if(params){
  248. if (params.businessDate != undefined) { //发货
  249. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00";
  250. params.businessEndDate = params.businessDate[1] + " " + "23:59:59";
  251. this.$delete(params,'businessDate')
  252. }
  253. if (params.createTime!= undefined) {
  254. params.createStartTime = params.createTime[0]+ " " + "00:00:00";
  255. params.createEndTime = params.createTime[1] + " " + "23:59:59";
  256. this.$delete(params,'createTime')
  257. }
  258. }
  259. let queryParams = Object.assign({}, params, {
  260. size: page.pageSize,
  261. current: page.currentPage,
  262. })
  263. selectInvoiceList(queryParams).then(res => {
  264. this.dataList = res.data.data.records
  265. this.page.total = res.data.data.total
  266. })
  267. },
  268. goBack() {
  269. this.detailData=this.$options.data().detailData
  270. this.show = true;
  271. },
  272. //列保存触发
  273. async saveColumn() {
  274. const inSave = await this.saveColumnData(
  275. this.getColumnName(43),
  276. this.option
  277. );
  278. if (inSave) {
  279. this.$message.success("保存成功");
  280. //关闭窗口
  281. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  282. }
  283. },
  284. }
  285. }
  286. </script>
  287. <style scoped>
  288. </style>