index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. <template slot-scope="scope" slot="orderNo">
  65. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
  66. </template>
  67. <template slot-scope="scope" slot="corpsName">
  68. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
  69. </template>
  70. </avue-crud>
  71. </basic-container>
  72. <detail-page
  73. ref="detail"
  74. @goBack="goBack"
  75. :detailData="detailData"
  76. v-else
  77. ></detail-page>
  78. </template>
  79. <script>
  80. import option from "./config/mainList.json";
  81. import {customerList, typeSave, deleteDetails} from "@/api/basicData/configuration"
  82. import {selectInvoiceList,
  83. removeInvoiceList,} from "@/api/importTrade/invoice"
  84. import detailPage from "./detailsPageEdit.vue";
  85. export default {
  86. name: "customerInformation",
  87. data() {
  88. return {
  89. form: {},
  90. option: option,
  91. parentId: 0,
  92. show:true,
  93. detailData:{},
  94. dataList: [],
  95. page: {
  96. pageSize: 10,
  97. pagerCount: 5,
  98. total: 0,
  99. },
  100. search: {},
  101. configuration:{
  102. multipleChoices:false,
  103. multiple:false,
  104. disabled:false,
  105. searchShow:true,
  106. collapseTags:false,
  107. clearable:true,
  108. placeholder:'请点击右边按钮选择',
  109. dicData:[]
  110. },
  111. sConfiguration:{
  112. multipleChoices:false,
  113. multiple:false,
  114. disabled:false,
  115. searchShow:true,
  116. collapseTags:false,
  117. clearable:true,
  118. placeholder:'请点击右边按钮选择',
  119. dicData:[]
  120. }
  121. }
  122. },
  123. components:{
  124. detailPage
  125. },
  126. async created() {
  127. // this.option = await this.getColumnData(this.getColumnName(43), option);
  128. },
  129. mounted() {
  130. // this.option.height = window.innerHeight - 200;
  131. },
  132. activated() {
  133. setTimeout(() => {
  134. if(this.$route.query.form){
  135. this.detailData={
  136. form:this.$route.query.form
  137. }
  138. this.show = false;
  139. this.$store.commit("GO_IN_DETAIL");
  140. }
  141. }, 100);
  142. },
  143. methods: {
  144. //删除列表后面的删除按钮触发触发(row, index, done)
  145. rowDel(row, index, done) {
  146. this.$confirm("确定将选择数据删除?", {
  147. confirmButtonText: "确定",
  148. cancelButtonText: "取消",
  149. type: "warning"
  150. }).then(() => {
  151. return removeInvoiceList(row.id);
  152. }).then(() => {
  153. this.$message({
  154. type: "success",
  155. message: "操作成功!"
  156. });
  157. this.page.currentPage = 1;
  158. this.onLoad(this.page);
  159. });
  160. },
  161. //修改时的修改按钮点击触发
  162. rowUpdate(row, index, done, loading) {
  163. typeSave(row).then(() => {
  164. this.$message({
  165. type: "success",
  166. message: "操作成功!"
  167. });
  168. // 数据回调进行刷新
  169. done(row);
  170. }, error => {
  171. window.console.log(error);
  172. loading();
  173. });
  174. },
  175. //新增修改时保存触发
  176. rowSave(row, done, loading) {
  177. typeSave(row).then(res => {
  178. console.log(res)
  179. done()
  180. })
  181. },
  182. //查询全部
  183. initData() {
  184. customerList().then(res => {
  185. console.log(this.form);
  186. const column = this.findObject(this.option.column, "parentId");
  187. column.dicData = res.data.data.records;
  188. });
  189. },
  190. //新增子项触发
  191. handleAdd(row) {
  192. this.parentId = row.id;
  193. const column = this.findObject(this.option.column, "parentId");
  194. column.value = row.id;
  195. column.addDisabled = true;
  196. this.$refs.crud.rowAdd();
  197. },
  198. //查看跳转页面
  199. beforeOpenPage(row, status) {
  200. this.detailData = {
  201. id: row.id,
  202. view:true,
  203. status: status
  204. };
  205. this.show = false;
  206. this.$store.commit("GO_IN_DETAIL");
  207. },
  208. //新增跳转页面
  209. beforeOpen(row) {
  210. this.detailData = {
  211. id: row.id,
  212. status: 0
  213. };
  214. this.show = false;
  215. },
  216. editOpen(row, status) {
  217. this.detailData = {
  218. id: row.id,
  219. status: status
  220. };
  221. this.show = false;
  222. this.$store.commit("GO_IN_DETAIL");
  223. },
  224. //点击新增时触发
  225. beforeClose(done) {
  226. this.parentId = "";
  227. const column = this.findObject(this.option.column, "parentId");
  228. column.value = "";
  229. column.addDisabled = false;
  230. done();
  231. },
  232. //点击搜索按钮触发
  233. searchChange(params, done) {
  234. this.page.currentPage = 1;
  235. this.onLoad(this.page, params);
  236. done()
  237. },
  238. searchReset() {
  239. console.log('1')
  240. },
  241. selectionChange() {
  242. console.log('1')
  243. },
  244. currentChange() {
  245. console.log('1')
  246. },
  247. sizeChange() {
  248. console.log('1')
  249. },
  250. refreshChange() {
  251. console.log('1')
  252. },
  253. onLoad(page, params) {
  254. if(params){
  255. if (params.businessDate != undefined) { //发货
  256. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00";
  257. params.businessEndDate = params.businessDate[1] + " " + "23:59:59";
  258. this.$delete(params,'businessDate')
  259. }
  260. if (params.createTime!= undefined) {
  261. params.createStartTime = params.createTime[0]+ " " + "00:00:00";
  262. params.createEndTime = params.createTime[1] + " " + "23:59:59";
  263. this.$delete(params,'createTime')
  264. }
  265. }
  266. let queryParams = Object.assign({}, params, {
  267. size: page.pageSize,
  268. current: page.currentPage,
  269. })
  270. selectInvoiceList(queryParams).then(res => {
  271. this.dataList = res.data.data.records
  272. this.page.total = res.data.data.total
  273. })
  274. },
  275. goBack() {
  276. this.detailData=this.$options.data().detailData
  277. this.show = true;
  278. },
  279. //列保存触发
  280. async saveColumn() {
  281. const inSave = await this.saveColumnData(
  282. this.getColumnName(43),
  283. this.option
  284. );
  285. if (inSave) {
  286. this.$message.success("保存成功");
  287. //关闭窗口
  288. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  289. }
  290. },
  291. }
  292. }
  293. </script>
  294. <style scoped>
  295. </style>