detailsPage.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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="info" @click="getData" size="small">刷新资料
  11. </el-button>
  12. <el-button type="primary" size="small" :disabled="form.status>0"
  13. class="el-button--small-yh " @click.stop="openEdit">编辑
  14. </el-button>
  15. <el-button type="primary" @click="editCustomer" :loading="subLoading" v-if="detailData.status != 3"
  16. size="small">保存数据
  17. </el-button>
  18. <el-dropdown style="padding: 0 6px;line-height: 0">
  19. <el-button type="primary" size="small" :loading="subLoading" :disabled="!form.id">
  20. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  21. </el-button>
  22. <el-dropdown-menu slot="dropdown">
  23. <el-dropdown-item :disabled="form.status>0" @click.native="auditCheck">提交审核</el-dropdown-item>
  24. <el-dropdown-item v-if="roleName=='admin'" :disabled="form.status!=5" @click.native="revokeCheck">撤销审核
  25. </el-dropdown-item>
  26. <el-dropdown-item :disabled="form.status<3" @click.native="checkScheduleDialog = true">审核进度
  27. </el-dropdown-item>
  28. <el-dropdown-item v-if="$route.query.check" :disabled="form.status<3" @click.native="check">审批数据
  29. </el-dropdown-item>
  30. </el-dropdown-menu>
  31. </el-dropdown>
  32. </div>
  33. </div>
  34. <div class="customer-main" v-loading="subLoading">
  35. <trade-card title="基础信息">
  36. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  37. <template slot="purchaserId">
  38. <crop-select v-model="form.purchaserId" corpType="KH" :refresh="false" @getCorpData="getKHData"
  39. :disabled="detailData.status == 1"></crop-select>
  40. </template>
  41. <template slot="corpId">
  42. <crop-select v-model="form.corpId" corpType="GYS" :refresh="false" @getCorpData="getGYSData"
  43. :disabled="detailData.status == 1"></crop-select>
  44. </template>
  45. <template slot="storageId">
  46. <el-cascader v-model="form.storageId" :options="storagetreeList" :show-all-levels="false" disabled
  47. :props="{ checkStrictly: true, emitPath: false, label: 'title' }" clearable @change="storagetreeChange">
  48. </el-cascader>
  49. </template>
  50. <template slot-scope="{column}" slot="storageIdLabel">
  51. <span style="color: #409EFF;cursor: pointer" @click.stop="addData('storage')">{{column.label}}</span>
  52. </template>
  53. </avue-form>
  54. </trade-card>
  55. <trade-card title="盘点明细">
  56. <avue-crud ref="crud" :data="itemsVOList" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
  57. @resetColumn="resetColumn" :cell-style="cellStyle">
  58. <template slot="menu" slot-scope="{ row, index }">
  59. <div style="display:flex;justify-content: center;">
  60. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  61. :disabled="disabled || detailData.status == 1">{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
  62. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  63. :disabled="detailData.status == 1">删除</el-button>
  64. </div>
  65. </template>
  66. <template slot="storageIdHeader" slot-scope="{column}">
  67. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{column.label}}</span>
  68. </template>
  69. <template slot="itemIdHeader" slot-scope="{column}">
  70. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{column.label}}</span>
  71. </template>
  72. <template slot="inventoryForm" slot-scope="{ row,disabled }">
  73. <el-input-number size="small" v-model="row.inventory" @change="calculateChange(row)" :controls="false"
  74. style="width:100%" placeholder="请输入"></el-input-number>
  75. </template>
  76. </avue-crud>
  77. </trade-card>
  78. <containerTitle title="上传附件"></containerTitle>
  79. <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
  80. :data="orderFilesList" display :enumerationValue="85.6" :disabled="detailData.status == 1"></c-upload>
  81. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  82. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  83. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  84. </check-schedule>
  85. </el-dialog>
  86. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  87. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  88. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  89. </check>
  90. </el-dialog>
  91. </div>
  92. </div>
  93. </template>
  94. <script>
  95. import { detail, submit, checkWarehousing, getStoragetree, getStorage, getAllgoods, revokeWarehousing, delItem } from "@/api/purchasingManagement/inStock";
  96. import tableOption from "./config/customerContact.json";
  97. import feeInfo from "@/components/fee-info/main";
  98. import checkSchedule from "../../../components/check/checkSchedule";
  99. import uploadFile from "@/components/upload-file/main";
  100. import { getCurrentDate } from "@/util/date";
  101. import { getToken } from "@/util/auth";
  102. import { number } from "echarts";
  103. import check from "@/components/check/check";
  104. export default {
  105. name: "detailsPageEdit",
  106. data() {
  107. return {
  108. checkData: {},
  109. checkDialog: false,
  110. form: {},
  111. checkScheduleDialog: false,
  112. tableOption: {},
  113. option: {
  114. disabled: false,
  115. menuBtn: false,
  116. labelWidth: 100,
  117. column: [
  118. {
  119. label: "盘点日期",
  120. prop: "stockTime",
  121. type: "datetime",
  122. format: "yyyy-MM-dd HH:mm",
  123. valueFormat: "yyyy-MM-dd HH:mm:ss",
  124. rules: [
  125. {
  126. required: true,
  127. message: "",
  128. trigger: "blur"
  129. }
  130. ],
  131. span: 6
  132. },
  133. {
  134. label: "盘点仓库",
  135. prop: "storageId",
  136. rules: [
  137. {
  138. required: true,
  139. message: "",
  140. trigger: "blur"
  141. }
  142. ],
  143. span: 6
  144. },
  145. {
  146. label: "盘点单号",
  147. prop: "sysNo",
  148. disabled: true,
  149. span: 6
  150. },
  151. {
  152. label: "审核状态",
  153. prop: "status",
  154. type: "select",
  155. dataType: 'number',
  156. props: {
  157. label: "dictValue",
  158. value: "dictKey"
  159. },
  160. dicData: [],
  161. disabled: true,
  162. span: 6
  163. },
  164. {
  165. label: "备注",
  166. prop: "orderRemark",
  167. type: "textarea",
  168. minRows: 2,
  169. span: 18
  170. },
  171. ]
  172. },
  173. itemsVOList: [],
  174. orderFilesList: [],
  175. subLoading: false,
  176. pageLoading: false,
  177. batchNo: '',
  178. storagetreeList: [],
  179. roleName: localStorage.getItem("roleName")
  180. };
  181. },
  182. props: {
  183. detailData: {
  184. type: Object
  185. }
  186. },
  187. components: {
  188. feeInfo,
  189. checkSchedule,
  190. uploadFile,
  191. check
  192. },
  193. async created() {
  194. if (this.detailData.status == 1) {
  195. this.option.disabled = true;
  196. }
  197. if (this.detailData.id) {
  198. this.getDetail(this.detailData.id);
  199. }
  200. if (this.detailData.generateId) {
  201. this.getGenerate(this.detailData.generateId);
  202. }
  203. this.tableOption = await this.getColumnData(
  204. this.getColumnName(197),
  205. tableOption
  206. );
  207. getStoragetree().then(res => {
  208. this.storagetreeList = res.data.data;
  209. })
  210. this.getWorkDicts("financing_status").then(res => {
  211. this.findObject(this.option.column, "status").dicData =
  212. res.data.data;
  213. });
  214. this.getWorkDicts("CMY_business_type").then(res => {
  215. this.findObject(this.option.column, "businessType").dicData =
  216. res.data.data;
  217. });
  218. this.getAllWorkDicts()
  219. },
  220. methods: {
  221. check() {
  222. this.checkData = this.$route.query.check
  223. this.checkDialog = true
  224. },
  225. //关闭审核
  226. choceCheckFun() {
  227. this.checkDialog = false;
  228. },
  229. getData() {
  230. getAllgoods().then(res => {
  231. this.findObject(this.tableOption.column, "itemId").dicData =
  232. res.data.data;
  233. })
  234. getStoragetree().then(res => {
  235. this.storagetreeList = res.data.data;
  236. })
  237. this.getStorage()
  238. },
  239. getAllWorkDicts() {
  240. getAllgoods().then(res => {
  241. this.findObject(this.tableOption.column, "itemId").dicData =
  242. res.data.data;
  243. })
  244. },
  245. cellStyle() {
  246. return "padding:0;height:40px;";
  247. },
  248. calculateChange(row) {
  249. row.balanceMoney = (Number(row.price?row.price:0) * Number(row.inventory?row.inventory:0)).toFixed(2)
  250. row.surplusLoss = (Number(row.inventory ? row.inventory : 0) - Number(row.storageInQuantity ? row.storageInQuantity : 0)).toFixed(2)
  251. },
  252. getStorage() {
  253. getStorage({ storageTypeId: this.form.storageId }).then(res => {
  254. this.findObject(this.tableOption.column, "storageId").dicData = res.data;
  255. })
  256. },
  257. storagetreeChange(row) {
  258. if (row) {
  259. if (this.itemsVOList.length > 0) {
  260. this.getStorage()
  261. this.itemsVOList.forEach(e => {
  262. e.storageId = null
  263. })
  264. this.$message.warning("请重新选择库区!")
  265. }
  266. } else {
  267. if (this.itemsVOList.length > 0) {
  268. this.findObject(this.tableOption.column, "storageId").dicData = []
  269. this.itemsVOList.forEach(e => {
  270. e.storageId = null
  271. })
  272. this.$message.warning("请重新选择库区!")
  273. }
  274. }
  275. },
  276. getKHData(row) {
  277. this.form.purchaser = row.cname
  278. },
  279. getGYSData(row) {
  280. this.form.corpName = row.cname
  281. },
  282. choceScheduleFun() {
  283. this.checkScheduleDialog = false
  284. },
  285. addRow() {
  286. this.$refs["form"].validate((valid, done) => {
  287. done();
  288. if (valid) {
  289. this.itemsVOList.push({ $cellEdit: true });
  290. this.getStorage()
  291. } else {
  292. return false;
  293. }
  294. });
  295. },
  296. rowCell(row, index) {
  297. if (row.$cellEdit == true) {
  298. this.$set(row, "$cellEdit", false);
  299. } else {
  300. this.$set(row, "$cellEdit", true);
  301. }
  302. },
  303. rowSave(row) {
  304. this.$set(row, "$cellEdit", false);
  305. },
  306. rowDel(row) {
  307. this.$confirm("确定删除数据?", {
  308. confirmButtonText: "确定",
  309. cancelButtonText: "取消",
  310. type: "warning"
  311. }).then(() => {
  312. if (row.id) {
  313. delItem({ itemId: row.id }).then(res => {
  314. this.$message({
  315. type: "success",
  316. message: "删除成功!"
  317. });
  318. this.itemsVOList.splice(row.$index, 1);
  319. });
  320. } else {
  321. this.$message({
  322. type: "success",
  323. message: "删除成功!"
  324. });
  325. this.itemsVOList.splice(row.$index, 1);
  326. }
  327. });
  328. },
  329. getDetail(id) {
  330. this.pageLoading = true;
  331. detail(id)
  332. .then(res => {
  333. this.form = res.data.data;
  334. this.itemsVOList = res.data.data.itemsVOList;
  335. this.orderFilesList = res.data.data.orderFilesList;
  336. this.getStorage()
  337. })
  338. .finally(() => {
  339. this.pageLoading = false;
  340. });
  341. },
  342. getGenerate(id) {
  343. this.pageLoading = true;
  344. detail(id)
  345. .then(res => {
  346. delete res.data.data.id
  347. delete res.data.data.stockTime
  348. delete res.data.data.createTime
  349. delete res.data.data.createUser
  350. delete res.data.data.createUserName
  351. delete res.data.data.sysNo
  352. delete res.data.data.status
  353. res.data.data.stockTime = getCurrentDate()
  354. res.data.data.itemsVOList.forEach(e => {
  355. e.surplusLoss = (Number(e.inventory ? e.inventory : 0) - Number(e.storageInQuantity ? e.storageInQuantity : 0)).toFixed(2)
  356. e.srcItemId = e.id
  357. delete e.id
  358. })
  359. this.form = res.data.data;
  360. this.itemsVOList = res.data.data.itemsVOList.filter(item => item.isIssue == 3);
  361. this.getStorage()
  362. })
  363. .finally(() => {
  364. this.pageLoading = false;
  365. });
  366. },
  367. //修改提交触发
  368. editCustomer(status) {
  369. this.$refs["form"].validate((valid, done) => {
  370. done();
  371. if (valid) {
  372. this.itemsVOList.forEach((e, index) => {
  373. e.sort = Number(index) + 1
  374. })
  375. this.subLoading = true;
  376. let data = {
  377. ...this.form,
  378. billType: 'PD',
  379. itemsVOList: this.itemsVOList,
  380. orderFilesList: this.orderFilesList
  381. };
  382. delete data.orderFeesList
  383. submit(data).then(res => {
  384. this.form = res.data.data;
  385. this.itemsVOList = res.data.data.itemsVOList;
  386. this.orderFilesList = res.data.data.orderFilesList;
  387. this.$message({
  388. type: "success",
  389. message: "保存成功!"
  390. });
  391. })
  392. .finally(() => {
  393. this.subLoading = false;
  394. });
  395. } else {
  396. return false;
  397. }
  398. });
  399. },
  400. //请核
  401. auditCheck() {
  402. this.$confirm("确定审核此订单?", {
  403. confirmButtonText: "确定",
  404. cancelButtonText: "取消",
  405. type: "warning"
  406. }).then(() => {
  407. this.subLoading = true
  408. const data = {
  409. id: this.form.id,
  410. checkType: 'PD',
  411. url: '/InventoryManagement/inventory/index',
  412. pageStatus: "this.$store.getters.entranceXsStatus",
  413. pageLabel: "库内盘点",
  414. checkFlag: 3,
  415. }
  416. checkWarehousing(data).then(res => {
  417. if (res.data.success) {
  418. this.$message.success("操作成功!")
  419. }
  420. }).finally(() => {
  421. this.subLoading = false
  422. this.getDetail(this.form.id)
  423. })
  424. })
  425. },
  426. revokeCheck() {
  427. this.$confirm("确定撤销审核此订单?", {
  428. confirmButtonText: "确定",
  429. cancelButtonText: "取消",
  430. type: "warning"
  431. }).then(() => {
  432. this.subLoading = true;
  433. let data = {
  434. ...this.form,
  435. billType: 'PD',
  436. itemsVOList: this.itemsVOList,
  437. orderFilesList: this.orderFilesList
  438. };
  439. revokeWarehousing(data).then(res => {
  440. if (res.data.success) {
  441. this.$message.success("操作成功!")
  442. }
  443. }).finally(() => {
  444. this.subLoading = false
  445. this.getDetail(this.form.id)
  446. })
  447. })
  448. },
  449. addData(row) {
  450. console.log(row)
  451. if (row == 'purchaserId') {
  452. this.$router.push(`/basicData/customerInformation/index`);
  453. } else if (row == 'corpId') {
  454. this.$router.push(`/basicData/customerManagement/supplierMaterial/index`);
  455. } else if (row == 'storage') {
  456. this.$router.push(`/basicData/basicStorageType/index`);
  457. } else if (row == 'storageId') {
  458. this.$router.push(`/basicData/basicStorageDesc/index`);
  459. } else if (row == 'itemId') {
  460. this.$router.push(`/basicData/commodityType/index`);
  461. }
  462. },
  463. getTemplate() {
  464. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  465. },
  466. //返回列表
  467. backToList() {
  468. this.$emit("goBack");
  469. },
  470. openEdit() {
  471. this.detailData.status = 2;
  472. this.option.disabled = false;
  473. this.$refs.crud.refreshTable();
  474. },
  475. async saveColumn() {
  476. const inSave = await this.saveColumnData(
  477. this.getColumnName(197),
  478. this.tableOption
  479. );
  480. if (inSave) {
  481. this.$nextTick(() => {
  482. this.$refs.crud.doLayout();
  483. });
  484. this.$message.success("保存成功");
  485. //关闭窗口
  486. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  487. }
  488. },
  489. async resetColumn() {
  490. this.tableOption = tableOption;
  491. const inSave = await this.delColumnData(
  492. this.getColumnName(197),
  493. tableOption
  494. );
  495. if (inSave) {
  496. this.$nextTick(() => {
  497. this.$refs.crud.doLayout();
  498. });
  499. this.getAllWorkDicts()
  500. this.getStorage()
  501. this.$message.success("重置成功");
  502. //关闭窗口
  503. setTimeout(() => {
  504. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  505. }, 1000);
  506. }
  507. }
  508. },
  509. watch: {
  510. }
  511. };
  512. </script>
  513. <style lang="scss" scoped>
  514. .trading-form ::v-deep .el-form-item {
  515. margin-bottom: 8px !important;
  516. }
  517. ::v-deep .el-form-item__error {
  518. display: none !important;
  519. }
  520. ::v-deep .select-component {
  521. display: flex !important;
  522. }
  523. ::v-deep .el-table .cell {
  524. padding: 0 2px !important;
  525. }
  526. ::v-deep .avue-crud .el-table .el-form-item__label {
  527. left: -1px;
  528. }
  529. </style>