detailsPage.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  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. </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" typeName="wood" :corpId="form.purchaserId" :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. import {dateFormat} from "@/util/date";
  192. export default {
  193. name: "detailsPageEdit",
  194. data() {
  195. return {
  196. checkData: {},
  197. checkDialog: false,
  198. subLoading: false,
  199. form: {},
  200. excelBox: false,
  201. excelOption: {
  202. submitBtn: false,
  203. emptyBtn: false,
  204. column: [
  205. {
  206. label: '模板下载',
  207. prop: 'excelTemplate',
  208. formslot: true,
  209. span: 24,
  210. }, {
  211. label: '模板上传',
  212. prop: 'excelFile',
  213. type: 'upload',
  214. drag: true,
  215. loadText: '模板上传中,请稍等',
  216. span: 24,
  217. propsHttp: {
  218. res: 'data'
  219. },
  220. tip: '请上传 .xls,.xlsx 标准格式文件',
  221. action: "/api/trade-purchase/woodHarvestingCloud/import"
  222. }
  223. ]
  224. },
  225. excelForm: {},
  226. checkScheduleDialog: false,
  227. tableOption: {},
  228. option: {
  229. disabled: false,
  230. menuBtn: false,
  231. labelWidth: 100,
  232. column: [
  233. {
  234. label: "货权人",
  235. prop: "purchaserId",
  236. rules: [
  237. {
  238. required: true,
  239. message: "",
  240. trigger: "blur"
  241. }
  242. ],
  243. span: 6
  244. },
  245. {
  246. label: "入库日期",
  247. prop: "stockTime",
  248. type: "datetime",
  249. value: dateFormat(new Date(),'yyyy-MM-dd hh:mm:ss'),
  250. format: "yyyy-MM-dd HH:mm:ss",
  251. valueFormat: "yyyy-MM-dd HH:mm:ss",
  252. rules: [
  253. {
  254. required: true,
  255. message: "",
  256. trigger: "blur"
  257. }
  258. ],
  259. span: 6
  260. },
  261. {
  262. label: "箱号",
  263. prop: "caseNo",
  264. span: 6,
  265. blur: (data) => {
  266. for (let item of this.itemsVOList){
  267. item.containerNo = data.value
  268. }
  269. }
  270. },
  271. {
  272. label: "提单号",
  273. prop: "billNo",
  274. rules: [{
  275. required: true,
  276. message: "",
  277. trigger: "blur"
  278. }],
  279. span: 6
  280. },
  281. {
  282. label: "仓库",
  283. prop: "storageId",
  284. rules: [{
  285. required: true,
  286. message: "",
  287. trigger: "blur"
  288. }],
  289. span: 6
  290. },
  291. {
  292. label: "业务类型",
  293. prop: "businessType",
  294. type: "select",
  295. props: {
  296. label: "dictValue",
  297. value: "dictKey"
  298. },
  299. dicData: [],
  300. span: 6
  301. },
  302. {
  303. label: "车船号",
  304. prop: "vehicleShipNumber",
  305. rules: [{
  306. required: true,
  307. message: "",
  308. trigger: "blur"
  309. }],
  310. span: 6
  311. },
  312. {
  313. label: "审核状态",
  314. prop: "status",
  315. type: "select",
  316. dataType: 'number',
  317. props: {
  318. label: "dictValue",
  319. value: "dictKey"
  320. },
  321. dicData: [],
  322. disabled: true,
  323. span: 6
  324. },
  325. {
  326. label: "供应商",
  327. prop: "corpId",
  328. span: 6
  329. },
  330. {
  331. label: "入库单号",
  332. prop: "sysNo",
  333. disabled: true,
  334. span: 6
  335. },
  336. {
  337. label: "库管员",
  338. prop: "stockUser",
  339. span: 6,
  340. dataType: "number",
  341. type: 'select',
  342. dicUrl: "/api/blade-user/MCSelectList",
  343. props: {
  344. label: "realName",
  345. value: "id"
  346. }
  347. },
  348. {
  349. label: "是否融资",
  350. prop: "arrival",
  351. type: "select",
  352. dataType: 'number',
  353. value: 0,
  354. dicData: [
  355. {
  356. label: "是",
  357. value: 1
  358. }, {
  359. label: "否",
  360. value: 0
  361. }
  362. ],
  363. change: (data) => {
  364. if (data.value == 0) {
  365. this.findObject(this.tableOption.column, "price").label = "入库单价"
  366. this.findObject(this.tableOption.column, "price").rules[0].required = false
  367. } else {
  368. this.findObject(this.tableOption.column, "price").label = "*入库单价"
  369. this.findObject(this.tableOption.column, "price").rules[0].required = true
  370. }
  371. },
  372. span: 6
  373. }, {
  374. label: "备注",
  375. prop: "orderRemark",
  376. type: "textarea",
  377. minRows: 1,
  378. span: 24
  379. },
  380. ]
  381. },
  382. itemsVOList: [],
  383. orderFeesList: [],
  384. orderFilesList: [],
  385. pageLoading: false,
  386. batchNo: '',
  387. storagetreeList: [],
  388. oldform: {},
  389. olditemsVOList: [],
  390. oldorderFeesList: [],
  391. oldorderFilesList: [],
  392. roleName: localStorage.getItem("roleName")
  393. };
  394. },
  395. props: {
  396. detailData: {
  397. type: Object
  398. }
  399. },
  400. components: {
  401. feeInfo,
  402. checkSchedule,
  403. uploadFile,
  404. check
  405. },
  406. async created() {
  407. if (this.detailData.status == 1) {
  408. this.option.disabled = true;
  409. }
  410. if (this.detailData.id) {
  411. this.getDetail(this.detailData.id);
  412. }
  413. this.tableOption = await this.getColumnData(
  414. this.getColumnName(189),
  415. tableOption
  416. );
  417. getStoragetree().then(res => {
  418. this.storagetreeList = res.data.data;
  419. })
  420. this.getWorkDicts("financing_status").then(res => {
  421. this.findObject(this.option.column, "status").dicData =
  422. res.data.data;
  423. });
  424. this.getWorkDicts("CMY_business_type").then(res => {
  425. this.findObject(this.option.column, "businessType").dicData =
  426. res.data.data;
  427. });
  428. this.getAllWorkDicts()
  429. },
  430. methods: {
  431. check() {
  432. this.checkData = this.$route.query.check
  433. this.checkDialog = true
  434. },
  435. //关闭审核
  436. choceCheckFun() {
  437. this.checkDialog = false;
  438. },
  439. getData() {
  440. getAllgoods().then(res => {
  441. this.findObject(this.tableOption.column, "itemId").dicData =
  442. res.data.data;
  443. })
  444. getStoragetree().then(res => {
  445. this.storagetreeList = res.data.data;
  446. })
  447. this.getStorage()
  448. this.$refs.purchaser.refreshData()
  449. this.$refs.corpId.refreshData()
  450. },
  451. getAllWorkDicts() {
  452. getAllgoods().then(res => {
  453. this.findObject(this.tableOption.column, "itemId").dicData = res.data.data;
  454. })
  455. this.findObject(this.tableOption.column, "itemId").change = (data)=>{
  456. for (let item of this.findObject(this.tableOption.column, "itemId").dicData){
  457. if (data.value == item.id){
  458. this.itemsVOList[data.index].cname = item.cname
  459. }
  460. }
  461. }
  462. this.getWorkDicts("unit").then(res => {
  463. this.findObject(this.tableOption.column, "unit").dicData =
  464. res.data.data;
  465. });
  466. this.getWorkDicts("goods_grade").then(res => {
  467. this.findObject(this.tableOption.column, "grade").dicData =
  468. res.data.data;
  469. });
  470. },
  471. cellStyle() {
  472. return "padding:0;height:40px;";
  473. },
  474. getStorage() {
  475. getStorage({storageTypeId: this.form.storageId}).then(res => {
  476. this.findObject(this.tableOption.column, "storageId").dicData = res.data;
  477. })
  478. },
  479. storagetreeChange(row) {
  480. if (row) {
  481. if (this.itemsVOList.length > 0) {
  482. this.getStorage()
  483. this.itemsVOList.forEach(e => {
  484. e.storageId = null
  485. })
  486. this.$message.warning("请重新选择库区!")
  487. }
  488. } else {
  489. if (this.itemsVOList.length > 0) {
  490. this.findObject(this.tableOption.column, "storageId").dicData = []
  491. this.itemsVOList.forEach(e => {
  492. e.storageId = null
  493. })
  494. this.$message.warning("请重新选择库区!")
  495. }
  496. }
  497. },
  498. getKHData(row) {
  499. this.form.purchaser = row.cname
  500. },
  501. getGYSData(row) {
  502. console.log(row)
  503. this.form.corpName = row.cname
  504. },
  505. choceScheduleFun() {
  506. this.checkScheduleDialog = false
  507. },
  508. addRow() {
  509. this.$refs["form"].validate((valid, done) => {
  510. done();
  511. if (valid) {
  512. this.itemsVOList.push({$cellEdit: true, unit: '1',containerNo:this.form.caseNo});
  513. this.getStorage()
  514. } else {
  515. return false;
  516. }
  517. });
  518. },
  519. rowCell(row, index) {
  520. this.$refs.crud.rowCell(row, index)
  521. },
  522. rowSave(form, done) {
  523. done()
  524. },
  525. addUpdate(form, index, done, loading) {
  526. done()
  527. },
  528. rowDel(row) {
  529. this.$confirm("确定删除数据?", {
  530. confirmButtonText: "确定",
  531. cancelButtonText: "取消",
  532. type: "warning"
  533. }).then(() => {
  534. if (row.id) {
  535. delItem({itemId: row.id,type:"RK"}).then(res => {
  536. this.$message({
  537. type: "success",
  538. message: "删除成功!"
  539. });
  540. this.itemsVOList.splice(row.$index, 1);
  541. });
  542. } else {
  543. this.$message({
  544. type: "success",
  545. message: "删除成功!"
  546. });
  547. this.itemsVOList.splice(row.$index, 1);
  548. }
  549. });
  550. },
  551. getDetail(id) {
  552. this.pageLoading = true;
  553. detail(id)
  554. .then(res => {
  555. this.form = res.data.data;
  556. this.itemsVOList = res.data.data.itemsVOList;
  557. this.orderFeesList = res.data.data.orderFeesList;
  558. this.orderFilesList = res.data.data.orderFilesList;
  559. this.oldform = this.deepClone(res.data.data);
  560. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  561. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  562. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  563. this.getStorage()
  564. })
  565. .finally(() => {
  566. this.pageLoading = false;
  567. });
  568. },
  569. rowPrint(row) {
  570. this.$router.push(`/myiframe/urlPath?name=preview-木材管理-入库垛卡.ureport.xml&src=${this.website.reportUrl}/preview?_u=blade-木材管理-入库垛卡.ureport.xml&id=${row.id}`);
  571. },
  572. //提交撤销
  573. withdraw(type) {
  574. if (type == 0) {
  575. this.$confirm("是否确认提交?", {
  576. confirmButtonText: "确定",
  577. cancelButtonText: "取消",
  578. type: "warning"
  579. }).then(() => {
  580. if (this.itemsVOList.length == 0) {
  581. return this.$message({
  582. type: "warning",
  583. message: "无明细不允许提交!"
  584. });
  585. }
  586. this.subLoading = true;
  587. withdraw({
  588. id: this.form.id,
  589. type: "RK",
  590. status: 1,
  591. isIssue: 1
  592. }).then(res => {
  593. this.$message({
  594. type: "success",
  595. message: "提交成功!"
  596. });
  597. this.getDetail(this.form.id);
  598. this.subLoading = false;
  599. })
  600. })
  601. } else {
  602. this.$confirm("是否确认撤销?", {
  603. confirmButtonText: "确定",
  604. cancelButtonText: "取消",
  605. type: "warning"
  606. }).then(() => {
  607. this.subLoading = true;
  608. withdraw({
  609. id: this.form.id,
  610. type: "RK",
  611. status: 0,
  612. isIssue: 0
  613. }).then(res => {
  614. this.$message({
  615. type: "success",
  616. message: "撤销成功!"
  617. });
  618. this.getDetail(this.form.id);
  619. this.subLoading = false;
  620. })
  621. })
  622. }
  623. },
  624. //修改提交触发
  625. editCustomer(status) {
  626. this.$refs["form"].validate((valid, done) => {
  627. done();
  628. if (valid) {
  629. for (let i = 0; i < this.itemsVOList.length; i++) {
  630. // if (validatenull(this.itemsVOList[i].storageId)) {
  631. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  632. // }
  633. if (validatenull(this.itemsVOList[i].itemId)) {
  634. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  635. }
  636. // if (validatenull(this.itemsVOList[i].itemType)) {
  637. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  638. // }
  639. // if (validatenull(this.itemsVOList[i].grade)) {
  640. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  641. // }
  642. if (validatenull(this.itemsVOList[i].billNo)) {
  643. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  644. }
  645. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  646. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  647. // }
  648. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  649. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  650. }
  651. // if (validatenull(this.itemsVOList[i].unit)) {
  652. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  653. // }
  654. if (this.form.arrival == 1) {
  655. if (validatenull(this.itemsVOList[i].price)) {
  656. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  657. }
  658. }
  659. }
  660. this.itemsVOList.forEach((e, index) => {
  661. e.sort = Number(index) + 1
  662. })
  663. let orderFeesList = this.$refs.feeInfo.submitData();
  664. this.subLoading = true;
  665. let data = {
  666. ...this.form,
  667. billType: 'RK',
  668. itemsVOList: this.itemsVOList,
  669. orderFeesList: orderFeesList,
  670. orderFilesList: this.orderFilesList
  671. };
  672. submit(data).then(res => {
  673. this.form = res.data.data;
  674. this.itemsVOList = res.data.data.itemsVOList;
  675. this.orderFeesList = res.data.data.orderFeesList;
  676. this.orderFilesList = res.data.data.orderFilesList;
  677. this.oldform = this.deepClone(res.data.data);
  678. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  679. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  680. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  681. this.$message({
  682. type: "success",
  683. message: "保存成功!"
  684. });
  685. if (!this.detailData.id){
  686. this.detailData.id = res.data.data.id
  687. }
  688. this.getDetail(res.data.data.id)
  689. }).finally(() => {
  690. this.subLoading = false;
  691. });
  692. } else {
  693. return false;
  694. }
  695. });
  696. },
  697. //请核
  698. auditCheck() {
  699. let orderFeesList = this.$refs.feeInfo.submitData();
  700. if (orderFeesList.length == 0) {
  701. this.$confirm("没有应付费用,是否继续提交?", {
  702. confirmButtonText: "确定",
  703. cancelButtonText: "取消",
  704. type: "warning"
  705. }).then(() => {
  706. this.$confirm("确定审核此订单?", {
  707. confirmButtonText: "确定",
  708. cancelButtonText: "取消",
  709. type: "warning"
  710. }).then(() => {
  711. const data = {
  712. id: this.form.id,
  713. checkType: 'RK',
  714. url: '/purchasingManagement/inStock/index',
  715. pageStatus: "this.$store.getters.entranceXsStatus",
  716. pageLabel: "入库管理",
  717. checkFlag: 1,
  718. }
  719. this.subLoading = true
  720. checkWarehousing(data).then(res => {
  721. if (res.data.success) {
  722. this.$message.success("操作成功!")
  723. }
  724. }).finally(() => {
  725. this.subLoading = false
  726. this.getDetail(this.form.id)
  727. })
  728. })
  729. })
  730. } else {
  731. this.$confirm("确定审核此订单?", {
  732. confirmButtonText: "确定",
  733. cancelButtonText: "取消",
  734. type: "warning"
  735. }).then(() => {
  736. this.subLoading = true
  737. const data = {
  738. id: this.form.id,
  739. checkType: 'RK',
  740. url: '/purchasingManagement/inStock/index',
  741. pageStatus: "this.$store.getters.entranceXsStatus",
  742. pageLabel: "入库管理",
  743. checkFlag: 1,
  744. }
  745. checkWarehousing(data).then(res => {
  746. if (res.data.success) {
  747. this.$message.success("操作成功!")
  748. }
  749. }).finally(() => {
  750. this.subLoading = false
  751. this.getDetail(this.form.id)
  752. })
  753. }).finally(() => {
  754. })
  755. }
  756. },
  757. revokeCheck() {
  758. this.$confirm("确定撤销审核此订单?", {
  759. confirmButtonText: "确定",
  760. cancelButtonText: "取消",
  761. type: "warning"
  762. }).then(() => {
  763. let orderFeesList = this.$refs.feeInfo.submitData();
  764. this.subLoading = true;
  765. let data = {
  766. ...this.form,
  767. billType: 'RK',
  768. itemsVOList: this.itemsVOList,
  769. orderFeesList: orderFeesList,
  770. orderFilesList: this.orderFilesList
  771. };
  772. revokeWarehousing(data).then(res => {
  773. if (res.data.success) {
  774. this.$message.success("操作成功!")
  775. }
  776. }).finally(() => {
  777. this.subLoading = false
  778. this.getDetail(this.form.id)
  779. })
  780. })
  781. },
  782. calculateChange(row) {
  783. row.storageAmount = Number((row.storageInQuantity ? row.storageInQuantity : 0) * (row.price ? row.price : 0)).toFixed(2)
  784. },
  785. beforeFinance(feesData, callback) {
  786. let params = {}
  787. //暂时默认通过 之后优化
  788. params.valid = true
  789. params.parentId = this.form.id
  790. callback(params)
  791. console.log('1111')
  792. },
  793. getTemplate() {
  794. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  795. },
  796. uploadAfter(res, done, loading, column) {
  797. if (!res.message) {
  798. res.forEach(item => {
  799. this.itemsVOList.push({
  800. ...item,
  801. containerNo:this.form.caseNo,
  802. $cellEdit: true
  803. })
  804. })
  805. this.excelBox = false
  806. done();
  807. } else {
  808. loading()
  809. }
  810. },
  811. addData(row) {
  812. if (row == 'purchaserId') {
  813. this.$router.push(`/basicData/customerInformation/index`);
  814. } else if (row == 'corpId') {
  815. this.$router.push(`/basicData/customerManagement/supplierMaterial/index`);
  816. } else if (row == 'storage') {
  817. this.$router.push(`/basicData/basicStorageType/index`);
  818. } else if (row == 'storageId') {
  819. this.$router.push(`/basicData/basicStorageDesc/index`);
  820. } else if (row == 'itemId') {
  821. this.$router.push(`/basicData/commodityType/index`);
  822. }
  823. },
  824. //返回列表
  825. backToList() {
  826. let orderFeesList = this.$refs.feeInfo.submitData();
  827. if (
  828. contrastObj(this.form, this.oldform) ||
  829. contrastList(this.itemsVOList, this.olditemsVOList) ||
  830. contrastList2(orderFeesList, this.oldorderFeesList) ||
  831. contrastList(this.orderFilesList, this.oldorderFilesList)
  832. ) {
  833. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  834. confirmButtonText: "确定",
  835. cancelButtonText: "取消",
  836. type: "warning"
  837. })
  838. .then(() => {
  839. this.editCustomer("goBack");
  840. })
  841. .catch(() => {
  842. this.$emit("goBack");
  843. });
  844. } else {
  845. this.$emit("goBack");
  846. }
  847. },
  848. openEdit() {
  849. this.detailData.status = 2;
  850. this.option.disabled = false;
  851. this.$refs.crud.refreshTable();
  852. },
  853. async saveColumn() {
  854. const inSave = await this.saveColumnData(
  855. this.getColumnName(189),
  856. this.tableOption
  857. );
  858. if (inSave) {
  859. this.$nextTick(() => {
  860. this.$refs.crud.doLayout();
  861. });
  862. this.$message.success("保存成功");
  863. //关闭窗口
  864. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  865. }
  866. },
  867. moveUp(row, index) {
  868. this.itemsVOList[index] = this.itemsVOList.splice(index - 1, 1, row)[0]
  869. },
  870. moveDown(row, index) {
  871. this.itemsVOList[index] = this.itemsVOList.splice(index + 1, 1, row)[0]
  872. },
  873. async resetColumn() {
  874. this.tableOption = tableOption;
  875. const inSave = await this.delColumnData(
  876. this.getColumnName(189),
  877. tableOption
  878. );
  879. if (inSave) {
  880. this.$nextTick(() => {
  881. this.$refs.crud.doLayout();
  882. });
  883. this.$message.success("重置成功");
  884. this.getAllWorkDicts()
  885. this.getStorage()
  886. //关闭窗口
  887. setTimeout(() => {
  888. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  889. }, 1000);
  890. }
  891. }
  892. },
  893. watch: {}
  894. };
  895. </script>
  896. <style lang="scss" scoped>
  897. .trading-form ::v-deep .el-form-item {
  898. margin-bottom: 8px !important;
  899. }
  900. ::v-deep .el-form-item__error {
  901. display: none !important;
  902. }
  903. ::v-deep .select-component {
  904. display: flex !important;
  905. }
  906. ::v-deep .el-table .cell {
  907. padding: 0 2px !important;
  908. }
  909. ::v-deep .avue-crud .el-table .el-form-item__label {
  910. left: -1px;
  911. }
  912. </style>