detailsPage.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879
  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" v-if="!(form.status > 2)"
  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. </template>
  83. <template slot="headerSerial">
  84. <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
  85. :disabled="detailData.status == 1" circle></el-button>
  86. </template>
  87. <template slot="storageIdHeader" slot-scope="{column}">
  88. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  89. </template>
  90. <template slot="itemIdHeader" slot-scope="{column}">
  91. <span style="color: #409EFF;cursor: pointer" @click.stop="addData(column.prop)">{{ column.label }}</span>
  92. </template>
  93. <template slot="oneCode" slot-scope="{ row, index }">
  94. <el-popover placement="right" width="160" trigger="click">
  95. <el-image style="width: 160px; height: 80px" :src="row.oneCode" :fit="fit"></el-image>
  96. <el-button v-if="row.oneCode" type="text" slot="reference">查看</el-button>
  97. </el-popover>
  98. </template>
  99. <template slot="qrCode" slot-scope="{ row, index }">
  100. <el-popover placement="right" width="300" trigger="click">
  101. <el-image style="width: 300px; height: 300px" :src="row.qrCode" :fit="fit"></el-image>
  102. <el-button v-if="row.qrCode" type="text" slot="reference">查看</el-button>
  103. </el-popover>
  104. </template>
  105. <template slot="storageInQuantityForm" slot-scope="{ row }">
  106. <el-input-number size="small" v-model="row.storageInQuantity" @change="calculateChange(row)"
  107. :controls="false" style="width:100%" placeholder="请输入"></el-input-number>
  108. </template>
  109. <template slot="priceForm" slot-scope="{ row }">
  110. <el-input-number size="small" v-model="row.price" @change="calculateChange(row)" :controls="false"
  111. style="width:100%" placeholder="请输入"></el-input-number>
  112. </template>
  113. <template slot="menu" slot-scope="{ row, index }">
  114. <div style="display:flex;justify-content: center;">
  115. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  116. :disabled="disabled || detailData.status == 1">{{ row.$cellEdit ? "保存" : "编辑" }}
  117. </el-button>
  118. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  119. :disabled="detailData.status == 1">删除
  120. </el-button>
  121. <el-button size="small" icon="el-icon-printer" type="text" @click="rowPrint(row, index)"
  122. :disabled="!row.id">
  123. 打印
  124. </el-button>
  125. <div style="display:flex;flex-direction: column;justify-content: center;margin-left: 10px;">
  126. <el-tooltip effect="dark" content="向上移动" placement="top">
  127. <i v-if="index != 0&&detailData.status != 1" :disabled="disabled || detailData.status == 1"
  128. class="el-icon-arrow-up" @click="moveUp(row, index)" style="color:#409EFF;"></i>
  129. </el-tooltip>
  130. <el-tooltip effect="dark" content="向下移动" placement="bottom"><i
  131. v-if="index != (itemsVOList.length - 1)&&detailData.status != 1" class="el-icon-arrow-down"
  132. @click="moveDown(row, index)" style="color:#409EFF;"></i></el-tooltip>
  133. </div>
  134. </div>
  135. </template>
  136. </avue-crud>
  137. </trade-card>
  138. <fee-info ref="feeInfo" :orderFeesList="orderFeesList" :disabled="!(form.status < 3)"
  139. feeUrl="/blade-purchase-sales/entranceOrder/removeOrderFees" :optionType="'CMY'" :itemType="'C'"
  140. :inCropId="true" @beforeFinance="beforeFinance" :delType="2" :billingShow="false"/>
  141. <!-- <upload-file ref="uploadFile" title="合同附件" :disabled="detailData.status == 1" :orderFilesList="orderFilesList"
  142. delUrl="" /> -->
  143. <containerTitle title="上传附件"></containerTitle>
  144. <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
  145. :data="orderFilesList" display :enumerationValue="85.6" :disabled="!(form.status < 3)"></c-upload>
  146. <el-dialog append-to-body title="审核进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  147. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  148. <check-schedule :checkId="form.id" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  149. </check-schedule>
  150. </el-dialog>
  151. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  152. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  153. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  154. </check>
  155. </el-dialog>
  156. </div>
  157. <el-dialog title="导入" append-to-body :close-on-click-modal="false" :visible.sync="excelBox" width="555px">
  158. <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter" :upload-error="uploadError">
  159. <template slot="excelTemplate">
  160. <el-button type="primary" @click="getTemplate">
  161. 点击下载<i class="el-icon-download el-icon--right"></i>
  162. </el-button>
  163. </template>
  164. </avue-form>
  165. <p style="text-align: center;color: #DC0505">
  166. 温馨提示 第一次导入时请先下载模板
  167. </p>
  168. </el-dialog>
  169. </div>
  170. </template>
  171. <script>
  172. import {
  173. detail,
  174. submit,
  175. checkWarehousing,
  176. getStoragetree,
  177. getStorage,
  178. getAllgoods,
  179. delItem,
  180. revokeWarehousing,
  181. withdraw
  182. } from "@/api/purchasingManagement/inStock";
  183. import tableOption from "./config/customerContact.json";
  184. import feeInfo from "@/components/fee-info/main";
  185. import checkSchedule from "../../../components/check/checkSchedule";
  186. import uploadFile from "@/components/upload-file/main";
  187. import {getToken} from "@/util/auth";
  188. import {contrastObj, contrastList, contrastList2} from "@/util/contrastData";
  189. import {validatenull} from '@/util/validate'
  190. import check from "@/components/check/check";
  191. export default {
  192. name: "detailsPageEdit",
  193. data() {
  194. return {
  195. checkData: {},
  196. checkDialog: false,
  197. subLoading: false,
  198. form: {},
  199. excelBox: false,
  200. excelOption: {
  201. submitBtn: false,
  202. emptyBtn: false,
  203. column: [
  204. {
  205. label: '模板下载',
  206. prop: 'excelTemplate',
  207. formslot: true,
  208. span: 24,
  209. }, {
  210. label: '模板上传',
  211. prop: 'excelFile',
  212. type: 'upload',
  213. drag: true,
  214. loadText: '模板上传中,请稍等',
  215. span: 24,
  216. propsHttp: {
  217. res: 'data'
  218. },
  219. tip: '请上传 .xls,.xlsx 标准格式文件',
  220. action: "/api/trade-purchase/woodHarvestingCloud/import"
  221. }
  222. ]
  223. },
  224. excelForm: {},
  225. checkScheduleDialog: false,
  226. tableOption: {},
  227. option: {
  228. disabled: false,
  229. menuBtn: false,
  230. labelWidth: 100,
  231. column: [
  232. {
  233. label: "货权人",
  234. prop: "purchaserId",
  235. rules: [
  236. {
  237. required: true,
  238. message: "",
  239. trigger: "blur"
  240. }
  241. ],
  242. span: 6
  243. },
  244. {
  245. label: "入库日期",
  246. prop: "stockTime",
  247. type: "datetime",
  248. format: "yyyy-MM-dd HH:mm:ss",
  249. valueFormat: "yyyy-MM-dd HH:mm:ss",
  250. rules: [
  251. {
  252. required: true,
  253. message: "",
  254. trigger: "blur"
  255. }
  256. ],
  257. span: 6
  258. },
  259. {
  260. label: "仓库",
  261. prop: "storageId",
  262. rules: [
  263. {
  264. required: true,
  265. message: "",
  266. trigger: "blur"
  267. }
  268. ],
  269. span: 6
  270. },
  271. {
  272. label: "提单号",
  273. prop: "billNo",
  274. span: 6
  275. },
  276. {
  277. label: "业务类型",
  278. prop: "businessType",
  279. type: "select",
  280. props: {
  281. label: "dictValue",
  282. value: "dictKey"
  283. },
  284. dicData: [],
  285. span: 6
  286. },
  287. {
  288. label: "车船号",
  289. prop: "vehicleShipNumber",
  290. span: 6
  291. },
  292. {
  293. label: "审核状态",
  294. prop: "status",
  295. type: "select",
  296. dataType: 'number',
  297. props: {
  298. label: "dictValue",
  299. value: "dictKey"
  300. },
  301. dicData: [],
  302. disabled: true,
  303. span: 6
  304. },
  305. {
  306. label: "供应商",
  307. prop: "corpId",
  308. span: 6
  309. },
  310. {
  311. label: "入库单号",
  312. prop: "sysNo",
  313. disabled: true,
  314. span: 6
  315. },
  316. {
  317. label: "是否融资",
  318. prop: "arrival",
  319. type: "select",
  320. dataType: 'number',
  321. value: 0,
  322. dicData: [
  323. {
  324. label: "是",
  325. value: 1
  326. }, {
  327. label: "否",
  328. value: 0
  329. }
  330. ],
  331. change: (data) => {
  332. if (data.value == 0) {
  333. this.findObject(this.tableOption.column, "price").label = "入库单价"
  334. this.findObject(this.tableOption.column, "price").rules.required = false
  335. } else {
  336. this.findObject(this.tableOption.column, "price").label = "*入库单价"
  337. this.findObject(this.tableOption.column, "price").rules.required = true
  338. }
  339. },
  340. span: 6
  341. },
  342. {
  343. label: "备注",
  344. prop: "orderRemark",
  345. type: "textarea",
  346. minRows: 1,
  347. span: 12
  348. },
  349. ]
  350. },
  351. itemsVOList: [],
  352. orderFeesList: [],
  353. orderFilesList: [],
  354. pageLoading: false,
  355. batchNo: '',
  356. storagetreeList: [],
  357. oldform: {},
  358. olditemsVOList: [],
  359. oldorderFeesList: [],
  360. oldorderFilesList: [],
  361. roleName: localStorage.getItem("roleName")
  362. };
  363. },
  364. props: {
  365. detailData: {
  366. type: Object
  367. }
  368. },
  369. components: {
  370. feeInfo,
  371. checkSchedule,
  372. uploadFile,
  373. check
  374. },
  375. async created() {
  376. if (this.detailData.status == 1) {
  377. this.option.disabled = true;
  378. }
  379. if (this.detailData.id) {
  380. this.getDetail(this.detailData.id);
  381. }
  382. this.tableOption = await this.getColumnData(
  383. this.getColumnName(189),
  384. tableOption
  385. );
  386. getStoragetree().then(res => {
  387. this.storagetreeList = res.data.data;
  388. })
  389. this.getWorkDicts("approval_status").then(res => {
  390. this.findObject(this.option.column, "status").dicData =
  391. res.data.data;
  392. });
  393. this.getWorkDicts("CMY_business_type").then(res => {
  394. this.findObject(this.option.column, "businessType").dicData =
  395. res.data.data;
  396. });
  397. this.getAllWorkDicts()
  398. },
  399. methods: {
  400. check() {
  401. this.checkData = this.$route.query.check
  402. this.checkDialog = true
  403. },
  404. //关闭审核
  405. choceCheckFun() {
  406. this.checkDialog = false;
  407. },
  408. getData() {
  409. getAllgoods().then(res => {
  410. this.findObject(this.tableOption.column, "itemId").dicData =
  411. res.data.data;
  412. })
  413. getStoragetree().then(res => {
  414. this.storagetreeList = res.data.data;
  415. })
  416. this.getStorage()
  417. this.$refs.purchaser.refreshData()
  418. this.$refs.corpId.refreshData()
  419. },
  420. getAllWorkDicts() {
  421. getAllgoods().then(res => {
  422. this.findObject(this.tableOption.column, "itemId").dicData =
  423. res.data.data;
  424. })
  425. this.getWorkDicts("unit").then(res => {
  426. this.findObject(this.tableOption.column, "unit").dicData =
  427. res.data.data;
  428. });
  429. },
  430. cellStyle() {
  431. return "padding:0;height:40px;";
  432. },
  433. getStorage() {
  434. getStorage({storageTypeId: this.form.storageId}).then(res => {
  435. this.findObject(this.tableOption.column, "storageId").dicData = res.data;
  436. })
  437. },
  438. storagetreeChange(row) {
  439. if (row) {
  440. if (this.itemsVOList.length > 0) {
  441. this.getStorage()
  442. this.itemsVOList.forEach(e => {
  443. e.storageId = null
  444. })
  445. this.$message.warning("请重新选择库区!")
  446. }
  447. } else {
  448. if (this.itemsVOList.length > 0) {
  449. this.findObject(this.tableOption.column, "storageId").dicData = []
  450. this.itemsVOList.forEach(e => {
  451. e.storageId = null
  452. })
  453. this.$message.warning("请重新选择库区!")
  454. }
  455. }
  456. },
  457. getKHData(row) {
  458. this.form.purchaser = row.cname
  459. },
  460. getGYSData(row) {
  461. console.log(row)
  462. this.form.corpName = row.cname
  463. },
  464. choceScheduleFun() {
  465. this.checkScheduleDialog = false
  466. },
  467. addRow() {
  468. this.$refs["form"].validate((valid, done) => {
  469. done();
  470. if (valid) {
  471. this.itemsVOList.push({$cellEdit: true, unit: '1'});
  472. this.getStorage()
  473. } else {
  474. return false;
  475. }
  476. });
  477. },
  478. rowCell(row, index) {
  479. this.$refs.crud.rowCell(row, index)
  480. },
  481. rowSave(form, done) {
  482. done()
  483. },
  484. addUpdate(form, index, done, loading) {
  485. done()
  486. },
  487. rowDel(row) {
  488. this.$confirm("确定删除数据?", {
  489. confirmButtonText: "确定",
  490. cancelButtonText: "取消",
  491. type: "warning"
  492. }).then(() => {
  493. if (row.id) {
  494. delItem({itemId: row.id}).then(res => {
  495. this.$message({
  496. type: "success",
  497. message: "删除成功!"
  498. });
  499. this.itemsVOList.splice(row.$index, 1);
  500. });
  501. } else {
  502. this.$message({
  503. type: "success",
  504. message: "删除成功!"
  505. });
  506. this.itemsVOList.splice(row.$index, 1);
  507. }
  508. });
  509. },
  510. getDetail(id) {
  511. this.pageLoading = true;
  512. detail(id)
  513. .then(res => {
  514. this.form = res.data.data;
  515. this.itemsVOList = res.data.data.itemsVOList;
  516. this.orderFeesList = res.data.data.orderFeesList;
  517. this.orderFilesList = res.data.data.orderFilesList;
  518. this.oldform = this.deepClone(res.data.data);
  519. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  520. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  521. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  522. this.getStorage()
  523. })
  524. .finally(() => {
  525. this.pageLoading = false;
  526. });
  527. },
  528. rowPrint(row) {
  529. this.$router.push(`/myiframe/urlPath?name=preview-木材管理-入库垛卡.ureport.xml&src=${this.website.reportUrl}/preview?_u=blade-木材管理-入库垛卡.ureport.xml&id=${row.id}`);
  530. },
  531. //提交撤销
  532. withdraw(type) {
  533. if (type == 0) {
  534. this.$confirm("是否确认提交?", {
  535. confirmButtonText: "确定",
  536. cancelButtonText: "取消",
  537. type: "warning"
  538. }).then(() => {
  539. if (this.itemsVOList.length == 0){
  540. return this.$message({
  541. type: "warning",
  542. message: "无明细不允许提交!"
  543. });
  544. }
  545. this.subLoading = true;
  546. withdraw({
  547. id: this.form.id,
  548. type: "RK",
  549. status: 1,
  550. isIssue: 1
  551. }).then(res => {
  552. this.$message({
  553. type: "success",
  554. message: "提交成功!"
  555. });
  556. this.getDetail(this.form.id);
  557. this.subLoading = false;
  558. })
  559. })
  560. } else {
  561. this.$confirm("是否确认撤销?", {
  562. confirmButtonText: "确定",
  563. cancelButtonText: "取消",
  564. type: "warning"
  565. }).then(() => {
  566. this.subLoading = true;
  567. withdraw({
  568. id: this.form.id,
  569. type: "RK",
  570. status: 0,
  571. isIssue: 0
  572. }).then(res => {
  573. this.$message({
  574. type: "success",
  575. message: "撤销成功!"
  576. });
  577. this.getDetail(this.form.id);
  578. this.subLoading = false;
  579. })
  580. })
  581. }
  582. },
  583. //修改提交触发
  584. editCustomer(status) {
  585. this.$refs["form"].validate((valid, done) => {
  586. done();
  587. if (valid) {
  588. for (let i = 0; i < this.itemsVOList.length; i++) {
  589. if (validatenull(this.itemsVOList[i].storageId)) {
  590. return this.$message.error('请完善第' + (i + 1) + '行的库区')
  591. }
  592. if (validatenull(this.itemsVOList[i].itemId)) {
  593. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  594. }
  595. if (validatenull(this.itemsVOList[i].itemType)) {
  596. return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  597. }
  598. if (validatenull(this.itemsVOList[i].grade)) {
  599. return this.$message.error('请完善第' + (i + 1) + '行的等级')
  600. }
  601. if (validatenull(this.itemsVOList[i].billNo)) {
  602. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  603. }
  604. if (validatenull(this.itemsVOList[i].sliceNumber)) {
  605. return this.$message.error('请完善第' + (i + 1) + '行的片数')
  606. }
  607. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  608. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  609. }
  610. if (validatenull(this.itemsVOList[i].unit)) {
  611. return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  612. }
  613. if (validatenull(this.itemsVOList[i].price)) {
  614. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  615. }
  616. }
  617. this.itemsVOList.forEach((e, index) => {
  618. e.sort = Number(index) + 1
  619. })
  620. let orderFeesList = this.$refs.feeInfo.submitData();
  621. this.subLoading = true;
  622. let data = {
  623. ...this.form,
  624. billType: 'RK',
  625. itemsVOList: this.itemsVOList,
  626. orderFeesList: orderFeesList,
  627. orderFilesList: this.orderFilesList
  628. };
  629. submit(data).then(res => {
  630. this.form = res.data.data;
  631. this.itemsVOList = res.data.data.itemsVOList;
  632. this.orderFeesList = res.data.data.orderFeesList;
  633. this.orderFilesList = res.data.data.orderFilesList;
  634. this.oldform = this.deepClone(res.data.data);
  635. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  636. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  637. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  638. this.$message({
  639. type: "success",
  640. message: "保存成功!"
  641. });
  642. if (status == "goBack") {
  643. this.$emit("goBack");
  644. }
  645. })
  646. .finally(() => {
  647. this.subLoading = false;
  648. });
  649. } else {
  650. return false;
  651. }
  652. });
  653. },
  654. //请核
  655. auditCheck() {
  656. let orderFeesList = this.$refs.feeInfo.submitData();
  657. if (orderFeesList.length == 0) {
  658. this.$confirm("没有应付费用,是否继续提交?", {
  659. confirmButtonText: "确定",
  660. cancelButtonText: "取消",
  661. type: "warning"
  662. }).then(() => {
  663. this.$confirm("确定审核此订单?", {
  664. confirmButtonText: "确定",
  665. cancelButtonText: "取消",
  666. type: "warning"
  667. }).then(() => {
  668. const data = {
  669. id: this.form.id,
  670. checkType: 'RK',
  671. url: '/purchasingManagement/inStock/index',
  672. pageStatus: "this.$store.getters.entranceXsStatus",
  673. pageLabel: "入库管理",
  674. checkFlag: 1,
  675. }
  676. this.subLoading = true
  677. checkWarehousing(data).then(res => {
  678. if (res.data.success) {
  679. this.$message.success("操作成功!")
  680. }
  681. }).finally(() => {
  682. this.subLoading = false
  683. this.getDetail(this.form.id)
  684. })
  685. })
  686. })
  687. } else {
  688. this.$confirm("确定审核此订单?", {
  689. confirmButtonText: "确定",
  690. cancelButtonText: "取消",
  691. type: "warning"
  692. }).then(() => {
  693. this.subLoading = true
  694. const data = {
  695. id: this.form.id,
  696. checkType: 'RK',
  697. url: '/purchasingManagement/inStock/index',
  698. pageStatus: "this.$store.getters.entranceXsStatus",
  699. pageLabel: "入库管理",
  700. checkFlag: 1,
  701. }
  702. checkWarehousing(data).then(res => {
  703. if (res.data.success) {
  704. this.$message.success("操作成功!")
  705. }
  706. }).finally(() => {
  707. this.subLoading = false
  708. this.getDetail(this.form.id)
  709. })
  710. }).finally(() => {
  711. })
  712. }
  713. },
  714. revokeCheck() {
  715. this.$confirm("确定撤销审核此订单?", {
  716. confirmButtonText: "确定",
  717. cancelButtonText: "取消",
  718. type: "warning"
  719. }).then(() => {
  720. let orderFeesList = this.$refs.feeInfo.submitData();
  721. this.subLoading = true;
  722. let data = {
  723. ...this.form,
  724. billType: 'RK',
  725. itemsVOList: this.itemsVOList,
  726. orderFeesList: orderFeesList,
  727. orderFilesList: this.orderFilesList
  728. };
  729. revokeWarehousing(data).then(res => {
  730. if (res.data.success) {
  731. this.$message.success("操作成功!")
  732. }
  733. }).finally(() => {
  734. this.subLoading = false
  735. this.getDetail(this.form.id)
  736. })
  737. })
  738. },
  739. calculateChange(row) {
  740. row.storageAmount = Number((row.storageInQuantity ? row.storageInQuantity : 0) * (row.price ? row.price : 0)).toFixed(2)
  741. },
  742. beforeFinance(feesData, callback) {
  743. let params = {}
  744. //暂时默认通过 之后优化
  745. params.valid = true
  746. params.parentId = this.form.id
  747. callback(params)
  748. },
  749. getTemplate() {
  750. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  751. },
  752. uploadAfter(res, done, loading, column) {
  753. if (!res.message) {
  754. res.forEach(item => this.itemsVOList.push({
  755. ...item,
  756. $cellEdit: true
  757. }))
  758. this.excelBox = false
  759. done();
  760. } else {
  761. loading()
  762. }
  763. },
  764. addData(row) {
  765. if (row == 'purchaserId') {
  766. this.$router.push(`/basicData/customerInformation/index`);
  767. } else if (row == 'corpId') {
  768. this.$router.push(`/basicData/customerManagement/supplierMaterial/index`);
  769. } else if (row == 'storage') {
  770. this.$router.push(`/basicData/basicStorageType/index`);
  771. } else if (row == 'storageId') {
  772. this.$router.push(`/basicData/basicStorageDesc/index`);
  773. } else if (row == 'itemId') {
  774. this.$router.push(`/basicData/commodityType/index`);
  775. }
  776. },
  777. //返回列表
  778. backToList() {
  779. let orderFeesList = this.$refs.feeInfo.submitData();
  780. if (
  781. contrastObj(this.form, this.oldform) ||
  782. contrastList(this.itemsVOList, this.olditemsVOList) ||
  783. contrastList2(orderFeesList, this.oldorderFeesList) ||
  784. contrastList(this.orderFilesList, this.oldorderFilesList)
  785. ) {
  786. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  787. confirmButtonText: "确定",
  788. cancelButtonText: "取消",
  789. type: "warning"
  790. })
  791. .then(() => {
  792. this.editCustomer("goBack");
  793. })
  794. .catch(() => {
  795. this.$emit("goBack");
  796. });
  797. } else {
  798. this.$emit("goBack");
  799. }
  800. },
  801. openEdit() {
  802. this.detailData.status = 2;
  803. this.option.disabled = false;
  804. this.$refs.crud.refreshTable();
  805. },
  806. async saveColumn() {
  807. const inSave = await this.saveColumnData(
  808. this.getColumnName(189),
  809. this.tableOption
  810. );
  811. if (inSave) {
  812. this.$nextTick(() => {
  813. this.$refs.crud.doLayout();
  814. });
  815. this.$message.success("保存成功");
  816. //关闭窗口
  817. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  818. }
  819. },
  820. moveUp(row, index) {
  821. this.itemsVOList[index] = this.itemsVOList.splice(index - 1, 1, row)[0]
  822. },
  823. moveDown(row, index) {
  824. this.itemsVOList[index] = this.itemsVOList.splice(index + 1, 1, row)[0]
  825. },
  826. async resetColumn() {
  827. this.tableOption = tableOption;
  828. const inSave = await this.delColumnData(
  829. this.getColumnName(189),
  830. tableOption
  831. );
  832. if (inSave) {
  833. this.$nextTick(() => {
  834. this.$refs.crud.doLayout();
  835. });
  836. this.$message.success("重置成功");
  837. this.getAllWorkDicts()
  838. this.getStorage()
  839. //关闭窗口
  840. setTimeout(() => {
  841. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  842. }, 1000);
  843. }
  844. }
  845. },
  846. watch: {}
  847. };
  848. </script>
  849. <style lang="scss" scoped>
  850. .trading-form ::v-deep .el-form-item {
  851. margin-bottom: 8px !important;
  852. }
  853. ::v-deep .el-form-item__error {
  854. display: none !important;
  855. }
  856. ::v-deep .select-component {
  857. display: flex !important;
  858. }
  859. ::v-deep .el-table .cell {
  860. padding: 0 2px !important;
  861. }
  862. ::v-deep .avue-crud .el-table .el-form-item__label {
  863. left: -1px;
  864. }
  865. </style>