临时提交
This commit is contained in:
parent
af291d04cd
commit
3ef03a59d3
|
@ -9,59 +9,16 @@
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="单据状态" prop="erpDocumentStatus">
|
|
||||||
<el-select v-model="queryParams.erpDocumentStatus" placeholder="请选择单据状态" clearable @change="handleQuery">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.prod_order_erp_document_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="生产车间" prop="deptId">
|
|
||||||
<dept-tree-select v-model="queryParams.deptId" class="small-tree-select" @change="handleQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<!-- <el-form-item label="业务状态" prop="erpStatusList">
|
|
||||||
<el-checkbox-group v-model="queryParams.erpStatusList" @change="handleQuery">
|
|
||||||
<el-checkbox-button
|
|
||||||
v-for="dict in dict.type.prod_order_erp_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>{{dict.label}}
|
|
||||||
</el-checkbox-button>
|
|
||||||
</el-checkbox-group>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="物料编码" prop="materialNumber">
|
<el-form-item label="物料编码" prop="materialNumber">
|
||||||
<el-input v-model="queryParams.materialNumber" placeholder="请输入物料编码" clearable @keyup.enter.native="handleQuery"/>
|
<el-input v-model="queryParams.materialNumber" placeholder="请输入物料编码" clearable @keyup.enter.native="handleQuery"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="物料规格" prop="materialCategory">
|
<el-form-item>
|
||||||
<el-input v-model="queryParams.materialCategory" placeholder="请输入物料规格" clearable @keyup.enter.native="handleQuery"/>
|
<el-button type="success" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
</el-form-item>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
<el-form-item label="物料大小" prop="materialSize">
|
|
||||||
<el-input v-model="queryParams.materialSize" placeholder="请输入物料大小" clearable @keyup.enter.native="handleQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="表面处理" prop="materialSurface">
|
|
||||||
<el-input v-model="queryParams.materialSurface" placeholder="请输入物料表面处理" clearable @keyup.enter.native="handleQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="盖子方式" prop="materialCover">
|
|
||||||
<el-input v-model="queryParams.materialCover" placeholder="请输入物料盖子方式" clearable @keyup.enter.native="handleQuery"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="图案" prop="materialGraphics">
|
|
||||||
<el-input v-model="queryParams.materialGraphics" placeholder="请输入物料图案" clearable @keyup.enter.native="handleQuery"/>
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="是否返工" prop="erpIsRework">
|
|
||||||
<el-radio-group v-model="queryParams.erpIsRework">
|
|
||||||
<el-radio :label="null">全部</el-radio>
|
|
||||||
<el-radio :label="true">是</el-radio>
|
|
||||||
<el-radio :label="false">否</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row style="margin-bottom: 1em">
|
<el-row style="margin-bottom: 1em">
|
||||||
<el-button type="success" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
||||||
name: "HoverShow",
|
name: "HoverShow",
|
||||||
props: {
|
props: {
|
||||||
showValue: {
|
showValue: {
|
||||||
type: String,
|
type: [String, Number],
|
||||||
default: '--'
|
default: '--'
|
||||||
},
|
},
|
||||||
showIcon: {
|
showIcon: {
|
||||||
|
|
99
src/components/TableFormCol/index.vue
Normal file
99
src/components/TableFormCol/index.vue
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
<template>
|
||||||
|
<el-table-column class="table-form-col" :align="align" :width="width" >
|
||||||
|
<template #header>
|
||||||
|
<div @click="handleClickHeader">
|
||||||
|
<span :class="required ? 'required-label' : ''">{{label}}</span>
|
||||||
|
<el-tooltip v-if="!isEmpty(tips)" :content="tips" placement="top">
|
||||||
|
<i class="el-icon-question" style="cursor: pointer;"/>
|
||||||
|
</el-tooltip>
|
||||||
|
<i v-if="!isEmpty(headerIcon)" :class="headerIcon" style="cursor: pointer;"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template scope="d">
|
||||||
|
<form-col table label-width="0" :prop="colProp(d.$index)" :rules="rules">
|
||||||
|
<el-popover
|
||||||
|
v-if="showOverflowTooltip"
|
||||||
|
placement="top"
|
||||||
|
width="250"
|
||||||
|
trigger="hover">
|
||||||
|
<slot name="content-tip" :row="d.row" :index="d.$index"/>
|
||||||
|
<template #reference>
|
||||||
|
<slot :row="d.row" :index="d.$index"/>
|
||||||
|
</template>
|
||||||
|
</el-popover>
|
||||||
|
|
||||||
|
<slot v-else :row="d.row" :index="d.$index"/>
|
||||||
|
</form-col>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FormCol from '@/components/FormCol/index.vue'
|
||||||
|
import HoverShow from '@/components/HoverShow/index.vue'
|
||||||
|
import { isEmpty } from '@/utils'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "TableFormCol",
|
||||||
|
components: { HoverShow, FormCol },
|
||||||
|
props: {
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: "center"
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
required: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
propPrefix: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
prop: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ([])
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
showOverflowTooltip: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
tips: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
// 头部图标
|
||||||
|
headerIcon: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
colProp() {
|
||||||
|
return (index) => {
|
||||||
|
if (isEmpty(this.propPrefix) || isEmpty(this.prop)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return `${this.propPrefix}[${index}].${this.prop}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
isEmpty,
|
||||||
|
handleClickHeader() {
|
||||||
|
this.$emit('click-header');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -83,7 +83,7 @@ export const constantRoutes = [
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'report/:reportId?',
|
path: 'report/:reportId?',
|
||||||
component: () => import('@/views/yh/report/edit/edit.vue'),
|
component: () => import('@/views/yh/report/edit-v2/index.vue'),
|
||||||
name: 'ReportEdit',
|
name: 'ReportEdit',
|
||||||
meta: { title: '编辑报表', noCache: false}
|
meta: { title: '编辑报表', noCache: false}
|
||||||
},
|
},
|
||||||
|
|
|
@ -149,7 +149,8 @@ export default {
|
||||||
Cookies.remove('rememberMe');
|
Cookies.remove('rememberMe');
|
||||||
}
|
}
|
||||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
// this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
|
window.location.href = this.redirect || "/";
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (this.captchaEnabled) {
|
if (this.captchaEnabled) {
|
||||||
|
|
299
src/views/yh/report/edit-v2/components/ReportProductList.vue
Normal file
299
src/views/yh/report/edit-v2/components/ReportProductList.vue
Normal file
|
@ -0,0 +1,299 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-row type="flex" style="margin-bottom: 10px; justify-content: space-between;">
|
||||||
|
<el-input
|
||||||
|
v-model="searchKey"
|
||||||
|
placeholder="请输入工序名称/代码"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
style="width: 300px;"
|
||||||
|
@keyup.enter.native="handleSearch"
|
||||||
|
@clear="handleSearch"
|
||||||
|
@input="handleSearch"
|
||||||
|
>
|
||||||
|
<el-button slot="append" icon="el-icon-search" @click="handleSearch"></el-button>
|
||||||
|
</el-input>
|
||||||
|
<el-row type="flex" style="justify-content: flex-end;">
|
||||||
|
<el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleBatchEditUserProduct" icon="el-icon-edit">TODO:修改所选员工产量</el-button>
|
||||||
|
<el-button type="text" size="mini" :disabled="rows.length === 0" @click="handleCopy" icon="el-icon-document-copy">复制所选工序</el-button>
|
||||||
|
</el-row>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
:data="filteredProductList"
|
||||||
|
size="mini"
|
||||||
|
stripe
|
||||||
|
:header-cell-style="headerCellStyle"
|
||||||
|
class="mini-table"
|
||||||
|
ref="table"
|
||||||
|
accordion
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" align="center"/>
|
||||||
|
<el-table-column type="index" min-width="30" align="right" label="#"/>
|
||||||
|
<table-form-col label="TODO:工序选择" prop-prefix="productList" prop="priceId" required :rules="rules.priceId">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.priceId" placeholder="请输入工序"/>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="成品" prop-prefix="productList" prop="isEnd" :rules="rules.isEnd" required width="60">
|
||||||
|
<el-checkbox slot-scope="d" v-model="d.row.isEnd"/>
|
||||||
|
</table-form-col>
|
||||||
|
<!-- <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%"/>
|
||||||
|
</table-form-col> -->
|
||||||
|
<table-form-col label="表面处理" prop-prefix="productList" prop="surface" :rules="rules.surface" header-icon="el-icon-edit" @click-header="handleBatchEdit('surface')">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.surface" placeholder="请输入表面处理"/>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="颜色" prop-prefix="productList" prop="color" :rules="rules.color" header-icon="el-icon-edit" @click-header="handleBatchEdit('color')">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.color" placeholder="请输入颜色"/>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="良品" prop-prefix="productList" prop="num" required :rules="rules.num" header-icon="el-icon-edit" @click-header="handleBatchEdit('num')">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.num" placeholder="请输入数量">
|
||||||
|
<template #append>
|
||||||
|
{{d.row.priceUnit | dv}}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</table-form-col>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" width="160">
|
||||||
|
<template #header>
|
||||||
|
<el-button size="small" icon="el-icon-plus" type="text" @click="handleAdd" >新增工序</el-button>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="handleChangeSort(d.$index, -1)"
|
||||||
|
icon="el-icon-upload2"
|
||||||
|
size="small"
|
||||||
|
></el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="handleChangeSort(d.$index, 1)"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="small"
|
||||||
|
></el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="doCopy(d.$index, d.row)"
|
||||||
|
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.userProdList"
|
||||||
|
:prod="d.row"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane :label="`订单产量(${d.row.orderProdList.length})`">
|
||||||
|
<report-product-order-list
|
||||||
|
v-model="d.row.orderProdList"
|
||||||
|
:prop-prefix="`productList[${d.$index}].orderProdList`"
|
||||||
|
:rules="rules.orderProdList"
|
||||||
|
:prod="d.row"
|
||||||
|
/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<user-product-batch-dialog
|
||||||
|
:show.sync="showUserEditDialog"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TableFormCol from '@/components/TableFormCol/index.vue'
|
||||||
|
import BooleanTag from '@/components/BooleanTag/index.vue'
|
||||||
|
import HoverShow from '@/components/HoverShow/index.vue'
|
||||||
|
import { isEmpty } from '@/utils/index'
|
||||||
|
import ReportProductUserList from '@/views/yh/report/edit-v2/components/ReportProductUserList.vue'
|
||||||
|
import ReportProductOrderList from '@/views/yh/report/edit-v2/components/ReportProductOrderList.vue'
|
||||||
|
import UserProductBatchDialog from '@/views/yh/report/edit-v2/components/UserProductBatchDialog.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ReportProductList",
|
||||||
|
dicts: ['price_type'],
|
||||||
|
components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog},
|
||||||
|
props: {
|
||||||
|
form: {
|
||||||
|
type: Object,
|
||||||
|
default: () =>({
|
||||||
|
productList: [], // 工序产量列表
|
||||||
|
})
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerCellStyle: {
|
||||||
|
backgroundColor: "#f5f7fa",
|
||||||
|
},
|
||||||
|
rows: [], // 当前选择的行
|
||||||
|
searchKey: '', // 搜索关键字
|
||||||
|
filteredProductList: [], // 过滤后的工序列表
|
||||||
|
showUserEditDialog: false, // 批量修改员工产量弹窗
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 批量修改员工产量
|
||||||
|
handleBatchEditUserProduct() {
|
||||||
|
this.showUserEditDialog = true;
|
||||||
|
},
|
||||||
|
// 批量编辑属性
|
||||||
|
handleBatchEdit(prop) {
|
||||||
|
if (this.rows.length === 0) {
|
||||||
|
this.$message.warning('请先勾选要编辑的工序');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$prompt('请输入要编辑的属性值', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputValue: '',
|
||||||
|
inputPlaceholder: '请输入属性值',
|
||||||
|
}).then(({ value }) => {
|
||||||
|
this.rows.forEach(row => {
|
||||||
|
row[prop] = value;
|
||||||
|
})
|
||||||
|
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行工序`);
|
||||||
|
this.handleSearch();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 复制所选工序
|
||||||
|
handleCopy() {
|
||||||
|
if (this.rows.length === 0) {
|
||||||
|
this.$message.warning('请先勾选要复制的工序');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$prompt('请输入复制的数量', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputPattern: /^[0-9]+$/,
|
||||||
|
inputPlaceholder: '请输入复制数量',
|
||||||
|
inputValue: '1',
|
||||||
|
}).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.$message.success(`复制成功,一共复制了${value * this.rows.length}行工序`);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 执行复制
|
||||||
|
doCopy(index, row) {
|
||||||
|
let data = JSON.parse(JSON.stringify(row));
|
||||||
|
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 ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.form.productList.push(data);
|
||||||
|
this.handleSearch();
|
||||||
|
this.reorder();
|
||||||
|
},
|
||||||
|
// 选择行
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.rows = selection;
|
||||||
|
},
|
||||||
|
isEmpty,
|
||||||
|
// 新增行
|
||||||
|
handleAdd() {
|
||||||
|
this.form.productList.push(this.getNewRow());
|
||||||
|
this.handleSearch();
|
||||||
|
this.reorder();
|
||||||
|
},
|
||||||
|
// 获取新的行
|
||||||
|
getNewRow() {
|
||||||
|
return {
|
||||||
|
priceId: null,
|
||||||
|
isEnd: false,
|
||||||
|
num: null,
|
||||||
|
defectNum: null,
|
||||||
|
surface: null,
|
||||||
|
color: null,
|
||||||
|
sort: this.getNewSort(),
|
||||||
|
userProdList: [],
|
||||||
|
orderProdList: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 重新排序,根据sort字段,从小到大排序
|
||||||
|
reorder() {
|
||||||
|
if (this.form == null || this.form.productList == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.form.productList.sort((a, b) => a.sort - b.sort);
|
||||||
|
},
|
||||||
|
handleChangeSort(index, offset) {
|
||||||
|
if (index + offset < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (index + offset >= this.form.productList.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 交换顺序
|
||||||
|
let upItem = this.form.productList[index + offset];
|
||||||
|
let current = this.form.productList[index];
|
||||||
|
let temp = upItem.sort;
|
||||||
|
upItem.sort = current.sort;
|
||||||
|
current.sort = temp;
|
||||||
|
this.reorder();
|
||||||
|
},
|
||||||
|
// 获取最新的排序
|
||||||
|
getNewSort() {
|
||||||
|
let max = 0;
|
||||||
|
if (this.form != null && this.form.productList != null) {
|
||||||
|
this.form.productList.forEach(item => {
|
||||||
|
max = item.sort > max ? item.sort : max;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return max + 1;
|
||||||
|
},
|
||||||
|
// 删除行
|
||||||
|
handleDel(index, row) {
|
||||||
|
this.$confirm(`是否删除第 ${index + 1} 行的工序?`, "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.form.productList.splice(index, 1)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSearch() {
|
||||||
|
if (!this.searchKey) {
|
||||||
|
this.filteredProductList = this.form.productList;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const key = this.searchKey.toLowerCase();
|
||||||
|
this.filteredProductList = this.form.productList.filter(item => {
|
||||||
|
const priceId = (item.priceId || '').toLowerCase();
|
||||||
|
const surface = (item.surface || '').toLowerCase();
|
||||||
|
const color = (item.color || '').toLowerCase();
|
||||||
|
return priceId.includes(key) || surface.includes(key) || color.includes(key);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,115 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="value"
|
||||||
|
size="mini"
|
||||||
|
stripe
|
||||||
|
class="mini-table"
|
||||||
|
>
|
||||||
|
<el-table-column align="center" label="#" width="50" type="index"/>
|
||||||
|
<table-form-col label="订单" :prop-prefix="propPrefix" prop="orderId" required :rules="rules.orderId">
|
||||||
|
<template slot-scope="d">
|
||||||
|
{{d.row.orderErpBillNo | dv}}
|
||||||
|
</template>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="物料编码" :prop-prefix="propPrefix" prop="orderMaterialNumber">
|
||||||
|
<template slot-scope="d">
|
||||||
|
{{d.row.orderMaterialNumber | dv}}
|
||||||
|
</template>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="产量" :prop-prefix="propPrefix" prop="num" required :rules="rules.num">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.num" placeholder="请输入产量">
|
||||||
|
<template #append>
|
||||||
|
{{prod.priceUnit | dv}}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="handleDel(d.$index, d.row)"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="small"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<prod-order-drawer
|
||||||
|
:show.sync="showOrderDialog"
|
||||||
|
@select="handleOrderSelect"
|
||||||
|
multiple
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TableFormCol from '@/components/TableFormCol/index.vue'
|
||||||
|
import ProdOrderDrawer from '@/components/Business/ProdOrder/ProdOrderDrawer.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ReportProductOrderList",
|
||||||
|
components: { TableFormCol, ProdOrderDrawer },
|
||||||
|
props: {
|
||||||
|
// 数据
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ([])
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
propPrefix: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
prod: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
showOrderDialog: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 新增
|
||||||
|
handleAdd() {
|
||||||
|
this.showOrderDialog = true;
|
||||||
|
},
|
||||||
|
// 删除行
|
||||||
|
handleDel(index, row) {
|
||||||
|
this.$confirm(`是否删除第 ${index + 1} 行的订单产量?`, "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.value.splice(index, 1);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 选择订单
|
||||||
|
handleOrderSelect(orderList) {
|
||||||
|
let list = orderList.map(item => ({
|
||||||
|
orderId: item.orderId,
|
||||||
|
num: null,
|
||||||
|
// vo
|
||||||
|
orderErpBillNo: item.erpBillNo,
|
||||||
|
orderMaterialNumber: item.materialNumber,
|
||||||
|
}));
|
||||||
|
if (this.value == null) {
|
||||||
|
this.$emit('input', list);
|
||||||
|
} else {
|
||||||
|
this.value.push(...list);
|
||||||
|
}
|
||||||
|
this.showOrderDialog = false;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
113
src/views/yh/report/edit-v2/components/ReportProductUserList.vue
Normal file
113
src/views/yh/report/edit-v2/components/ReportProductUserList.vue
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-table
|
||||||
|
:data="value"
|
||||||
|
size="mini"
|
||||||
|
stripe
|
||||||
|
class="mini-table"
|
||||||
|
>
|
||||||
|
<el-table-column align="center" label="#" width="50" type="index"/>
|
||||||
|
<table-form-col label="员工" :prop-prefix="propPrefix" prop="userId" required :rules="rules.userId">
|
||||||
|
<template slot-scope="d">
|
||||||
|
{{d.row.userName | dv}} ({{d.row.userNo | dv}})
|
||||||
|
</template>
|
||||||
|
</table-form-col>
|
||||||
|
<table-form-col label="产量" :prop-prefix="propPrefix" prop="num" required :rules="rules.num">
|
||||||
|
<el-input slot-scope="d" v-model="d.row.num" placeholder="请输入产量">
|
||||||
|
<template #append>
|
||||||
|
{{prod.priceUnit | dv}}
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
@click="handleDel(d.$index, d.row)"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="small"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<user-new-drawer
|
||||||
|
:show.sync="showUserDialog"
|
||||||
|
@confirm="handleUserConfirm"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TableFormCol from '@/components/TableFormCol/index.vue'
|
||||||
|
import UserNewDrawer from '@/components/Business/User/UserNewDrawer.vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ReportProductUserList",
|
||||||
|
components: {TableFormCol, UserNewDrawer },
|
||||||
|
props: {
|
||||||
|
// 数据
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ([])
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
propPrefix: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
prod: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
showUserDialog: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
deptQuery() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 新增
|
||||||
|
handleAdd() {
|
||||||
|
this.showUserDialog = true;
|
||||||
|
},
|
||||||
|
// 删除行
|
||||||
|
handleDel(index, row) {
|
||||||
|
this.$confirm(`是否删除第 ${index + 1} 行的员工产量?`, "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.value.splice(index, 1);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleUserConfirm(userList) {
|
||||||
|
let list = userList.map(item => ({
|
||||||
|
userId: item.userId,
|
||||||
|
num: 0,
|
||||||
|
// vo
|
||||||
|
userName: item.nickName,
|
||||||
|
userNo: item.userNo,
|
||||||
|
}))
|
||||||
|
if (this.value == null) {
|
||||||
|
this.$emit('input', list);
|
||||||
|
} else {
|
||||||
|
this.value.push(...list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -0,0 +1,185 @@
|
||||||
|
<template>
|
||||||
|
<el-drawer :visible.sync="visible" append-to-body title="批量编辑员工产量" size="800px">
|
||||||
|
<el-row style="padding: 16px;">
|
||||||
|
<el-form :model="form" :rules="rules" ref="form">
|
||||||
|
<el-row>
|
||||||
|
<form-col :span="24" label="工资模式">
|
||||||
|
<el-radio-group v-model="form.mode">
|
||||||
|
<el-radio-button :label="IncomeMode.COUNT">产量</el-radio-button>
|
||||||
|
<el-radio-button :label="IncomeMode.SCORE">计分</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
<div v-show="form.mode === IncomeMode.SCORE" style="color: red; ">
|
||||||
|
请注意!计分模式下,需要提前输入选中行的 <strong>总产量</strong> ,否则无法计算员工产量!
|
||||||
|
</div>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="24" label="更新工序总产量" label-width="8em" v-if="form.mode === IncomeMode.COUNT">
|
||||||
|
<el-switch v-model="form.updateTotal" active-text="开启" inactive-text="关闭"/>
|
||||||
|
<div style="color: red; " v-show="form.updateTotal">
|
||||||
|
请注意!开启之后,将会根据员工产量汇总并覆盖原有的工序总产量。
|
||||||
|
</div>
|
||||||
|
</form-col>
|
||||||
|
</el-row>
|
||||||
|
<!-- <el-row class="edit-table-operate">
|
||||||
|
<el-button type="primary" plain @click="handleAdd" icon="el-icon-plus" size="mini">添加员工</el-button>
|
||||||
|
</el-row> -->
|
||||||
|
<el-table :data="form.list" border size="mini">
|
||||||
|
<el-table-column label="序号" type="index" width="50" align="center"/>
|
||||||
|
<el-table-column label="员工" align="center">
|
||||||
|
<template #header>
|
||||||
|
<span class="required-label">
|
||||||
|
员工
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<form-col table label-width="0">
|
||||||
|
<!-- <user-input v-model="d.row.userId" :list-api="listUserWithShift" :query="userQueryParams" open-type="drawer" /> -->
|
||||||
|
{{d.row.userName | dv}}
|
||||||
|
</form-col>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column align="center">
|
||||||
|
<template #header>
|
||||||
|
<span class="required-label" v-if="form.mode === IncomeMode.COUNT">
|
||||||
|
良品数
|
||||||
|
</span>
|
||||||
|
<span class="required-label" v-if="form.mode === IncomeMode.SCORE">
|
||||||
|
分数
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<form-col table label-width="0" v-if="form.mode === IncomeMode.COUNT" :prop="`list[${d.$index}].num`" :rules="rules.list.num">
|
||||||
|
<el-input-number v-model="d.row.num" type="number" placeholder="请输入员工产量" :min="1" style="width: 100%"/>
|
||||||
|
</form-col>
|
||||||
|
<form-col table label-width="0" v-if="form.mode === IncomeMode.SCORE" :prop="`list[${d.$index}].score`" :rules="rules.list.score">
|
||||||
|
<el-input-number v-model="d.row.score" type="number" placeholder="请输入员工分数" :min="0" style="width: 100%"/>
|
||||||
|
</form-col>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="100">
|
||||||
|
<template #header>
|
||||||
|
<el-button type="text" @click="handleAdd" icon="el-icon-plus" >添加员工</el-button>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="d">
|
||||||
|
<el-button type="text" size="mini" icon="el-icon-delete" @click="handleDel(d.$index)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form>
|
||||||
|
</el-row>
|
||||||
|
<el-row type="flex" justify="end" style="padding: 16px;">
|
||||||
|
<el-button @click="visible = false" icon="el-icon-close">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit()" icon="el-icon-check">确 定</el-button>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<user-new-drawer
|
||||||
|
:show.sync="showUserDialog"
|
||||||
|
:multiple="true"
|
||||||
|
@confirm="onSelectUsers"
|
||||||
|
:list-api="listUserWithShift"
|
||||||
|
:query="userQueryParams"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FormCol from "@/components/FormCol/index.vue";
|
||||||
|
import UserInput from "@/components/Business/User/UserInput.vue";
|
||||||
|
import {IncomeMode} from "@/utils/constants";
|
||||||
|
import UserNewDrawer from "@/components/Business/User/UserNewDrawer.vue";
|
||||||
|
import {listUserWithShift} from "@/api/system/user";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "UserProductBatchDialog",
|
||||||
|
components: {UserNewDrawer, UserInput, FormCol},
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 用户查询条件
|
||||||
|
userQuery: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
userQueryParams() {
|
||||||
|
return {
|
||||||
|
excludeUserIds: this.form.list.map(item => item.userId),
|
||||||
|
...this.userQuery,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visible: {
|
||||||
|
get() {
|
||||||
|
return this.show;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:show', val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
IncomeMode,
|
||||||
|
form: {
|
||||||
|
list: [],
|
||||||
|
mode: IncomeMode.COUNT,
|
||||||
|
updateTotal: true,
|
||||||
|
},
|
||||||
|
showUserDialog: false,
|
||||||
|
rules: {
|
||||||
|
list: {
|
||||||
|
num: [
|
||||||
|
{required: true, message: '请输入员工产量', trigger: 'blur'},
|
||||||
|
],
|
||||||
|
score: [
|
||||||
|
{required: true, message: '请输入员工分数', trigger: 'blur'},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
listUserWithShift,
|
||||||
|
onSubmit() {
|
||||||
|
this.$refs.form.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.$confirm('【注意!】保存后将会覆盖已选中的员工产量数据,是否确认保存当前产量信息?', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$emit('submit', this.form);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.warning("表单校验不通过,请检查")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDel(index) {
|
||||||
|
this.$confirm(`确定删除当前员工产量吗?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(res => {
|
||||||
|
this.form.list.splice(index, 1);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleAdd() {
|
||||||
|
this.showUserDialog = true;
|
||||||
|
},
|
||||||
|
onSelectUsers(list) {
|
||||||
|
list.forEach(item => {
|
||||||
|
this.form.list.push({
|
||||||
|
userId: item.userId,
|
||||||
|
userName: item.nickName,
|
||||||
|
num: null,
|
||||||
|
score: 10,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.showUserDialog = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
222
src/views/yh/report/edit-v2/index.vue
Normal file
222
src/views/yh/report/edit-v2/index.vue
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
<template>
|
||||||
|
<div class="report-edit-container" v-loading="loading">
|
||||||
|
<edit-header class="edit-header">
|
||||||
|
<template #title>
|
||||||
|
{{title}}
|
||||||
|
<el-button type="text" @click="previewUserProd = true" style="margin-left: 16px" icon="el-icon-view">员工产量汇总</el-button>
|
||||||
|
</template>
|
||||||
|
<el-button plain @click="cancel" icon="el-icon-close" size="small">取消</el-button>
|
||||||
|
<el-button type="primary" plain @click="submitForm(false)" icon="el-icon-check" size="small">仅保存</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm(true)" icon="el-icon-s-check" size="small">保存并提交</el-button>
|
||||||
|
</edit-header>
|
||||||
|
|
||||||
|
<div class="edit-container">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="4em">
|
||||||
|
<el-row :gutter="gutter">
|
||||||
|
<form-col :span="span" label="部门" prop="deptId">
|
||||||
|
<dept-tree-select v-model="form.deptId" class="mini-tree-select" width="100%" disabled/>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="日期" prop="reportDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.reportDate"
|
||||||
|
type="date"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="选择日期"
|
||||||
|
style="width: 100%;"
|
||||||
|
:clearable="false"
|
||||||
|
:editable="false"
|
||||||
|
:picker-options="DatePickerOptions.DISABLE_FUTURE"
|
||||||
|
/>
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="span" label="总金额">
|
||||||
|
{{totalPrice.toNumber() | dv}} 元
|
||||||
|
</form-col>
|
||||||
|
<form-col :span="24" label="备注">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" maxlength="200" show-word-limit :autosize="{minRows: 2, maxRows: 10}"/>
|
||||||
|
</form-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-tabs>
|
||||||
|
<el-tab-pane :label="`工序产量 (${form.productList.length}) `">
|
||||||
|
<report-product-list :form="form" :rules="rules" />
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import FormCol from "@/components/FormCol/index.vue";
|
||||||
|
import DeptTreeSelect from "@/components/Business/Dept/DeptTreeSelect.vue";
|
||||||
|
import {addReport, getReport, updateReport} from "@/api/yh/report";
|
||||||
|
import EditHeader from "@/components/EditHeader/index.vue";
|
||||||
|
import {isEmpty, notNullDecimal} from "@/utils";
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import Decimal from "decimal.js";
|
||||||
|
import {DatePickerOptions} from "@/utils/constants";
|
||||||
|
import ReportProductList from '@/views/yh/report/edit-v2/components/ReportProductList.vue';
|
||||||
|
import { parseTime } from '@/utils/ruoyi.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ReportEditV2",
|
||||||
|
components: {
|
||||||
|
EditHeader,
|
||||||
|
DeptTreeSelect,
|
||||||
|
FormCol,
|
||||||
|
ReportProductList
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
previewUserProd: false,
|
||||||
|
row: {},
|
||||||
|
index: null,
|
||||||
|
showMore: false,
|
||||||
|
DatePickerOptions,
|
||||||
|
title: null,
|
||||||
|
loading: false,
|
||||||
|
gutter: 8,
|
||||||
|
span: 8,
|
||||||
|
priceOptions: [], // 工序选项列表
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
productList: []
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
deptId: [
|
||||||
|
{ required: true, message: "部门不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
reportDate: [
|
||||||
|
{ required: true, message: "报表日期不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...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;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.form.reportId = this.$route.params.reportId;
|
||||||
|
if (this.form.reportId == null) {
|
||||||
|
this.title = "新增报表";
|
||||||
|
this.reset();
|
||||||
|
} else {
|
||||||
|
this.title = "修改报表";
|
||||||
|
this.getDetail(this.form.reportId);
|
||||||
|
}
|
||||||
|
this.getPriceOptions(); // 获取工序选项
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取工序选项
|
||||||
|
getPriceOptions() {
|
||||||
|
// TODO: 调用获取工序列表接口
|
||||||
|
},
|
||||||
|
handlePriceChange(priceId, row) {
|
||||||
|
// TODO: 根据选择的工序更新行数据
|
||||||
|
},
|
||||||
|
handleEditProduct(row, index) {
|
||||||
|
this.row = row;
|
||||||
|
this.index = index;
|
||||||
|
this.showMore = true;
|
||||||
|
},
|
||||||
|
handleDeleteProduct(index) {
|
||||||
|
this.form.productList.splice(index, 1);
|
||||||
|
},
|
||||||
|
handleAddProduct() {
|
||||||
|
this.form.productList.push({
|
||||||
|
priceId: null,
|
||||||
|
priceName: null,
|
||||||
|
priceType: '1',
|
||||||
|
num: 0,
|
||||||
|
defectNum: 0,
|
||||||
|
price: 0,
|
||||||
|
totalAmount: 0
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.$tab.closeBack();
|
||||||
|
},
|
||||||
|
getDetail(reportId) {
|
||||||
|
this.loading = true;
|
||||||
|
getReport(reportId, {needProductList: true, needUserProd: true, needOrderProd: true}).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submitForm(submit) {
|
||||||
|
this.form.totalAmount = this.totalPrice;
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.$confirm(`确认${submit ? '保存并提交' : '保存'}当前报表?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
if (this.form.reportId != null) {
|
||||||
|
updateReport(this.form, submit).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.$tab.closeBack();
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addReport(this.form, submit).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.$tab.closeBack();
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.warning("表单校验未通过,请检查")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
reportId: null,
|
||||||
|
deptId: this.deptId,
|
||||||
|
reportDate: parseTime(new Date(), '{y}-{m}-{d}'),
|
||||||
|
remark: null,
|
||||||
|
productList: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.report-edit-container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.edit-header {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-container {
|
||||||
|
padding: 16px;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="drawer-container" v-if="showMore">
|
<el-drawer class="drawer-container" :visible.sync="showMore" :with-header="false" size="80%" append-to-body>
|
||||||
<!-- <div class="drawer-operator-box">
|
<!-- <div class="drawer-operator-box">
|
||||||
<el-button @click="cancel" icon="el-icon-close">取 消</el-button>
|
<el-button @click="cancel" icon="el-icon-close">取 消</el-button>
|
||||||
<el-button type="primary" @click="onSubmit" icon="el-icon-check">保 存</el-button>
|
<el-button type="primary" @click="onSubmit" icon="el-icon-check">保 存</el-button>
|
||||||
|
@ -19,9 +19,6 @@
|
||||||
<el-radio v-for="(item, index) in dict.type.price_type" :key="index" :label="item.value">{{item.label}}</el-radio>
|
<el-radio v-for="(item, index) in dict.type.price_type" :key="index" :label="item.value">{{item.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</form-col>
|
</form-col>
|
||||||
<!-- <form-col :span="span" label="表面处理" prop="surface">
|
|
||||||
<el-input v-model="row.surface" placeholder="请输入表面处理" />
|
|
||||||
</form-col> -->
|
|
||||||
<form-col :span="span / 2" label="单价">
|
<form-col :span="span / 2" label="单价">
|
||||||
{{row.pricePrice | dv}} 元
|
{{row.pricePrice | dv}} 元
|
||||||
</form-col>
|
</form-col>
|
||||||
|
@ -64,7 +61,7 @@
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user