更新:单价审核后,写回报表

This commit is contained in:
磷叶 2025-02-18 11:33:09 +08:00
parent 3d8d48c06b
commit 9a30368b74
9 changed files with 73 additions and 37 deletions

View File

@ -81,12 +81,12 @@ export function cancelPrice(priceId) {
}
// 审核单价
export function verifyPrice(priceIds, pass) {
export function verifyPrice(priceList, pass) {
return request({
url: `/yh/price/verify`,
method: 'put',
data: {
priceIds,
priceList,
pass
}
})

View File

@ -16,7 +16,10 @@
:label="label(item)"
:value="item.priceId"
>
<span style="float: left">{{ item.name | dv}}</span>
<span style="float: left">
{{ item.name | dv}}
<dict-tag :value="item.status" :options="dict.type.price_status" size="mini"/>
</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code | dv}}</span>
</el-option>
<el-option v-if="options.length === 0 && !loading" style="height: 0px" disabled label="" :value="null"/>
@ -30,6 +33,7 @@
import { listPrice } from '@/api/yh/price'
export default {
name: 'PriceSelect',
dicts: ['price_status'],
props: {
value: {
type: String,
@ -43,6 +47,10 @@ export default {
type: String,
default: null,
},
status: {
type: String,
default: null,
},
query: {
type: Object,
default: () => ({}),
@ -81,13 +89,15 @@ export default {
value(nv, ov ) {
let obj = this.options.find(item => item.priceId == nv);
if (obj == null) {
this.options.push({priceId: nv, name: this.name, code: this.code});
this.options.push({priceId: nv, name: this.name, code: this.code, status: this.status});
this.total ++;
}
}
},
created() {
if (this.value != null) {
this.options = [{priceId: this.value, name: this.name, code: this.code}]
this.options = [{priceId: this.value, name: this.name, code: this.code, status: this.status}]
this.total = 1;
}
},
methods: {

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="dict-tag">
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<span
@ -91,4 +91,7 @@ export default {
.el-tag + .el-tag {
margin-left: 10px;
}
.dict-tag {
display: inline-block;
}
</style>

View File

@ -37,6 +37,10 @@ export const PriceStatus = {
// 允许删除
canDel(status) {
return [this.WAIT_SUBMIT, this.REJECT].includes(status);
},
// 允许使用
canUse() {
return [this.WAIT_VERIFY, this.PASS];
}
}

View File

@ -26,6 +26,14 @@
<el-descriptions-item label="备注" span="3">{{detail.remark | dv}}</el-descriptions-item>
</el-descriptions>
</div>
<el-form :model="detail" ref="form" label-width="4em" style="margin-top: 1em;">
<el-form-item label="单价" prop="price">
<el-input v-model="detail.price" placeholder="请输入单价" type="number">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button type="success" plain icon="el-icon-check" @click="submitVerify(true)" :loading="submitLoading">通过</el-button>
<el-button type="danger" plain icon="el-icon-close" @click="submitVerify(false)" :loading="submitLoading">驳回</el-button>
@ -77,13 +85,14 @@ export default {
methods: {
formatFraction,
submitVerify(pass) {
this.$refs.form.validate().then(() => {
this.$confirm(`确定要${pass ? '通过' : '驳回'}吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.submitLoading = true;
verifyPrice([this.priceId], pass).then(res => {
verifyPrice([{priceId: this.priceId, price: this.detail.price}], pass).then(res => {
if (res.code === 200) {
this.$message.success(pass ? '通过成功' : '驳回成功');
this.show = false;
@ -93,6 +102,7 @@ export default {
this.submitLoading = false;
})
})
})
},
//
getDetail(priceId) {

View File

@ -482,13 +482,7 @@ export default {
//
rules: {
deptId: [
{ required: true, message: "部门ID不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "状态不能为空", trigger: "change" }
],
price: [
{ required: true, message: "单价不能为空", trigger: "blur" }
{ required: true, message: "部门不能为空", trigger: "blur" }
],
unit: [
{ required: true, message: "单位不能为空", trigger: "blur" }
@ -498,6 +492,7 @@ export default {
]
},
currentRow: null, //
rows: [],
};
},
computed: {
@ -516,8 +511,14 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
verifyPrice(this.ids, pass).then(res => {
this.$message.success(pass ? '通过成功' : '驳回成功');
let data = this.rows.map(item => ({
priceId: item.priceId,
price: item.price
}));
verifyPrice(data, pass).then(res => {
if (res.code === 200) {
this.$message.success(pass ? `通过成功${res.data}条数据` : `驳回成功${res.data}条数据`);
}
}).finally(() => {
this.getList();
})
@ -596,6 +597,7 @@ export default {
this.ids = selection.map(item => item.priceId)
this.single = selection.length!==1
this.multiple = !selection.length
this.rows = selection;
//
this.currentRow = selection.length === 1 ? selection[0] : null;
},

View File

@ -39,8 +39,10 @@
v-model="d.row.priceId"
:name="d.row.priceName"
:code="d.row.priceCode"
:status="d.row.priceStatus"
:query="priceQuery"
@change="(val) => handlePriceChange(d.row, val)"
style="width: 100%;"
/>
</table-form-col>
<table-form-col label="成品" prop-prefix="productList" prop="isEnd" :rules="rules.productList.isEnd" required width="60">
@ -50,12 +52,12 @@
<el-input-number slot-scope="d" v-model="d.row.defectNum" placeholder="请输入数量" :min="0" :precision="0" controls-position="right" style="width: 100%"/>
</table-form-col> -->
<table-form-col label="表面处理" prop-prefix="productList" prop="surface" :rules="rules.productList.surface" header-icon="el-icon-edit" @click-header="handleBatchEdit('surface')">
<el-select slot-scope="d" v-model="d.row.surface" placeholder="请选择表面处理" filterable clearable allow-create>
<el-select slot-scope="d" v-model="d.row.surface" placeholder="请选择表面处理" filterable clearable allow-create style="width: 100%;">
<el-option v-for="item in dict.type.surface" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</table-form-col>
<table-form-col label="颜色" prop-prefix="productList" prop="color" :rules="rules.productList.color" header-icon="el-icon-edit" @click-header="handleBatchEdit('color')">
<el-select slot-scope="d" v-model="d.row.color" placeholder="请选择颜色" filterable clearable allow-create>
<el-select slot-scope="d" v-model="d.row.color" placeholder="请选择颜色" filterable clearable allow-create style="width: 100%;">
<el-option v-for="item in dict.type.color_code" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
</table-form-col>
@ -198,7 +200,7 @@ export default {
priceQuery() {
return {
deptId: this.form.deptId,
status: PriceStatus.PASS, //
statusList: PriceStatus.canUse(),
disabled: false,
excludePriceIds: this.form.productList.map(item => item.priceId)
}
@ -228,6 +230,7 @@ export default {
row.priceQuantityNumerator = val.quantityNumerator;
row.priceQuantityDenominator = val.quantityDenominator;
row.priceCode = val.code;
row.priceStatus = val.status;
},
//
handleChangeUserNum(row) {

View File

@ -1,7 +1,7 @@
<template>
<div class="app-container" v-loading="loading">
<el-row :gutter="16">
<el-col :md="showVerify ? 19 : 24">
<el-col :lg="showVerify ? 18 : 24">
<el-card header="基本信息" class="card-box">
<el-descriptions :column="4">
<el-descriptions-item label="报表编号">{{detail.reportId | dv}}</el-descriptions-item>
@ -38,7 +38,7 @@
}"/>
</el-card>
</el-col>
<el-col :md="5" v-if="showVerify">
<el-col :lg="6" v-if="showVerify">
<el-card header="审核">
<el-form :model="detail">
<el-form-item label="审核意见" prop="verifyRemark">

View File

@ -70,7 +70,7 @@
size="mini"
>
<el-table-column type="selection" width="55" align="center" v-if="listConfig.showSelection"/>
<el-table-column type="expand" width="55" align="left" fixed="left">
<el-table-column type="expand" width="20" align="left" fixed="left">
<template slot-scope="d">
<div class="expand-container">
<el-descriptions border>
@ -119,6 +119,9 @@
<template v-else-if="column.key === 'reportStatus'">
<dict-tag :value="d.row.reportStatus" :options="dict.type.report_status"/>
</template>
<template v-else-if="column.key === 'priceStatus'">
<dict-tag :value="d.row.priceStatus" :options="dict.type.price_status"/>
</template>
<template v-else-if="['totalAmount', 'pricePrice'].includes(column.key)">
{{d.row[column.key] | dv}}
</template>
@ -239,7 +242,7 @@ const defaultSort = {
export default {
name: "ReportProd",
mixins: [$showColumns, $listConfig, $showSearch],
dicts: ['price_type', 'report_status'],
dicts: ['price_type', 'report_status', 'price_status'],
components: {ReportOrderProdDescriptions, ReportUserProdDescriptions, ReportUserProd, SearchFormItem, FormCol, BooleanTag},
props: {
query: {
@ -282,6 +285,7 @@ export default {
{key: 'reportStatus', visible: true, label: '报表状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'priceDeptName', visible: true, label: '车间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceName', visible: true, label: '工序', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceStatus', visible: true, label: '单价状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'priceSubName', visible: true, label: '子工序', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'priceType', visible: false, label: '类型', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'isEnd', visible: true, label: '成品', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},