Commit 8d428e7a by huangqy

1111

parent cf5dedb3
......@@ -25,7 +25,7 @@
<el-table-column label="操作" width="200" align="center">
<template #default="scope">
<el-button type="success" size="small" @click="activateBill(scope.row)">激活</el-button>
<el-button type="primary" size="small" @click="reportBill(scope.row)">上报</el-button>
<el-button type="primary" size="small" :disabled="scope.row.activeState !== 2" @click="reportBill(scope.row)">上报</el-button>
</template>
</el-table-column>
</el-table>
......@@ -71,7 +71,18 @@
<el-table-column prop="modelName" label="号型名称" align="center"/>
<el-table-column prop="planAmount" label="计划数量" align="center"/>
<el-table-column prop="realAmount" label="实际数量" align="center"/>
<el-table-column prop="writeAmount" label="手动修改数量" align="center"/>
<el-table-column prop="writeAmount" label="手动修改数量" align="center">
<template #default="scope">
<div class="editable-cell">
<div v-if="editable" class="editable-cell-input-wrapper">
<el-input-number ref='inputs' size="small" style="height: 30px" :value="writeAmount" @change="handleChange" @blur="check" :max="scope.row.planAmount - scope.row.realAmount"/>
</div>
<div v-else class="editable-cell-text-wrapper" @dblclick="edit(scope.row)">
<span>{{ scope.row.writeAmount }}</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
style="left: 36%;margin-top: 6px;"
......@@ -91,7 +102,7 @@
<script>
import { defineComponent, ref, reactive, toRefs, getCurrentInstance } from 'vue'
import { ElMessage } from 'element-plus'
import { postAction } from '@/api/manage'
import { postAction, getAction } from '@/api/manage'
export default defineComponent({
setup() {
const billList = ref([])
......@@ -99,6 +110,9 @@ export default defineComponent({
const modelList = ref([])
const selectBill = ref({})
const selectGoods = ref({})
const editable = ref(false)
const writeAmount = ref()
const itemForm = ref({})
const { proxy } = getCurrentInstance()
const searchData = ref({
pageNo: 1,
......@@ -119,7 +133,9 @@ export default defineComponent({
url: {
getBillPage: '/bill/getBillPage',
getGoodsPage: '/bill/getGoodsPage',
getModelPage: '/bill/getModelPage'
getModelPage: '/bill/getModelPage',
updateItem: '/bill/updateItem',
reportBill: '/platform/reportInBill'
},
storeInfo: {},
storeCode: ''
......@@ -193,6 +209,40 @@ export default defineComponent({
loadModel()
}
function edit(row) {
proxy.editable = true;
itemForm.value = row
proxy.$nextTick((x) => {
if (proxy.$refs.inputs) {
proxy.$refs.inputs.focus();
}
})
}
function handleChange(e) {
writeAmount.value = e
itemForm.value.writeAmount = e
}
function check() {
proxy.editable = false;
itemForm.value.bizBillNo = selectBill.value.bizBillNo
itemForm.value.storeCode = searchData.value.storeCode
postAction(state.url.updateItem, itemForm.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
})
}
function reportBill(row) {
getAction(state.url.reportBill, {storeCode: searchData.value.storeCode, billNo: row.billNo}).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
})
}
loadData()
return {
...toRefs(state),
......@@ -207,12 +257,30 @@ export default defineComponent({
total,
total1,
total2,
editable,
writeAmount,
itemForm,
handleCurrentChange,
handleCurrentChange1,
handleCurrentChange2,
billClick,
goodsClick
goodsClick,
handleChange,
edit,
check,
reportBill
}
},
})
</script>
\ No newline at end of file
</script>
<style scoped>
.editable-cell {
position: relative;
}
.editable-cell-text-wrapper {
padding: 4px 5px 5px 5px;
cursor: pointer;
}
</style>
\ No newline at end of file
......@@ -25,7 +25,7 @@
<el-table-column label="操作" width="200" align="center">
<template #default="scope">
<el-button type="success" size="small" @click="activateBill(scope.row)">激活</el-button>
<el-button type="primary" size="small" @click="reportBill(scope.row)">上报</el-button>
<el-button type="primary" size="small" :disabled="scope.row.activeState !== 2" @click="reportBill(scope.row)">上报</el-button>
</template>
</el-table-column>
</el-table>
......@@ -71,7 +71,18 @@
<el-table-column prop="modelName" label="号型名称" align="center"/>
<el-table-column prop="planAmount" label="计划数量" align="center"/>
<el-table-column prop="realAmount" label="实际数量" align="center"/>
<el-table-column prop="writeAmount" label="手动修改数量" align="center"/>
<el-table-column prop="writeAmount" label="手动修改数量" align="center">
<template #default="scope">
<div class="editable-cell">
<div v-if="editable" class="editable-cell-input-wrapper">
<el-input-number ref='inputs' size="small" style="height: 30px" :value="writeAmount" @change="handleChange" @blur="check" :max="scope.row.planAmount - scope.row.realAmount"/>
</div>
<div v-else class="editable-cell-text-wrapper" @dblclick="edit(scope.row)">
<span>{{ scope.row.writeAmount }}</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
style="left: 36%;margin-top: 6px;"
......@@ -99,6 +110,9 @@ export default defineComponent({
const modelList = ref([])
const selectBill = ref({})
const selectGoods = ref({})
const editable = ref(false)
const writeAmount = ref()
const itemForm = ref({})
const { proxy } = getCurrentInstance()
const searchData = ref({
pageNo: 1,
......@@ -119,7 +133,9 @@ export default defineComponent({
url: {
getBillPage: '/bill/getBillPage',
getGoodsPage: '/bill/getGoodsPage',
getModelPage: '/bill/getModelPage'
getModelPage: '/bill/getModelPage',
updateItem: '/bill/updateItem',
reportBill: '/platform/reportOutBill'
},
storeInfo: {},
storeCode: ''
......@@ -193,6 +209,40 @@ export default defineComponent({
loadModel()
}
function edit(row) {
proxy.editable = true;
itemForm.value = row
proxy.$nextTick((x) => {
if (proxy.$refs.inputs) {
proxy.$refs.inputs.focus();
}
})
}
function handleChange(e) {
writeAmount.value = e
itemForm.value.writeAmount = e
}
function check() {
proxy.editable = false;
itemForm.value.bizBillNo = selectBill.value.bizBillNo
itemForm.value.storeCode = searchData.value.storeCode
postAction(state.url.updateItem, itemForm.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
})
}
function reportBill(row) {
getAction(state.url.reportBill, {storeCode: searchData.value.storeCode, billNo: row.billNo}).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
})
}
loadData()
return {
...toRefs(state),
......@@ -207,12 +257,30 @@ export default defineComponent({
total,
total1,
total2,
editable,
writeAmount,
itemForm,
handleCurrentChange,
handleCurrentChange1,
handleCurrentChange2,
billClick,
goodsClick
goodsClick,
handleChange,
edit,
check,
reportBill
}
},
})
</script>
\ No newline at end of file
</script>
<style scoped>
.editable-cell {
position: relative;
}
.editable-cell-text-wrapper {
padding: 4px 5px 5px 5px;
cursor: pointer;
}
</style>
\ No newline at end of file
......@@ -68,6 +68,7 @@ export default defineComponent({
const searchData = ref({
pageNo: 1,
pageSize: 10,
state: 'IN',
startTime: parseTime(new Date(new Date().setHours(0, 0, 0, 0))),
endTime: parseTime(new Date())
})
......@@ -112,7 +113,6 @@ export default defineComponent({
const loadData = () => {
if (sessionStorage.getItem('storeInfo')) {
let config = JSON.parse(sessionStorage.getItem('storeInfo'))
searchData.value.state = 'IN'
searchData.value.storeCode = config.storeCode
postAction('http://' + config.serverIp + ':' + config.serverPort + state.url.getGoodsRecord, searchData.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
......
......@@ -91,16 +91,20 @@ export default defineComponent({
}
const loadData = () => {
const loadData = (e) => {
if (sessionStorage.getItem('storeInfo')) {
searchData.value.storeCode = JSON.parse(sessionStorage.getItem('storeInfo')).storeCode
postAction(state.url.getBindPage, searchData.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
bindList.value = res.data.records
total.value = res.data.totalRows - 0
if (res.data.records.length > 0) {
formData.value.stationId = res.data.records[0].stationId
formData.value.id = res.data.records[0].id
if(e) {
} else {
if (res.data.records.length > 0) {
formData.value.stationId = res.data.records[0].stationId
formData.value.id = res.data.records[0].id
}
}
})
}
......@@ -155,7 +159,7 @@ export default defineComponent({
postAction(state.url.updateBind, formData.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
loadData(1)
})
}
......@@ -173,7 +177,7 @@ export default defineComponent({
postAction(state.url.updateBind, formData.value).then(res => {
if (res.code !== 99200) return ElMessage.error(res.message);
ElMessage.success(res.message)
loadData()
loadData(1)
})
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论