detailsPage.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  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",
  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. for (let i = 0; i < this.itemsVOList.length; i++) {
  581. // if (validatenull(this.itemsVOList[i].storageId)) {
  582. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  583. // }
  584. if (validatenull(this.itemsVOList[i].itemId)) {
  585. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  586. }
  587. // if (validatenull(this.itemsVOList[i].itemType)) {
  588. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  589. // }
  590. // if (validatenull(this.itemsVOList[i].grade)) {
  591. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  592. // }
  593. if (validatenull(this.itemsVOList[i].billNo)) {
  594. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  595. }
  596. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  597. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  598. // }
  599. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  600. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  601. }
  602. // if (validatenull(this.itemsVOList[i].unit)) {
  603. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  604. // }
  605. if (this.form.arrival == 1) {
  606. if (validatenull(this.itemsVOList[i].price)) {
  607. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  608. }
  609. }
  610. }
  611. this.itemsVOList.forEach((e, index) => {
  612. e.sort = Number(index) + 1
  613. })
  614. let orderFeesList = this.$refs.feeInfo.submitData();
  615. this.subLoading = true;
  616. let data = {
  617. ...this.form,
  618. billType: 'RK',
  619. itemsVOList: this.itemsVOList,
  620. orderFeesList: orderFeesList,
  621. orderFilesList: this.orderFilesList
  622. };
  623. submit(data).then(res => {
  624. this.form = res.data.data;
  625. this.itemsVOList = res.data.data.itemsVOList;
  626. this.orderFeesList = res.data.data.orderFeesList;
  627. this.orderFilesList = res.data.data.orderFilesList;
  628. this.oldform = this.deepClone(res.data.data);
  629. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  630. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  631. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  632. this.$message({
  633. type: "success",
  634. message: "保存成功!"
  635. });
  636. if (!this.detailData.id){
  637. this.detailData.id = res.data.data.id
  638. }
  639. if (this.itemsVOList.length == 0) {
  640. this.subLoading = false
  641. return this.$message({
  642. type: "warning",
  643. message: "无明细不允许提交!"
  644. });
  645. }
  646. withdraw({
  647. id: this.form.id,
  648. type: "RK",
  649. status: 1,
  650. isIssue: 1
  651. }).then(res => {
  652. this.$message({
  653. type: "success",
  654. message: "提交成功!"
  655. });
  656. this.getDetail(this.form.id);
  657. this.subLoading = false;
  658. })
  659. })
  660. })
  661. } else {
  662. this.$confirm("是否确认撤销?", {
  663. confirmButtonText: "确定",
  664. cancelButtonText: "取消",
  665. type: "warning"
  666. }).then(() => {
  667. for (let i = 0; i < this.itemsVOList.length; i++) {
  668. // if (validatenull(this.itemsVOList[i].storageId)) {
  669. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  670. // }
  671. if (validatenull(this.itemsVOList[i].itemId)) {
  672. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  673. }
  674. // if (validatenull(this.itemsVOList[i].itemType)) {
  675. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  676. // }
  677. // if (validatenull(this.itemsVOList[i].grade)) {
  678. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  679. // }
  680. if (validatenull(this.itemsVOList[i].billNo)) {
  681. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  682. }
  683. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  684. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  685. // }
  686. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  687. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  688. }
  689. // if (validatenull(this.itemsVOList[i].unit)) {
  690. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  691. // }
  692. if (this.form.arrival == 1) {
  693. if (validatenull(this.itemsVOList[i].price)) {
  694. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  695. }
  696. }
  697. }
  698. this.itemsVOList.forEach((e, index) => {
  699. e.sort = Number(index) + 1
  700. })
  701. let orderFeesList = this.$refs.feeInfo.submitData();
  702. this.subLoading = true;
  703. let data = {
  704. ...this.form,
  705. billType: 'RK',
  706. itemsVOList: this.itemsVOList,
  707. orderFeesList: orderFeesList,
  708. orderFilesList: this.orderFilesList
  709. };
  710. submit(data).then(res => {
  711. this.form = res.data.data;
  712. this.itemsVOList = res.data.data.itemsVOList;
  713. this.orderFeesList = res.data.data.orderFeesList;
  714. this.orderFilesList = res.data.data.orderFilesList;
  715. this.oldform = this.deepClone(res.data.data);
  716. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  717. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  718. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  719. this.$message({
  720. type: "success",
  721. message: "保存成功!"
  722. });
  723. if (!this.detailData.id){
  724. this.detailData.id = res.data.data.id
  725. }
  726. withdraw({
  727. id: this.form.id,
  728. type: "RK",
  729. status: 0,
  730. isIssue: 0
  731. }).then(res => {
  732. this.$message({
  733. type: "success",
  734. message: "撤销成功!"
  735. });
  736. this.getDetail(this.form.id);
  737. this.subLoading = false;
  738. })
  739. })
  740. })
  741. }
  742. },
  743. //修改提交触发
  744. editCustomer(status) {
  745. this.$refs["form"].validate((valid, done) => {
  746. done();
  747. if (valid) {
  748. for (let i = 0; i < this.itemsVOList.length; i++) {
  749. // if (validatenull(this.itemsVOList[i].storageId)) {
  750. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  751. // }
  752. if (validatenull(this.itemsVOList[i].itemId)) {
  753. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  754. }
  755. // if (validatenull(this.itemsVOList[i].itemType)) {
  756. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  757. // }
  758. // if (validatenull(this.itemsVOList[i].grade)) {
  759. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  760. // }
  761. if (validatenull(this.itemsVOList[i].billNo)) {
  762. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  763. }
  764. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  765. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  766. // }
  767. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  768. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  769. }
  770. // if (validatenull(this.itemsVOList[i].unit)) {
  771. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  772. // }
  773. if (this.form.arrival == 1) {
  774. if (validatenull(this.itemsVOList[i].price)) {
  775. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  776. }
  777. }
  778. }
  779. this.itemsVOList.forEach((e, index) => {
  780. e.sort = Number(index) + 1
  781. })
  782. let orderFeesList = this.$refs.feeInfo.submitData();
  783. this.subLoading = true;
  784. let data = {
  785. ...this.form,
  786. billType: 'RK',
  787. itemsVOList: this.itemsVOList,
  788. orderFeesList: orderFeesList,
  789. orderFilesList: this.orderFilesList
  790. };
  791. submit(data).then(res => {
  792. this.form = res.data.data;
  793. this.itemsVOList = res.data.data.itemsVOList;
  794. this.orderFeesList = res.data.data.orderFeesList;
  795. this.orderFilesList = res.data.data.orderFilesList;
  796. this.oldform = this.deepClone(res.data.data);
  797. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  798. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  799. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  800. this.$message({
  801. type: "success",
  802. message: "保存成功!"
  803. });
  804. if (!this.detailData.id){
  805. this.detailData.id = res.data.data.id
  806. }
  807. this.getDetail(res.data.data.id)
  808. }).finally(() => {
  809. this.subLoading = false;
  810. });
  811. } else {
  812. return false;
  813. }
  814. });
  815. },
  816. //请核
  817. auditCheck() {
  818. let orderFeesList = this.$refs.feeInfo.submitData();
  819. if (orderFeesList.length == 0) {
  820. this.$confirm("没有应付费用,是否继续提交?", {
  821. confirmButtonText: "确定",
  822. cancelButtonText: "取消",
  823. type: "warning"
  824. }).then(() => {
  825. this.$confirm("确定审核此订单?", {
  826. confirmButtonText: "确定",
  827. cancelButtonText: "取消",
  828. type: "warning"
  829. }).then(() => {
  830. for (let i = 0; i < this.itemsVOList.length; i++) {
  831. // if (validatenull(this.itemsVOList[i].storageId)) {
  832. // return this.$message.error('请完善第' + (i + 1) + '行的库区')
  833. // }
  834. if (validatenull(this.itemsVOList[i].itemId)) {
  835. return this.$message.error('请完善第' + (i + 1) + '行的品名')
  836. }
  837. // if (validatenull(this.itemsVOList[i].itemType)) {
  838. // return this.$message.error('请完善第' + (i + 1) + '行的品牌')
  839. // }
  840. // if (validatenull(this.itemsVOList[i].grade)) {
  841. // return this.$message.error('请完善第' + (i + 1) + '行的等级')
  842. // }
  843. if (validatenull(this.itemsVOList[i].billNo)) {
  844. return this.$message.error('请完善第' + (i + 1) + '行的捆包号')
  845. }
  846. // if (validatenull(this.itemsVOList[i].sliceNumber)) {
  847. // return this.$message.error('请完善第' + (i + 1) + '行的片数')
  848. // }
  849. if (validatenull(this.itemsVOList[i].storageInQuantity)) {
  850. return this.$message.error('请完善第' + (i + 1) + '行的入库量')
  851. }
  852. // if (validatenull(this.itemsVOList[i].unit)) {
  853. // return this.$message.error('请完善第' + (i + 1) + '行的入库单位')
  854. // }
  855. if (this.form.arrival == 1) {
  856. if (validatenull(this.itemsVOList[i].price)) {
  857. return this.$message.error('请完善第' + (i + 1) + '行的入库单价')
  858. }
  859. }
  860. }
  861. this.itemsVOList.forEach((e, index) => {
  862. e.sort = Number(index) + 1
  863. })
  864. let orderFeesList = this.$refs.feeInfo.submitData();
  865. this.subLoading = true;
  866. let data = {
  867. ...this.form,
  868. billType: 'RK',
  869. itemsVOList: this.itemsVOList,
  870. orderFeesList: orderFeesList,
  871. orderFilesList: this.orderFilesList
  872. };
  873. submit(data).then(res => {
  874. this.form = res.data.data;
  875. this.itemsVOList = res.data.data.itemsVOList;
  876. this.orderFeesList = res.data.data.orderFeesList;
  877. this.orderFilesList = res.data.data.orderFilesList;
  878. this.oldform = this.deepClone(res.data.data);
  879. this.olditemsVOList = this.deepClone(res.data.data.itemsVOList);
  880. this.oldorderFeesList = this.deepClone(res.data.data.orderFeesList);
  881. this.oldorderFilesList = this.deepClone(res.data.data.orderFilesList);
  882. this.$message({
  883. type: "success",
  884. message: "保存成功!"
  885. });
  886. if (!this.detailData.id){
  887. this.detailData.id = res.data.data.id
  888. }
  889. const datat = {
  890. id: this.form.id,
  891. checkType: 'RK',
  892. url: '/purchasingManagement/inStock/index',
  893. pageStatus: "this.$store.getters.entranceXsStatus",
  894. pageLabel: "入库管理",
  895. checkFlag: 1,
  896. }
  897. checkWarehousing(datat).then(res => {
  898. if (res.data.success) {
  899. this.$message.success("操作成功!")
  900. }
  901. }).finally(() => {
  902. this.subLoading = false
  903. this.getDetail(this.form.id)
  904. })
  905. })
  906. })
  907. })
  908. } else {
  909. this.$confirm("确定审核此订单?", {
  910. confirmButtonText: "确定",
  911. cancelButtonText: "取消",
  912. type: "warning"
  913. }).then(() => {
  914. this.subLoading = true
  915. const data = {
  916. id: this.form.id,
  917. checkType: 'RK',
  918. url: '/purchasingManagement/inStock/index',
  919. pageStatus: "this.$store.getters.entranceXsStatus",
  920. pageLabel: "入库管理",
  921. checkFlag: 1,
  922. }
  923. checkWarehousing(data).then(res => {
  924. if (res.data.success) {
  925. this.$message.success("操作成功!")
  926. }
  927. }).finally(() => {
  928. this.subLoading = false
  929. this.getDetail(this.form.id)
  930. })
  931. }).finally(() => {
  932. })
  933. }
  934. },
  935. revokeCheck() {
  936. this.$confirm("确定撤销审核此订单?", {
  937. confirmButtonText: "确定",
  938. cancelButtonText: "取消",
  939. type: "warning"
  940. }).then(() => {
  941. let orderFeesList = this.$refs.feeInfo.submitData();
  942. this.subLoading = true;
  943. let data = {
  944. ...this.form,
  945. billType: 'RK',
  946. itemsVOList: this.itemsVOList,
  947. orderFeesList: orderFeesList,
  948. orderFilesList: this.orderFilesList
  949. };
  950. revokeWarehousing(data).then(res => {
  951. if (res.data.success) {
  952. this.$message.success("操作成功!")
  953. }
  954. }).finally(() => {
  955. this.subLoading = false
  956. this.getDetail(this.form.id)
  957. })
  958. })
  959. },
  960. calculateChange(row) {
  961. row.storageAmount = Number((row.storageInQuantity ? row.storageInQuantity : 0) * (row.price ? row.price : 0)).toFixed(2)
  962. },
  963. beforeFinance(feesData, callback) {
  964. let params = {}
  965. //暂时默认通过 之后优化
  966. params.valid = true
  967. params.parentId = this.form.id
  968. callback(params)
  969. console.log('1111')
  970. },
  971. getTemplate() {
  972. window.open(`/api/trade-purchase/woodHarvestingCloud/export-template?${this.website.tokenHeader}=${getToken()}`)
  973. },
  974. uploadAfter(res, done, loading, column) {
  975. if (!res.message) {
  976. res.forEach(item => {
  977. this.itemsVOList.push({
  978. ...item,
  979. containerNo:this.form.caseNo,
  980. $cellEdit: true
  981. })
  982. })
  983. this.excelBox = false
  984. done();
  985. } else {
  986. loading()
  987. }
  988. },
  989. addData(row) {
  990. if (row == 'purchaserId') {
  991. this.$router.push(`/basicData/customerInformation/index`);
  992. } else if (row == 'corpId') {
  993. this.$router.push(`/basicData/customerManagement/supplierMaterial/index`);
  994. } else if (row == 'storage') {
  995. this.$router.push(`/basicData/basicStorageType/index`);
  996. } else if (row == 'storageId') {
  997. this.$router.push(`/basicData/basicStorageDesc/index`);
  998. } else if (row == 'itemId') {
  999. this.$router.push(`/basicData/commodityType/index`);
  1000. }
  1001. },
  1002. //返回列表
  1003. backToList() {
  1004. let orderFeesList = this.$refs.feeInfo.submitData();
  1005. if (
  1006. contrastObj(this.form, this.oldform) ||
  1007. contrastList(this.itemsVOList, this.olditemsVOList) ||
  1008. contrastList2(orderFeesList, this.oldorderFeesList) ||
  1009. contrastList(this.orderFilesList, this.oldorderFilesList)
  1010. ) {
  1011. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1012. confirmButtonText: "确定",
  1013. cancelButtonText: "取消",
  1014. type: "warning"
  1015. })
  1016. .then(() => {
  1017. this.editCustomer("goBack");
  1018. })
  1019. .catch(() => {
  1020. this.$emit("goBack");
  1021. });
  1022. } else {
  1023. this.$emit("goBack");
  1024. }
  1025. },
  1026. openEdit() {
  1027. this.detailData.status = 2;
  1028. this.option.disabled = false;
  1029. this.$refs.crud.refreshTable();
  1030. },
  1031. async saveColumn() {
  1032. const inSave = await this.saveColumnData(
  1033. this.getColumnName(189),
  1034. this.tableOption
  1035. );
  1036. if (inSave) {
  1037. this.$nextTick(() => {
  1038. this.$refs.crud.doLayout();
  1039. });
  1040. this.$message.success("保存成功");
  1041. //关闭窗口
  1042. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1043. }
  1044. },
  1045. moveUp(row, index) {
  1046. this.itemsVOList[index] = this.itemsVOList.splice(index - 1, 1, row)[0]
  1047. },
  1048. moveDown(row, index) {
  1049. this.itemsVOList[index] = this.itemsVOList.splice(index + 1, 1, row)[0]
  1050. },
  1051. async resetColumn() {
  1052. this.tableOption = tableOption;
  1053. const inSave = await this.delColumnData(
  1054. this.getColumnName(189),
  1055. tableOption
  1056. );
  1057. if (inSave) {
  1058. this.$nextTick(() => {
  1059. this.$refs.crud.doLayout();
  1060. });
  1061. this.$message.success("重置成功");
  1062. this.getAllWorkDicts()
  1063. this.getStorage()
  1064. //关闭窗口
  1065. setTimeout(() => {
  1066. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1067. }, 1000);
  1068. }
  1069. }
  1070. },
  1071. watch: {}
  1072. };
  1073. </script>
  1074. <style lang="scss" scoped>
  1075. .trading-form ::v-deep .el-form-item {
  1076. margin-bottom: 8px !important;
  1077. }
  1078. ::v-deep .el-form-item__error {
  1079. display: none !important;
  1080. }
  1081. ::v-deep .select-component {
  1082. display: flex !important;
  1083. }
  1084. ::v-deep .el-table .cell {
  1085. padding: 0 2px !important;
  1086. }
  1087. ::v-deep .avue-crud .el-table .el-form-item__label {
  1088. left: -1px;
  1089. }
  1090. </style>