detailsPage.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button type="primary" size="small" :disabled="form.status>0" v-if="detailData.status == 1"
  11. class="el-button--small-yh " @click.stop="openEdit">编辑
  12. </el-button>
  13. <el-button type="primary" @click="editCustomer" :loading="subLoading" v-if="detailData.status != 1"
  14. size="small">保存数据
  15. </el-button>
  16. <el-dropdown style="padding: 0 6px;line-height: 0">
  17. <el-button type="primary" size="small" :loading="buttonLoading" :disabled="!form.id">
  18. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  19. </el-button>
  20. <el-dropdown-menu slot="dropdown">
  21. <el-dropdown-item :disabled="form.status>0" @click.native="auditCheck">审核数据</el-dropdown-item>
  22. <el-dropdown-item :disabled="form.status<1" @click.native="checkScheduleDialog = true">审核进度
  23. </el-dropdown-item>
  24. </el-dropdown-menu>
  25. </el-dropdown>
  26. </div>
  27. </div>
  28. <div class="customer-main">
  29. <trade-card title="基础信息">
  30. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  31. <template slot="purchaserId">
  32. <crop-select v-model="form.purchaserId" corpType="KH" :refresh="false" @getCorpData="getKHData"
  33. :disabled="detailData.status == 1"></crop-select>
  34. </template>
  35. <template slot="corpId">
  36. <crop-select v-model="form.corpId" corpType="GYS" :refresh="false" @getCorpData="getGYSData"
  37. :disabled="detailData.status == 1"></crop-select>
  38. </template>
  39. <template slot="storageId">
  40. <el-cascader v-model="form.storageId" :options="storagetreeList" :show-all-levels="false"
  41. :disabled="detailData.status == 1" :props="{ checkStrictly: true, emitPath: false, label: 'title' }"
  42. clearable @change="storagetreeChange">
  43. </el-cascader>
  44. </template>
  45. </avue-form>
  46. </trade-card>
  47. <trade-card title="出库明细">
  48. <avue-crud ref="crud" :data="itemsVOList" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
  49. @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
  50. <template slot="menuLeft">
  51. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="detailData.status == 1"
  52. @click.stop="addRow">录入明细
  53. </el-button>
  54. <el-button type="success" icon="el-icon-bottom" size="small" @click.stop="getTemplate">下载模板
  55. </el-button>
  56. <el-button type="info" icon="el-icon-top" size="small" :disabled="detailData.status == 1"
  57. @click.stop="addRow">导入
  58. </el-button>
  59. <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印</el-button>
  60. </template>
  61. <template slot="oneCode" slot-scope="{ row, index }">
  62. <el-popover placement="right" width="160" trigger="click">
  63. <el-image style="width: 160px; height: 80px" :src="row.oneCode" :fit="fit"></el-image>
  64. <el-button v-if="row.oneCode" type="text" slot="reference">查看</el-button>
  65. </el-popover>
  66. </template>
  67. <template slot="qrCode" slot-scope="{ row, index }">
  68. <el-popover placement="right" width="300" trigger="click">
  69. <el-image style="width: 300px; height: 300px" :src="row.qrCode" :fit="fit"></el-image>
  70. <el-button v-if="row.qrCode" type="text" slot="reference">查看</el-button>
  71. </el-popover>
  72. </template>
  73. <template slot="storageInQuantityForm" slot-scope="{ row,disabled }">
  74. <el-input-number size="small" v-model="row.storageInQuantity" @change="calculateChange(row)"
  75. :controls="false" style="width:100%" placeholder="请输入"></el-input-number>
  76. </template>
  77. <template slot="priceForm" slot-scope="{ row,disabled }">
  78. <el-input-number size="small" v-model="row.price" @change="calculateChange(row)" :controls="false"
  79. style="width:100%" placeholder="请输入"></el-input-number>
  80. </template>
  81. <template slot="menu" slot-scope="{ row, index }">
  82. <div style="display:flex;justify-content: center;">
  83. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  84. :disabled="disabled || detailData.status == 1">{{ row.$cellEdit ? "保存" : "编辑" }}</el-button>
  85. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  86. :disabled="detailData.status == 1">删除</el-button>
  87. <!-- <el-button size="small" icon="el-icon-printer" type="text" @click="rowPrint(row, index)" :disabled="!row.id">
  88. 打印</el-button> -->
  89. </div>
  90. </template>
  91. </avue-crud>
  92. </trade-card>
  93. <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="detailData.status == 1"
  94. feeUrl="/blade-purchase-sales/entranceOrder/removeOrderFees" :optionType="'CMY'" :itemType="'D'"
  95. :inCropId="true" :tabShow="2" @beforeFinance="beforeFinance" :delType="2" :billingShow="false" />
  96. <upload-file ref="uploadFile" title="合同附件" :disabled="detailData.status == 1" :orderFilesList="orderFilesList"
  97. delUrl="" />
  98. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  99. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  100. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  101. </check-schedule>
  102. </el-dialog>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import { detail, submit, checkWarehousing, getStoragetree, getStorage, getAllgoods, financingExcess } from "@/api/purchasingManagement/inStock";
  108. import tableOption from "./config/customerContact.json";
  109. import feeInfo from "@/components/fee-info/main";
  110. import checkSchedule from "../../../components/check/checkSchedule";
  111. import uploadFile from "@/components/upload-file/main";
  112. import { getToken } from "@/util/auth";
  113. import { contrastObj, contrastList } from "@/util/contrastData";
  114. export default {
  115. name: "detailsPageEdit",
  116. data() {
  117. return {
  118. form: {},
  119. checkScheduleDialog: false,
  120. tableOption: {},
  121. option: {
  122. disabled: false,
  123. menuBtn: false,
  124. labelWidth: 100,
  125. column: [
  126. {
  127. label: "货权人",
  128. prop: "purchaserId",
  129. rules: [
  130. {
  131. required: true,
  132. message: "",
  133. trigger: "blur"
  134. }
  135. ],
  136. span: 6
  137. },
  138. {
  139. label: "出库日期",
  140. prop: "stockTime",
  141. type: "datetime",
  142. format: "yyyy-MM-dd HH:mm:ss",
  143. valueFormat: "yyyy-MM-dd HH:mm:ss",
  144. rules: [
  145. {
  146. required: true,
  147. message: "",
  148. trigger: "blur"
  149. }
  150. ],
  151. span: 6
  152. },
  153. {
  154. label: "仓库",
  155. prop: "storageId",
  156. rules: [
  157. {
  158. required: true,
  159. message: "",
  160. trigger: "blur"
  161. }
  162. ],
  163. span: 6
  164. },
  165. {
  166. label: "提单号",
  167. prop: "billNo",
  168. span: 6
  169. },
  170. {
  171. label: "业务类型",
  172. prop: "businessType",
  173. type: "select",
  174. props: {
  175. label: "dictValue",
  176. value: "dictKey"
  177. },
  178. dicData: [],
  179. span: 6
  180. },
  181. {
  182. label: "车船号",
  183. prop: "vehicleShipNumber",
  184. span: 6
  185. },
  186. {
  187. label: "供应商",
  188. prop: "corpId",
  189. span: 6
  190. },
  191. {
  192. label: "出库单号",
  193. prop: "sysNo",
  194. disabled: true,
  195. span: 6
  196. },
  197. {
  198. label: "审核状态",
  199. prop: "status",
  200. type: "select",
  201. dataType: 'number',
  202. props: {
  203. label: "dictValue",
  204. value: "dictKey"
  205. },
  206. dicData: [],
  207. disabled: true,
  208. span: 6
  209. },
  210. {
  211. label: "备注",
  212. prop: "orderRemark",
  213. type: "textarea",
  214. minRows: 2,
  215. span: 18
  216. },
  217. ]
  218. },
  219. itemsVOList: [],
  220. orderFeesList: [],
  221. orderFilesList: [],
  222. subLoading: false,
  223. pageLoading: false,
  224. batchNo: '',
  225. storagetreeList: [],
  226. oldform: {},
  227. olditemsVOList: [],
  228. oldorderFeesList: [],
  229. oldorderFilesList: [],
  230. };
  231. },
  232. props: {
  233. detailData: {
  234. type: Object
  235. }
  236. },
  237. components: {
  238. feeInfo,
  239. checkSchedule,
  240. uploadFile
  241. },
  242. async created() {
  243. if (this.detailData.status == 1) {
  244. this.option.disabled = true;
  245. }
  246. if (this.detailData.id) {
  247. this.getDetail(this.detailData.id);
  248. }
  249. this.tableOption = await this.getColumnData(
  250. this.getColumnName(191),
  251. tableOption
  252. );
  253. getStoragetree().then(res => {
  254. this.storagetreeList = res.data.data;
  255. })
  256. this.getWorkDicts("approval_status").then(res => {
  257. this.findObject(this.option.column, "status").dicData =
  258. res.data.data;
  259. });
  260. this.getWorkDicts("CMY_business_type").then(res => {
  261. this.findObject(this.option.column, "businessType").dicData =
  262. res.data.data;
  263. });
  264. getAllgoods().then(res => {
  265. this.findObject(this.tableOption.column, "itemId").dicData =
  266. res.data.data;
  267. })
  268. this.getWorkDicts("unit").then(res => {
  269. this.findObject(this.tableOption.column, "unit").dicData =
  270. res.data.data;
  271. });
  272. if (this.$route.query.generateId) {
  273. this.getGenerate(this.$route.query.generateId);
  274. }
  275. },
  276. activated() {
  277. setTimeout(() => {
  278. if (this.$route.query.generateId) {
  279. this.getGenerate(this.$route.query.generateId);
  280. }
  281. }, 100);
  282. },
  283. methods: {
  284. cellStyle() {
  285. return "padding:0;height:40px;";
  286. },
  287. getStorage() {
  288. getStorage({ storageTypeId: this.form.storageId }).then(res => {
  289. this.findObject(this.tableOption.column, "storageId").dicData = res.data;
  290. })
  291. },
  292. storagetreeChange(row) {
  293. if (row) {
  294. if (this.itemsVOList.length > 0) {
  295. this.getStorage()
  296. this.itemsVOList.forEach(e => {
  297. e.storageId = null
  298. })
  299. this.$message.warning("请重新选择库区!")
  300. }
  301. } else {
  302. if (this.itemsVOList.length > 0) {
  303. this.findObject(this.tableOption.column, "storageId").dicData = []
  304. this.itemsVOList.forEach(e => {
  305. e.storageId = null
  306. })
  307. this.$message.warning("请重新选择库区!")
  308. }
  309. }
  310. },
  311. getKHData(row) {
  312. this.form.purchaser = row.cname
  313. },
  314. getGYSData(row) {
  315. this.form.corpName = row.cname
  316. },
  317. choceScheduleFun() {
  318. this.checkScheduleDialog = false
  319. },
  320. addRow() {
  321. this.$refs["form"].validate((valid, done) => {
  322. done();
  323. if (valid) {
  324. this.itemsVOList.push({ $cellEdit: true });
  325. this.getStorage()
  326. } else {
  327. return false;
  328. }
  329. });
  330. },
  331. rowCell(row, index) {
  332. this.$refs.crud.rowCell(row, index)
  333. },
  334. rowSave(form, done) {
  335. done()
  336. },
  337. addUpdate(form, index, done, loading) {
  338. done()
  339. },
  340. rowDel(row) {
  341. this.$confirm("确定删除数据?", {
  342. confirmButtonText: "确定",
  343. cancelButtonText: "取消",
  344. type: "warning"
  345. }).then(() => {
  346. this.$message({
  347. type: "success",
  348. message: "删除成功!"
  349. });
  350. this.itemsVOList.splice(row.$index, 1);
  351. });
  352. },
  353. getDetail(id) {
  354. this.pageLoading = true;
  355. detail(id)
  356. .then(res => {
  357. this.form = res.data.data;
  358. this.itemsVOList = res.data.data.itemsVOList;
  359. this.orderFeesList = res.data.data.orderFeesList;
  360. this.orderFilesList = res.data.data.orderFilesList;
  361. this.oldform = this.deepClone(res.data.data);
  362. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  363. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  364. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  365. this.getStorage()
  366. })
  367. .finally(() => {
  368. this.pageLoading = false;
  369. });
  370. },
  371. getGenerate(id) {
  372. this.pageLoading = true;
  373. detail(id)
  374. .then(res => {
  375. delete res.data.data.id
  376. delete res.data.data.createTime
  377. delete res.data.data.createUser
  378. delete res.data.data.createUserName
  379. delete res.data.data.sysNo
  380. delete res.data.data.status
  381. res.data.data.itemsVOList.forEach(e => {
  382. delete e.id
  383. })
  384. this.form = res.data.data;
  385. this.itemsVOList = res.data.data.itemsVOList.filter(e => e.isIssue == 'N');
  386. this.oldform = this.deepClone(res.data.data);
  387. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList.filter(e => e.isIssue == 'N'));
  388. this.getStorage()
  389. })
  390. .finally(() => {
  391. this.pageLoading = false;
  392. });
  393. },
  394. //修改提交触发
  395. editCustomer(status) {
  396. this.$refs["form"].validate((valid, done) => {
  397. done();
  398. if (valid) {
  399. let orderFeesList = this.$refs.feeInfo.submitData();
  400. this.subLoading = true;
  401. let data = {
  402. ...this.form,
  403. billType: 'CK',
  404. itemsVOList: this.itemsVOList,
  405. orderFeesList: orderFeesList,
  406. orderFilesList: this.orderFilesList
  407. };
  408. submit(data).then(res => {
  409. this.form = res.data.data;
  410. this.itemsVOList = res.data.data.itemsVOList;
  411. this.orderFeesList = res.data.data.orderFeesList;
  412. this.orderFilesList = res.data.data.orderFilesList;
  413. this.oldform = this.deepClone(res.data.data);
  414. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  415. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  416. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  417. this.$message({
  418. type: "success",
  419. message: "保存成功!"
  420. });
  421. if (status == "goBack") {
  422. this.$emit("goBack");
  423. }
  424. })
  425. .finally(() => {
  426. this.subLoading = false;
  427. });
  428. } else {
  429. return false;
  430. }
  431. });
  432. },
  433. //请核
  434. auditCheck() {
  435. financingExcess({ id: this.form.purchaserId }).then(res => {
  436. if (res.data.data == '操作成功') {
  437. this.$confirm("确定审核此订单?", {
  438. confirmButtonText: "确定",
  439. cancelButtonText: "取消",
  440. type: "warning"
  441. }).then(() => {
  442. this.buttonLoading = true
  443. const data = {
  444. id: this.form.id,
  445. checkType: 'CK',
  446. url: '/salesManagement/outStock/index',
  447. pageStatus: "this.$store.getters.entranceXsStatus",
  448. pageLabel: "出库管理",
  449. checkFlag: 2,
  450. }
  451. checkWarehousing(data).then(res => {
  452. if (res.data.success) {
  453. this.$message.success("操作成功!")
  454. this.viewDisabled = true
  455. this.approverDisabled = true
  456. }
  457. })
  458. }).finally(() => {
  459. this.buttonLoading = false
  460. })
  461. } else {
  462. this.$confirm("此订单余额不足,是否继续确认提交审核?", {
  463. confirmButtonText: "确定",
  464. cancelButtonText: "取消",
  465. type: "warning"
  466. }).then(() => {
  467. this.buttonLoading = true
  468. const data = {
  469. id: this.form.id,
  470. checkType: 'CK',
  471. url: '/salesManagement/outStock/index',
  472. pageStatus: "this.$store.getters.entranceXsStatus",
  473. pageLabel: "出库管理",
  474. checkFlag: 2,
  475. }
  476. checkWarehousing(data).then(res => {
  477. if (res.data.success) {
  478. this.$message.success("操作成功!")
  479. this.viewDisabled = true
  480. this.approverDisabled = true
  481. }
  482. })
  483. }).finally(() => {
  484. this.buttonLoading = false
  485. })
  486. }
  487. })
  488. },
  489. getTemplate() {
  490. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  491. },
  492. //返回列表
  493. backToList() {
  494. let orderFeesList = this.$refs.feeInfo.submitData();
  495. if (
  496. contrastObj(this.form, this.oldform) ||
  497. contrastList(this.itemsVOList, this.olditemsVOList) ||
  498. contrastList(orderFeesList, this.oldorderFeesList) ||
  499. contrastList(this.orderFilesList, this.oldorderFilesList)
  500. ) {
  501. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  502. confirmButtonText: "确定",
  503. cancelButtonText: "取消",
  504. type: "warning"
  505. })
  506. .then(() => {
  507. this.editCustomer("goBack");
  508. })
  509. .catch(() => {
  510. this.$emit("goBack");
  511. });
  512. } else {
  513. this.$emit("goBack");
  514. }
  515. },
  516. openEdit() {
  517. this.detailData.status = 2;
  518. this.option.disabled = false;
  519. this.$refs.crud.refreshTable();
  520. },
  521. calculateChange(row) {
  522. row.storageAmount = (row.storageInQuantity ? row.storageInQuantity : 0) * (row.price ? row.price : 0)
  523. },
  524. beforeFinance(feesData, callback) {
  525. let params = {}
  526. //暂时默认通过 之后优化
  527. params.valid = true
  528. params.parentId = this.form.id
  529. callback(params)
  530. },
  531. openReport() {
  532. this.$router.push(`/myiframe/urlPath?name=preview-木材库-出库单.ureport.xml&src=${this.website.reportUrl}/preview?_u=blade-木材库-出库单.ureport.xml&id=${this.form.id}`);
  533. },
  534. async saveColumn() {
  535. const inSave = await this.saveColumnData(
  536. this.getColumnName(191),
  537. this.tableOption
  538. );
  539. if (inSave) {
  540. this.$nextTick(() => {
  541. this.$refs.crud.doLayout();
  542. });
  543. this.$message.success("保存成功");
  544. //关闭窗口
  545. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  546. }
  547. },
  548. async resetColumn() {
  549. this.tableOption = tableOption;
  550. const inSave = await this.delColumnData(
  551. this.getColumnName(191),
  552. tableOption
  553. );
  554. if (inSave) {
  555. this.$nextTick(() => {
  556. this.$refs.crud.doLayout();
  557. });
  558. this.$message.success("重置成功");
  559. //关闭窗口
  560. setTimeout(() => {
  561. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  562. }, 1000);
  563. }
  564. }
  565. },
  566. watch: {
  567. }
  568. };
  569. </script>
  570. <style lang="scss" scoped>
  571. .trading-form ::v-deep .el-form-item {
  572. margin-bottom: 8px !important;
  573. }
  574. ::v-deep .el-form-item__error {
  575. display: none !important;
  576. }
  577. ::v-deep .select-component {
  578. display: flex !important;
  579. }
  580. </style>