更新
This commit is contained in:
parent
7585a1c284
commit
a841f6038d
|
@ -42,3 +42,13 @@ export function delReportProd(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 刷新单价匹配报表产量
|
||||
export function refreshPriceMatchReportProd(ids) {
|
||||
return request({
|
||||
url: '/yh/reportProd/priceMatch',
|
||||
method: 'put',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
>
|
||||
<span style="float: left">
|
||||
{{ 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 style="float: right; color: #8492a6; font-size: 13px">{{ item.code | dv}}</span>
|
||||
</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">
|
||||
共{{ total }}条数据
|
||||
</div>
|
||||
|
@ -35,7 +35,6 @@
|
|||
import { listPrice } from '@/api/yh/price'
|
||||
export default {
|
||||
name: 'PriceSelect',
|
||||
dicts: ['price_status'],
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
|
@ -60,6 +59,10 @@ export default {
|
|||
query: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
priceStatus: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
|
@ -7,33 +7,40 @@
|
|||
clearable
|
||||
size="mini"
|
||||
style="width: 300px;"
|
||||
@keyup.enter.native="handleSearch"
|
||||
@clear="handleSearch"
|
||||
@input="handleSearch"
|
||||
@keyup.enter.native="getList"
|
||||
@clear="getList"
|
||||
@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-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="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="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="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="handleBatchDel" icon="el-icon-delete">批量删除</el-button>
|
||||
</el-row>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:data="filteredProductList"
|
||||
v-loading="loadLoading"
|
||||
:element-loading-text="`加载中...第${loadIndex}行/共${loadTotal}行`"
|
||||
:data="tableData"
|
||||
size="mini"
|
||||
stripe
|
||||
max-height="500px"
|
||||
:header-cell-style="headerCellStyle"
|
||||
class="mini-table table-form"
|
||||
ref="table"
|
||||
accordion
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<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')">
|
||||
<el-input slot-scope="d" v-model="d.row.priceName" placeholder="请输入工序名称" @change="selectPrice(d.index)" />
|
||||
</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')">
|
||||
<el-input slot-scope="d" v-model="d.row.priceSize" placeholder="请输入大小" @change="selectPrice(d.index)" />
|
||||
</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)" />
|
||||
</table-form-col>
|
||||
<table-form-col label="成品" prop-prefix="productList" prop="isEnd" :rules="rules.productList.isEnd" required width="60">
|
||||
|
@ -91,7 +98,7 @@
|
|||
</table-form-col>
|
||||
<el-table-column label="操作" align="center" width="120">
|
||||
<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 slot-scope="d">
|
||||
<el-button
|
||||
|
@ -112,28 +119,22 @@
|
|||
icon="el-icon-document-copy"
|
||||
size="small"
|
||||
>复制</el-button>
|
||||
<!-- <el-button
|
||||
type="text"
|
||||
@click="handleDel(d.$index, d.row)"
|
||||
icon="el-icon-delete"
|
||||
size="small"
|
||||
style="color: #f56c6c;"
|
||||
>删除</el-button> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column type="expand" width="20" align="left">
|
||||
<template slot-scope="d">
|
||||
<div class="expand-container">
|
||||
<el-tabs tab-position="left">
|
||||
<el-tab-pane :label="`员工产量(${d.row.userProdList.length})`">
|
||||
<report-product-user-list
|
||||
v-model="d.row.userProdList"
|
||||
:prop-prefix="`productList[${d.$index}].userProdList`"
|
||||
:rules="rules.productList.userProdList"
|
||||
:prod="d.row"
|
||||
:form="form"
|
||||
@change-num="handleChangeUserNum(d.row)"
|
||||
/>
|
||||
<report-product-user-list
|
||||
v-model="d.row.userProdList"
|
||||
:prop-prefix="`productList[${d.$index}].userProdList`"
|
||||
:rules="rules.productList.userProdList"
|
||||
:prod="d.row"
|
||||
:form="form"
|
||||
@change-num="handleChangeUserNum(d.row)"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="`订单产量(${d.row.orderProdList.length})`">
|
||||
<report-product-order-list
|
||||
|
@ -150,6 +151,16 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
||||
<!-- TODO 分页 -->
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="pageNum"
|
||||
:limit.sync="pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<user-product-batch-dialog
|
||||
:show.sync="showUserEditDialog"
|
||||
@submit="onSubmitUserProductBatch"
|
||||
|
@ -172,7 +183,7 @@ import PriceSelect from '@/components/Business/Price/PriceSelect.vue'
|
|||
|
||||
export default {
|
||||
name: "ReportProductList",
|
||||
dicts: ['price_type', 'surface', 'color_code'],
|
||||
dicts: ['price_type', 'surface', 'color_code', 'price_status'],
|
||||
components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog, PriceSelect},
|
||||
props: {
|
||||
form: {
|
||||
|
@ -193,12 +204,13 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
onlyNoPrice: false, // 仅看无单价
|
||||
tableData: [],
|
||||
headerCellStyle: {
|
||||
backgroundColor: "#f5f7fa",
|
||||
},
|
||||
rows: [], // 当前选择的行
|
||||
searchKey: '', // 搜索关键字
|
||||
filteredProductList: [], // 过滤后的工序列表
|
||||
showUserEditDialog: false, // 批量修改员工产量弹窗
|
||||
fieldMap: { // 字段映射
|
||||
surface: '表面处理',
|
||||
|
@ -210,7 +222,20 @@ export default {
|
|||
priceName: '工序',
|
||||
},
|
||||
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: {
|
||||
|
@ -229,10 +254,83 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.handleSearch();
|
||||
this.showPattern = localStorage.getItem("report_show_pattern") == "true";
|
||||
this.getList();
|
||||
},
|
||||
mounted() {
|
||||
this.showPattern = localStorage.getItem("report_show_pattern") === "true";
|
||||
},
|
||||
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; // 每批加载时间
|
||||
|
||||
// 若tableData长度与data长度一致,则加快加载速度
|
||||
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) {
|
||||
localStorage.setItem("report_show_pattern", val);
|
||||
},
|
||||
|
@ -240,6 +338,7 @@ export default {
|
|||
selectPrice(index) {
|
||||
this.$refs[`priceSelect${index}`].getOptionsAndSelectFirst();
|
||||
},
|
||||
// 优化展开行处理
|
||||
handleDetail(row) {
|
||||
// 展开行
|
||||
this.$refs.table.toggleRowExpansion(row);
|
||||
|
@ -368,7 +467,6 @@ export default {
|
|||
}
|
||||
})
|
||||
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`);
|
||||
this.handleSearch();
|
||||
})
|
||||
},
|
||||
// 复制所选工序
|
||||
|
@ -386,26 +484,49 @@ export default {
|
|||
}).then(({ value }) => {
|
||||
for (let i = 0; i < value; i++) {
|
||||
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));
|
||||
|
||||
// 清空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) {
|
||||
data.sort = this.getNewSort();
|
||||
} else {
|
||||
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.handleSearch();
|
||||
this.reorder();
|
||||
this.getList();
|
||||
},
|
||||
// 选择行
|
||||
handleSelectionChange(selection) {
|
||||
|
@ -414,9 +535,13 @@ export default {
|
|||
isEmpty,
|
||||
// 新增行
|
||||
handleAdd() {
|
||||
this.form.productList.push(this.getNewRow());
|
||||
this.handleSearch();
|
||||
this.reorder();
|
||||
let row = this.getNewRow();
|
||||
this.form.productList.push(row);
|
||||
this.total ++;
|
||||
// 如果当前在最后一页,直接加入数据
|
||||
if (Math.ceil(this.total / this.pageSize) <= this.pageNum) {
|
||||
this.tableData.push(row);
|
||||
}
|
||||
},
|
||||
// 获取新的行
|
||||
getNewRow() {
|
||||
|
@ -502,23 +627,9 @@ export default {
|
|||
}
|
||||
this.$message.success(`删除成功,一共删除了${this.rows.length}行工序`);
|
||||
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>
|
||||
|
|
|
@ -37,12 +37,15 @@
|
|||
</form-col>
|
||||
</el-row>
|
||||
|
||||
<el-tabs v-if="init">
|
||||
<el-tabs v-if="init" >
|
||||
<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-tabs>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
@ -97,9 +100,6 @@ export default {
|
|||
{ required: true, message: "报表日期不能为空", trigger: "blur" }
|
||||
],
|
||||
productList: {
|
||||
priceId: [
|
||||
{ required: true, message: "工序不能为空", trigger: "blur" }
|
||||
],
|
||||
isEnd: [
|
||||
{ required: true, message: "是否成品不能为空", trigger: "blur" }
|
||||
],
|
||||
|
@ -127,6 +127,11 @@ export default {
|
|||
autoSaveInterval: null,
|
||||
saveTime: null,
|
||||
init: false,
|
||||
|
||||
loadLoading: false, // 加载状态
|
||||
loadIndex: 0, // 加载索引
|
||||
loadTotal: 0, // 加载总数
|
||||
loadInterval: null, // 加载间隔
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -184,8 +189,10 @@ export default {
|
|||
// 10秒自动保存一次
|
||||
if (this.autoSaveInterval == null) {
|
||||
this.autoSaveInterval = setInterval(() => {
|
||||
this.saveTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}');
|
||||
localStorage.setItem('report', JSON.stringify(this.form));
|
||||
if (this.form != null) {
|
||||
this.saveTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}');
|
||||
localStorage.setItem('report', JSON.stringify(this.form));
|
||||
}
|
||||
}, 1000 * 10);
|
||||
}
|
||||
},
|
||||
|
@ -202,7 +209,11 @@ export default {
|
|||
},
|
||||
// 获取保存的数据
|
||||
getLocalSave() {
|
||||
return JSON.parse(localStorage.getItem('report'));
|
||||
let save = localStorage.getItem('report');
|
||||
if (save == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parse(save);
|
||||
},
|
||||
handleEditProduct(row, index) {
|
||||
this.row = row;
|
||||
|
@ -232,9 +243,12 @@ export default {
|
|||
getReport(reportId, {needProductList: true, needUserProd: true, needOrderProd: true}).then(response => {
|
||||
this.form = response.data;
|
||||
this.init = true;
|
||||
}).catch(error => {
|
||||
this.$modal.msgError("获取数据失败");
|
||||
console.error(error);
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
});
|
||||
},
|
||||
submitForm(submit) {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
@ -301,17 +315,13 @@ export default {
|
|||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.report-edit-container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 32px;
|
||||
|
||||
.edit-header {
|
||||
flex-shrink: 0;
|
||||
|
@ -319,7 +329,7 @@ export default {
|
|||
|
||||
.edit-container {
|
||||
padding: 16px;
|
||||
|
||||
padding-bottom: 232px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
<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="本次提交产量">{{item.num | fix2 | dv}} {{priceUnit}}</el-descriptions-item>
|
||||
<el-descriptions-item :key="item.id" label="订单进度">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-descriptions border>
|
||||
<el-descriptions border size="mini">
|
||||
<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.num | dv}} {{priceUnit}}</el-descriptions-item>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<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
|
||||
v-for="item of searchColumns"
|
||||
:key="item.key"
|
||||
|
@ -12,6 +12,13 @@
|
|||
:dict="dict"
|
||||
@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-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>
|
||||
|
@ -41,6 +48,17 @@
|
|||
<!-- v-has-permi="['yh:reportProd:remove']"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </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-button
|
||||
type="warning"
|
||||
|
@ -73,7 +91,7 @@
|
|||
<el-table-column type="expand" width="20" align="left" fixed="left">
|
||||
<template slot-scope="d">
|
||||
<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.priceSize | 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"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'isEnd'">
|
||||
<boolean-tag :value="d.row.isEnd"/>
|
||||
<boolean-tag :value="d.row.isEnd" size="mini"/>
|
||||
</template>
|
||||
<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 v-else-if="column.key === 'priceStatus'">
|
||||
<dict-tag :value="d.row.priceStatus" :options="dict.type.price_status"/>
|
||||
<template v-else-if="column.key === 'num'">
|
||||
{{d.row[column.key] | dv}} {{d.row.priceUnit | dv}}
|
||||
</template>
|
||||
<template v-else-if="['totalAmount', 'pricePrice'].includes(column.key)">
|
||||
<template v-else-if="['totalAmount'].includes(column.key)">
|
||||
{{d.row[column.key] | dv}} 元
|
||||
</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)">
|
||||
{{d.row[column.key] | dv}}
|
||||
</template>
|
||||
|
@ -134,24 +162,18 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- @click="handleUpdate(scope.row)"-->
|
||||
<!-- v-has-permi="['yh:reportProd:edit']"-->
|
||||
<!-- >修改</el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- @click="handleDelete(scope.row)"-->
|
||||
<!-- v-has-permi="['yh:reportProd:remove']"-->
|
||||
<!-- >删除</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-has-permi="['yh:report:edit']"
|
||||
v-show="ReportStatus.canEdit(scope.row.reportStatus)"
|
||||
>修改报表</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
|
@ -222,7 +244,7 @@
|
|||
</template>
|
||||
|
||||
<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 FormCol from "@/components/FormCol/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 ReportOrderProdDescriptions from "@/views/yh/reportProd/components/ReportOrderProdDescriptions.vue";
|
||||
import BooleanTag from '@/components/BooleanTag/index.vue'
|
||||
import {ReportStatus} from "@/utils/constants";
|
||||
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
|
@ -254,6 +277,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
ReportStatus,
|
||||
expandCustomConfig: {
|
||||
containerClass: null,
|
||||
showSearch: false,
|
||||
|
@ -265,11 +289,10 @@ export default {
|
|||
searchColumns: [
|
||||
{key: 'reportId', label: "报表编号", type: 'input', dictType: null},
|
||||
{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: 'priceName', 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: 'priceSize', label: "大小", type: 'input', dictType: null},
|
||||
{key: 'pricePattern', label: "图案", type: 'input', dictType: null},
|
||||
|
@ -280,25 +303,24 @@ export default {
|
|||
span: 24,
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: 'id', visible: true, 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: '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: 'id', visible: false, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'reportId', visible: false, 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: '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: '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: 'priceCategory', visible: true, label: '类别', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{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: '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: '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: '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: '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: '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},
|
||||
|
@ -346,7 +368,8 @@ export default {
|
|||
priceClassify: null,
|
||||
priceQuantity: null,
|
||||
deleted: null,
|
||||
priceType: null
|
||||
priceType: null,
|
||||
priceMatch: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
|
@ -390,6 +413,16 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
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,
|
||||
isEmpty,
|
||||
calcMulDecimal,
|
||||
|
@ -469,13 +502,7 @@ export default {
|
|||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getReportProd(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改报表产量";
|
||||
});
|
||||
this.$router.push(`/edit/report/${row.reportId}`)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user