index.vue 18 KB

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