更新:细节优化
This commit is contained in:
parent
9a30368b74
commit
7585a1c284
|
@ -280,3 +280,16 @@ aside {
|
||||||
justify-content: flex-end; /* 使用标准值 */
|
justify-content: flex-end; /* 使用标准值 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-form.el-table {
|
||||||
|
.cell {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-form.el-table th.el-table__cell > .cell {
|
||||||
|
padding-left: 0px;
|
||||||
|
padding-right: 0px;
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-select
|
<el-select
|
||||||
|
v-loading="loading"
|
||||||
v-model="selectedValue"
|
v-model="selectedValue"
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
@focus="handleFocus"
|
@focus="handleFocus"
|
||||||
|
:class="{ 'empty-select': value == null }"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
|
@ -17,12 +19,12 @@
|
||||||
:value="item.priceId"
|
:value="item.priceId"
|
||||||
>
|
>
|
||||||
<span style="float: left">
|
<span style="float: left">
|
||||||
{{ item.name | 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="dict.type.price_status" 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="options.length === 0 && !loading" style="height: 0px" 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>
|
||||||
|
@ -51,6 +53,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
price: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
query: {
|
query: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
|
@ -81,7 +87,7 @@ export default {
|
||||||
},
|
},
|
||||||
label() {
|
label() {
|
||||||
return (item) => {
|
return (item) => {
|
||||||
return item.name + (item.code ? '(' + item.code + ')' : '');
|
return item.price == null ? '--' : item.price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -89,14 +95,19 @@ export default {
|
||||||
value(nv, ov ) {
|
value(nv, ov ) {
|
||||||
let obj = this.options.find(item => item.priceId == nv);
|
let obj = this.options.find(item => item.priceId == nv);
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
this.options.push({priceId: nv, name: this.name, code: this.code, status: this.status});
|
if (nv == null) {
|
||||||
this.total ++;
|
this.options = [];
|
||||||
|
this.total = 0;
|
||||||
|
} else {
|
||||||
|
this.options.push({priceId: nv, name: this.name, code: this.code, status: this.status, price: this.price});
|
||||||
|
this.total ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (this.value != null) {
|
if (this.value != null) {
|
||||||
this.options = [{priceId: this.value, name: this.name, code: this.code, status: this.status}]
|
this.options = [{priceId: this.value, name: this.name, code: this.code, status: this.status, price: this.price}]
|
||||||
this.total = 1;
|
this.total = 1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -116,19 +127,41 @@ export default {
|
||||||
this.getOptions();
|
this.getOptions();
|
||||||
},
|
},
|
||||||
// 获取选项列表
|
// 获取选项列表
|
||||||
getOptions() {
|
async getOptions() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.queryParams = {
|
this.queryParams = {
|
||||||
...this.queryParams,
|
...this.queryParams,
|
||||||
...this.query
|
...this.query
|
||||||
}
|
}
|
||||||
listPrice(this.queryParams).then(res => {
|
try {
|
||||||
|
let res = await listPrice(this.queryParams);
|
||||||
this.options = res.rows;
|
this.options = res.rows;
|
||||||
this.total = res.total;
|
this.total = res.total;
|
||||||
}).finally(() => {
|
} finally {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
}
|
||||||
},
|
},
|
||||||
|
// 获取选项列表,并选中第一个
|
||||||
|
async getOptionsAndSelectFirst() {
|
||||||
|
await this.getOptions();
|
||||||
|
if (this.options.length > 0) {
|
||||||
|
let value = this.options[0].priceId;
|
||||||
|
this.selectedValue = value;
|
||||||
|
this.handleChange(value);
|
||||||
|
} else {
|
||||||
|
this.options = [];
|
||||||
|
this.selectedValue = null;
|
||||||
|
this.handleChange(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.empty-select.el-select {
|
||||||
|
.el-input__inner {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<el-table-column class="table-form-col" :align="align" :width="width" >
|
<el-table-column class="table-form-col" :header-align="align" :align="align" :width="width" >
|
||||||
<template #header>
|
<template #header>
|
||||||
<div @click="handleClickHeader">
|
<div @click="handleClickHeader">
|
||||||
<span :class="required ? 'required-label' : ''">{{label}}</span>
|
<span :class="required ? 'required-label' : ''">{{label}}</span>
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = {
|
||||||
/**
|
/**
|
||||||
* 是否固定头部
|
* 是否固定头部
|
||||||
*/
|
*/
|
||||||
fixedHeader: false,
|
fixedHeader: true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否显示logo
|
* 是否显示logo
|
||||||
|
|
|
@ -231,3 +231,9 @@ export function tansParams(params) {
|
||||||
export function blobValidate(data) {
|
export function blobValidate(data) {
|
||||||
return data.type !== 'application/json'
|
return data.type !== 'application/json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取字典标签
|
||||||
|
export function getDictLabel(value, options) {
|
||||||
|
return options.filter(item => item.value === value).map(item => item.label).join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button>
|
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></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="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>
|
||||||
|
@ -32,18 +33,18 @@
|
||||||
@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="right" label="#"/>
|
<el-table-column type="index" min-width="10" align="center" label="#"/>
|
||||||
<table-form-col label="工序" prop-prefix="productList" prop="priceId" required :rules="rules.productList.priceId">
|
<table-form-col label="工序名称" prop-prefix="productList" prop="priceName" :rules="rules.productList.priceName" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceName')">
|
||||||
<price-select
|
<el-input slot-scope="d" v-model="d.row.priceName" placeholder="请输入工序名称" @change="selectPrice(d.index)" />
|
||||||
slot-scope="d"
|
</table-form-col>
|
||||||
v-model="d.row.priceId"
|
<table-form-col label="类别" prop-prefix="productList" prop="priceCategory" width="80" :rules="rules.productList.priceCategory" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceCategory')">
|
||||||
:name="d.row.priceName"
|
<el-input slot-scope="d" v-model="d.row.priceCategory" placeholder="请输入类别" @change="selectPrice(d.index)" />
|
||||||
:code="d.row.priceCode"
|
</table-form-col>
|
||||||
:status="d.row.priceStatus"
|
<table-form-col label="大小" prop-prefix="productList" prop="priceSize" width="60" :rules="rules.productList.priceSize" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceSize')">
|
||||||
:query="priceQuery"
|
<el-input slot-scope="d" v-model="d.row.priceSize" placeholder="请输入大小" @change="selectPrice(d.index)" />
|
||||||
@change="(val) => handlePriceChange(d.row, val)"
|
</table-form-col>
|
||||||
style="width: 100%;"
|
<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')">
|
||||||
/>
|
<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">
|
||||||
<el-checkbox slot-scope="d" v-model="d.row.isEnd"/>
|
<el-checkbox slot-scope="d" v-model="d.row.isEnd"/>
|
||||||
|
@ -51,27 +52,38 @@
|
||||||
<!-- <table-form-col label="不良品" prop-prefix="productList" prop="defectNum">
|
<!-- <table-form-col label="不良品" prop-prefix="productList" prop="defectNum">
|
||||||
<el-input-number slot-scope="d" v-model="d.row.defectNum" placeholder="请输入数量" :min="0" :precision="0" controls-position="right" style="width: 100%"/>
|
<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> -->
|
||||||
<table-form-col label="表面处理" prop-prefix="productList" prop="surface" :rules="rules.productList.surface" header-icon="el-icon-edit" @click-header="handleBatchEdit('surface')">
|
<table-form-col label="表面" width="80" 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 style="width: 100%;">
|
<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-option v-for="item in dict.type.surface" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</table-form-col>
|
</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')">
|
<table-form-col label="颜色" width="120" 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 style="width: 100%;">
|
<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-option v-for="item in dict.type.color_code" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</table-form-col>
|
</table-form-col>
|
||||||
<table-form-col label="良品" prop-prefix="productList" prop="num" required :rules="rules.productList.num" header-icon="el-icon-edit" @click-header="handleBatchEdit('num')">
|
<table-form-col label="良品" prop-prefix="productList" width="100" prop="num" required :rules="rules.productList.num" header-icon="el-icon-edit" @click-header="handleBatchEdit('num')">
|
||||||
<el-input slot-scope="d" v-model="d.row.num" placeholder="请输入数量">
|
<el-input slot-scope="d" v-model="d.row.num" placeholder="请输入数量">
|
||||||
<template #append>
|
<template #suffix>
|
||||||
{{d.row.priceUnit | dv}}
|
{{d.row.priceUnit | dv}}
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</table-form-col>
|
</table-form-col>
|
||||||
<table-form-col label="单价" prop-prefix="productList" prop="pricePrice" align="right" width="80" :rules="rules.productList.pricePrice">
|
<table-form-col label="单价" prop-prefix="productList" width="100" prop="priceId" required :rules="rules.productList.priceId">
|
||||||
<span slot-scope="d" style="font-size: 12px;">{{d.row.pricePrice | dv}}</span>
|
<price-select
|
||||||
|
slot-scope="d"
|
||||||
|
v-model="d.row.priceId"
|
||||||
|
:name="d.row.priceName"
|
||||||
|
:code="d.row.priceCode"
|
||||||
|
:status="d.row.priceStatus"
|
||||||
|
:price="d.row.pricePrice"
|
||||||
|
:query="priceQuery(d.row)"
|
||||||
|
@change="(val) => handlePriceChange(d.row, val)"
|
||||||
|
style="width: 100%;"
|
||||||
|
:ref="`priceSelect${d.index}`"
|
||||||
|
/>
|
||||||
</table-form-col>
|
</table-form-col>
|
||||||
<table-form-col label="详细" prop-prefix="productList" prop="pricePrice" align="right" width="80" :rules="rules.productList.pricePrice">
|
<table-form-col label="详细" prop-prefix="productList" prop="pricePrice" align="right" width="60" :rules="rules.productList.pricePrice">
|
||||||
<div slot-scope="d" @click="handleDetail(d.row)">
|
<div slot-scope="d" @click="handleDetail(d.row)">
|
||||||
<div style="font-size: 12px;">员工:{{d.row.userProdList.length}}</div>
|
<div style="font-size: 12px;">员工:{{d.row.userProdList.length}}</div>
|
||||||
<div style="font-size: 12px;" v-if="d.row.orderProdList.length > 0">订单:{{d.row.orderProdList.length}}</div>
|
<div style="font-size: 12px;" v-if="d.row.orderProdList.length > 0">订单:{{d.row.orderProdList.length}}</div>
|
||||||
|
@ -192,45 +204,63 @@ export default {
|
||||||
surface: '表面处理',
|
surface: '表面处理',
|
||||||
color: '颜色',
|
color: '颜色',
|
||||||
num: '良品',
|
num: '良品',
|
||||||
|
priceCategory: '类别',
|
||||||
|
priceSize: '大小',
|
||||||
|
pricePattern: '图案',
|
||||||
|
priceName: '工序',
|
||||||
},
|
},
|
||||||
autoSumNum: true, // 自动汇总良品
|
autoSumNum: true, // 自动汇总良品
|
||||||
|
showPattern: false, // 显示图案
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
priceQuery() {
|
priceQuery() {
|
||||||
return {
|
return (row) => {
|
||||||
deptId: this.form.deptId,
|
return {
|
||||||
statusList: PriceStatus.canUse(),
|
deptId: this.form.deptId,
|
||||||
disabled: false,
|
statusList: PriceStatus.canUse(),
|
||||||
excludePriceIds: this.form.productList.map(item => item.priceId)
|
disabled: false,
|
||||||
|
eqCategory: row.priceCategory,
|
||||||
|
eqSize: row.priceSize,
|
||||||
|
eqPattern: row.pricePattern,
|
||||||
|
name: row.priceName,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.handleSearch();
|
this.handleSearch();
|
||||||
|
this.showPattern = localStorage.getItem("report_show_pattern") == "true";
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleChangeShowPattern(val) {
|
||||||
|
localStorage.setItem("report_show_pattern", val);
|
||||||
|
},
|
||||||
|
// 选择工序
|
||||||
|
selectPrice(index) {
|
||||||
|
this.$refs[`priceSelect${index}`].getOptionsAndSelectFirst();
|
||||||
|
},
|
||||||
handleDetail(row) {
|
handleDetail(row) {
|
||||||
// 展开行
|
// 展开行
|
||||||
this.$refs.table.toggleRowExpansion(row);
|
this.$refs.table.toggleRowExpansion(row);
|
||||||
},
|
},
|
||||||
handlePriceChange(row, val) {
|
handlePriceChange(row, val) {
|
||||||
|
row.priceSubName = val?.subName;
|
||||||
|
row.priceSpec = val?.spec;
|
||||||
|
row.pricePrice = val?.price;
|
||||||
|
row.priceUnit = val?.unit;
|
||||||
|
row.priceClassify = val?.classify;
|
||||||
|
row.priceQuantityNumerator = val?.quantityNumerator;
|
||||||
|
row.priceQuantityDenominator = val?.quantityDenominator;
|
||||||
|
row.priceCode = val?.code;
|
||||||
|
row.priceStatus = val?.status;
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
row.priceCategory = val.category;
|
row.priceCategory = val.category;
|
||||||
row.priceSize = val.size;
|
row.priceSize = val.size;
|
||||||
row.priceName = val.name;
|
row.priceName = val.name;
|
||||||
row.priceSubName = val.subName;
|
|
||||||
row.pricePattern = val.pattern;
|
row.pricePattern = val.pattern;
|
||||||
row.priceSpec = val.spec;
|
|
||||||
row.pricePrice = val.price;
|
|
||||||
row.priceUnit = val.unit;
|
|
||||||
row.priceClassify = val.classify;
|
|
||||||
row.priceQuantityNumerator = val.quantityNumerator;
|
|
||||||
row.priceQuantityDenominator = val.quantityDenominator;
|
|
||||||
row.priceCode = val.code;
|
|
||||||
row.priceStatus = val.status;
|
|
||||||
},
|
},
|
||||||
// 当用户数量发生变化时,自动汇总良品
|
// 当用户数量发生变化时,自动汇总良品
|
||||||
handleChangeUserNum(row) {
|
handleChangeUserNum(row) {
|
||||||
|
@ -316,14 +346,26 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let fieldName = this.fieldMap[prop];
|
let fieldName = this.fieldMap[prop];
|
||||||
this.$prompt(`请输入要批量修改的${fieldName}`, '提示', {
|
this.$prompt(`请输入要批量修改的【${fieldName}】`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
inputValue: '',
|
inputValue: '',
|
||||||
inputPlaceholder: `请输入${fieldName}`,
|
inputPlaceholder: `请输入【${fieldName}】`,
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
this.rows.forEach(row => {
|
let isEditPrice = ['priceCategory', 'priceSize', 'pricePattern', 'priceName'].includes(prop);
|
||||||
|
for (let i = 0; i < this.rows.length; i++) {
|
||||||
|
let row = this.rows[i];
|
||||||
row[prop] = value;
|
row[prop] = value;
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (isEditPrice) {
|
||||||
|
for (let i = 0; i < this.rows.length; i++) {
|
||||||
|
let index = this.form.productList.indexOf(this.rows[i]);
|
||||||
|
if (index != -1) {
|
||||||
|
this.selectPrice(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`);
|
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`);
|
||||||
this.handleSearch();
|
this.handleSearch();
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
import TableFormCol from '@/components/TableFormCol/index.vue'
|
import TableFormCol from '@/components/TableFormCol/index.vue'
|
||||||
import UserNewDrawer from '@/components/Business/User/UserNewDrawer.vue'
|
import UserNewDrawer from '@/components/Business/User/UserNewDrawer.vue'
|
||||||
import {listUserWithShift} from "@/api/system/user";
|
import {listUserWithShift} from "@/api/system/user";
|
||||||
|
import { notNullDecimal } from "@/utils/index";
|
||||||
export default {
|
export default {
|
||||||
name: "ReportProductUserList",
|
name: "ReportProductUserList",
|
||||||
components: {TableFormCol, UserNewDrawer },
|
components: {TableFormCol, UserNewDrawer },
|
||||||
|
@ -86,13 +87,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
// 用户查询条件
|
||||||
userQuery() {
|
userQuery() {
|
||||||
return {
|
return {
|
||||||
shiftDate: this.form.reportDate,
|
shiftDate: this.form.reportDate,
|
||||||
targetDeptId: this.form.deptId,
|
targetDeptId: this.form.deptId,
|
||||||
excludeUserIds: this.value.map(item => item.userId),
|
excludeUserIds: this.value.map(item => item.userId),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
listUserWithShift,
|
listUserWithShift,
|
||||||
|
|
|
@ -131,16 +131,6 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['deptId']),
|
...mapGetters(['deptId']),
|
||||||
// 总价
|
|
||||||
// totalPrice() {
|
|
||||||
// let total = new Decimal(0);
|
|
||||||
// if (this.form != null && !isEmpty(this.form.productList)) {
|
|
||||||
// this.form.productList.forEach(item => {
|
|
||||||
// total = total.plus(notNullDecimal(item.totalAmount));
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// return total;
|
|
||||||
// },
|
|
||||||
// 标题
|
// 标题
|
||||||
title() {
|
title() {
|
||||||
if (this.form.reportId == null) {
|
if (this.form.reportId == null) {
|
||||||
|
@ -247,9 +237,14 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submitForm(submit) {
|
submitForm(submit) {
|
||||||
// this.form.totalAmount = this.totalPrice;
|
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
let error = this.checkForm();
|
||||||
|
if (error != null) {
|
||||||
|
this.$message.error(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.$confirm(`确认${submit ? '保存并提交' : '保存'}当前报表?`, '提示', {
|
this.$confirm(`确认${submit ? '保存并提交' : '保存'}当前报表?`, '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
|
@ -291,6 +286,21 @@ export default {
|
||||||
remark: null,
|
remark: null,
|
||||||
productList: []
|
productList: []
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
checkForm() {
|
||||||
|
// 校验工序产量和用户产量
|
||||||
|
for(let index = 0; index < this.form.productList.length; index++) {
|
||||||
|
let item = this.form.productList[index];
|
||||||
|
let userNum = item.userProdList.reduce((acc, curr) => notNullDecimal(acc).plus(notNullDecimal(curr.num)).toNumber(), 0);
|
||||||
|
if (userNum > item.num) {
|
||||||
|
return `第${index + 1}行工序校验失败:员工产量【${userNum}】不能大于工序产量【${item.num}】`;
|
||||||
|
}
|
||||||
|
let orderNum = item.orderProdList.reduce((acc, curr) => notNullDecimal(acc).plus(notNullDecimal(curr.num)).toNumber(), 0);
|
||||||
|
if (orderNum > item.num) {
|
||||||
|
return `第${index + 1}行工序校验失败:订单产量【${orderNum}】不能大于工序产量【${item.num}】`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,7 +292,7 @@ export default {
|
||||||
{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: true, 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: '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},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user