detailsPage.vue 18 KB

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