1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087 |
- <template>
- <div>
- <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules">
- <zj-form-module title="调拨单" :form-data="formData" :form-items="formItems" label-width="100px" :column="3" />
- <zj-form-module title="调拨单明细" :form-items="detailData" label-width="0" :column="3" />
- <zj-form-module
- v-if="moduleType === 2"
- title="物流费用"
- :form-items="formLogisticsData"
- label-width="0"
- :column="3"
- />
- <zj-form-module
- v-if="moduleType === 3"
- title="审核信息"
- :form-data="formData"
- :form-items="formExamine"
- label-width="100px"
- :column="3"
- />
- </zj-form-container>
- <el-dialog title="添加产品" :visible.sync="visible" width="60%" :append-to-body="true" @close="visible = false">
- <div style="height: 600px">
- <template-page
- ref="pageRef"
- style="height: 100%"
- :get-list="getList"
- :column-parsing="columnParsing"
- :table-attributes="tableAttributes"
- :table-events="tableEvents"
- />
- </div>
- <span slot="footer">
- <el-button type="primary" @click="handleAddData">提交</el-button>
- </span>
- </el-dialog>
- <!-- 新增 -->
- <div v-if="!comDisabled">
- <template v-if="moduleType === 1">
- <el-button type="primary" size="mini" @click="onSubmit('WAIT')">提交</el-button>
- <el-button size="mini" @click="onSubmit('SAVE')">保存</el-button>
- </template>
- <template v-else>
- <el-button type="primary" size="mini" @click="onSubmit">编辑</el-button>
- </template>
- <el-button size="mini" @click="onReset">重置</el-button>
- </div>
- <!-- 审核 /详情-->
- <div v-if="moduleType === 3 || moduleType === 2">
- <el-button v-if="moduleType === 3" type="primary" size="mini" @click="onExamine('OK')">同意</el-button>
- <el-button v-if="formData.status === 'OK'" size="mini" @click="onInvoice('WAIT')">反审</el-button>
- </div>
- </div>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import { getcustomerFrontList } from '@/api/stock'
- import { getListCostBillV2 } from '@/api/logisticsBill'
- import { debounce } from '@/utils/common'
- import { getStagecustomerListV2, getDealerListV2 } from '@/api/basic_data/dealer'
- import {
- addCustomerTransfer,
- updateCustomerTransfer,
- getCustomerTransferDetail,
- examineCustomerTransfer,
- setNeExamine
- } from '@/api/transferOrder'
- import { mapGetters } from 'vuex'
- export default {
- components: { TemplatePage },
- props: {
- edit: {
- type: Boolean,
- default: false
- },
- detailsId: {
- type: String,
- default: null
- },
- moduleType: {
- type: Number,
- default: null
- }
- },
- data() {
- return {
- visible: false,
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: true,
- selectable: this.selectable
- }, // 关闭新增弹窗
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- itemTableEvents: { 'selection-change': this.itemSelectionChange },
- defaultTableAttributes: {
- border: true,
- headerCellClassName: 'headerRowColor',
- size: 'mini',
- 'summary-method': this.$getSummaries,
- 'show-summary': true
- },
- recordSelected: [],
- formData: {
- customerNumber: '',
- customerName: '',
- transferTime: '',
- createBy: '',
- transferCustomerNumber: '',
- transferCustomerName: '',
- stockType: '',
- createTime: '',
- notes: ''
- },
- formRules: {
- customerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
- customerName: [{ required: true, message: '请输入', trigger: 'blur' }],
- transferTime: [{ required: true, message: '请选择', trigger: 'change' }],
- transferCustomerNumber: [{ required: true, message: '请输入', trigger: 'blur' }],
- transferCustomerName: [{ required: true, message: '请选择', trigger: 'change' }],
- stockType: [{ required: true, message: '请输入', trigger: 'blur' }]
- },
- fileType: ['word', 'excel', 'ppt', 'pdf'],
- fileList: [],
- fileList2: [],
- srcList: [],
- dict: [],
- mainContractList: [],
- serviceProviderList: [],
- filetype: [],
- authList: [],
- selectData: [],
- itemRecordSelected: [],
- sonCustomerList: [],
- logisticsData: [],
- sonCustomerNumberList: [],
- sonCustomerNameList: [],
- setDisabled: {
- disabledDate: time => {
- return time.getTime() < new Date() - 24 * 3600 * 1000
- }
- }
- }
- },
- computed: {
- ...mapGetters(['customerNumber', 'customerName']),
- comDisabled() {
- // 禁止
- return !!~[2, 3].indexOf(this.moduleType || 1)
- },
- formItems() {
- return [
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '请输入' },
- formItemAttributes: { label: '商家编号', prop: 'customerNumber' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '请输入' },
- formItemAttributes: { label: '商家名称', prop: 'customerName' }
- },
- {
- name: 'el-date-picker',
- md: 6,
- attributes: {
- type: 'datetime',
- style: { width: '100%' },
- placeholder: '选择日期时间',
- valueFormat: 'yyyy-MM-dd HH:mm:ss',
- disabled: this.comDisabled,
- pickerOptions: this.setDisabled
- },
- formItemAttributes: { label: '调整日期', prop: 'transferTime' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '系统自动生成' },
- formItemAttributes: { label: '制单人', prop: 'createBy' }
- },
- {
- name: 'el-select',
- options: this.sonCustomerNumberList,
- events: {
- change: e => this.handleChange(e, 'transferCustomerNumber')
- },
- md: 6,
- attributes: {
- clearable: true,
- filterable: true,
- disabled: this.comDisabled
- },
- formItemAttributes: { label: '商家编号', prop: 'transferCustomerNumber' }
- },
- {
- name: 'el-select',
- options: this.sonCustomerNameList,
- md: 6,
- events: {
- change: e => this.handleChange(e, 'transferCustomerName')
- },
- attributes: {
- clearable: true,
- filterable: true,
- disabled: this.comDisabled
- },
- formItemAttributes: { label: '商家名称', prop: 'transferCustomerName' }
- },
- {
- name: 'el-select',
- md: 6,
- options: [
- { label: '嘉贤前置仓', value: 'JIAXIAN' }
- // { label: '商家仓', value: 'SHANGJIA' }
- ],
- attributes: { disabled: this.comDisabled, placeholder: '请输入' },
- formItemAttributes: { label: '调拨仓库', prop: 'stockType' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true, placeholder: '系统自动生成' },
- formItemAttributes: { label: '制单时间', prop: 'createTime' }
- },
- {
- name: 'el-input',
- md: 24,
- attributes: { type: 'textarea', style: { width: '100%' }, disabled: this.comDisabled, placeholder: '请输入' },
- formItemAttributes: { label: '备注', prop: 'notes' }
- }
- ]
- },
- formExamine() {
- return [
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true },
- formItemAttributes: { label: '审核人', prop: 'approvalName' }
- },
- {
- name: 'el-input',
- md: 6,
- attributes: { disabled: true },
- formItemAttributes: { label: '审核时间', prop: 'approvalTime' }
- },
- {
- name: 'el-input',
- md: 24,
- attributes: { type: 'textarea', style: { width: '100%' }, placeholder: '请输入' },
- formItemAttributes: { label: '备注', prop: 'approvalRemark' }
- }
- ]
- },
- columns() {
- return [
- {
- columnAttributes: {
- label: '产品名称',
- prop: 'materialName'
- }
- },
- {
- columnAttributes: {
- label: '产品编码',
- prop: 'materialOldNumber'
- }
- },
- {
- columnAttributes: {
- label: '规格型号',
- prop: 'specification',
- width: 300
- }
- },
- ...(() => {
- if (~[1].indexOf(this.moduleType)) {
- return [
- {
- columnAttributes: {
- label: '可调拨库存数',
- prop: 'frontStockNum'
- }
- }
- ]
- }
- return []
- })(),
- {
- columnAttributes: {
- label: '调拨数量',
- prop: 'qty'
- },
- render: (h, { column, row, index }) => {
- return (
- <div style='margin:0 20px'>
- <el-input
- type='number'
- disabled={this.comDisabled}
- value={row.qty}
- // onInput={e => (row.qty = e)}
- onInput={value => {
- row.qty = value
- this.debounceChange(value, index)
- }}
- placeholder='调拨数量'
- size='mini'
- ></el-input>
- </div>
- )
- }
- },
- {
- columnAttributes: {
- label: '备注',
- prop: 'notes'
- },
- render: (h, { column, row, index }) => {
- return (
- <el-input
- type='text'
- value={row.notes}
- disabled={this.comDisabled}
- onInput={e => (row.notes = e)}
- placeholder='备注'
- size='mini'
- ></el-input>
- )
- }
- },
- {
- columnAttributes: {
- label: '调拨仓库',
- prop: 'stockName'
- }
- },
- {
- columnAttributes: {
- label: '操作',
- prop: ''
- },
- render: (h, { column, row, index }) => {
- return (
- <div>
- {!this.comDisabled ? (
- <el-button
- type='text'
- size='default'
- onClick={() => {
- this.handleDel(index)
- }}
- >
- 删除
- </el-button>
- ) : null}
- </div>
- )
- }
- }
- ]
- },
- detailData() {
- return [
- ...[
- !this.comDisabled
- ? {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: (h, { props, onInput }) => {
- return (
- <div>
- <el-button
- size='mini'
- onClick={() => {
- this.visible = true
- this.recordSelected = []
- }}
- >
- 添加
- </el-button>
- <el-button size='mini' onClick={() => this.handleAllDel()}>
- 删除
- </el-button>
- </div>
- )
- }
- }
- : {}
- ],
- {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <zj-table
- isDrop={true}
- columns={this.columns}
- tableData={this.selectData}
- tableAttributes={{ border: true, selectColumn: !this.comDisabled }}
- tableEvents={this.itemTableEvents}
- ></zj-table>
- )
- }
- }
- ]
- },
- formLogistics() {
- return [
- {
- columnAttributes: {
- label: '补贴费用',
- prop: 'allowanceCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '所属销售公司类型',
- prop: 'belongCompanyType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '运费结算系数',
- prop: 'coefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '备注',
- prop: 'comment',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '最终运费',
- prop: 'cost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '客户名称',
- prop: 'customerName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '客户电话',
- prop: 'customerPhone',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '无法生成的原因',
- prop: 'errorResult',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否已经对过帐',
- prop: 'isAccountChecking',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否已经审核',
- prop: 'isAudit',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否完结',
- prop: 'isFinish',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '实际是否卸货',
- prop: 'isRealUnload',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '实际是否上楼',
- prop: 'isRealUpstairs',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否卸货',
- prop: 'isUnload',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '是否上楼',
- prop: 'isUpstairs',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '物料名称',
- prop: 'materialCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '计费分类',
- prop: 'materialCostType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '产品名称',
- prop: 'materialName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '规格型号',
- prop: 'materialSpecification',
- width: 350
- }
- },
- {
- columnAttributes: {
- label: '物料类型',
- prop: 'materialType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家编码',
- prop: 'merchantCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家名称',
- prop: 'merchantName',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单号',
- prop: 'orderCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单时间',
- prop: 'orderDate',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单类型',
- prop: 'orderType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '订单类型细分',
- prop: 'orderTypeDetail',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '收货送货地址',
- prop: 'receiptAddress',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '退货单号',
- prop: 'returnOrderCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '补贴结算系数',
- prop: 'subsidyCoefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '嘉贤创建时间',
- prop: 'time',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '费用汇总',
- prop: 'totalCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '单价计算',
- prop: 'unitPrice',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '卸货上楼结算系数',
- prop: 'unloadUpstairsCoefficient',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '上楼卸货费用',
- prop: 'unloadUpstairsCost',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库编码',
- prop: 'warehouseCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库名称',
- prop: 'warehouseName',
- width: 200
- }
- }
- ]
- },
- formOutbound() {
- return [
- {
- columnAttributes: {
- label: '条码',
- prop: 'barCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '出库时间',
- prop: 'consignerTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '出库时间',
- prop: 'consignerTimeV2',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '创建人',
- prop: 'createBy',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '创建时间',
- prop: 'createTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '送货时间',
- prop: 'deliveryTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '送货时间',
- prop: 'deliveryTimeV2',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '条码唯一id',
- prop: 'id',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '物料代码',
- prop: 'materialCode',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '物料类型',
- prop: 'materialType',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '销售订单号',
- prop: 'orderNumber',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '收货人',
- prop: 'receiptCompany',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '商家名称',
- prop: 'salesCompany',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '规格',
- prop: 'specification',
- width: 350
- }
- },
- {
- columnAttributes: {
- label: '更新人',
- prop: 'updateBy',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '修改时间',
- prop: 'updateTime',
- width: 200
- }
- },
- {
- columnAttributes: {
- label: '发货仓库名称',
- prop: 'warehouse',
- width: 200
- }
- }
- ]
- },
- formLogisticsData() {
- return [
- {
- name: 'slot-component',
- md: 24,
- attributes: { disabled: false },
- formItemAttributes: { label: '', prop: '' },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <zj-table
- style='height: 600px;'
- tableAttributes={{ ...this.defaultTableAttributes }}
- isDrop={true}
- columns={this.formLogistics}
- tableData={this.logisticsData}
- tableEvents={this.itemTableEvents}
- ></zj-table>
- )
- }
- }
- ]
- }
- },
- mounted() {
- this.getStagecustomerListV2()
- if (this.detailsId) {
- getCustomerTransferDetail({ id: this.detailsId }).then(res => {
- this.formData = res.data
- this.selectData = res.data.orders.map(k => {
- k.disabledId = k.customerStockId
- k.stockName = '嘉贤前置仓'
- return k
- })
- delete this.formData.orders
- if (this.detailsId && this.moduleType === 2) {
- getListCostBillV2({
- pageNum: 1,
- pageSize: -1,
- params: [
- {
- param: 'order_code',
- compare: '=',
- value: this.formData.jiaxianOrderId
- }
- ]
- }).then(res => {
- res.data.records.forEach(item => {
- item.sums1 = ['orderHasSendQty', 'subsidyCoefficient', 'unloadUpstairsCoefficient', 'coefficient']
- item.sums2 = ['cost', 'unitPrice', 'totalCost', 'allowanceCost']
- })
- this.logisticsData = res.data.records
- })
- }
- })
- }
- },
- methods: {
- debounceChange: debounce(function(val, index) {
- if (val <= 0) {
- this.selectData[index].qty = 1
- } else {
- this.selectData[index].qty = parseInt(val)
- }
- }, 500),
- // 列表请求函数
- getList(...p) {
- this.recordSelected = []
- return getcustomerFrontList(...p)
- },
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- }, // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- itemSelectionChange(data) {
- this.itemRecordSelected = data
- },
- selectable(row, index) {
- if (this.selectData.length) {
- for (let j = 0; j < this.selectData.length; j++) {
- if (row.id === this.selectData[j].disabledId) {
- this.$set(row, 'disabledId', this.selectData[j].disabledId)
- }
- }
- }
- if (!row.disabledId) {
- return true
- } else {
- return false
- }
- },
- getStagecustomerListV2() {
- this.formData.customerNumber = this.customerNumber
- this.formData.customerName = this.customerName
- getStagecustomerListV2({
- pageNum: 1,
- pageSize: -1,
- params: [
- {
- param: 'a.higher_prant_number',
- compare: '=',
- value: this.customerNumber || ''
- }
- ]
- }).then(res => {
- this.sonCustomerList = res.data.records
- this.sonCustomerNameList = res.data.records.map(k => {
- return {
- label: k.name,
- value: k.id
- }
- })
- this.sonCustomerNumberList = res.data.records.map(k => {
- return {
- label: k.number,
- value: k.id
- }
- })
- if (this.detailsId && this.sonCustomerList.length) {
- const transfer = this.sonCustomerList.find(k => k.number === this.formData.transferCustomerNumber)
- this.formData.transferCustomerNumber = transfer.id
- this.formData.transferCustomerName = transfer.id
- }
- })
- },
- handleAddData() {
- this.selectData = [...this.selectData, ...this.recordSelected]
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- for (let j = 0; j < this.selectData.length; j++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id == this.selectData[j].id) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', this.selectData[j].id)
- }
- }
- }
- this.selectData = this.selectData.map(k => {
- return {
- materialCode: k.materialCode,
- materialId: '',
- materialName: k.materialName,
- materialOldNumber: k.materialOldNumber,
- notes: '',
- qty: 0,
- frontStockNum: k.frontStockNum,
- specification: k.specification,
- disabledId: k.disabledId,
- stockName: '嘉贤前置仓',
- customerStockId: k.disabledId
- }
- })
- this.visible = false
- this.handleClearSelection()
- },
- handleAllDel() {
- if (this.itemRecordSelected.length) {
- if (this.$refs.pageRef) {
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- for (let j = 0; j < this.itemRecordSelected.length; j++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id === this.itemRecordSelected[j].disabledId) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
- }
- }
- }
- }
- for (let j = 0; j < this.itemRecordSelected.length; j++) {
- for (let k = 0; k < this.selectData.length; k++) {
- if (this.selectData[k].disabledId === this.itemRecordSelected[j].disabledId) {
- this.selectData.splice(k, 1)
- }
- }
- }
- this.handleClearSelection()
- } else {
- this.$errorMsg('请选择删除项')
- }
- },
- handleDel(index) {
- if (this.$refs.pageRef) {
- for (let i = 0; i < this.$refs.pageRef.$children[0].tableData.length; i++) {
- if (this.$refs.pageRef.$children[0].tableData[i].id === this.selectData[index].disabledId) {
- this.$set(this.$refs.pageRef.$children[0].tableData[i], 'disabledId', null)
- }
- }
- }
- this.selectData.splice(index, 1)
- this.handleClearSelection()
- },
- handleClearSelection() {
- this.recordSelected = []
- this.$refs.pageRef &&
- this.$refs.pageRef.$children[0].$children[0].$children[2].$children[0].$children[0].clearSelection()
- },
- handleChange(e, type) {
- if (e) {
- this.formData.transferCustomerName = e
- this.formData.transferCustomerNumber = e
- } else {
- this.formData.transferCustomerNumber = ''
- this.formData.transferCustomerName = ''
- }
- },
- handlerefreshList() {
- this.$emit('refresh')
- this.onClose()
- },
- onClose() {
- this.formData = {}
- this.selectData = []
- this.$emit('close')
- },
- onReset() {
- this.$refs.formRef.resetFields()
- this.selectData = []
- },
- onSubmit(type = null) {
- this.$refs.formRef.validate(valid => {
- for (let i = 0; i < this.selectData.length; i++) {
- if (this.selectData[i].qty <= 0) {
- this.$errorMsg('调拨数量不能小于1')
- return
- }
- }
- const transfer = this.sonCustomerList.find(k => k.id === (this.formData.transferCustomerNumber || this.formData.transferCustomerName))
- console.log(transfer, 999)
- if (valid) {
- const params = {
- ...this.formData,
- orders: this.selectData,
- transferCustomerNumber: transfer.number,
- transferCustomerName: transfer.name
- }
- if (this.moduleType === 1) {
- params.status = type
- addCustomerTransfer(params).then(res => {
- this.$successMsg(type === 'SAVE' ? '保存成功' : '新增成功')
- this.handlerefreshList()
- })
- } else {
- updateCustomerTransfer(params).then(res => {
- this.$successMsg('编辑成功')
- this.handlerefreshList()
- })
- }
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- onExamine(type = null) {
- examineCustomerTransfer({
- id: this.detailsId,
- status: type
- }).then(res => {
- this.$successMsg('审核成功')
- this.handlerefreshList()
- })
- },
- onInvoice(type = null) {
- setNeExamine({
- id: this.detailsId,
- status: type
- }).then(res => {
- this.$successMsg('反审成功')
- this.handlerefreshList()
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .header1style {
- text-align: right;
- font-size: 12px;
- color: red;
- line-height: 18px;
- }
- </style>
|