This commit is contained in:
磷叶 2025-02-21 10:05:06 +08:00
parent 7585a1c284
commit a841f6038d
7 changed files with 287 additions and 126 deletions

View File

@ -42,3 +42,13 @@ export function delReportProd(id) {
method: 'delete' method: 'delete'
}) })
} }
// 刷新单价匹配报表产量
export function refreshPriceMatchReportProd(ids) {
return request({
url: '/yh/reportProd/priceMatch',
method: 'put',
data: ids
})
}

View File

@ -20,11 +20,11 @@
> >
<span style="float: left"> <span style="float: left">
{{ item.name | dv}} ({{ item.price | dv }}) {{ item.name | dv}} ({{ item.price | dv }})
<dict-tag :value="item.status" :options="dict.type.price_status" size="mini"/> <dict-tag :value="item.status" :options="priceStatus" size="mini"/>
</span> </span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code | dv}}</span> <span style="float: right; color: #8492a6; font-size: 13px">{{ item.code | dv}}</span>
</el-option> </el-option>
<el-option v-if="value == null && options.length == 0" disabled label="请检查" :value="null"/> <el-option v-if="value == null && options.length == 0" disabled label="无单价" :value="null"/>
<div style="text-align: center; color: #8492a6; font-size: 13px"> <div style="text-align: center; color: #8492a6; font-size: 13px">
{{ total }}条数据 {{ total }}条数据
</div> </div>
@ -35,7 +35,6 @@
import { listPrice } from '@/api/yh/price' import { listPrice } from '@/api/yh/price'
export default { export default {
name: 'PriceSelect', name: 'PriceSelect',
dicts: ['price_status'],
props: { props: {
value: { value: {
type: String, type: String,
@ -60,6 +59,10 @@ export default {
query: { query: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
},
priceStatus: {
type: Array,
default: () => [],
} }
}, },
data() { data() {

View File

@ -7,33 +7,40 @@
clearable clearable
size="mini" size="mini"
style="width: 300px;" style="width: 300px;"
@keyup.enter.native="handleSearch" @keyup.enter.native="getList"
@clear="handleSearch" @clear="getList"
@input="handleSearch" @change="getList"
> >
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button> <el-button slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
<el-row type="flex" style="justify-content: flex-end;align-items: center;"> <el-row type="flex" style="justify-content: flex-end;align-items: center;">
<div style="font-size: 12px; color: #999; margin-right: 10px;line-height: 1em;">仅看无单价:<el-switch v-model="onlyNoPrice" @change="getList" style="height: 20px" size="mini" /></div>
<div style="font-size: 12px; color: #999; margin-right: 10px;line-height: 1em;">显示图案:<el-switch v-model="showPattern" @change="handleChangeShowPattern" style="height: 20px" size="mini" /></div> <div style="font-size: 12px; color: #999; margin-right: 10px;line-height: 1em;">显示图案:<el-switch v-model="showPattern" @change="handleChangeShowPattern" style="height: 20px" size="mini" /></div>
<div style="font-size: 12px; color: #999; margin-right: 10px;line-height: 1em;">自动汇总良品:<el-switch v-model="autoSumNum" style="height: 20px" size="mini" /></div> <div style="font-size: 12px; color: #999; margin-right: 10px;line-height: 1em;">自动汇总良品:<el-switch v-model="autoSumNum" style="height: 20px" size="mini" /></div>
<el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleBatchEditUserProduct" icon="el-icon-edit">修改所选员工产量</el-button> <el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleBatchEditUserProduct" icon="el-icon-edit">批量修改员工产量</el-button>
<el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleCopy" icon="el-icon-document-copy">复制所选工序</el-button> <el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleCopy" icon="el-icon-document-copy">批量复制</el-button>
<el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleBatchDel" icon="el-icon-delete">删除所选工序</el-button> <el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleBatchDel" icon="el-icon-delete">批量删除</el-button>
</el-row> </el-row>
</el-row> </el-row>
<el-table <el-table
:data="filteredProductList" v-loading="loadLoading"
:element-loading-text="`加载中...第${loadIndex}行/共${loadTotal}行`"
:data="tableData"
size="mini" size="mini"
stripe stripe
max-height="500px"
:header-cell-style="headerCellStyle" :header-cell-style="headerCellStyle"
class="mini-table table-form" class="mini-table table-form"
ref="table" ref="table"
accordion
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" align="center"/> <el-table-column type="selection" align="center"/>
<el-table-column type="index" min-width="10" align="center" label="#"/> <el-table-column type="index" min-width="10" align="center" label="#">
<template slot-scope="d">
{{d.$index + (pageNum - 1) * pageSize + 1}}
</template>
</el-table-column>
<table-form-col label="工序名称" prop-prefix="productList" prop="priceName" :rules="rules.productList.priceName" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceName')"> <table-form-col label="工序名称" prop-prefix="productList" prop="priceName" :rules="rules.productList.priceName" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceName')">
<el-input slot-scope="d" v-model="d.row.priceName" placeholder="请输入工序名称" @change="selectPrice(d.index)" /> <el-input slot-scope="d" v-model="d.row.priceName" placeholder="请输入工序名称" @change="selectPrice(d.index)" />
</table-form-col> </table-form-col>
@ -43,7 +50,7 @@
<table-form-col label="大小" prop-prefix="productList" prop="priceSize" width="60" :rules="rules.productList.priceSize" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceSize')"> <table-form-col label="大小" prop-prefix="productList" prop="priceSize" width="60" :rules="rules.productList.priceSize" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceSize')">
<el-input slot-scope="d" v-model="d.row.priceSize" placeholder="请输入大小" @change="selectPrice(d.index)" /> <el-input slot-scope="d" v-model="d.row.priceSize" placeholder="请输入大小" @change="selectPrice(d.index)" />
</table-form-col> </table-form-col>
<table-form-col label="图案" v-if="showPattern" prop-prefix="productList" width="100" prop="pricePattern" :rules="rules.productList.pricePattern" header-icon="el-icon-edit" @click-header="handleBatchEdit('pricePattern')"> <table-form-col :label="showPattern ? '图案' : ''" prop-prefix="productList" :width="showPattern ? '100' : '0'" prop="pricePattern" :rules="rules.productList.pricePattern" header-icon="el-icon-edit" @click-header="handleBatchEdit('pricePattern')">
<el-input slot-scope="d" v-model="d.row.pricePattern" placeholder="请输入图案" @change="selectPrice(d.index)" /> <el-input slot-scope="d" v-model="d.row.pricePattern" placeholder="请输入图案" @change="selectPrice(d.index)" />
</table-form-col> </table-form-col>
<table-form-col label="成品" prop-prefix="productList" prop="isEnd" :rules="rules.productList.isEnd" required width="60"> <table-form-col label="成品" prop-prefix="productList" prop="isEnd" :rules="rules.productList.isEnd" required width="60">
@ -91,7 +98,7 @@
</table-form-col> </table-form-col>
<el-table-column label="操作" align="center" width="120"> <el-table-column label="操作" align="center" width="120">
<template #header> <template #header>
<el-button size="small" icon="el-icon-plus" type="text" @click="handleAdd" >新增工序</el-button> <el-button size="small" icon="el-icon-plus" type="text" @click="handleAdd">新增工序</el-button>
</template> </template>
<template slot-scope="d"> <template slot-scope="d">
<el-button <el-button
@ -112,28 +119,22 @@
icon="el-icon-document-copy" icon="el-icon-document-copy"
size="small" size="small"
>复制</el-button> >复制</el-button>
<!-- <el-button
type="text"
@click="handleDel(d.$index, d.row)"
icon="el-icon-delete"
size="small"
style="color: #f56c6c;"
>删除</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
<el-table-column type="expand" width="20" align="left"> <el-table-column type="expand" width="20" align="left">
<template slot-scope="d"> <template slot-scope="d">
<div class="expand-container"> <div class="expand-container">
<el-tabs tab-position="left"> <el-tabs tab-position="left">
<el-tab-pane :label="`员工产量(${d.row.userProdList.length})`"> <el-tab-pane :label="`员工产量(${d.row.userProdList.length})`">
<report-product-user-list <report-product-user-list
v-model="d.row.userProdList" v-model="d.row.userProdList"
:prop-prefix="`productList[${d.$index}].userProdList`" :prop-prefix="`productList[${d.$index}].userProdList`"
:rules="rules.productList.userProdList" :rules="rules.productList.userProdList"
:prod="d.row" :prod="d.row"
:form="form" :form="form"
@change-num="handleChangeUserNum(d.row)" @change-num="handleChangeUserNum(d.row)"
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="`订单产量(${d.row.orderProdList.length})`"> <el-tab-pane :label="`订单产量(${d.row.orderProdList.length})`">
<report-product-order-list <report-product-order-list
@ -150,6 +151,16 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- TODO 分页 -->
<pagination
v-show="total>0"
:total="total"
:page.sync="pageNum"
:limit.sync="pageSize"
@pagination="getList"
/>
<user-product-batch-dialog <user-product-batch-dialog
:show.sync="showUserEditDialog" :show.sync="showUserEditDialog"
@submit="onSubmitUserProductBatch" @submit="onSubmitUserProductBatch"
@ -172,7 +183,7 @@ import PriceSelect from '@/components/Business/Price/PriceSelect.vue'
export default { export default {
name: "ReportProductList", name: "ReportProductList",
dicts: ['price_type', 'surface', 'color_code'], dicts: ['price_type', 'surface', 'color_code', 'price_status'],
components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog, PriceSelect}, components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog, PriceSelect},
props: { props: {
form: { form: {
@ -193,12 +204,13 @@ export default {
}, },
data() { data() {
return { return {
onlyNoPrice: false, //
tableData: [],
headerCellStyle: { headerCellStyle: {
backgroundColor: "#f5f7fa", backgroundColor: "#f5f7fa",
}, },
rows: [], // rows: [], //
searchKey: '', // searchKey: '', //
filteredProductList: [], //
showUserEditDialog: false, // showUserEditDialog: false, //
fieldMap: { // fieldMap: { //
surface: '表面处理', surface: '表面处理',
@ -210,7 +222,20 @@ export default {
priceName: '工序', priceName: '工序',
}, },
autoSumNum: true, // autoSumNum: true, //
showPattern: false, // showPattern: true, //
searchTimer: null,
patternChangeTimer: null, //
isPatternChanging: false, //
expandedRows: new Set(), //
cachedComponents: {}, //
total: 0, //
pageNum: 1, //
pageSize: 20, //
loadLoading: false, //
loadIndex: 0, //
loadTotal: 0, //
loadInterval: null, //
} }
}, },
computed: { computed: {
@ -229,10 +254,83 @@ export default {
} }
}, },
created() { created() {
this.handleSearch(); this.getList();
this.showPattern = localStorage.getItem("report_show_pattern") == "true"; },
mounted() {
this.showPattern = localStorage.getItem("report_show_pattern") === "true";
}, },
methods: { methods: {
getList() {
if (this.loadLoading) {
return;
}
let filteredList = [];
if (this.searchKey == null || this.searchKey === '') {
filteredList = this.form.productList;
} else {
// 使
const searchRegex = new RegExp(this.searchKey, 'i');
filteredList = this.form.productList.filter(item => {
return searchRegex.test(item.priceName) ||
searchRegex.test(item.priceCode) ||
searchRegex.test(item.priceCategory) ||
searchRegex.test(item.priceSize) ||
searchRegex.test(item.pricePattern);
});
}
if (this.onlyNoPrice) {
filteredList = filteredList.filter(item => {
return item.priceId == null;
});
}
this.total = filteredList.length;
//
const start = (this.pageNum - 1) * this.pageSize;
const end = start + this.pageSize;
// 使Array.from,
const data = Array.from({length: Math.min(this.pageSize, filteredList.length - start)},
(_, i) => filteredList[start + i]);
this.loadLoading = true;
this.loadIndex = 0;
this.loadTotal = data.length;
let batchSize = 1; //
let timeout = 50; //
// tableDatadata
if (this.tableData.length == this.loadTotal) {
batchSize = this.pageSize;
timeout = 10;
}
// 使setTimeout
const loadNextBatch = () => {
for(let i = 0; i < batchSize && this.loadIndex <= this.loadTotal; i++) {
const item = data[this.loadIndex];
if (item) {
// ,push
this.$set(this.tableData, this.loadIndex, item);
}
this.loadIndex++;
}
// ,
if (this.loadIndex >= this.loadTotal) {
// tableData,
if (this.tableData.length > this.loadTotal) {
this.tableData.splice(this.loadTotal);
}
this.loadLoading = false;
} else {
setTimeout(loadNextBatch, timeout);
}
};
setTimeout(loadNextBatch, 100);
},
handleChangeShowPattern(val) { handleChangeShowPattern(val) {
localStorage.setItem("report_show_pattern", val); localStorage.setItem("report_show_pattern", val);
}, },
@ -240,6 +338,7 @@ export default {
selectPrice(index) { selectPrice(index) {
this.$refs[`priceSelect${index}`].getOptionsAndSelectFirst(); this.$refs[`priceSelect${index}`].getOptionsAndSelectFirst();
}, },
//
handleDetail(row) { handleDetail(row) {
// //
this.$refs.table.toggleRowExpansion(row); this.$refs.table.toggleRowExpansion(row);
@ -368,7 +467,6 @@ export default {
} }
}) })
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`); this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`);
this.handleSearch();
}) })
}, },
// //
@ -386,26 +484,49 @@ export default {
}).then(({ value }) => { }).then(({ value }) => {
for (let i = 0; i < value; i++) { for (let i = 0; i < value; i++) {
for (let j = 0; j < this.rows.length; j++) { for (let j = 0; j < this.rows.length; j++) {
this.doCopy(null, this.rows[j]); this.form.productList.push(this.getCopyData(null, this.rows[j]));
} }
} }
this.$message.success(`复制成功,一共复制了${value * this.rows.length}行工序`); // ,getList
if (Math.ceil(this.total / this.pageSize) === this.pageNum) {
this.getList();
}
}) })
}, },
// //
doCopy(index, row) { getCopyData(index, row) {
let data = JSON.parse(JSON.stringify(row)); let data = JSON.parse(JSON.stringify(row));
// ID
data.id = null;
if (data.userProdList != null) {
data.userProdList.forEach(item => {
item.id = null;
})
}
if (data.orderProdList != null) {
data.orderProdList.forEach(item => {
item.id = null;
})
}
//
if (index == null) { if (index == null) {
data.sort = this.getNewSort(); data.sort = this.getNewSort();
} else { } else {
data.sort = row.sort + 1; data.sort = row.sort + 1;
for (let i = index + 1 ; i < this.form.productList.length; i ++) { }
this.form.productList[i].sort ++;
} return data;
},
doCopy(index, row) {
let data = this.getCopyData(index, row);
for (let i = index + 1 ; i < this.form.productList.length; i ++) {
this.form.productList[i].sort ++;
} }
this.form.productList.push(data); this.form.productList.push(data);
this.handleSearch();
this.reorder(); this.reorder();
this.getList();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -414,9 +535,13 @@ export default {
isEmpty, isEmpty,
// //
handleAdd() { handleAdd() {
this.form.productList.push(this.getNewRow()); let row = this.getNewRow();
this.handleSearch(); this.form.productList.push(row);
this.reorder(); this.total ++;
// ,
if (Math.ceil(this.total / this.pageSize) <= this.pageNum) {
this.tableData.push(row);
}
}, },
// //
getNewRow() { getNewRow() {
@ -502,23 +627,9 @@ export default {
} }
this.$message.success(`删除成功,一共删除了${this.rows.length}行工序`); this.$message.success(`删除成功,一共删除了${this.rows.length}行工序`);
this.rows = []; this.rows = [];
this.handleSearch(); this.getList();
}); });
}, },
handleSearch() {
if (!this.searchKey) {
this.filteredProductList = this.form.productList;
return;
}
const key = this.searchKey.toLowerCase();
this.filteredProductList = this.form.productList.filter(item => {
const priceName = (item.priceName || '').toLowerCase();
const priceCode = (item.priceCode || '').toLowerCase();
const surface = (item.surface || '').toLowerCase();
const color = (item.color || '').toLowerCase();
return priceName.includes(key) || priceCode.includes(key) || surface.includes(key) || color.includes(key);
});
}
} }
} }
</script> </script>

View File

@ -37,12 +37,15 @@
</form-col> </form-col>
</el-row> </el-row>
<el-tabs v-if="init"> <el-tabs v-if="init" >
<el-tab-pane :label="`工序产量 (${form.productList.length}) `"> <el-tab-pane :label="`工序产量 (${form.productList.length}) `">
<report-product-list :form="form" :rules="rules" /> <report-product-list
ref="productList"
:form="form"
:rules="rules"
/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-form> </el-form>
</div> </div>
@ -97,9 +100,6 @@ export default {
{ required: true, message: "报表日期不能为空", trigger: "blur" } { required: true, message: "报表日期不能为空", trigger: "blur" }
], ],
productList: { productList: {
priceId: [
{ required: true, message: "工序不能为空", trigger: "blur" }
],
isEnd: [ isEnd: [
{ required: true, message: "是否成品不能为空", trigger: "blur" } { required: true, message: "是否成品不能为空", trigger: "blur" }
], ],
@ -127,6 +127,11 @@ export default {
autoSaveInterval: null, autoSaveInterval: null,
saveTime: null, saveTime: null,
init: false, init: false,
loadLoading: false, //
loadIndex: 0, //
loadTotal: 0, //
loadInterval: null, //
} }
}, },
computed: { computed: {
@ -184,8 +189,10 @@ export default {
// 10 // 10
if (this.autoSaveInterval == null) { if (this.autoSaveInterval == null) {
this.autoSaveInterval = setInterval(() => { this.autoSaveInterval = setInterval(() => {
this.saveTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'); if (this.form != null) {
localStorage.setItem('report', JSON.stringify(this.form)); this.saveTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}');
localStorage.setItem('report', JSON.stringify(this.form));
}
}, 1000 * 10); }, 1000 * 10);
} }
}, },
@ -202,7 +209,11 @@ export default {
}, },
// //
getLocalSave() { getLocalSave() {
return JSON.parse(localStorage.getItem('report')); let save = localStorage.getItem('report');
if (save == null) {
return null;
}
return JSON.parse(save);
}, },
handleEditProduct(row, index) { handleEditProduct(row, index) {
this.row = row; this.row = row;
@ -232,9 +243,12 @@ export default {
getReport(reportId, {needProductList: true, needUserProd: true, needOrderProd: true}).then(response => { getReport(reportId, {needProductList: true, needUserProd: true, needOrderProd: true}).then(response => {
this.form = response.data; this.form = response.data;
this.init = true; this.init = true;
}).catch(error => {
this.$modal.msgError("获取数据失败");
console.error(error);
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}) });
}, },
submitForm(submit) { submitForm(submit) {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
@ -301,17 +315,13 @@ export default {
} }
} }
return null; return null;
} },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.report-edit-container { .report-edit-container {
height: 100%;
display: flex;
flex-direction: column;
padding-bottom: 32px;
.edit-header { .edit-header {
flex-shrink: 0; flex-shrink: 0;
@ -319,7 +329,7 @@ export default {
.edit-container { .edit-container {
padding: 16px; padding: 16px;
padding-bottom: 232px;
} }
} }
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<template v-for="(item, index) of data"> <template v-for="(item, index) of data">
<el-descriptions border :column="4" > <el-descriptions border :column="4" size="mini">
<el-descriptions-item :key="item.id" label="生产订单" :span="2">{{item.orderErpBillNo | dv}}</el-descriptions-item> <el-descriptions-item :key="item.id" label="生产订单" :span="2">{{item.orderErpBillNo | dv}}</el-descriptions-item>
<el-descriptions-item :key="item.id" label="本次提交产量">{{item.num | fix2 | dv}} {{priceUnit}}</el-descriptions-item> <el-descriptions-item :key="item.id" label="本次提交产量">{{item.num | fix2 | dv}} {{priceUnit}}</el-descriptions-item>
<el-descriptions-item :key="item.id" label="订单进度"> <el-descriptions-item :key="item.id" label="订单进度">

View File

@ -1,5 +1,5 @@
<template> <template>
<el-descriptions border> <el-descriptions border size="mini">
<template v-for="(item, index) of data"> <template v-for="(item, index) of data">
<el-descriptions-item :key="item.id" label="员工">{{item.userName | dv}}</el-descriptions-item> <el-descriptions-item :key="item.id" label="员工">{{item.userName | dv}}</el-descriptions-item>
<el-descriptions-item :key="item.id" label="产量">{{item.num | dv}} {{priceUnit}}</el-descriptions-item> <el-descriptions-item :key="item.id" label="产量">{{item.num | dv}} {{priceUnit}}</el-descriptions-item>

View File

@ -1,6 +1,6 @@
<template> <template>
<div :class="listConfig.containerClass"> <div :class="listConfig.containerClass">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="68px">
<search-form-item <search-form-item
v-for="item of searchColumns" v-for="item of searchColumns"
:key="item.key" :key="item.key"
@ -12,6 +12,13 @@
:dict="dict" :dict="dict"
@query="handleQuery" @query="handleQuery"
/> />
<el-form-item label="单价">
<el-radio-group v-model="queryParams.priceMatch" @change="handleQuery">
<el-radio-button :label="null">全部</el-radio-button>
<el-radio-button :label="true">有单价</el-radio-button>
<el-radio-button :label="false">无单价</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -41,6 +48,17 @@
<!-- v-has-permi="['yh:reportProd:remove']"--> <!-- v-has-permi="['yh:reportProd:remove']"-->
<!-- >删除</el-button>--> <!-- >删除</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-refresh"
size="mini"
:disabled="multiple"
@click="handleRefreshPriceMatchReportProd"
v-has-permi="['yh:reportProd:priceMatch']"
>刷新单价</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
@ -73,7 +91,7 @@
<el-table-column type="expand" width="20" align="left" fixed="left"> <el-table-column type="expand" width="20" align="left" fixed="left">
<template slot-scope="d"> <template slot-scope="d">
<div class="expand-container"> <div class="expand-container">
<el-descriptions border> <el-descriptions border size="mini">
<el-descriptions-item label="类别">{{d.row.priceCategory | dv}}</el-descriptions-item> <el-descriptions-item label="类别">{{d.row.priceCategory | dv}}</el-descriptions-item>
<el-descriptions-item label="大小">{{d.row.priceSize | dv}}</el-descriptions-item> <el-descriptions-item label="大小">{{d.row.priceSize | dv}}</el-descriptions-item>
<el-descriptions-item label="图案">{{d.row.pricePattern | dv}}</el-descriptions-item> <el-descriptions-item label="图案">{{d.row.pricePattern | dv}}</el-descriptions-item>
@ -114,17 +132,27 @@
<dict-tag :value="d.row.priceType" :options="dict.type.price_type"/> <dict-tag :value="d.row.priceType" :options="dict.type.price_type"/>
</template> </template>
<template v-else-if="column.key === 'isEnd'"> <template v-else-if="column.key === 'isEnd'">
<boolean-tag :value="d.row.isEnd"/> <boolean-tag :value="d.row.isEnd" size="mini"/>
</template> </template>
<template v-else-if="column.key === 'reportStatus'"> <template v-else-if="column.key === 'reportStatus'">
<dict-tag :value="d.row.reportStatus" :options="dict.type.report_status"/> <dict-tag :value="d.row.reportStatus" :options="dict.type.report_status" size="mini"/>
</template> </template>
<template v-else-if="column.key === 'priceStatus'"> <template v-else-if="column.key === 'num'">
<dict-tag :value="d.row.priceStatus" :options="dict.type.price_status"/> {{d.row[column.key] | dv}} {{d.row.priceUnit | dv}}
</template> </template>
<template v-else-if="['totalAmount', 'pricePrice'].includes(column.key)"> <template v-else-if="['totalAmount'].includes(column.key)">
{{d.row[column.key] | dv}} {{d.row[column.key] | dv}}
</template> </template>
<template v-else-if="['pricePrice'].includes(column.key)">
<template v-if="d.row.priceId">
{{d.row[column.key] | dv}}
<dict-tag :value="d.row.priceStatus" :options="dict.type.price_status" size="mini"/>
</template>
<span v-else style="color: red;">
暂无单价
</span>
</template>
<template v-else-if="['num','defectNum'].includes(column.key)"> <template v-else-if="['num','defectNum'].includes(column.key)">
{{d.row[column.key] | dv}} {{d.row[column.key] | dv}}
</template> </template>
@ -134,24 +162,18 @@
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">--> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<!-- <template slot-scope="scope">--> <template slot-scope="scope">
<!-- <el-button--> <el-button
<!-- size="mini"--> size="mini"
<!-- type="text"--> type="text"
<!-- icon="el-icon-edit"--> icon="el-icon-edit"
<!-- @click="handleUpdate(scope.row)"--> @click="handleUpdate(scope.row)"
<!-- v-has-permi="['yh:reportProd:edit']"--> v-has-permi="['yh:report:edit']"
<!-- >修改</el-button>--> v-show="ReportStatus.canEdit(scope.row.reportStatus)"
<!-- <el-button--> >修改报表</el-button>
<!-- size="mini"--> </template>
<!-- type="text"--> </el-table-column>
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-has-permi="['yh:reportProd:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
<pagination <pagination
@ -222,7 +244,7 @@
</template> </template>
<script> <script>
import {addReportProd, delReportProd, getReportProd, listReportProd, updateReportProd} from "@/api/yh/reportProd"; import {addReportProd, delReportProd, getReportProd, listReportProd, updateReportProd, refreshPriceMatchReportProd} from "@/api/yh/reportProd";
import {$listConfig, $showColumns, $showSearch} from '@/utils/mixins'; import {$listConfig, $showColumns, $showSearch} from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue"; import FormCol from "@/components/FormCol/index.vue";
import SearchFormItem from "@/components/SearchFormItem/index.vue"; import SearchFormItem from "@/components/SearchFormItem/index.vue";
@ -232,6 +254,7 @@ import ReportUserProdDescriptions from "@/views/yh/reportProd/components/ReportU
import {formatFraction, isEmpty} from "@/utils"; import {formatFraction, isEmpty} from "@/utils";
import ReportOrderProdDescriptions from "@/views/yh/reportProd/components/ReportOrderProdDescriptions.vue"; import ReportOrderProdDescriptions from "@/views/yh/reportProd/components/ReportOrderProdDescriptions.vue";
import BooleanTag from '@/components/BooleanTag/index.vue' import BooleanTag from '@/components/BooleanTag/index.vue'
import {ReportStatus} from "@/utils/constants";
// //
const defaultSort = { const defaultSort = {
@ -254,6 +277,7 @@ export default {
}, },
data() { data() {
return { return {
ReportStatus,
expandCustomConfig: { expandCustomConfig: {
containerClass: null, containerClass: null,
showSearch: false, showSearch: false,
@ -265,11 +289,10 @@ export default {
searchColumns: [ searchColumns: [
{key: 'reportId', label: "报表编号", type: 'input', dictType: null}, {key: 'reportId', label: "报表编号", type: 'input', dictType: null},
{key: 'reportStatus', label: "报表状态", type: 'dict', dictType: 'report_status'}, {key: 'reportStatus', label: "报表状态", type: 'dict', dictType: 'report_status'},
{key: 'priceDeptId', label: "车间", type: 'dept', dictType: null}, {key: 'deptId', label: "车间", type: 'dept', dictType: null},
{key: 'reportDateRange', label: "报表日期", type: 'daterange', dictType: null}, {key: 'reportDateRange', label: "报表日期", type: 'daterange', dictType: null},
{key: 'priceName', label: "工序", type: 'input', dictType: null}, {key: 'priceName', label: "工序", type: 'input', dictType: null},
{key: 'priceSubName', label: "子工序", type: 'input', dictType: null}, {key: 'priceSubName', label: "子工序", type: 'input', dictType: null},
{key: 'priceType', label: "类型", type: 'dict', dictType: 'price_type'},
{key: 'priceCategory', label: "类别", type: 'input', dictType: null}, {key: 'priceCategory', label: "类别", type: 'input', dictType: null},
{key: 'priceSize', label: "大小", type: 'input', dictType: null}, {key: 'priceSize', label: "大小", type: 'input', dictType: null},
{key: 'pricePattern', label: "图案", type: 'input', dictType: null}, {key: 'pricePattern', label: "图案", type: 'input', dictType: null},
@ -280,25 +303,24 @@ export default {
span: 24, span: 24,
// //
columns: [ columns: [
{key: 'id', visible: true, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"}, {key: 'id', visible: false, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
{key: 'reportId', visible: true, label: '报表编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"}, {key: 'reportId', visible: false, label: '报表', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'reportStatus', visible: true, label: '报表状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"}, {key: 'deptName', visible: true, label: '车间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceDeptName', visible: true, label: '车间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'reportDate', visible: true, label: '日期', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'reportStatus', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'priceName', 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: 'priceCategory', visible: true, label: '类别', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceSubName', visible: true, label: '子工序', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"}, {key: 'priceSize', visible: true, label: '大小', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'pricePattern', visible: true, label: '图案', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceSubName', visible: false, 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: '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"}, {key: 'isEnd', visible: true, label: '成品', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
{key: 'surface', visible: false, label: '表面处理', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'surface', visible: false, label: '表面处理', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'color', visible: false, label: '颜色', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'color', visible: false, label: '颜色', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'num', visible: true, label: '良品', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'num', visible: true, label: '良品', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'defectNum', visible: false, label: '不良品', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"}, {key: 'defectNum', visible: false, label: '不良品', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'priceUnit', visible: true, label: '单位', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'pricePrice', visible: true, label: '单价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'pricePrice', visible: true, label: '单价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'totalAmount', visible: true, label: '总价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'totalAmount', visible: true, label: '总价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceCategory', visible: false, label: '类别', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceSize', visible: false, label: '大小', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'pricePattern', visible: false, label: '图案', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceSpec', visible: false, label: '规格', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'priceSpec', visible: false, label: '规格', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceClassify', visible: false, label: '分类', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'priceClassify', visible: false, label: '分类', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'priceQuantity', visible: false, label: '倍数', minWidth: null, sortable: true, overflow: false, align: 'center', width: null}, {key: 'priceQuantity', visible: false, label: '倍数', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
@ -346,7 +368,8 @@ export default {
priceClassify: null, priceClassify: null,
priceQuantity: null, priceQuantity: null,
deleted: null, deleted: null,
priceType: null priceType: null,
priceMatch: null,
}, },
// //
form: {}, form: {},
@ -390,6 +413,16 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleRefreshPriceMatchReportProd() {
refreshPriceMatchReportProd(this.ids).then(response => {
if (response.code === 200 && response.data > 0) {
this.$modal.msgSuccess("刷新成功,刷新了" + response.data + "条数据");
this.getList();
} else {
this.$modal.msgError("刷新失败");
}
})
},
formatFraction, formatFraction,
isEmpty, isEmpty,
calcMulDecimal, calcMulDecimal,
@ -469,13 +502,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.$router.push(`/edit/report/${row.reportId}`)
const id = row.id || this.ids
getReportProd(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改报表产量";
});
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {