detailsPage.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  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="form.status < 1"
  11. class="el-button--small-yh " @click.stop="openEdit">编辑
  12. </el-button>
  13. <el-button type="info" @click="getData" size="small">刷新资料
  14. </el-button>
  15. <el-button type="primary" size="small" v-if="form.status == 0"
  16. class="el-button--small-yh " @click.stop="withdraw(0)">提交
  17. </el-button>
  18. <el-button type="primary" size="small" v-if="form.status == 1"
  19. class="el-button--small-yh " @click.stop="withdraw(1)">撤销
  20. </el-button>
  21. <el-button type="primary" @click="editCustomer" :loading="subLoading"
  22. size="small">保存数据
  23. </el-button>
  24. <el-dropdown style="padding: 0 6px;line-height: 0">
  25. <el-button type="primary" size="small" :loading="subLoading" :disabled="!form.id">
  26. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  27. </el-button>
  28. <el-dropdown-menu slot="dropdown">
  29. <el-dropdown-item :disabled="form.status != 2" @click.native="auditCheck">提交审核</el-dropdown-item>
  30. <el-dropdown-item v-if="roleName=='admin'" :disabled="form.status != 5" @click.native="revokeCheck">
  31. 撤销审核
  32. </el-dropdown-item>
  33. <el-dropdown-item :disabled="form.status < 3" @click.native="checkScheduleDialog = true">审核进度
  34. </el-dropdown-item>
  35. <el-dropdown-item v-if="$route.query.check" :disabled="!(form.status > 2 && form.status < 5)"
  36. @click.native="check">审批数据
  37. </el-dropdown-item>
  38. </el-dropdown-menu>
  39. </el-dropdown>
  40. </div>
  41. </div>
  42. <div class="customer-main" v-loading="subLoading">
  43. <trade-card title="基础信息">
  44. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  45. <template slot="purchaserId">
  46. <crop-select ref="purchaser" v-model="form.purchaserId" corpType="KH" :refresh="false"
  47. @getCorpData="getKHData" :disabled="detailData.status == 1"></crop-select>
  48. </template>
  49. <template slot="corpId">
  50. <crop-select ref="corpId" v-model="form.corpId" corpType="GYS" :refresh="false" @getCorpData="getGYSData"
  51. :disabled="detailData.status == 1"></crop-select>
  52. </template>
  53. <template slot="storageId">
  54. <el-cascader v-model="form.storageId" :options="storagetreeList" :show-all-levels="false"
  55. :disabled="detailData.status == 1"
  56. :props="{ checkStrictly: true, emitPath: false, label: 'title' }"
  57. clearable @change="storagetreeChange">
  58. </el-cascader>
  59. </template>
  60. <template slot-scope="{column}" slot="purchaserIdLabel">
  61. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  62. </template>
  63. <template slot-scope="{column}" slot="corpIdLabel">
  64. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  65. </template>
  66. <template slot-scope="{column}" slot="storageIdLabel">
  67. <span style="color: #409EFF;cursor: pointer" @click.stop="addData('storage')">{{ column.label }}</span>
  68. </template>
  69. </avue-form>
  70. </trade-card>
  71. <trade-card title="入库明细">
  72. <avue-crud ref="crud" :data="itemsVOList" :option="tableOption" @row-del="rowDel" @saveColumn="saveColumn"
  73. @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
  74. <template slot="menuLeft">
  75. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="detailData.status == 1"
  76. @click.stop="addRow">录入明细
  77. </el-button>
  78. <!-- <el-button type="success" icon="el-icon-bottom" size="small" @click.stop="getTemplate">下载模板</el-button>-->
  79. <el-button type="info" icon="el-icon-top" size="small" :disabled="detailData.status == 1&&form.id"
  80. @click.stop="excelBox = true">导入
  81. </el-button>
  82. <!-- <el-button-->
  83. <!-- type="success"-->
  84. <!-- icon="el-icon-printer"-->
  85. <!-- size="small"-->
  86. <!-- @click.stop="dialogVisible = true">打印-->
  87. <!-- </el-button>-->
  88. </template>
  89. <template slot="headerSerial">
  90. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  91. :disabled="detailData.status == 1" circle></el-button>
  92. </template>
  93. <template slot="storageIdHeader" slot-scope="{column}">
  94. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  95. </template>
  96. <template slot="itemIdHeader" slot-scope="{column}">
  97. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  98. </template>
  99. <template slot="oneCode" slot-scope="{ row, index }">
  100. <el-popover placement="right" width="160" trigger="click">
  101. <el-image style="width: 160px; height: 80px" :src="row.oneCode" :fit="fit"></el-image>
  102. <el-button v-if="row.oneCode" type="text" slot="reference">查看</el-button>
  103. </el-popover>
  104. </template>
  105. <template slot="qrCode" slot-scope="{ row, index }">
  106. <el-popover placement="right" width="300" trigger="click">
  107. <el-image style="width: 300px; height: 300px" :src="row.qrCode" :fit="fit"></el-image>
  108. <el-button v-if="row.qrCode" type="text" slot="reference">查看</el-button>
  109. </el-popover>
  110. </template>
  111. <template slot="storageInQuantityForm" slot-scope="{ row }">
  112. <el-input-number size="small" v-model="row.storageInQuantity" @change="calculateChange(row)"
  113. :controls="false" style="width:100%" placeholder="请输入"></el-input-number>
  114. </template>
  115. <template slot="priceForm" slot-scope="{ row }">
  116. <el-input-number size="small" v-model="row.price" @change="calculateChange(row)" :controls="false"
  117. style="width:100%" placeholder="请输入"></el-input-number>
  118. </template>
  119. <template slot="menu" slot-scope="{ row, index }">
  120. <div style="display:flex;justify-content: center;">
  121. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  122. :disabled="disabled || detailData.status == 1">{{ row.$cellEdit ? "保存" : "编辑" }}
  123. </el-button>
  124. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  125. :disabled="detailData.status == 1">删除
  126. </el-button>
  127. <el-button size="small" icon="el-icon-printer" type="text" @click="rowPrint(row, index)"
  128. :disabled="!row.id">
  129. 打印
  130. </el-button>
  131. <div style="display:flex;flex-direction: column;justify-content: center;margin-left: 10px;">
  132. <el-tooltip effect="dark" content="向上移动" placement="top">
  133. <i v-if="index != 0&&detailData.status != 1" :disabled="disabled || detailData.status == 1"
  134. class="el-icon-arrow-up" @click="moveUp(row, index)" style="color:#409EFF;"></i>
  135. </el-tooltip>
  136. <el-tooltip effect="dark" content="向下移动" placement="bottom"><i
  137. v-if="index != (itemsVOList.length - 1)&&detailData.status != 1" class="el-icon-arrow-down"
  138. @click="moveDown(row, index)" style="color:#409EFF;"></i></el-tooltip>
  139. </div>
  140. </div>
  141. </template>
  142. </avue-crud>
  143. </trade-card>
  144. <fee-info ref="feeInfo" :orderFeesList="orderFeesList" typeName="wood" :corpId="form.purchaserId" :disabled="!(form.status < 3)"
  145. feeUrl="/blade-purchase-sales/entranceOrder/removeOrderFees" :optionType="'CMY'" :itemType="'C'"
  146. :inCropId="true" @beforeFinance="beforeFinance" :delType="2" :billingShow="false" />
  147. <!-- <upload-file ref="uploadFile" title="合同附件" :disabled="detailData.status == 1" :orderFilesList="orderFilesList"
  148. delUrl="" /> -->
  149. <containerTitle title="上传附件"></containerTitle>
  150. <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
  151. :data="orderFilesList" display :enumerationValue="85.6" :disabled="!(form.status < 3)"></c-upload>
  152. <el-dialog append-to-body title="审核进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  153. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  154. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  155. </check-schedule>
  156. </el-dialog>
  157. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  158. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  159. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  160. </check>
  161. </el-dialog>
  162. </div>
  163. <el-dialog title="导入" append-to-body :close-on-click-modal="false" :visible.sync="excelBox" width="555px">
  164. <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter" :upload-error="uploadError">
  165. <template slot="excelTemplate">
  166. <el-button type="primary" @click="getTemplate">
  167. 点击下载<i class="el-icon-download el-icon--right"></i>
  168. </el-button>
  169. </template>
  170. </avue-form>
  171. <p style="text-align: center;color: #DC0505">
  172. 温馨提示 第一次导入时请先下载模板
  173. </p>
  174. </el-dialog>
  175. <el-dialog
  176. title="打印"
  177. :visible.sync="dialogVisible"
  178. fullscreen
  179. append-to-body
  180. width="70%">
  181. <div id="printAll">
  182. <div v-for="item in 1000">测试</div>
  183. </div>
  184. <span slot="footer" class="dialog-footer">
  185. <el-button @click="dialogVisible = false">取 消</el-button>
  186. <el-button type="primary">打 印</el-button>
  187. </span>
  188. </el-dialog>
  189. </div>
  190. </template>
  191. <script>
  192. import {
  193. detail,
  194. submit,
  195. checkWarehousing,
  196. getStoragetree,
  197. getStorage,
  198. getAllgoods,
  199. delItem,
  200. revokeWarehousing,
  201. withdraw
  202. } from "@/api/purchasingManagement/inStock";
  203. import tableOption from "./config/customerContact.json";
  204. import feeInfo from "@/components/fee-info/main";
  205. import checkSchedule from "../../../components/check/checkSchedule";
  206. import uploadFile from "@/components/upload-file/main";
  207. import {getToken} from "@/util/auth";
  208. import {contrastObj, contrastList, contrastList2} from "@/util/contrastData";
  209. import {validatenull} from '@/util/validate'
  210. import check from "@/components/check/check";
  211. import {dateFormat} from "@/util/date";
  212. export default {
  213. name: "detailsPageEdit",
  214. data() {
  215. return {
  216. checkData: {},
  217. checkDialog: false,
  218. dialogVisible: false,
  219. subLoading: false,
  220. form: {},
  221. excelBox: false,
  222. excelOption: {
  223. submitBtn: false,
  224. emptyBtn: false,
  225. column: [
  226. {
  227. label: '模板下载',
  228. prop: 'excelTemplate',
  229. formslot: true,
  230. span: 24,
  231. }, {
  232. label: '模板上传',
  233. prop: 'excelFile',
  234. type: 'upload',
  235. drag: true,
  236. loadText: '模板上传中,请稍等',
  237. span: 24,
  238. propsHttp: {
  239. res: 'data'
  240. },
  241. tip: '请上传 .xls,.xlsx 标准格式文件',
  242. action: "/api/trade-purchase/woodHarvestingCloud/import"
  243. }
  244. ]
  245. },
  246. excelForm: {},
  247. checkScheduleDialog: false,
  248. tableOption: {},
  249. option: {
  250. disabled: false,
  251. menuBtn: false,
  252. labelWidth: 100,
  253. column: [
  254. {
  255. label: "货权人",
  256. prop: "purchaserId",
  257. rules: [
  258. {
  259. required: true,
  260. message: "",
  261. trigger: "blur"
  262. }
  263. ],
  264. span: 6
  265. },
  266. {
  267. label: "入库日期",
  268. prop: "stockTime",
  269. type: "datetime",
  270. value: dateFormat(new Date(),'yyyy-MM-dd hh:mm:ss'),
  271. format: "yyyy-MM-dd HH:mm",
  272. valueFormat: "yyyy-MM-dd HH:mm:ss",
  273. rules: [
  274. {
  275. required: true,
  276. message: "",
  277. trigger: "blur"
  278. }
  279. ],
  280. span: 6
  281. },
  282. {
  283. label: "箱号",
  284. prop: "caseNo",
  285. span: 6,
  286. blur: (data) => {
  287. for (let item of this.itemsVOList){
  288. item.containerNo = data.value
  289. }
  290. }
  291. },
  292. {
  293. label: "提单号",
  294. prop: "billNo",
  295. rules: [{
  296. required: true,
  297. message: "",
  298. trigger: "blur"
  299. }],
  300. span: 6
  301. },
  302. {
  303. label: "仓库",
  304. prop: "storageId",
  305. rules: [{
  306. required: true,
  307. message: "",
  308. trigger: "blur"
  309. }],
  310. span: 6
  311. },
  312. {
  313. label: "业务类型",
  314. prop: "businessType",
  315. type: "select",
  316. props: {
  317. label: "dictValue",
  318. value: "dictKey"
  319. },
  320. dicData: [],
  321. span: 6
  322. },
  323. {
  324. label: "车船号",
  325. prop: "vehicleShipNumber",
  326. rules: [{
  327. required: false,
  328. message: "",
  329. trigger: "blur"
  330. }],
  331. span: 6
  332. },
  333. {
  334. label: "审核状态",
  335. prop: "status",
  336. type: "select",
  337. dataType: 'number',
  338. props: {
  339. label: "dictValue",
  340. value: "dictKey"
  341. },
  342. dicData: [],
  343. disabled: true,
  344. span: 6
  345. },
  346. {
  347. label: "供应商",
  348. prop: "corpId",
  349. span: 6
  350. },
  351. {
  352. label: "入库单号",
  353. prop: "sysNo",
  354. disabled: true,
  355. span: 6
  356. },
  357. {
  358. label: "库管员",
  359. prop: "stockUser",
  360. span: 6,
  361. dataType: "number",
  362. type: 'select',
  363. dicUrl: "/api/blade-user/MCSelectList",
  364. props: {
  365. label: "realName",
  366. value: "id"
  367. }
  368. },
  369. {
  370. label: "是否融资",
  371. prop: "arrival",
  372. type: "select",
  373. dataType: 'number',
  374. value: 0,
  375. dicData: [
  376. {
  377. label: "是",
  378. value: 1
  379. }, {
  380. label: "否",
  381. value: 0
  382. }
  383. ],
  384. change: (data) => {
  385. if (data.value == 0) {
  386. this.findObject(this.tableOption.column, "price").label = "入库单价"
  387. this.findObject(this.tableOption.column, "price").rules[0].required = false
  388. } else {
  389. this.findObject(this.tableOption.column, "price").label = "*入库单价"
  390. this.findObject(this.tableOption.column, "price").rules[0].required = true
  391. }
  392. },
  393. span: 6
  394. }, {
  395. label: "备注",
  396. prop: "orderRemark",
  397. type: "textarea",
  398. minRows: 1,
  399. span: 24
  400. },
  401. ]
  402. },
  403. itemsVOList: [],
  404. orderFeesList: [],
  405. orderFilesList: [],
  406. pageLoading: false,
  407. batchNo: '',
  408. storagetreeList: [],
  409. oldform: {},
  410. olditemsVOList: [],
  411. oldorderFeesList: [],
  412. oldorderFilesList: [],
  413. roleName: localStorage.getItem("roleName")
  414. };
  415. },
  416. props: {
  417. detailData: {
  418. type: Object
  419. }
  420. },
  421. components: {
  422. feeInfo,
  423. checkSchedule,
  424. uploadFile,
  425. check
  426. },
  427. async created() {
  428. if (this.detailData.status == 1) {
  429. this.option.disabled = true;
  430. }
  431. if (this.detailData.id) {
  432. this.getDetail(this.detailData.id);
  433. }
  434. this.tableOption = await this.getColumnData(
  435. this.getColumnName(189),
  436. tableOption
  437. );
  438. getStoragetree().then(res => {
  439. this.storagetreeList = res.data.data;
  440. })
  441. this.getWorkDicts("financing_status").then(res => {
  442. this.findObject(this.option.column, "status").dicData =
  443. res.data.data;
  444. });
  445. this.getWorkDicts("CMY_business_type").then(res => {
  446. this.findObject(this.option.column, "businessType").dicData =
  447. res.data.data;
  448. });
  449. this.getAllWorkDicts()
  450. },
  451. methods: {
  452. check() {
  453. this.checkData = this.$route.query.check
  454. this.checkDialog = true
  455. },
  456. //关闭审核
  457. choceCheckFun() {
  458. this.checkDialog = false;
  459. },
  460. getData() {
  461. getAllgoods().then(res => {
  462. this.findObject(this.tableOption.column, "itemId").dicData =
  463. res.data.data;
  464. })
  465. getStoragetree().then(res => {
  466. this.storagetreeList = res.data.data;
  467. })
  468. this.getStorage()
  469. this.$refs.purchaser.refreshData()
  470. this.$refs.corpId.refreshData()
  471. },
  472. getAllWorkDicts() {
  473. getAllgoods().then(res => {
  474. this.findObject(this.tableOption.column, "itemId").dicData = res.data.data;
  475. })
  476. this.findObject(this.tableOption.column, "itemId").change = (data)=>{
  477. for (let item of this.findObject(this.tableOption.column, "itemId").dicData){
  478. if (data.value == item.id){
  479. this.itemsVOList[data.index].cname = item.cname
  480. }
  481. }
  482. }
  483. this.getWorkDicts("unit").then(res => {
  484. this.findObject(this.tableOption.column, "unit").dicData =
  485. res.data.data;
  486. });
  487. this.getWorkDicts("goods_grade").then(res => {
  488. this.findObject(this.tableOption.column, "grade").dicData =
  489. res.data.data;
  490. });
  491. },
  492. cellStyle() {
  493. return "padding:0;height:40px;";
  494. },
  495. getStorage() {
  496. getStorage({storageTypeId: this.form.storageId}).then(res => {
  497. this.findObject(this.tableOption.column, "storageId").dicData = res.data;
  498. })
  499. },
  500. storagetreeChange(row) {
  501. if (row) {
  502. if (this.itemsVOList.length > 0) {
  503. this.getStorage()
  504. this.itemsVOList.forEach(e => {
  505. e.storageId = null
  506. })
  507. this.$message.warning("请重新选择库区!")
  508. }
  509. } else {
  510. if (this.itemsVOList.length > 0) {
  511. this.findObject(this.tableOption.column, "storageId").dicData = []
  512. this.itemsVOList.forEach(e => {
  513. e.storageId = null
  514. })
  515. this.$message.warning("请重新选择库区!")
  516. }
  517. }
  518. },
  519. getKHData(row) {
  520. this.form.purchaser = row.cname
  521. },
  522. getGYSData(row) {
  523. console.log(row)
  524. this.form.corpName = row.cname
  525. },
  526. choceScheduleFun() {
  527. this.checkScheduleDialog = false
  528. },
  529. addRow() {
  530. this.$refs["form"].validate((valid, done) => {
  531. done();
  532. if (valid) {
  533. this.itemsVOList.push({$cellEdit: true, unit: '1',containerNo:this.form.caseNo});
  534. this.getStorage()
  535. } else {
  536. return false;
  537. }
  538. });
  539. },
  540. rowCell(row, index) {
  541. this.$refs.crud.rowCell(row, index)
  542. },
  543. rowSave(form, done) {
  544. done()
  545. },
  546. addUpdate(form, index, done, loading) {
  547. done()
  548. },
  549. rowDel(row) {
  550. this.$confirm("确定删除数据?", {
  551. confirmButtonText: "确定",
  552. cancelButtonText: "取消",
  553. type: "warning"
  554. }).then(() => {
  555. if (row.id) {
  556. delItem({itemId: row.id,type:"RK"}).then(res => {
  557. this.$message({
  558. type: "success",
  559. message: "删除成功!"
  560. });
  561. this.itemsVOList.splice(row.$index, 1);
  562. });
  563. } else {
  564. this.$message({
  565. type: "success",
  566. message: "删除成功!"
  567. });
  568. this.itemsVOList.splice(row.$index, 1);
  569. }
  570. });
  571. },
  572. getDetail(id) {
  573. this.pageLoading = true;
  574. detail(id)
  575. .then(res => {
  576. this.form = res.data.data;
  577. this.itemsVOList = res.data.data.itemsVOList;
  578. this.orderFeesList = res.data.data.orderFeesList;
  579. this.orderFilesList = res.data.data.orderFilesList;
  580. this.oldform = this.deepClone(res.data.data);
  581. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  582. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  583. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  584. this.getStorage()
  585. })
  586. .finally(() => {
  587. this.pageLoading = false;
  588. });
  589. },
  590. rowPrint(row) {
  591. this.$router.push(`/myiframe/urlPath?name=preview-木材管理-入库垛卡.ureport.xml&src=${this.website.reportUrl}/preview?_u=blade-木材管理-入库垛卡.ureport.xml&id=${row.id}`);
  592. },
  593. //提交撤销
  594. withdraw(type) {
  595. if (type == 0) {
  596. this.$confirm("是否确认提交?", {
  597. confirmButtonText: "确定",
  598. cancelButtonText: "取消",
  599. type: "warning"
  600. }).then(() => {
  601. for (let i = 0; i < this.itemsVOList.length; i++) {
  602. // if (validatenull(this.itemsVOList[i].storageId)) {
  603. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  604. // }
  605. if (validatenull(this.itemsVOList[i].itemId)) {
  606. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  607. }
  608. // if (validatenull(this.itemsVOList[i].itemType)) {
  609. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  610. // }
  611. // if (validatenull(this.itemsVOList[i].grade)) {
  612. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  613. // }
  614. if (validatenull(this.itemsVOList[i].billNo)) {
  615. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  616. }
  617. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  618. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  619. // }
  620. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  621. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  622. }
  623. // if (validatenull(this.itemsVOList[i].unit)) {
  624. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  625. // }
  626. if (this.form.arrival == 1) {
  627. if (validatenull(this.itemsVOList[i].price)) {
  628. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  629. }
  630. }
  631. }
  632. this.itemsVOList.forEach((e, index) => {
  633. e.sort = Number(index) + 1
  634. })
  635. let orderFeesList = this.$refs.feeInfo.submitData();
  636. this.subLoading = true;
  637. let data = {
  638. ...this.form,
  639. billType: 'RK',
  640. itemsVOList: this.itemsVOList,
  641. orderFeesList: orderFeesList,
  642. orderFilesList: this.orderFilesList
  643. };
  644. submit(data).then(res => {
  645. this.form = res.data.data;
  646. this.itemsVOList = res.data.data.itemsVOList;
  647. this.orderFeesList = res.data.data.orderFeesList;
  648. this.orderFilesList = res.data.data.orderFilesList;
  649. this.oldform = this.deepClone(res.data.data);
  650. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  651. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  652. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  653. this.$message({
  654. type: "success",
  655. message: "保存成功!"
  656. });
  657. if (!this.detailData.id){
  658. this.detailData.id = res.data.data.id
  659. }
  660. if (this.itemsVOList.length == 0) {
  661. this.subLoading = false
  662. return this.$message({
  663. type: "warning",
  664. message: "无明细不允许提交!"
  665. });
  666. }
  667. withdraw({
  668. id: this.form.id,
  669. type: "RK",
  670. status: 1,
  671. isIssue: 1
  672. }).then(res => {
  673. this.$message({
  674. type: "success",
  675. message: "提交成功!"
  676. });
  677. this.getDetail(this.form.id);
  678. this.subLoading = false;
  679. })
  680. })
  681. })
  682. } else {
  683. this.$confirm("是否确认撤销?", {
  684. confirmButtonText: "确定",
  685. cancelButtonText: "取消",
  686. type: "warning"
  687. }).then(() => {
  688. for (let i = 0; i < this.itemsVOList.length; i++) {
  689. // if (validatenull(this.itemsVOList[i].storageId)) {
  690. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  691. // }
  692. if (validatenull(this.itemsVOList[i].itemId)) {
  693. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  694. }
  695. // if (validatenull(this.itemsVOList[i].itemType)) {
  696. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  697. // }
  698. // if (validatenull(this.itemsVOList[i].grade)) {
  699. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  700. // }
  701. if (validatenull(this.itemsVOList[i].billNo)) {
  702. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  703. }
  704. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  705. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  706. // }
  707. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  708. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  709. }
  710. // if (validatenull(this.itemsVOList[i].unit)) {
  711. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  712. // }
  713. if (this.form.arrival == 1) {
  714. if (validatenull(this.itemsVOList[i].price)) {
  715. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  716. }
  717. }
  718. }
  719. this.itemsVOList.forEach((e, index) => {
  720. e.sort = Number(index) + 1
  721. })
  722. let orderFeesList = this.$refs.feeInfo.submitData();
  723. this.subLoading = true;
  724. let data = {
  725. ...this.form,
  726. billType: 'RK',
  727. itemsVOList: this.itemsVOList,
  728. orderFeesList: orderFeesList,
  729. orderFilesList: this.orderFilesList
  730. };
  731. submit(data).then(res => {
  732. this.form = res.data.data;
  733. this.itemsVOList = res.data.data.itemsVOList;
  734. this.orderFeesList = res.data.data.orderFeesList;
  735. this.orderFilesList = res.data.data.orderFilesList;
  736. this.oldform = this.deepClone(res.data.data);
  737. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  738. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  739. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  740. this.$message({
  741. type: "success",
  742. message: "保存成功!"
  743. });
  744. if (!this.detailData.id){
  745. this.detailData.id = res.data.data.id
  746. }
  747. withdraw({
  748. id: this.form.id,
  749. type: "RK",
  750. status: 0,
  751. isIssue: 0
  752. }).then(res => {
  753. this.$message({
  754. type: "success",
  755. message: "撤销成功!"
  756. });
  757. this.getDetail(this.form.id);
  758. this.subLoading = false;
  759. })
  760. })
  761. })
  762. }
  763. },
  764. //修改提交触发
  765. editCustomer(status) {
  766. this.$refs["form"].validate((valid, done) => {
  767. done();
  768. if (valid) {
  769. for (let i = 0; i < this.itemsVOList.length; i++) {
  770. // if (validatenull(this.itemsVOList[i].storageId)) {
  771. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  772. // }
  773. if (validatenull(this.itemsVOList[i].itemId)) {
  774. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  775. }
  776. // if (validatenull(this.itemsVOList[i].itemType)) {
  777. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  778. // }
  779. // if (validatenull(this.itemsVOList[i].grade)) {
  780. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  781. // }
  782. if (validatenull(this.itemsVOList[i].billNo)) {
  783. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  784. }
  785. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  786. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  787. // }
  788. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  789. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  790. }
  791. // if (validatenull(this.itemsVOList[i].unit)) {
  792. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  793. // }
  794. if (this.form.arrival == 1) {
  795. if (validatenull(this.itemsVOList[i].price)) {
  796. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  797. }
  798. }
  799. }
  800. this.itemsVOList.forEach((e, index) => {
  801. e.sort = Number(index) + 1
  802. })
  803. let orderFeesList = this.$refs.feeInfo.submitData();
  804. this.subLoading = true;
  805. let data = {
  806. ...this.form,
  807. billType: 'RK',
  808. itemsVOList: this.itemsVOList,
  809. orderFeesList: orderFeesList,
  810. orderFilesList: this.orderFilesList
  811. };
  812. submit(data).then(res => {
  813. this.form = res.data.data;
  814. this.itemsVOList = res.data.data.itemsVOList;
  815. this.orderFeesList = res.data.data.orderFeesList;
  816. this.orderFilesList = res.data.data.orderFilesList;
  817. this.oldform = this.deepClone(res.data.data);
  818. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  819. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  820. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  821. this.$message({
  822. type: "success",
  823. message: "保存成功!"
  824. });
  825. if (!this.detailData.id){
  826. this.detailData.id = res.data.data.id
  827. }
  828. this.getDetail(res.data.data.id)
  829. }).finally(() => {
  830. this.subLoading = false;
  831. });
  832. } else {
  833. return false;
  834. }
  835. });
  836. },
  837. //请核
  838. auditCheck() {
  839. let orderFeesList = this.$refs.feeInfo.submitData();
  840. if (orderFeesList.length == 0) {
  841. this.$confirm("没有应付费用,是否继续提交?", {
  842. confirmButtonText: "确定",
  843. cancelButtonText: "取消",
  844. type: "warning"
  845. }).then(() => {
  846. this.$confirm("确定审核此订单?", {
  847. confirmButtonText: "确定",
  848. cancelButtonText: "取消",
  849. type: "warning"
  850. }).then(() => {
  851. for (let i = 0; i < this.itemsVOList.length; i++) {
  852. // if (validatenull(this.itemsVOList[i].storageId)) {
  853. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  854. // }
  855. if (validatenull(this.itemsVOList[i].itemId)) {
  856. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  857. }
  858. // if (validatenull(this.itemsVOList[i].itemType)) {
  859. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  860. // }
  861. // if (validatenull(this.itemsVOList[i].grade)) {
  862. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  863. // }
  864. if (validatenull(this.itemsVOList[i].billNo)) {
  865. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  866. }
  867. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  868. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  869. // }
  870. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  871. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  872. }
  873. // if (validatenull(this.itemsVOList[i].unit)) {
  874. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  875. // }
  876. if (this.form.arrival == 1) {
  877. if (validatenull(this.itemsVOList[i].price)) {
  878. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  879. }
  880. }
  881. }
  882. this.itemsVOList.forEach((e, index) => {
  883. e.sort = Number(index) + 1
  884. })
  885. let orderFeesList = this.$refs.feeInfo.submitData();
  886. this.subLoading = true;
  887. let data = {
  888. ...this.form,
  889. billType: 'RK',
  890. itemsVOList: this.itemsVOList,
  891. orderFeesList: orderFeesList,
  892. orderFilesList: this.orderFilesList
  893. };
  894. submit(data).then(res => {
  895. this.form = res.data.data;
  896. this.itemsVOList = res.data.data.itemsVOList;
  897. this.orderFeesList = res.data.data.orderFeesList;
  898. this.orderFilesList = res.data.data.orderFilesList;
  899. this.oldform = this.deepClone(res.data.data);
  900. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  901. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  902. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  903. this.$message({
  904. type: "success",
  905. message: "保存成功!"
  906. });
  907. if (!this.detailData.id){
  908. this.detailData.id = res.data.data.id
  909. }
  910. const datat = {
  911. id: this.form.id,
  912. checkType: 'RK',
  913. url: '/purchasingManagement/inStock/index',
  914. pageStatus: "this.$store.getters.entranceXsStatus",
  915. pageLabel: "入库管理",
  916. checkFlag: 1,
  917. }
  918. checkWarehousing(datat).then(res => {
  919. if (res.data.success) {
  920. this.$message.success("操作成功!")
  921. }
  922. }).finally(() => {
  923. this.subLoading = false
  924. this.getDetail(this.form.id)
  925. })
  926. })
  927. })
  928. })
  929. } else {
  930. this.$confirm("确定审核此订单?", {
  931. confirmButtonText: "确定",
  932. cancelButtonText: "取消",
  933. type: "warning"
  934. }).then(() => {
  935. for (let i = 0; i < this.itemsVOList.length; i++) {
  936. // if (validatenull(this.itemsVOList[i].storageId)) {
  937. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  938. // }
  939. if (validatenull(this.itemsVOList[i].itemId)) {
  940. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  941. }
  942. // if (validatenull(this.itemsVOList[i].itemType)) {
  943. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  944. // }
  945. // if (validatenull(this.itemsVOList[i].grade)) {
  946. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  947. // }
  948. if (validatenull(this.itemsVOList[i].billNo)) {
  949. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  950. }
  951. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  952. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  953. // }
  954. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  955. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  956. }
  957. // if (validatenull(this.itemsVOList[i].unit)) {
  958. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  959. // }
  960. if (this.form.arrival == 1) {
  961. if (validatenull(this.itemsVOList[i].price)) {
  962. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  963. }
  964. }
  965. }
  966. this.itemsVOList.forEach((e, index) => {
  967. e.sort = Number(index) + 1
  968. })
  969. let orderFeesList = this.$refs.feeInfo.submitData();
  970. this.subLoading = true;
  971. let data = {
  972. ...this.form,
  973. billType: 'RK',
  974. itemsVOList: this.itemsVOList,
  975. orderFeesList: orderFeesList,
  976. orderFilesList: this.orderFilesList
  977. };
  978. submit(data).then(res => {
  979. this.form = res.data.data;
  980. this.itemsVOList = res.data.data.itemsVOList;
  981. this.orderFeesList = res.data.data.orderFeesList;
  982. this.orderFilesList = res.data.data.orderFilesList;
  983. this.oldform = this.deepClone(res.data.data);
  984. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  985. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  986. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  987. this.$message({
  988. type: "success",
  989. message: "保存成功!"
  990. });
  991. if (!this.detailData.id){
  992. this.detailData.id = res.data.data.id
  993. }
  994. const dataT = {
  995. id: this.form.id,
  996. checkType: 'RK',
  997. url: '/purchasingManagement/inStock/index',
  998. pageStatus: "this.$store.getters.entranceXsStatus",
  999. pageLabel: "入库管理",
  1000. checkFlag: 1,
  1001. }
  1002. checkWarehousing(dataT).then(res => {
  1003. if (res.data.success) {
  1004. this.$message.success("操作成功!")
  1005. }
  1006. }).finally(() => {
  1007. this.subLoading = false
  1008. this.getDetail(this.form.id)
  1009. })
  1010. })
  1011. })
  1012. }
  1013. },
  1014. revokeCheck() {
  1015. this.$confirm("确定撤销审核此订单?", {
  1016. confirmButtonText: "确定",
  1017. cancelButtonText: "取消",
  1018. type: "warning"
  1019. }).then(() => {
  1020. let orderFeesList = this.$refs.feeInfo.submitData();
  1021. this.subLoading = true;
  1022. let data = {
  1023. ...this.form,
  1024. billType: 'RK',
  1025. itemsVOList: this.itemsVOList,
  1026. orderFeesList: orderFeesList,
  1027. orderFilesList: this.orderFilesList
  1028. };
  1029. revokeWarehousing(data).then(res => {
  1030. if (res.data.success) {
  1031. this.$message.success("操作成功!")
  1032. }
  1033. }).finally(() => {
  1034. this.subLoading = false
  1035. this.getDetail(this.form.id)
  1036. })
  1037. })
  1038. },
  1039. calculateChange(row) {
  1040. row.storageAmount = Number((row.storageInQuantity ? row.storageInQuantity : 0) * (row.price ? row.price : 0)).toFixed(2)
  1041. },
  1042. beforeFinance(feesData, callback) {
  1043. let params = {}
  1044. //暂时默认通过 之后优化
  1045. params.valid = true
  1046. params.parentId = this.form.id
  1047. callback(params)
  1048. },
  1049. getTemplate() {
  1050. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  1051. },
  1052. uploadAfter(res, done, loading, column) {
  1053. if (!res.message) {
  1054. res.forEach(item => {
  1055. this.itemsVOList.push({
  1056. ...item,
  1057. containerNo:this.form.caseNo,
  1058. $cellEdit: false
  1059. })
  1060. })
  1061. this.excelBox = false
  1062. done();
  1063. } else {
  1064. loading()
  1065. }
  1066. },
  1067. addData(row) {
  1068. if (row == 'purchaserId') {
  1069. this.$router.push(`/basicData/customerInformation/index`);
  1070. } else if (row == 'corpId') {
  1071. this.$router.push(`/basicData/customerManagement/supplierMaterial/index`);
  1072. } else if (row == 'storage') {
  1073. this.$router.push(`/basicData/basicStorageType/index`);
  1074. } else if (row == 'storageId') {
  1075. this.$router.push(`/basicData/basicStorageDesc/index`);
  1076. } else if (row == 'itemId') {
  1077. this.$router.push(`/basicData/commodityType/index`);
  1078. }
  1079. },
  1080. //返回列表
  1081. backToList() {
  1082. let orderFeesList = this.$refs.feeInfo.submitData();
  1083. if (
  1084. contrastObj(this.form, this.oldform) ||
  1085. contrastList(this.itemsVOList, this.olditemsVOList) ||
  1086. contrastList2(orderFeesList, this.oldorderFeesList) ||
  1087. contrastList(this.orderFilesList, this.oldorderFilesList)
  1088. ) {
  1089. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1090. confirmButtonText: "确定",
  1091. cancelButtonText: "取消",
  1092. type: "warning"
  1093. })
  1094. .then(() => {
  1095. this.editCustomer("goBack");
  1096. })
  1097. .catch(() => {
  1098. this.$emit("goBack");
  1099. });
  1100. } else {
  1101. this.$emit("goBack");
  1102. }
  1103. },
  1104. openEdit() {
  1105. this.detailData.status = 2;
  1106. this.option.disabled = false;
  1107. this.$refs.crud.refreshTable();
  1108. },
  1109. async saveColumn() {
  1110. const inSave = await this.saveColumnData(
  1111. this.getColumnName(189),
  1112. this.tableOption
  1113. );
  1114. if (inSave) {
  1115. this.$nextTick(() => {
  1116. this.$refs.crud.doLayout();
  1117. });
  1118. this.$message.success("保存成功");
  1119. //关闭窗口
  1120. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1121. }
  1122. },
  1123. moveUp(row, index) {
  1124. this.itemsVOList[index] = this.itemsVOList.splice(index - 1, 1, row)[0]
  1125. },
  1126. moveDown(row, index) {
  1127. this.itemsVOList[index] = this.itemsVOList.splice(index + 1, 1, row)[0]
  1128. },
  1129. async resetColumn() {
  1130. this.tableOption = tableOption;
  1131. const inSave = await this.delColumnData(
  1132. this.getColumnName(189),
  1133. tableOption
  1134. );
  1135. if (inSave) {
  1136. this.$nextTick(() => {
  1137. this.$refs.crud.doLayout();
  1138. });
  1139. this.$message.success("重置成功");
  1140. this.getAllWorkDicts()
  1141. this.getStorage()
  1142. //关闭窗口
  1143. setTimeout(() => {
  1144. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1145. }, 1000);
  1146. }
  1147. }
  1148. },
  1149. watch: {}
  1150. };
  1151. </script>
  1152. <style lang="scss" scoped>
  1153. .trading-form ::v-deep .el-form-item {
  1154. margin-bottom: 8px !important;
  1155. }
  1156. ::v-deep .el-form-item__error {
  1157. display: none !important;
  1158. }
  1159. ::v-deep .select-component {
  1160. display: flex !important;
  1161. }
  1162. ::v-deep .el-table .cell {
  1163. padding: 0 2px !important;
  1164. }
  1165. ::v-deep .avue-crud .el-table .el-form-item__label {
  1166. left: -1px;
  1167. }
  1168. </style>