index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <div>
  3. <basic-container v-show="isShow">
  4. <avue-crud :option="option"
  5. :data="dataList"
  6. ref="crud"
  7. v-model="form"
  8. :page.sync="page"
  9. :search.sync="search"
  10. :table-loading="loading"
  11. @row-del="rowDel"
  12. @row-update="rowUpdate"
  13. :before-open="beforeOpen"
  14. :before-close="beforeClose"
  15. @row-save="rowSave"
  16. @search-change="searchChange"
  17. @search-reset="searchReset"
  18. @selection-change="selectionChange"
  19. @current-change="currentChange"
  20. @size-change="sizeChange"
  21. @refresh-change="refreshChange"
  22. @on-load="onLoad"
  23. @tree-load="treeLoad"
  24. @saveColumn="saveColumn"
  25. @resetColumn="resetColumn"
  26. @search-criteria-switch="searchCriteriaSwitch"
  27. :cell-style="cellStyle">
  28. <template slot="menuLeft" slot-scope="{size}">
  29. <el-button type="success" :size="size" @click="copyOrder" :disabled="single">复制单据</el-button>
  30. <el-button type="info" :size="size" icon="el-icon-printer":loading="exportLoading"
  31. @click.stop="statement">报 表</el-button>
  32. </template>
  33. <template slot-scope="scope" slot="orgOrderNo">
  34. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orgOrderNo }}</span>
  35. </template>
  36. <template slot="corpIdSearch">
  37. <crop-select
  38. v-model="search.corpId"
  39. corpType="KH"
  40. ></crop-select>
  41. </template>
  42. <template slot="salesCompanySearch">
  43. <select-component
  44. v-model="search.salesCompany"
  45. :configuration="configuration"
  46. ></select-component>
  47. </template>
  48. <template slot-scope="scope" slot="corpId">
  49. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
  50. </template>
  51. <template slot-scope="scope" slot="salesCompany">
  52. {{ scope.row.salesCompanyName }}
  53. </template>
  54. <template slot="storageIdSearch">
  55. <warehouseSelect
  56. v-model="search.storageId"
  57. :configuration="configurationWarehouse"
  58. ></warehouseSelect>
  59. </template>
  60. <template slot-scope="scope" slot="storageId">
  61. {{ scope.row.storageName }}
  62. </template>
  63. <template slot-scope="scope" slot="createUser">
  64. {{ scope.row.createUserName }}
  65. </template>
  66. <template slot-scope="scope" slot="menu">
  67. <!-- <el-button-->
  68. <!-- type="text"-->
  69. <!-- icon="el-icon-edit"-->
  70. <!-- size="small"-->
  71. <!-- @click.stop="editOpen(scope.row,scope.index)"-->
  72. <!-- >编辑-->
  73. <!-- </el-button>-->
  74. <el-button
  75. type="text"
  76. icon="el-icon-delete"
  77. size="small"
  78. @click.stop="rowDel(scope.row,scope.index)"
  79. >删除
  80. </el-button>
  81. </template>
  82. </avue-crud>
  83. </basic-container>
  84. <detail-page
  85. ref="detail"
  86. @goBack="goBack"
  87. :detailData="detailData"
  88. v-if="!isShow"
  89. ></detail-page>
  90. <report-dialog
  91. :switchDialog="switchDialog"
  92. :searchValue="statementData"
  93. reportName="国内贸易-客户确认"
  94. @onClose="onClose()"
  95. ></report-dialog>
  96. </div>
  97. </template>
  98. <script>
  99. import option from "./configuration/mainList.json";
  100. import {customerList, typeSave, deleteDetails} from "@/api/basicData/deliveryNotice"
  101. import detailPage from "./detailsPageEdit";
  102. import { defaultDate } from "@/util/date";
  103. import reportDialog from "@/components/report-dialog/main";
  104. import { gainUser } from "@/api/basicData/customerInquiry";
  105. export default {
  106. name: "customerInformation",
  107. components: {
  108. detailPage,
  109. reportDialog
  110. },
  111. data() {
  112. return {
  113. configuration: {
  114. multipleChoices: false,
  115. multiple: false,
  116. collapseTags: false,
  117. placeholder: "请点击右边按钮选择",
  118. dicData: [],
  119. },
  120. configurationWarehouse: {
  121. multipleChoices: false,
  122. multiple: false,
  123. collapseTags: false,
  124. placeholder: "请点击右边按钮选择",
  125. dicData: [],
  126. },
  127. form: {},
  128. search: {},
  129. loading: false,
  130. option: {},
  131. parentId: 0,
  132. dataList: [],
  133. page: {
  134. pageSize: 10,
  135. currentPage: 1,
  136. total: 0,
  137. pageSizes: [10,50,100,200,300]
  138. },
  139. // 非单个禁用
  140. single: true,
  141. // 非多个禁用
  142. multiple: true,
  143. selection: [],
  144. isShow: true,
  145. detailData: {},
  146. switchDialog: false, // 报表弹窗
  147. exportLoading:false,
  148. statementData: {},
  149. }
  150. },
  151. async created() {
  152. this.search.businessDate = defaultDate(1)
  153. this.option = option
  154. // this.option = await this.getColumnData(this.getColumnName(20), option);
  155. gainUser().then(res => {
  156. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  157. })
  158. let i = 0;
  159. this.option.column.forEach(item => {
  160. if (item.search) i++
  161. })
  162. if (i % 3 !== 0){
  163. const num = 3 - Number(i % 3)
  164. this.option.searchMenuSpan = num * 8;
  165. this.option.searchMenuPosition = "right";
  166. }
  167. this.option.column.forEach(item => {
  168. if (item.pickerOptions) {
  169. item.pickerOptions = {
  170. shortcuts: [{
  171. text: '最近一周',
  172. onClick(picker) {
  173. const end = new Date();
  174. const start = new Date();
  175. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  176. picker.$emit('pick', [start, end]);
  177. }
  178. }, {
  179. text: '最近一个月',
  180. onClick(picker) {
  181. const end = new Date();
  182. const start = new Date();
  183. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  184. picker.$emit('pick', [start, end]);
  185. }
  186. }, {
  187. text: '最近三个月',
  188. onClick(picker) {
  189. const end = new Date();
  190. const start = new Date();
  191. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  192. picker.$emit('pick', [start, end]);
  193. }
  194. }]
  195. }
  196. }
  197. })
  198. },
  199. activated() {
  200. // this.isShow = true;
  201. setTimeout(() => {
  202. if (this.$route.query.form) {
  203. this.detailData = {
  204. form: this.$route.query.form,
  205. };
  206. this.$store.commit("IN_IN_DETAIL");
  207. this.isShow = false;
  208. }
  209. }, 100);
  210. },
  211. methods: {
  212. cellStyle() {
  213. return "padding:0;height:40px;";
  214. },
  215. searchCriteriaSwitch(type){
  216. if (type){
  217. this.option.height = this.option.height - 140
  218. }else {
  219. this.option.height = this.option.height + 140
  220. }
  221. this.$refs.crud.getTableHeight()
  222. },
  223. //删除列表后面的删除按钮触发触发(row, index, done)
  224. rowDel(row, index, done) {
  225. this.$confirm("确定将选择数据删除?", {
  226. confirmButtonText: "确定",
  227. cancelButtonText: "取消",
  228. type: "warning"
  229. }).then(() => {
  230. return deleteDetails(row.id);
  231. }).then(() => {
  232. this.$message({
  233. type: "success",
  234. message: "操作成功!"
  235. });
  236. this.page.currentPage = 1;
  237. this.onLoad(this.page, {parentId: 0});
  238. });
  239. },
  240. //修改时的修改按钮点击触发
  241. rowUpdate(row, index, done, loading) {
  242. typeSave(row).then(() => {
  243. this.$message({
  244. type: "success",
  245. message: "操作成功!"
  246. });
  247. // 数据回调进行刷新
  248. done(row);
  249. }, error => {
  250. window.console.log(error);
  251. loading();
  252. });
  253. },
  254. //新增修改时保存触发
  255. rowSave(row, done, loading) {
  256. typeSave(row).then(res => {
  257. done()
  258. })
  259. },
  260. //查询全部
  261. initData() {
  262. customerList().then(res => {
  263. const column = this.findObject(this.option.column, "parentId");
  264. column.dicData = res.data.data.records;
  265. });
  266. },
  267. //新增子项触发
  268. handleAdd(row) {
  269. this.parentId = row.id;
  270. const column = this.findObject(this.option.column, "parentId");
  271. column.value = row.id;
  272. column.addDisabled = true;
  273. this.$refs.crud.rowAdd();
  274. },
  275. //查看跳转页面
  276. beforeOpenPage(row, index) {
  277. const data = {
  278. moduleName: 'fh',
  279. tableName: 'business_delivery',
  280. billId: row.id,
  281. no: localStorage.getItem('browserID')
  282. }
  283. this.checkLock(data).then(res => {
  284. if (res.data.code == 200) {
  285. this.onLock(data).then(response => {
  286. })
  287. this.detailData = {
  288. seeDisabled: true,
  289. id: row.id,
  290. };
  291. this.isShow = false;
  292. this.$store.commit("IN_IN_DETAIL");
  293. }
  294. }).catch(err => {
  295. this.detailData = {
  296. id: row.id,
  297. seeDisabled: true,
  298. opDisabled: true
  299. };
  300. this.isShow = false;
  301. this.$store.commit("IN_IN_DETAIL");
  302. })
  303. },
  304. //新增跳转页面
  305. beforeOpen(row, index) {
  306. this.detailData = {
  307. id: row.id,
  308. };
  309. this.isShow = false;
  310. this.$store.commit("IN_IN_DETAIL");
  311. },
  312. editOpen(row, index) {
  313. this.detailData = {
  314. id: row.id,
  315. };
  316. this.isShow = false;
  317. this.$store.commit("IN_IN_DETAIL");
  318. },
  319. // 复制新单
  320. copyOrder() {
  321. const id = this.selection[0].id;
  322. this.detailData = {
  323. copyId: id,
  324. };
  325. this.isShow = false;
  326. this.$store.commit("IN_IN_DETAIL");
  327. },
  328. //点击新增时触发
  329. beforeClose(done) {
  330. this.parentId = "";
  331. const column = this.findObject(this.option.column, "parentId");
  332. column.value = "";
  333. column.addDisabled = false;
  334. done();
  335. },
  336. //点击搜索按钮触发
  337. searchChange(params, done) {
  338. if (params.businessDate) {
  339. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00"
  340. params.businessEndDate = params.businessDate[1]+ " " + "23:59:59"
  341. }
  342. if (params.createTime) {
  343. params.createTimeStart = params.createTime[0]+ " " + "00:00:00"
  344. params.createTimeEnd = params.createTime[1]+ " " + "23:59:59"
  345. this.$delete(params,'createTime')
  346. }
  347. this.page.currentPage = 1;
  348. this.onLoad(this.page, params);
  349. done()
  350. },
  351. searchReset() {
  352. // this.configuration.dicData = []
  353. },
  354. selectionChange(list) {
  355. this.selection = list;
  356. this.single = list.length !== 1;
  357. },
  358. currentChange(currentPage) {
  359. this.page.currentPage = currentPage;
  360. },
  361. sizeChange(pageSize) {
  362. this.page.pageSize = pageSize;
  363. },
  364. refreshChange() {
  365. this.page.currentPage = 1;
  366. this.onLoad(this.page,this.search);
  367. },
  368. onLoad(page, params) {
  369. if (this.search.businessDate.length > 0) {
  370. params = {
  371. ...params,
  372. businessStartDate: this.search.businessDate[0]+ " " + "00:00:00",
  373. businessEndDate: this.search.businessDate[1]+ " " + "23:59:59",
  374. }
  375. this.$delete(params,'businessDate')
  376. }
  377. let data = this.gobackSearch(params)
  378. let queryParams = Object.assign({}, data, {
  379. size: page.pageSize,
  380. current: page.currentPage,
  381. billType:"FH"
  382. })
  383. this.loading = true;
  384. customerList(queryParams).then(res => {
  385. this.dataList = res.data.data.records
  386. this.page.total = res.data.data.total
  387. this.option.height = window.innerHeight - 240;
  388. }).finally(() => {
  389. this.loading = false;
  390. })
  391. },
  392. //树桩列点击展开触发
  393. treeLoad(tree, treeNode, resolve) {
  394. const parentId = tree.id;
  395. customerList({parentId: parentId}).then(res => {
  396. resolve(res.data.data.records);
  397. });
  398. },
  399. goBack() {
  400. this.detailData=this.$options.data().detailData
  401. if (this.$route.query.form) {
  402. this.$router.$avueRouter.closeTag();
  403. this.$router.push({
  404. path: "/businessManagement/deliveryNotice/index"
  405. });
  406. }
  407. this.isShow = true;
  408. this.$store.commit("IN_OUT_DETAIL");
  409. this.onLoad(this.page, this.search)
  410. },
  411. gobackSearch(params) {
  412. params = Object.assign({}, this.search)
  413. if (params.businessDate && params.businessDate != '') {
  414. params.businessStartDate = params.businessDate[0]+ " " + "00:00:00"
  415. params.businessEndDate = params.businessDate[1]+ " " + "23:59:59"
  416. this.$delete(params,'businessDate')
  417. }
  418. if (params.createTime && params.createTime != '') {
  419. params.createTimeStart = params.createTime[0]+ " " + "00:00:00"
  420. params.createTimeEnd = params.createTime[1]+ " " + "23:59:59"
  421. this.$delete(params,'createTime')
  422. }
  423. return params
  424. },
  425. //列保存触发
  426. async saveColumn() {
  427. /**
  428. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  429. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  430. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  431. */
  432. const inSave = await this.saveColumnData(
  433. this.getColumnName(20),
  434. this.option
  435. );
  436. if (inSave) {
  437. this.$message.success("保存成功");
  438. //关闭窗口
  439. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  440. this.$nextTick(() => {
  441. this.$refs.crud.doLayout()
  442. })
  443. }
  444. },
  445. async resetColumn() {
  446. this.option = option;
  447. const inSave = await this.delColumnData(
  448. this.getColumnName(20),
  449. option
  450. );
  451. if (inSave) {
  452. this.$nextTick(() => {
  453. this.$refs.crud.doLayout()
  454. })
  455. this.$message.success("重置成功");
  456. //关闭窗口
  457. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  458. }
  459. },
  460. statement() {
  461. this.statementData = {...this.search}
  462. if (this.statementData.createTime && this.statementData.createTime != '') {
  463. this.statementData.createTimeStart = this.statementData.createTime[0]+ " " + "00:00:00"
  464. this.statementData.createTimeEnd = this.statementData.createTime[1]+ " " + "23:59:59"
  465. } else {
  466. this.statementData.createTimeStart = ""
  467. this.statementData.createTimeEnd = ""
  468. }
  469. if (this.statementData.businessDate && this.statementData.businessDate != '') {
  470. this.statementData.businessStartDate = this.statementData.businessDate[0]+ " " + "00:00:00"
  471. this.statementData.businessEndDate = this.statementData.businessDate[1]+ " " + "23:59:59"
  472. } else {
  473. this.statementData.businessStartDate = ""
  474. this.statementData.businessEndDate = ""
  475. }
  476. this.$delete(this.statementData,'createTime')
  477. this.$delete(this.statementData,'businessDate')
  478. this.switchDialog = !this.switchDialog;
  479. },
  480. onClose(val) {
  481. this.switchDialog = val;
  482. },
  483. }
  484. }
  485. </script>
  486. <style scoped>
  487. </style>