123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701 |
- <template>
- <div class="bulkWarehousingOrderEdit-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <!-- 内容 -->
- <a-page-header :ghost="false" :backIcon="false" class="bulkWarehousingOrderEdit-cont" >
- <!-- 自定义的二级文字标题 -->
- <template slot="subTitle">
- <a id="bulkWarehousingOrderEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
- <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.sparePartsPurchaseNo) || '' }}</p>
- </template>
- <!-- 操作区,位于 title 行的行尾 -->
- <template slot="extra" v-if="$hasPermissions('B_bulkWarehousingOrder_print')">
- <a-radio-group key="3" v-model="printerType">
- <a-radio value="NEEDLE">针式</a-radio>
- <a-radio value="INK">喷墨</a-radio>
- </a-radio-group>
- <a-button key="2" id="bulkWarehousingOrderEdit-preview-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
- <a-button key="1" type="primary" id="bulkWarehousingOrderEdit-print-btn" :disabled="chooseLoadDataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
- </template>
- </a-page-header>
- <!-- 基础信息 -->
- <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1">
- <template slot="header">
- 基础信息
- <!-- <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="bulkWarehousingOrderEdit-edit-circle-btn" @click.stop="handleEditInfo" /> -->
- </template>
- <a-descriptions :column="3">
- <a-descriptions-item label="供应商">{{ (basicInfoData&&basicInfoData.supplierName) || '--' }}</a-descriptions-item>
- <a-descriptions-item label="散件入库类型">{{ (basicInfoData&&basicInfoData.sparePartsTypeName) || '--' }}</a-descriptions-item>
- <a-descriptions-item label="备注">{{ (basicInfoData&&basicInfoData.remarks) || '--' }}</a-descriptions-item>
- </a-descriptions>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 选择产品 -->
- <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1">
- <template slot="header">
- 选择产品<span class="sub-title">①输入查询条件--->②查找到需要入库的配件--->③录入成本价、数量、仓库、仓位--->④点击“添加”</span>
- </template>
- <!-- 选择产品 -->
- <div>
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="关键词">
- <a-input id="bulkWarehousingOrderEdit-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品品牌">
- <a-select
- placeholder="请选择产品品牌"
- id="bulkWarehousingOrderEdit-productBrandSn"
- allowClear
- v-model="queryParam.productBrandSn"
- :showSearch="true"
- option-filter-prop="children"
- :filter-option="filterOption">
- <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="产品分类">
- <a-cascader
- @change="changeProductType"
- change-on-select
- v-model="productType"
- expand-trigger="hover"
- :options="productTypeList"
- :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
- id="productInfoList-productType"
- placeholder="请选择产品分类"
- allowClear />
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bulkWarehousingOrderEdit-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="bulkWarehousingOrderEdit-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :customRow="handleClickRow"
- :data="loadData"
- :defaultLoadData="false"
- :scroll="{ x: 1240, y: 300 }"
- bordered>
- <!-- 成本价 -->
- <template slot="putCost" slot-scope="text, record">
- <a-input-number
- size="small"
- id="bulkWarehousingOrderEdit-putCost"
- v-model="record.putCost"
- :precision="2"
- :min="1"
- :max="999999"
- placeholder="请输入"
- style="width: 100%;" />
- </template>
- <!-- 数量 -->
- <template slot="putQty" slot-scope="text, record">
- <a-input-number
- size="small"
- id="bulkWarehousingOrderEdit-putQty"
- v-model="record.putQty"
- :precision="0"
- :min="1"
- :max="999999"
- placeholder="请输入"
- style="width: 100%;" />
- </template>
- <!-- 仓库仓位 -->
- <template slot="warehouse" slot-scope="text, record, index">
- <a-cascader
- size="small"
- @change="e => changeWarehouseCascade(e, record, index, 'dealerProduct')"
- v-model="record.warehouseCascade"
- expand-trigger="hover"
- :allowClear="false"
- :options="warehouseCascadeData"
- :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
- id="bulkWarehousingOrderEdit-warehouseCascade"
- placeholder="请选择仓库仓位"
- style="width: 100%;" />
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="primary" class="button-primary" @click="handleAdd(record)" id="bulkWarehousingOrderEdit-add-btn">添加</a-button>
- </template>
- </s-table>
- </div>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- <!-- 已选产品 -->
- <a-card size="small" :bordered="false" class="bulkWarehousingOrderEdit-cont">
- <a-collapse :activeKey="['1']">
- <a-collapse-panel key="1">
- <template slot="header">
- 已选产品
- <!-- <a-button size="small" class="import-btn" id="bulkWarehousingOrderEdit-import-btn" @click.stop="handleImport">导入明细</a-button> -->
- </template>
- <!-- 已选产品 -->
- <div>
- <!-- 总计 -->
- <a-alert type="info" style="margin-bottom:10px">
- <div slot="message">
- 总款数 <strong>{{ (productTotal&&(productTotal.productTotalCategory || productTotal.productTotalCategory==0)) ? productTotal.productTotalCategory : '--' }}</strong> ,
- 总数量 <strong>{{ (productTotal&&(productTotal.productTotalQty || productTotal.productTotalQty==0)) ? productTotal.productTotalQty : '--' }}</strong> ,
- 总成本 <strong>{{ (productTotal&&(productTotal.productTotalCost || productTotal.productTotalCost==0)) ? '¥'+productTotal.productTotalCost : '--' }}</strong>
- </div>
- </a-alert>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="chooseTable"
- size="small"
- :rowKey="(record) => record.id"
- :columns="chooseColumns"
- :data="chooseLoadData"
- :defaultLoadData="false"
- :scroll="{ x: 1320, y: 300 }"
- bordered>
- <!-- 成本价 -->
- <template slot="putCost" slot-scope="text, record">
- <a-input-number
- size="small"
- id="bulkWarehousingOrderEdit-choose-putCost"
- v-model="record.putCost"
- :precision="2"
- :min="1"
- :max="999999"
- placeholder="请输入"
- @blur="e => putCostBlur(e.target.value, record)"
- style="width: 100%;" />
- </template>
- <!-- 数量 -->
- <template slot="putQty" slot-scope="text, record">
- <a-input-number
- size="small"
- id="bulkWarehousingOrderEdit-choose-putQty"
- v-model="record.putQty"
- :precision="0"
- :min="1"
- :max="999999"
- placeholder="请输入"
- @blur="e => putQtyBlur(e.target.value, record)"
- style="width: 100%;" />
- </template>
- <!-- 仓库仓位 -->
- <template slot="warehouse" slot-scope="text, record, index">
- <a-cascader
- size="small"
- @change="e => changeWarehouseCascade(e, record, index, 'sparePartsPurDetail')"
- v-model="record.warehouseCascade"
- expand-trigger="hover"
- :allowClear="false"
- :options="warehouseCascadeData"
- :fieldNames="{ label: 'name', value: 'sn', children: 'warehouseLocationList' }"
- id="bulkWarehousingOrderEdit-choose-warehouseCascade"
- placeholder="请选择仓库仓位"
- style="width: 100%;" />
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="primary" class="button-error" @click="handleDel(record)" id="bulkWarehousingOrderEdit-del-btn">删除</a-button>
- </template>
- </s-table>
- </div>
- </a-collapse-panel>
- </a-collapse>
- </a-card>
- </a-spin>
- <div class="affix-cont">
- <a-button
- type="primary"
- id="bulkWarehousingOrderEdit-submit"
- size="large"
- :disabled="spinning"
- class="button-primary"
- @click="handleSubmit"
- style="padding: 0 60px;">提交</a-button>
- </div>
- <!-- 选择基本信息弹框 -->
- <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
- <!-- 打印 -->
- <div id="print"></div>
- </div>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import basicInfoModal from './basicInfoModal.vue'
- import { getOperationalPrecision } from '@/libs/tools.js'
- import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
- import { dealerProductTypeList } from '@/api/dealerProductType'
- import { sparePartsPurDetail, sparePartsPurDetailList, sparePartsPurDetailCount, sparePartsPurDetailSave, sparePartsPurDetailDel, sparePartsPurSubmit, sparePartsPurDetailPrint } from '@/api/sparePartsPur'
- import { dealerProductList } from '@/api/dealerProduct'
- import { warehouseCascadeList } from '@/api/warehouse'
- export default {
- components: { STable, VSelect, basicInfoModal },
- data () {
- return {
- spinning: false,
- loading: false,
- chooseLoading: false,
- queryParam: {
- queryWord: '',
- productBrandSn: undefined,
- productTypeSn1: undefined,
- productTypeSn2: undefined,
- productTypeSn3: undefined
- },
- productBrandList: [], // 产品品牌 下拉数据
- productTypeList: [], // 产品分类 下拉数据
- productType: [],
- warehouseCascadeData: [], // 仓库仓位
- disabled: false, // 查询、重置按钮是否可操作
- // 表头
- columns: [
- { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
- { title: '产品编码', dataIndex: 'code', width: 180, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
- { title: '产品名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'origCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品品牌', dataIndex: 'productBrandName', width: 140, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'unit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 100, align: 'center' },
- { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 100, align: 'center' },
- { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 150, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- parameter.sortAlias = 'dp'
- const params = Object.assign(parameter, this.queryParam)
- params.enabledFlag = 1
- return dealerProductList(params).then(res => {
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- if (this.defaultWarehouseCascade.length > 0) {
- data.list[i].warehouseCascade = this.defaultWarehouseCascade
- data.list[i].warehouseSn = this.defaultWarehouseCascade[0]
- data.list[i].warehouseLocationSn = this.defaultWarehouseCascade[1]
- } else {
- data.list[i].warehouseCascade = undefined
- }
- }
- this.loadDataSource = data.list
- this.disabled = false
- return data
- })
- },
- // 表头
- chooseColumns: [
- { title: '序号', dataIndex: 'no', width: 70, align: 'center' },
- { title: '产品编码', dataIndex: 'productCode', width: 180, align: 'center', customRender: function (text) { return text || '--' }, sorter: true },
- { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '原厂编码', dataIndex: 'productOrigCode', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '产品品牌', dataIndex: 'brandName', width: 140, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
- { title: '单位', dataIndex: 'productUnit', width: 60, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '成本价', scopedSlots: { customRender: 'putCost' }, width: 100, align: 'center' },
- { title: '数量', scopedSlots: { customRender: 'putQty' }, width: 100, align: 'center' },
- { title: '成本小计', dataIndex: 'costSubtotal', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '仓库仓位', scopedSlots: { customRender: 'warehouse' }, width: 150, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 80, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 Promise 对象
- chooseLoadData: parameter => {
- // 排序
- if (parameter.sortField == 'brandName') {
- parameter.sortField = 'productBrandName'
- parameter.sortAlias = 'dp'
- }
- if (parameter.sortField == 'productName') {
- parameter.sortField = 'productCode'
- parameter.sortAlias = 'sppd'
- }
- const params = Object.assign(parameter, { sparePartsPurchaseSn: this.$route.params.sn })
- return sparePartsPurDetailList(params).then(res => {
- this.getDetailCount(params)
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- data.list[i].putCostBackups = data.list[i].putCost
- data.list[i].putQtyBackups = data.list[i].putQty
- const warehouseSn = data.list[i].warehouseSn || undefined
- const warehouseLocationSn = data.list[i].warehouseLocationSn || undefined
- if (warehouseSn || warehouseLocationSn) {
- data.list[i].warehouseSnBackups = warehouseSn
- data.list[i].warehouseLocationSnBackups = warehouseLocationSn
- data.list[i].warehouseCascade = [warehouseSn, warehouseLocationSn]
- } else {
- data.list[i].warehouseCascade = undefined
- }
- // 成本小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
- data.list[i].costSubtotal = getOperationalPrecision(data.list[i].putCost, data.list[i].putQty)
- }
- this.chooseLoadDataSource = data.list
- return data
- })
- },
- loadDataSource: [],
- chooseLoadDataSource: [],
- openModal: false, // 选择基本信息弹框是否显示
- warehouseList: [], // 仓库 下拉数据
- warehouseLocList: {}, // 仓位 下拉数据
- defaultWarehouseCascade: [], // 默认仓库仓位
- chooseWarehouseList: [], // 已选产品 仓库 下拉数据
- chooseWarehouseLocList: {}, // 已选产品 仓位 下拉数据
- basicInfoData: null, // 基本信息
- productTotal: null, // 合计
- printerType: 'NEEDLE' // 打印机类型
- }
- },
- methods: {
- // 重置
- resetSearchForm () {
- this.queryParam.queryWord = ''
- this.queryParam.productBrandSn = undefined
- this.queryParam.productTypeSn1 = ''
- this.queryParam.productTypeSn2 = ''
- this.queryParam.productTypeSn3 = ''
- this.productType = []
- this.$refs.table.refresh(true)
- },
- // 打印预览/快捷打印
- handlePrint (type) {
- const _this = this
- _this.spinning = true
- sparePartsPurDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
- _this.spinning = false
- if (res.type == 'application/json') {
- var reader = new FileReader()
- reader.addEventListener('loadend', function () {
- const obj = JSON.parse(reader.result)
- _this.$notification.error({
- message: '提示',
- description: obj.message
- })
- })
- reader.readAsText(res)
- } else {
- this.print(res, type)
- }
- })
- },
- print (data, type) {
- if (!data) {
- return
- }
- const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
- document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
- if (type == 'preview') { // 预览
- window.open(url)
- } else if (type == 'print') { // 打印
- window.frames['printf'].focus()
- window.frames['printf'].print()
- }
- },
- // 双击快速添加
- handleClickRow (record) {
- return {
- on: {
- dblclick: (event) => {
- this.handleAdd(record)
- }
- }
- }
- },
- // 基本信息
- getDetail () {
- sparePartsPurDetail({ id: this.$route.params.id }).then(res => {
- if (res.status == 200) {
- this.basicInfoData = res.data
- } else {
- this.basicInfoData = null
- }
- })
- },
- // 添加/编辑
- handleAdd (row, isEdit) {
- if (!isEdit && !row.putCost) {
- this.$message.warning('请输入成本价后再添加!')
- return
- }
- if (!isEdit && !row.putQty) {
- this.$message.warning('请输入数量后再添加!')
- return
- }
- if (!isEdit && !row.warehouseSn) {
- this.$message.warning('请选择仓库后再添加!')
- return
- }
- if (!isEdit && !row.warehouseLocationSn) {
- this.$message.warning('请选择仓位后再添加!')
- return
- }
- const params = {
- id: isEdit ? row.id : undefined,
- sparePartsPurchaseSn: this.$route.params.sn,
- putCost: row.putCost,
- putQty: row.putQty,
- productCode: isEdit ? row.productCode : row.code,
- productOrigCode: (isEdit ? row.productOrigCode : row.origCode) || undefined,
- productSn: row.productSn,
- productTypeSn1: row.productTypeSn1,
- productTypeSn2: row.productTypeSn2,
- productTypeSn3: row.productTypeSn3,
- brandSn: isEdit ? row.brandSn : row.productBrandSn,
- warehouseLocationSn: row.warehouseLocationSn,
- warehouseSn: row.warehouseSn
- }
- if (isEdit) { // 编辑
- // 清空成本价或数量时,值应保持未清空前的值,因成本价和数量都不可为空
- if (!row.putCost) {
- row.putCost = row.putCostBackups
- return
- }
- if (!row.putQty) {
- row.putQty = row.putQtyBackups
- return
- }
- }
- this.spinning = true
- sparePartsPurDetailSave(params).then(res => {
- if (res.status == 200) {
- this.$message.success(res.message)
- this.$refs.chooseTable.refresh()
- this.spinning = false
- } else {
- this.spinning = false
- }
- })
- },
- // 提交
- handleSubmit () {
- const _this = this
- _this.spinning = true
- sparePartsPurSubmit({ id: this.$route.params.id }).then(res => {
- if (res.status == 200) {
- this.$message.success(res.message)
- setTimeout(() => {
- _this.handleBack()
- _this.spinning = false
- }, 1000)
- } else {
- _this.spinning = false
- }
- })
- },
- // 删除
- handleDel (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '删除后不可恢复,确定要进行删除吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- sparePartsPurDetailDel({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.chooseTable.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 编辑基本信息
- handleEditInfo () {
- this.openModal = true
- },
- // 基本信息 保存
- handleOk () {},
- // 导入明细
- handleImport () {
- console.log(333)
- },
- // 返回列表
- handleBack () {
- this.$router.push({ path: '/bulkManagement/bulkWarehousingOrder/list', query: { closeLastOldTab: true } })
- },
- // 合计
- getDetailCount (params) {
- sparePartsPurDetailCount(params).then(res => {
- if (res.status == 200) {
- this.productTotal = res.data
- } else {
- this.productTotal = null
- }
- })
- },
- changeWarehouseCascade (val, opt, ind, type) {
- let loadData
- if (type == 'dealerProduct') { // 全部产品
- loadData = this.loadDataSource[ind]
- } else if (type == 'sparePartsPurDetail') { // 已选产品
- loadData = this.chooseLoadDataSource[ind]
- }
- if (val.length < 2) {
- this.$message.warning('当前仓库无仓位,请选择其他仓库')
- const warehouseSnBackups = loadData.warehouseSnBackups || undefined
- const warehouseLocationSnBackups = loadData.warehouseLocationSnBackups || undefined
- loadData.warehouseSn = warehouseSnBackups
- loadData.warehouseLocationSn = warehouseLocationSnBackups
- if (warehouseSnBackups || warehouseLocationSnBackups) {
- loadData.warehouseCascade = [warehouseSnBackups, warehouseLocationSnBackups]
- } else {
- loadData.warehouseCascade = undefined
- }
- } else {
- loadData.warehouseSn = val[0] ? val[0] : ''
- loadData.warehouseLocationSn = val[1] ? val[1] : ''
- if (type == 'sparePartsPurDetail') { // 已选产品
- loadData = this.chooseLoadDataSource[ind]
- this.handleAdd(loadData, 'edit')
- }
- }
- },
- // 已选产品 成本价 blur
- putCostBlur (val, record) {
- // 光标移出,值发生改变再调用编辑接口
- if (val != record.putCostBackups) {
- this.handleAdd(record, 'edit')
- }
- },
- // 已选产品 数量 blur
- putQtyBlur (val, record) {
- if (val != record.putQtyBackups) {
- this.handleAdd(record, 'edit')
- }
- },
- // 产品分类 change
- changeProductType (val, opt) {
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
- },
- // 仓库仓位 级联 列表
- getWarehouseCascade () {
- const _this = this
- warehouseCascadeList({}).then(res => {
- if (res.status == 200) {
- res.data.filter(item => {
- // 过滤默认仓库
- if (item.defaultFlag == 1 && item.wasteFlag == 0) { // defaultFlag为1,且不是废品仓
- _this.defaultWarehouseCascade[0] = item.warehouseSn
- // 过滤默认仓位
- item.warehouseLocationList.filter(subItem => {
- if (subItem.defaultFlag == 1 && subItem.wasteFlag == 0) {
- _this.defaultWarehouseCascade[1] = subItem.warehouseLocationSn
- _this.$refs.table.refresh(true)
- _this.$refs.chooseTable.refresh(true)
- }
- })
- }
- })
- res.data.map(item => {
- item.sn = item.warehouseSn
- if (item.warehouseLocationList) {
- item.warehouseLocationList.map(subItem => {
- subItem.sn = subItem.warehouseLocationSn
- })
- }
- })
- this.warehouseCascadeData = res.data
- } else {
- this.warehouseCascadeData = []
- }
- })
- },
- // 产品品牌 列表
- getProductBrand () {
- // sysFlag传0,表示只查自建产品
- dealerProductBrandQuery({}).then(res => {
- if (res.status == 200) {
- this.productBrandList = res.data
- } else {
- this.productBrandList = []
- }
- })
- },
- // 产品分类 列表
- getProductType () {
- dealerProductTypeList({}).then(res => {
- if (res.status == 200) {
- this.productTypeList = res.data
- } else {
- this.productTypeList = []
- }
- })
- },
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- initPage () {
- this.getWarehouseCascade()
- this.getDetail()
- this.getProductBrand()
- this.getProductType()
- this.resetSearchForm()
- this.$refs.chooseTable.refresh(true)
- }
- },
- mounted () {
- this.initPage()
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {
- vm.openModal = false
- if (!vm.disabled) {
- vm.initPage()
- }
- })
- }
- }
- </script>
- <style lang="less">
- .bulkWarehousingOrderEdit-wrap{
- position: relative;
- height: 100%;
- padding-bottom: 51px;
- box-sizing: border-box;
- >.ant-spin-nested-loading{
- overflow-y: scroll;
- height: 100%;
- }
- .bulkWarehousingOrderEdit-cont{
- margin-bottom: 10px;
- .sub-title{
- font-size: 12px;
- color: #808695;
- margin-left: 10px;
- }
- }
- }
- </style>
|