1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList(0)">返回列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.id"
- @click="confirmEditing">编辑
- </el-button>
- <el-button class="el-button--small-yh" type="primary" :disabled="isButton" size="small"
- v-if="form.statusName != '已入库'" @click="editCustomer">保存数据
- </el-button>
- <el-button class="el-button--small-yh" type="success" size="small"
- v-if="form.statusName == '待入库' || form.statusName == '已撤销'" @click="complete" :disabled="isButton">入库完成
- </el-button>
- <el-button class="el-button--small-yh" type="success" size="small" v-if="form.statusName == '已入库'"
- @click="revoke" :disabled="isButton">撤销入库
- </el-button>
- </div>
- </div>
- <div style="margin-top: 50px">
- <trade-card title="基础信息">
- <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
- </trade-card>
- <trade-card title="明细信息">
- <el-tabs v-model="activeName" type="card">
- <el-tab-pane label="入库明细" name="sale_detail">
- <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
- :data="form.shipItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
- @selection-change="selectionContacts"
- @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 274.1)"
- @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 274.1)">
- <!--<template slot-scope="{ row }" slot="dot">-->
- <!-- <el-select v-model="row.dot" placeholder="请选择">-->
- <!-- <el-option-->
- <!-- v-for="item in options"-->
- <!-- :key="item.value"-->
- <!-- :label="item.label"-->
- <!-- :value="item.value">-->
- <!-- </el-option>-->
- <!-- </el-select>-->
- <!--</template>-->
- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
- <el-button :size="size" :disabled="disabled || isEdit" :type="type"
- :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="rowEdit(row, index)">
- {{ row.$cellEdit ? '保存' : '编辑' }}
- </el-button>
- <el-button icon="el-icon-delete" :size="size"
- :disabled="disabled || form.statusName == '已入库' || isEdit || isEdits" :type="type"
- @click="rowDelBox(row, index)">删除
- </el-button>
- </template>
- <template slot-scope="{scope,row}" slot="menuLeft">
- <!-- <el-button type="primary" icon="el-icon-plus" size="small" @click="rowAdd(row, score)"
- :disabled="isrowAdd">添加商品</el-button>
- <el-button type="success" size="small" :disabled="isrowAdd" icon="el-icon-bottom" @click="excelBox = true">导入
- </el-button> -->
- <el-button type="primary" icon="el-icon-printer" size="small"
- @click="handlePrint">打印</el-button>
- <el-button type="danger" plain size="small"
- :disabled="disabled || form.statusName == '已入库' || isEdit || isEdits"
- @click="batchDelete">一键删除</el-button>
- </template>
- </avue-crud>
- </el-tab-pane>
- <el-tab-pane label="采购信息" name="payment_details">
- <avue-crud :option="optionPaymentDetails" ref="payment_details" :data="form.shipVOList" :key="key"
- @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 274.2)"
- @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 274.2)">
- </avue-crud>
- </el-tab-pane>
- <el-tab-pane label="历史记录" name="outbound_records">
- <avue-crud :option="optionOutboundRecords" ref="outbound_records" :data="form.historyList"
- :key="key"
- @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 274.3)"
- @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 274.3)">
- </avue-crud>
- </el-tab-pane>
- </el-tabs>
- </trade-card>
- <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="入库工单"
- @onClose="onClose()"></report-dialog>
- <containerTitle title="上传附件"></containerTitle>
- <c-upload v-loading="loadingBtn" typeUpload="LT" :disabled="isEdit"
- deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="filesList" display
- :enumerationValue="35.1"></c-upload>
- </div>
- <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
- :close-on-click-modal="false" v-dialog-drag>
- <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore"
- :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="derivation">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getDetails,
- tradingBox,
- submit,
- warehousingComplete,
- revoke,
- goodsDetail,
- dotList,
- getWarehouseKeeper,
- dotListAll
- } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
- import { dateFormat } from "@/util/date";
- import { getToken } from "@/util/auth";
- import { getMenu } from "@/api/system/menu";
- import reportDialog from "@/components/report-dialog/main";
- import { corpsDescListAll } from "@/api/tirePartsMall/salesManagement/saleOrder";
- export default {
- name: "detailsPage",
- data() {
- return {
- // 上传附件的需要参数
- loadingBtn: false,
- filesList: [],
- switchDialog: false,
- isEdit: false,
- values: '',
- isEdits: false,
- isButton: false,
- activeName: "sale_detail",
- disabled: false,
- isrowAdd: true,
- excelBox: false,
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24
- },
- {
- label: "导入明细",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "上传中,请稍等",
- accept: '.xls,.xlsx',
- span: 24,
- propsHttp: {
- res: "data"
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/blade-sales-part/ship/import-item"
- }
- ]
- },
- excelForm: {},
- form: {
- shipItemsList: [],
- shipVOList: [],
- historyList: []
- },
- key: 0,
- optionForm: {
- disabled: false,
- menuBtn: false,
- labelWidth: 100,
- columnBtn: false,
- span: 8,
- column: [
- {
- label: "业务对象",
- prop: "customerId",
- disabled: false,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicData: [],
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ],
- change: ({ value, column }) => {
- if (this.form.billno.indexOf('TK') != -1) {
- this.corpsDescListAllfun('KH')
- } else {
- this.corpsDescListAllfun('GYS')
- }
- }
- },
- {
- label: "仓库",
- prop: "storageId",
- search: true,
- overHidden: true,
- type: 'select',
- dicUrl: "/api/blade-sales-part/storageDesc/listAll",
- disabled: false,
- props: {
- label: 'cname',
- value: 'id'
- },
- rules: [
- {
- required: true,
- message: " ",
- trigger: "blur"
- }
- ],
- // change:(data)=>{
- // // console.log(this.$refs);
- // getWarehouseKeeper({salesCompanyId:this.form.storageId}).then((res)=>{
- // console.log(res.data.data);
- // this.form.stockClerkId = res.data.data[0].id
- // })
- // }
- },
- {
- label: '库管',
- prop: "stockClerkId",
- type: 'select',
- disabled: false,
- props: {
- label: 'realName',
- value: 'id'
- },
- dicUrl: '/api/blade-user/stockClerkList',
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- },
- {
- label: "订单数量",
- prop: "goodsTotalNum",
- search: false,
- overHidden: true,
- disabled: true,
- // width: 120,
- // rules: [
- // {
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }
- // ]
- },
- {
- label: "入库数量",
- prop: "sendTotalNum",
- search: false,
- overHidden: true,
- disabled: true,
- },
- {
- label: "业务日期",
- prop: "createTime",
- disabled: false,
- type: "datetime",
- value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ]
- },
- {
- label: "入库单号",
- prop: "billno",
- disabled: true,
- },
- {
- label: "来源单号",
- prop: "ordNo",
- disabled: true,
- }, {
- label: '备注',
- disabled: false,
- prop: "remarks",
- type: 'textarea',
- span: 16,
- minRows: 1
- }
- ]
- },
- formContacts: {},
- optionContacts: {},
- optionContactsBack: {
- dialogDrag: true,
- cancelBtn: false,
- disabled: false,
- align: "center",
- index: true,
- addBtn: false, // 新增按钮
- addBtnText: "录入明细",
- refreshBtn: false,
- editBtn: false, // 修改按钮
- delBtn: false, //删除按钮
- border: true,
- menuWidth: 160,
- stripe: true,
- span: 8,
- addRowBtn: false,
- menu: true, // 是否员操作栏
- dialogTop: 25,
- dialogWidth: "80%",
- showSummary: true,
- saveBtn: false, // 表格弹窗保存按钮
- cellBtn: false, // 行编辑
- selection: true,
- sumColumnList: [
- {
- name: 'sendNum',
- type: 'sum',
- }, {
- name: 'goodsNum',
- type: 'sum',
- }
- ],
- column: [{
- label: '商品名称',
- prop: 'goodsId',
- width: 200,
- overHidden: true,
- disabled: false,
- filterable: true,
- hide: true,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
- }, {
- label: '商品名称',
- prop: 'goodsName',
- width: 200,
- overHidden: true,
- disabled: false,
- filterable: true,
- },
- // {
- // label: "价格",
- // prop: "price",
- // disabled: false,
- // ovrHidden: true,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }, {
- // validator: (rule, value, callback) => {
- // if (value < 0) {
- // callback(new Error("单价不能小于0"));
- // } else {
- // callback();
- // }
- // },
- // trigger: "blur"
- // }]
- // },
- {
- label: "到货数量",
- prop: "sendNum",
- width: 100,
- cell: true,
- disabled: false,
- overHidden: true,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- if (value < 0) {
- callback(new Error("实际数量不能小于0"));
- } else {
- callback();
- }
- },
- trigger: "blur"
- }]
- }, {
- label: "批次号",
- cell: true,
- width: 120,
- prop: "dot",
- type: "select",
- disabled: false,
- allowCreate: true,
- filterable: true,
- dicData: [],
- props: {
- label: "dot",
- value: "dot"
- },
- overHidden: true
- }, {
- label: '商品编码',
- prop: 'goodsNo',
- overHidden: true,
- disabled: false,
- width: 140
- // }, {
- // label: "品牌",
- // prop: 'brandId',
- // width: 100,
- // overHidden: true,
- // disabled: false,
- // type: 'select',
- // props: {
- // label: 'cname',
- // value: 'id'
- // },
- // dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP'
- // }, {
- }, {
- label: "品牌",
- prop: "brandName",
- disabled: false,
- overHidden: true
- }, {
- label: "规格型号",
- prop: "propertyName",
- overHidden: true,
- disabled: false,
- // rules: [{
- // required: true,
- // message: " ",
- // trigger: "blur"
- // }]
- }, {
- label: "花纹",
- prop: "pattern",
- disabled: false,
- overHidden: true
- }, {
- label: "商品描述",
- prop: "goodsDescription",
- disabled: false,
- overHidden: true
- }, {
- label: "单位",
- prop: 'units',
- type: "select",
- disabled: false,
- props: {
- label: "dictValue",
- value: "dictValue"
- },
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit"
- }, {
- label: "入库数量",
- prop: "goodsNum",
- disabled: true,
- ovrHidden: true,
- }, {
- label: "备注",
- cell: true,
- prop: "remarks",
- width: 150,
- span: 16,
- disabled: false,
- overHidde: true
- }]
- },
- selectionMultilist: [], // 多选数据
- optionPaymentDetails: {},
- optionPaymentDetailsBack: {
- align: "center",
- addBtn: false,
- refreshBtn: false,
- editBtn: false,
- delBtn: false,
- border: true,
- menuWidth: 120,
- stripe: true,
- index: true,
- menu: false,
- column: [
- {
- label: "入库单号",
- prop: "billno",
- disabled: true
- },
- {
- label: "来源单号",
- prop: "ordNo",
- disabled: true
- },
- // {
- // label: "业务来源",
- // prop: "stockTime",
- // type: "date",
- // searchRange: true,
- // searchDefaultTime: [
- // "00:00:00",
- // "23:59:59"
- // ],
- // format: "yyyy-MM-dd",
- // valueFormat: "yyyy-MM-dd HH:mm:ss",
- // overHidden: true
- // },
- {
- label: "地址",
- prop: "recAddress",
- overHidden: true,
- },
- {
- prop: "contacts",
- label: "联系人",
- overHidden: true
- },
- {
- prop: "phone",
- label: "电话",
- overHidden: true
- },
- {
- prop: "remarks",
- label: "备注",
- disabled: false,
- overHidden: true
- }
- ]
- },
- optionOutboundRecords: {},
- optionOutboundRecordsBack: {
- align: "center",
- addBtn: false,
- refreshBtn: false,
- editBtn: false,
- delBtn: false,
- border: true,
- menuWidth: 120,
- index: true,
- stripe: true,
- menu: false,
- column: [{
- prop: "operatorName",
- label: "操作人",
- overHidden: true,
- showColumn: false,
- width: 120,
- }, {
- prop: "operateStatus",
- label: "状态",
- overHidden: true,
- }, {
- prop: "operateTime",
- label: "时间",
- overHidden: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- }]
- }
- }
- },
- props: {
- onLoad: Object,
- detailData: Object
- },
- async created() {
- this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
- console.log(value);
- this.values = value
- console.log('this.formContacts.goodsId', this.formContacts.goodsId);
- if (this.formContacts.goodsId !== value) {
- dotListAll({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => { this.formContacts.price = res.data.data[0].inventoryCostPrice, console.log(res) })
- goodsDetail({ id: value, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
- console.log(this.form.storageId);
- this.formContacts.goodsNo = res.data.data.code
- this.formContacts.brandId = res.data.data.brandId
- this.formContacts.brandName = res.data.data.brandName
- this.formContacts.propertyName = res.data.data.specificationAndModel
- this.formContacts.pattern = res.data.data.brandItem
- this.formContacts.goodsDescription = res.data.data.goodsDescription
- this.formContacts.units = res.data.data.unit
- this.findObject(this.optionContacts.column, "goodsNum").disabled = true
- if (res.data.data.whether == 0) {
- this.findObject(this.optionContacts.column, "dot").disabled = true
- } else {
- this.findObject(this.optionContacts.column, "dot").disabled = false
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- console.log('dot', res);
- this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
- })
- }
- })
- }
- }
- this.optionContacts = await this.getColumnData(this.getColumnName(274.1), this.optionContactsBack);
- this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
- console.log(value);
- console.log(this.form.storageId);
- this.values = value
- if (this.formContacts.goodsId !== value) {
- dotListAll({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => { this.formContacts.price = res.data.data[0].inventoryCostPrice })
- goodsDetail({ id: value, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
- this.formContacts.goodsNo = res.data.data.code
- this.formContacts.brandId = res.data.data.brandId
- this.formContacts.brandName = res.data.data.brandName
- this.formContacts.propertyName = res.data.data.specificationAndModel
- this.formContacts.pattern = res.data.data.brandItem
- this.formContacts.goodsDescription = res.data.data.goodsDescription
- this.formContacts.units = res.data.data.unit
- this.findObject(this.optionContacts.column, "goodsNum").disabled = true
- if (res.data.data.whether == 0) {
- this.findObject(this.optionContacts.column, "dot").disabled = true
- } else {
- this.findObject(this.optionContacts.column, "dot").disabled = false
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- console.log('567');
- this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
- })
- }
- })
- }
- }
- this.optionPaymentDetails = await this.getColumnData(this.getColumnName(274.2), this.optionPaymentDetailsBack);
- this.optionOutboundRecords = await this.getColumnData(this.getColumnName(274.3), this.optionOutboundRecordsBack);
- this.key++
- this.isButton = true
- if (this.onLoad.id && this.detailData.id) {
- this.refresh(this.onLoad.id, true)
- this.$set(this.optionForm, 'disabled', true)
- this.$set(this.optionContactsBack, 'disabled', true)
- } else if (this.onLoad.id) {
- console.log(2);
- this.refresh(this.onLoad.id, true)
- }
- if (!this.form.id) {
- this.isEdit = true
- // this.$set(this.optionContactsBack, "addBtn", false)
- this['optionContacts'] = this['optionContactsBack'];
- this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
- }
- if (!this.onLoad.id) {
- this.isrowAdd = false
- this.isEdit = false
- // this.$set(this.optionForm,'disabled',false)
- // this.$set(this.optionContacts,'disabled',false)
- }
- if (this.detailData.id) {
- this.refresh()
- }
- if (this.$route.query.srcId) {
- this.refresh(this.$route.query.srcId)
- }
- this.$store.commit("DOMIO_IN_DETAIL");
- },
- components: {
- reportDialog
- },
- activated() {
- this.$store.commit("DOMIO_IN_DETAIL");
- },
- methods: {
- rowAdd(row, score) {
- console.log(123214);
- this.optionContactsBack.column.forEach(its => {
- if (its.prop == 'goodsNum' || its.prop == 'goodsNo' || its.prop == 'brandId' || its.prop == 'propertyName' || its.prop == 'pattern' || its.prop == 'goodsDescription' || its.prop == 'units') {
- this.$set(its, 'disabled', true)
- } else {
- this.$set(its, 'disabled', false)
- }
- })
- this.$refs.formContacts.rowAdd()
- },
- derivation() {
- window.open(
- `/api/blade-sales-part/ship/export-item?${this.website.tokenHeader
- }=${getToken()}`
- );
- },
- uploadAfter(res, done, loading, column) {
- if (res instanceof Array) {
- this.form.shipItemsList = this.form.shipItemsList.concat(res)
- }
- this.excelBox = false;
- loading = false;
- done();
- },
- uploadBefore(file, done, loading) {
- done();
- loading = true;
- },
- //撤销
- revoke() {
- this.$refs["form"].validate((valid, done) => {
- console.log(valid, 'valid')
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- revoke({
- ...this.form,
- bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
- }).then(res => {
- this.$message.success("撤销成功");
- this.refresh(res.data.data.id)
- loading.close();
- }).finally(() => {
- loading.close();
- });
- }
- })
- },
- //编辑
- confirmEditing() {
- this.isButton = false
- if (this.form.statusName == '待入库' || this.form.statusName == '已撤销') {
- this.isEdit = false
- this.isrowAdd = false
- this.$set(this.optionForm, 'disabled', false)
- this.$set(this.optionContacts, 'disabled', false)
- this.optionForm.column.forEach(item => {
- if (item.prop == 'remarks' || item.prop == 'createTime' || item.prop == 'stockClerkId' || item.prop == 'storageId') {
- this.$set(item, 'disabled', false)
- } else {
- this.$set(item, 'disabled', true)
- }
- })
- this.optionContacts.column.forEach(item => {
- if (item.prop == 'remarks' || item.prop == 'dot' || item.prop == 'sendNum') {
- this.$set(item, 'disabled', false)
- } else {
- this.$set(item, 'disabled', true)
- }
- })
- if (this.form.billno.substring(0, 4) == 'TKSH') {
- // this.isEdit = true
- this.isEdits = true
- this.isrowAdd = true
- this.optionContacts.column.forEach(item => {
- if (item.prop == 'remarks' || item.prop == 'sendNum' || item.prop == 'price' || item.prop == 'dot') {
- this.$set(item, 'disabled', false)
- } else {
- this.$set(item, 'disabled', true)
- }
- })
- }
- } else if (this.form.statusName == '已入库') {
- this.$set(this.optionForm, 'disabled', false)
- this.$set(this.optionContactsBack, 'disabled', false)
- this.optionForm.column.forEach(item => {
- if (item.prop == 'remarks') {
- this.$set(item, 'disabled', false)
- } else {
- this.$set(item, 'disabled', true)
- }
- })
- this.optionContactsBack.column.forEach(item => {
- if (item.prop == 'remarks') {
- this.$set(item, 'disabled', false)
- } else {
- this.$set(item, 'disabled', true)
- }
- })
- }
- console.log(this.form.shipItemsList[0].goodsId);
- goodsDetail({ id: this.form.shipItemsList[0].goodsId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
- if (res.data.data.whether == 0) {
- this.findObject(this.optionContacts.column, "dot").disabled = true
- } else {
- this.findObject(this.optionContacts.column, "dot").disabled = false
- dotList({
- storageId: this.form.storageId,
- goodsId: this.formContacts.goodsId
- }).then(res => {
- console.log('567');
- this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
- })
- }
- })
- },
- complete() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- this.form.customerName = this.form.$customerId
- submit({
- ...this.form,
- bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
- }).then(res => {
- warehousingComplete({
- ...this.form,
- bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
- }).then(res => {
- this.refresh(res.data.data.id)
- this.$set(this.optionForm, 'disabled', true)
- this.$set(this.optionContactsBack, 'disabled', true)
- this.isEdit = true
- this.$message.success("入库完成");
- loading.close();
- }).finally(() => {
- loading.close();
- });
- })
- }
- })
- },
- //修改提交触发
- editCustomer() {
- if (this.form.shipItemsList.length == 0) {
- return this.$message.warning('请明细不能为空')
- }
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- this.form.customerName = this.form.$customerId
- this.form.shipItemsList.map(item => {
- item.$cellEdit = false
- })
- submit({
- ...this.form,
- bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD",
- filesList: this.filesList
- }).then(res => {
- this.$message.success("保存成功");
- this.refresh(res.data.data.id);
- loading.close();
- }).finally(() => {
- loading.close();
- });
- } else {
- return false;
- }
- });
- },
- refresh(id, type) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- })
- if (!this.detailData.id) {
- getDetails({ id: id }).then(res => {
- this.form = res.data.data
- this.filesList = res.data.data.filesList
- loading.close();
- }).catch(() => {
- loading.close();
- })
- } else {
- getDetails({ id: this.detailData.id }).then(res => {
- this.form = res.data.data
- this.filesList = res.data.data.filesList
- loading.close();
- }).catch(() => {
- loading.close();
- })
- }
- },
- // 获取业务对象
- corpsDescListAllfun(corpType) {
- corpsDescListAll({ corpType }).then(res => {
- this.optionForm.column[0].dicData = res.data.data
- })
- },
- //编辑
- rowEdit(row, index) {
- if (row.$cellEdit) {
- this.$set(row, '$cellEdit', false)
- } else {
- this.$set(row, '$cellEdit', true)
- }
- // this.confirmEditing()
- dotList({
- storageId: this.form.storageId,
- goodsId: row.goodsId
- }).then(res => {
- this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
- // console.log(this.dicData)
- })
- console.log(this.optionContacts, 802)
- // this.$refs.formContacts.rowEdit(row, index)
- },
- rowDelBox(row, index) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- tradingBox(row.id).then(res => {
- this.form.shipItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- });
- } else {
- this.form.shipItemsList.splice(index, 1);
- this.$message.success("操作成功!");
- }
- }
- );
- },
- // 明细信息多选
- selectionContacts(list) {
- this.selectionMultilist = list
- },
- // 一键删除
- batchDelete() {
- if (this.selectionMultilist.length == 0) {
- return this.$message.warning('请选择要删除的数据')
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- let multiList = this.selectionMultilist
- let arr = this.form.shipItemsList
- // 获取有id 的数据
- const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
- let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
- // 把选中的删除掉
- multiList.forEach((item) => {
- for (let index in arr) {
- if (JSON.stringify(item) == JSON.stringify(arr[index])) {
- arr.splice(Number(index), 1)
- }
- }
- })
- // 有id 的处理
- if (itemsWithId.length != 0) {
- tradingBox(arrIds.join(',')).then(res => {
- this.$message.success("操作成功!");
- });
- }
- })
- },
- rowSave(form, done, loading) {
- console.log(form)
- done(form)
- },
- // 更新数据后确定触发该事件
- rowUpdate(form, index, done, loading) {
- console.log(form)
- done(form);
- },
- handlePrint() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口b
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- backToList(type) {
- this.$emit("backToList", type);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- </style>
|