|
@@ -74,7 +74,7 @@
|
|
|
<div class="table-page-search-wrapper">
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :span="24">
|
|
|
- <a-form-model :model="productForm" layout="inline" @keyup.enter.native="$refs.purchaseTable.refresh(true)" >
|
|
|
+ <a-form-model :model="productForm" layout="inline" @keyup.enter.native="getTableData()" >
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-model-item label="产品编码">
|
|
@@ -88,7 +88,7 @@
|
|
|
</a-col>
|
|
|
<a-col :md="8" :sm="24">
|
|
|
<a-form-model-item style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" @click="$refs.purchaseTable.refresh(true)" :disabled="purchaseDisabled" id="purchaseNewOrderEdit-refresh">查询</a-button>
|
|
|
+ <a-button type="primary" @click="getTableData()" :disabled="purchaseDisabled" id="purchaseNewOrderEdit-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetPurchaseForm" id="purchaseNewOrderEdit-reset">重置</a-button>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -98,42 +98,16 @@
|
|
|
</a-row>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
- <s-table
|
|
|
+ <ve-table
|
|
|
class="sTable"
|
|
|
+ border-y
|
|
|
ref="purchaseTable"
|
|
|
- :style="{ height: tableHeight +'px', overflow: 'auto' }"
|
|
|
- size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
+ :max-height="tableHeight"
|
|
|
+ :virtual-scroll-option="{enable: true}"
|
|
|
:columns="chooseColumns"
|
|
|
- :data="chooseLoadData"
|
|
|
- :defaultLoadData="false"
|
|
|
- :showPagination="false"
|
|
|
- :pageSize="5000"
|
|
|
- bordered>
|
|
|
- <!-- 采购数量 -->
|
|
|
- <template slot="storageQuantity" slot-scope="text, record">
|
|
|
- <a-input-number
|
|
|
- size="small"
|
|
|
- id="purchaseNewOrderEdit-qty"
|
|
|
- v-model="record.qty"
|
|
|
- :precision="0"
|
|
|
- :min="1"
|
|
|
- :max="999999"
|
|
|
- @blur="e => qtyBlur(e.target.value, record)"
|
|
|
- style="width: 100%;"
|
|
|
- placeholder="请输入" />
|
|
|
- </template>
|
|
|
- <!-- 操作 -->
|
|
|
- <template slot="action" slot-scope="text, record">
|
|
|
- <a-button
|
|
|
- size="small"
|
|
|
- type="link"
|
|
|
- class="button-error"
|
|
|
- :loading="delLoading"
|
|
|
- @click="handleDel(record)"
|
|
|
- id="purchaseNewOrderEdit-del-btn">删除</a-button>
|
|
|
- </template>
|
|
|
- </s-table>
|
|
|
+ :table-data="localDataSource"
|
|
|
+ row-key-field-name="id"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<div v-if="!spinning&&localDataSource.length==0">
|
|
@@ -198,6 +172,45 @@ import chooseProductModal from './chooseProductModal.vue'
|
|
|
import Print from '@/views/common/print.vue'
|
|
|
import { hdPrint } from '@/libs/JGPrint'
|
|
|
const shopingCatModal = () => import(/* webpackChunkName: "shopingCatModal" */ '@/views/common/shopingCatModal.vue')
|
|
|
+const qtyComp = {
|
|
|
+ name: "qtyComp",
|
|
|
+ template: `
|
|
|
+ <a-input-number
|
|
|
+ size="small"
|
|
|
+ v-model="row.qty"
|
|
|
+ :precision="0"
|
|
|
+ :min="1"
|
|
|
+ :max="999999"
|
|
|
+ @blur="e => that.qtyBlur(e.target.value, row)"
|
|
|
+ style="width: 100%;"
|
|
|
+ placeholder="请输入" />
|
|
|
+ `,
|
|
|
+ props: {
|
|
|
+ row: Object,
|
|
|
+ column: Object,
|
|
|
+ rowIndex: Number,
|
|
|
+ that: Object
|
|
|
+ },
|
|
|
+ };
|
|
|
+const actionComp = {
|
|
|
+ name: "actionComp",
|
|
|
+ template: `
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="link"
|
|
|
+ class="button-error"
|
|
|
+ :loading="row.delLoading"
|
|
|
+ @click="that.handleDel(row)"
|
|
|
+ >删除</a-button>
|
|
|
+ `,
|
|
|
+ props: {
|
|
|
+ row: Object,
|
|
|
+ column: Object,
|
|
|
+ rowIndex: Number,
|
|
|
+ that: Object
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
export default {
|
|
|
name: 'PurchaseEdit',
|
|
|
components: { STable, VSelect, ImportGuideModal, outStockModal, Print, chooseAddressModal, chooseProductModal, shopingCatModal },
|
|
@@ -222,25 +235,6 @@ export default {
|
|
|
orderBy: 'purchase_bill_detail.CREATE_DATE desc'
|
|
|
},
|
|
|
purchaseDisabled: false, // 查询、重置按钮是否可操作
|
|
|
- // 加载数据方法 必须为 Promise 对象
|
|
|
- chooseLoadData: parameter => {
|
|
|
- this.disabled = true
|
|
|
- this.spinning = true
|
|
|
- // 查询总计
|
|
|
- const params = Object.assign({ pageNo: 1, pageSize: 5000 }, this.productForm, { purchaseBillSn: this.$route.params.sn })
|
|
|
- return purchaseDetailList(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
|
|
|
- data.list[i].qtyBackups = data.list[i].qty
|
|
|
- }
|
|
|
- this.localDataSource = data.list
|
|
|
- this.disabled = false
|
|
|
- this.spinning = false
|
|
|
- return data
|
|
|
- })
|
|
|
- },
|
|
|
localDataSource: [],
|
|
|
openGuideModal: false, // 导入产品引导
|
|
|
openOutStockModal: false,
|
|
@@ -255,21 +249,50 @@ export default {
|
|
|
chooseColumns () {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
|
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', width: '20%', align: 'center' },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', width: '35%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: '8%', align: 'center' },
|
|
|
- { title: '单位', dataIndex: 'dealerProductEntity.unit', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
|
|
|
+ { title: '序号', key: "a", field: 'no', width: '5%', align: 'center' },
|
|
|
+ { title: '产品编码',key: "b", field: 'productCode', width: '20%', align: 'center'},
|
|
|
+ { title: '产品名称',key: "c", field: 'productName', width: '35%', align: 'center', ellipsis: true },
|
|
|
+ { title: '采购数量',key: "d", width: '8%', align: 'center',
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return <qtyComp row={row} column={column} rowIndex={rowIndex} that={_this} />
|
|
|
+ }},
|
|
|
+ { title: '单位',key: "e", field: 'productUnit', width: '8%', align: 'center' },
|
|
|
+ { title: '操作',key: "f", width: '8%', align: 'center',
|
|
|
+ renderBodyCell: ({ row, column, rowIndex }, h) => {
|
|
|
+ return <actionComp row={row} column={column} rowIndex={rowIndex} that={_this} />
|
|
|
+ }}
|
|
|
]
|
|
|
if (this.$hasPermissions('M_ShowAllCost')) {
|
|
|
- arr.splice(3, 0, { title: '采购单价', dataIndex: 'discountedPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
|
|
|
- arr.splice(6, 0, { title: '采购金额', dataIndex: 'discountedAmount', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text, 2) : '--') } })
|
|
|
+ arr.splice(3, 0, { title: '采购单价',key: "h", field: 'discountedPrice', width: '8%', align: 'right'})
|
|
|
+ arr.splice(6, 0, { title: '采购金额',key: "i", field: 'discountedAmount', width: '8%', align: 'right'})
|
|
|
}
|
|
|
return arr
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ getTableData(){
|
|
|
+ this.disabled = true
|
|
|
+ this.spinning = true
|
|
|
+ // 查询总计
|
|
|
+ const params = Object.assign({ pageNo: 1, pageSize: 10000 }, this.productForm, { purchaseBillSn: this.$route.params.sn })
|
|
|
+ purchaseDetailList(params).then(res => {
|
|
|
+ const data = res.data
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ const row = data.list[i]
|
|
|
+ row.no = no + i + 1
|
|
|
+ row.qtyBackups = row.qty
|
|
|
+ row.productCode = row.dealerProductEntity.code || '--'
|
|
|
+ row.productName = row.dealerProductEntity.name || '--'
|
|
|
+ row.productUnit = row.dealerProductEntity.unit || '--'
|
|
|
+ row.discountedPrice = (row.discountedPrice||row.discountedPrice==0)?this.toThousands(row.discountedPrice, 2):'--'
|
|
|
+ row.discountedAmount = (row.discountedAmount||row.discountedAmount==0)?this.toThousands(row.discountedAmount, 2):'--'
|
|
|
+ }
|
|
|
+ this.localDataSource = data.list
|
|
|
+ this.disabled = false
|
|
|
+ this.spinning = false
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取采购单基本信息
|
|
|
getOrderDetail (noRefashTable, isReset, flag) {
|
|
|
this.spinning = true
|
|
@@ -281,7 +304,7 @@ export default {
|
|
|
if (isReset) {
|
|
|
this.resetPurchaseForm()
|
|
|
} else {
|
|
|
- this.$refs.purchaseTable.refresh(!!flag)
|
|
|
+ this.getTableData()
|
|
|
}
|
|
|
} else {
|
|
|
this.localDataSource = []
|
|
@@ -304,14 +327,14 @@ export default {
|
|
|
centered: true,
|
|
|
closable: true,
|
|
|
onOk () {
|
|
|
- _this.delLoading = true
|
|
|
+ row.delLoading = true
|
|
|
purchaseDetailDel({ id: row.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
_this.getOrderDetail(false, false, true)
|
|
|
_this.$message.success(res.message)
|
|
|
- _this.delLoading = false
|
|
|
+ row.delLoading = false
|
|
|
} else {
|
|
|
- _this.delLoading = false
|
|
|
+ row.delLoading = false
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -329,7 +352,7 @@ export default {
|
|
|
this.productForm.productName = ''
|
|
|
this.productForm.productCode = ''
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.purchaseTable.refresh(true)
|
|
|
+ this.getTableData()
|
|
|
})
|
|
|
},
|
|
|
// 添加或修改
|