|
@@ -119,7 +119,7 @@
|
|
|
<el-table-column label="销售区域" align="center" prop="saleZone" width="180" />
|
|
|
<el-table-column label="制单人" align="center" prop="creator" width="180" />
|
|
|
<el-table-column label="部门" align="center" prop="dept" width="180" />
|
|
|
- <el-table-column label="目标合计(元)" align="center" prop="goalSum" width="180" />
|
|
|
+ <el-table-column label="销售目标合计(元)" align="center" prop="goalSum" width="180" />
|
|
|
<el-table-column label="备注" align="center" prop="notes" width="180" />
|
|
|
<el-table-column show-overflow-tooltip label="状态" align="center" width="100" prop="status">
|
|
|
<template slot-scope="scope">
|
|
@@ -207,7 +207,7 @@
|
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="目标合计(元)" prop="goalSum" label-width="120px">
|
|
|
+ <el-form-item label="销售目标合计(元)" prop="goalSum" label-width="150px">
|
|
|
<el-input v-model="form.goalSum" placeholder="目标合计自动计算" disabled />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -257,7 +257,7 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-tabs v-model="activeName">
|
|
|
- <el-tab-pane label="月销售目标明细" name="monthSaleGoalDetails">
|
|
|
+ <el-tab-pane label="月销售/月利润目标明细" name="monthSaleGoalDetails">
|
|
|
<el-table max-height="560" show-summary :summary-method="getSummaries" v-loading="loading" size="mini"
|
|
|
:data="monthSaleGoalDetailsList" @selection-change="handleSelectionChange" v-horizontal-scroll>
|
|
|
<el-table-column label="序号" type="index" width="70" align="center" fixed />
|
|
@@ -302,19 +302,23 @@
|
|
|
</el-popover-select-v2>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="一级分类" align="center" width="180" :render-header="addRedStar">
|
|
|
+ <el-table-column label="一级分类" align="center" min-width="200" :render-header="addRedStar">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="monthSaleGoalDetailsList[scope.$index].oneLevelClassify" placeholder="请输入一级分类"
|
|
|
- disabled></el-input>
|
|
|
+ <el-select v-model="monthSaleGoalDetailsList[scope.$index].oneLevelClassify" clearable
|
|
|
+ @focus="chooseTreeReferForMain('MATERIALCLASSIFY_PARAM', false, '一级物料分类', scope.$index)" :disabled="!isDept">
|
|
|
+ <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="二级分类" align="center" width="180" :render-header="addRedStar">
|
|
|
+ <el-table-column label="二级分类" align="center" min-width="200" :render-header="addRedStar">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="monthSaleGoalDetailsList[scope.$index].twoLevelClassify" placeholder="请输入二级分类"
|
|
|
- disabled></el-input>
|
|
|
+ <el-select v-model="monthSaleGoalDetailsList[scope.$index].twoLevelClassify" clearable
|
|
|
+ @focus="chooseTreeReferForMain('MATERIALCLASSIFY_PARAM', false, '二级物料分类', scope.$index)" :disabled="!isDept">
|
|
|
+ <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="物料" align="center" width="180" :render-header="addRedStar">
|
|
|
+ <el-table-column label="物料" align="center" min-width="220" :render-header="addRedStarChange">
|
|
|
<template slot-scope="scope">
|
|
|
<el-tooltip class="item" effect="dark" placement="top-start">
|
|
|
<div slot="content">{{ scope.row.memo }}</div>
|
|
@@ -328,31 +332,38 @@
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="科室" align="center" width="180">
|
|
|
+ <el-table-column label="科室" align="center" prop="department" min-width="200">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input v-model="monthSaleGoalDetailsList[scope.$index].department" placeholder="请输入科室">
|
|
|
- </el-input>
|
|
|
+ <el-select v-model="monthSaleGoalDetailsList[scope.$index].department" placeholder="请选择科室">
|
|
|
+ <el-option v-for="dict in dict.type.mk_bo_section" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="数量" align="center" prop="num" width="220">
|
|
|
+ <el-table-column label="数量" align="center" prop="num" min-width="220">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number v-model="monthSaleGoalDetailsList[scope.$index].num" :min="0"
|
|
|
@change="calculate(scope.row)"></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="月份" align="center" width="250" :render-header="addRedStar">
|
|
|
+ <el-table-column label="月份" align="center" min-width="250">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-date-picker v-model="monthSaleGoalDetailsList[scope.$index].monthly" value-format="yyyy-MM"
|
|
|
+ <el-date-picker v-model="monthSaleGoalDetailsList[scope.$index].monthly" value-format="yyyy-MM" disabled
|
|
|
type="month" placeholder="选择月份">
|
|
|
</el-date-picker>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="目标值(元)" align="center" prop="goalValue" width="220" :render-header="addRedStar">
|
|
|
+ <el-table-column label="销售目标值(元)" align="center" prop="goalValue" min-width="220" :render-header="addRedStar">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number @change="computeTotal" v-model="monthSaleGoalDetailsList[scope.$index].goalValue"
|
|
|
:precision="2" :step="1" :min="0"></el-input-number>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="利润目标值(元)" align="center" prop="profitTargetValue" min-width="220" :render-header="addRedStar" v-if="isDept">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number @change="computeTotal" v-model="monthSaleGoalDetailsList[scope.$index].profitTargetValue"
|
|
|
+ :precision="2" :step="1" :min="0"></el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px"
|
|
|
fixed="right">
|
|
|
<template slot-scope="scope">
|
|
@@ -437,6 +448,7 @@
|
|
|
<el-button type="primary" @click="dialogUpdateMoreSave">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <TreeRefers ref="treeMain" @doSubmit="selectionsToInputForMain" :single="true" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -475,7 +487,7 @@
|
|
|
TreeRefers,
|
|
|
ElPopoverSelectV2
|
|
|
},
|
|
|
- dicts: ["sys_status", "oa_templete_id"],
|
|
|
+ dicts: ["sys_status", "oa_templete_id", "mk_bo_section"],
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -490,7 +502,7 @@
|
|
|
showSearch: false,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
- // 月销售目标填报表格数据
|
|
|
+ // 月销售/月利润目标填报表格数据
|
|
|
monthSaleGoalList: [],
|
|
|
monthSaleGoalDetailsList: [],
|
|
|
// 弹出层标题
|
|
@@ -688,13 +700,26 @@
|
|
|
}],
|
|
|
materialRange: '',
|
|
|
text: '',
|
|
|
+ // 判断操作用户是否属于湖南公司部门的标志
|
|
|
+ isDept: false,
|
|
|
+ // 物料分类数组
|
|
|
+ classOptions: [],
|
|
|
+ // 树形参照
|
|
|
+ referCondition: {
|
|
|
+ type: '',
|
|
|
+ isPage: true,
|
|
|
+ title: '',
|
|
|
+ index: null
|
|
|
+ },
|
|
|
+ index: null,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
+ this.judge();
|
|
|
},
|
|
|
methods: {
|
|
|
- /** 查询月销售目标填报列表 */
|
|
|
+ /** 查询月销售/月利润目标填报列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
listMonthSaleGoal(this.queryParams).then(response => {
|
|
@@ -790,7 +815,7 @@
|
|
|
this.reset();
|
|
|
this.monthSaleGoalDetailsList = []
|
|
|
this.open = true;
|
|
|
- this.title = "添加--月销售目标填报";
|
|
|
+ this.title = "添加--月销售/月利润目标填报";
|
|
|
this.form.documentDate = new Date().getFullYear().toString() + '-' + (new Date().getMonth() + 1).toString()
|
|
|
.padStart(2, '0') + '-' + new Date().getDate().toString().padStart(2, '0')
|
|
|
this.form.annual = new Date().getFullYear().toString()
|
|
@@ -836,7 +861,7 @@
|
|
|
this.form.goalSum = this.form.goalSum.toFixed(2)
|
|
|
this.monthSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthDetailsList))
|
|
|
this.open = true;
|
|
|
- this.title = "修改--月销售目标填报";
|
|
|
+ this.title = "修改--月销售/月利润目标填报";
|
|
|
});
|
|
|
},
|
|
|
useDoubleClick(row) {
|
|
@@ -848,7 +873,7 @@
|
|
|
this.form.goalSum = this.form.goalSum.toFixed(2)
|
|
|
this.monthSaleGoalDetailsList = JSON.parse(JSON.stringify(this.form.monthDetailsList))
|
|
|
this.open = true;
|
|
|
- this.title = "修改--月销售目标填报";
|
|
|
+ this.title = "修改--月销售/月利润目标填报";
|
|
|
});
|
|
|
},
|
|
|
// 复制按钮
|
|
@@ -869,7 +894,7 @@
|
|
|
element.code = null
|
|
|
}
|
|
|
this.open = true;
|
|
|
- this.title = "新增--月销售目标填报";
|
|
|
+ this.title = "新增--月销售/月利润目标填报";
|
|
|
})
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
@@ -884,10 +909,12 @@
|
|
|
if (this.justiceDetailsList()) {
|
|
|
return this.$message.error('子表中第' + this.text + '行有必填字段未填,或者目标值为0')
|
|
|
}
|
|
|
- for (let i = 0; i < this.monthSaleGoalDetailsList.length; i++) {
|
|
|
- for (let j = i + 1; j < this.monthSaleGoalDetailsList.length; j++) {
|
|
|
- if (this.monthSaleGoalDetailsList[i].materialCode == this.monthSaleGoalDetailsList[j].materialCode) {
|
|
|
- return this.$message.error('子表存在重复物料');
|
|
|
+ if (!this.isDept) {
|
|
|
+ for (let i = 0; i < this.monthSaleGoalDetailsList.length; i++) {
|
|
|
+ for (let j = i + 1; j < this.monthSaleGoalDetailsList.length - i; j++) {
|
|
|
+ if (this.monthSaleGoalDetailsList[i].materialCode == this.monthSaleGoalDetailsList[j].materialCode) {
|
|
|
+ return this.$message.error('子表存在重复物料');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -895,19 +922,25 @@
|
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
|
this.form.monthDetailsList = JSON.parse(JSON.stringify(this.monthSaleGoalDetailsList))
|
|
|
+ this.$modal.loading("保存中...");
|
|
|
updateMonthSaleGoal(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
+ }).finally( e =>{
|
|
|
+ this.$modal.closeLoading();
|
|
|
});
|
|
|
} else {
|
|
|
this.form.status = '0'
|
|
|
this.form.monthDetailsList = JSON.parse(JSON.stringify(this.monthSaleGoalDetailsList))
|
|
|
console.log(this.form);
|
|
|
+ this.$modal.loading("保存中...");
|
|
|
addMonthSaleGoal(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
+ }).finally( e =>{
|
|
|
+ this.$modal.closeLoading();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -916,7 +949,7 @@
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除月销售目标填报单据编号为"' + row.code + '"的数据项?').then(function () {
|
|
|
+ this.$modal.confirm('是否确认删除月销售/月利润目标填报单据编号为"' + row.code + '"的数据项?').then(function () {
|
|
|
return delMonthSaleGoal(ids);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
@@ -929,7 +962,7 @@
|
|
|
this.computeTotal()
|
|
|
} else {
|
|
|
if (row.id !== null) {
|
|
|
- this.$modal.confirm('是否确认删除月销售目标填报明细序号为"' + (index + 1) + '"的数据项?').then(function () {
|
|
|
+ this.$modal.confirm('是否确认删除月销售/月利润目标填报明细序号为"' + (index + 1) + '"的数据项?').then(function () {
|
|
|
return delMonthSaleGoalDetails(row.id);
|
|
|
}).then(() => {
|
|
|
this.getListDetails();
|
|
@@ -1007,29 +1040,69 @@
|
|
|
h('span', '' + column.label)
|
|
|
]
|
|
|
},
|
|
|
+ // 子表table通过判断条件加必填标志
|
|
|
+ addRedStarChange(h, {
|
|
|
+ column
|
|
|
+ }) {
|
|
|
+ if (this.isDept) {
|
|
|
+ return[
|
|
|
+ h('span', '' + column.label)
|
|
|
+ ]
|
|
|
+ } else {
|
|
|
+ return [
|
|
|
+ h('span', {
|
|
|
+ style: 'color: #F56C6C'
|
|
|
+ }, '*'),
|
|
|
+ h('span', '' + column.label)
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
justiceDetailsList() {
|
|
|
this.text = ' ';
|
|
|
let isFlag = [];
|
|
|
let count = 1;
|
|
|
const arr = JSON.parse(JSON.stringify(this.monthSaleGoalDetailsList))
|
|
|
- for (const element of arr) {
|
|
|
- const flag1 = (element.saleOrg !== null) && (element.saleZone !== null) && (element.custom !== null) && (
|
|
|
- element.dept !== null) && (element.creator !== null) && (element.materialCode !== null) && (element
|
|
|
- .material !== null) && (element.monthly !== null) && (element.goalValue !== 0)
|
|
|
- const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
|
|
|
- undefined) && (element.dept !== undefined) && (element.creator !== undefined) && (element.materialCode !==
|
|
|
- undefined) && (element.material !== undefined) && (element.monthly !== undefined)
|
|
|
- if (flag1 && flag2) {
|
|
|
- isFlag.push(true);
|
|
|
- } else {
|
|
|
- this.text += '[' + count + '] ';
|
|
|
- isFlag.push(false);
|
|
|
+ if (this.isDept) {
|
|
|
+ for (const element of arr) {
|
|
|
+ const flag1 = (element.saleOrg !== null) && (element.saleZone !== null) && (element.custom !== null) && (
|
|
|
+ element.dept !== null) && (element.creator !== null) && (element.oneLevelClassify !== null) && (element
|
|
|
+ .oneLevelClassifyCode !== null) && (element.monthly !== null) && (element.goalValue !== 0);
|
|
|
+ const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
|
|
|
+ undefined) && (element.dept !== undefined) && (element.creator !== undefined) && (element.oneLevelClassify !==
|
|
|
+ undefined) && (element.oneLevelClassifyCode !== undefined) && (element.monthly !== undefined);
|
|
|
+ if (flag1 && flag2) {
|
|
|
+ isFlag.push(true);
|
|
|
+ } else {
|
|
|
+ this.text += '[' + count + '] ';
|
|
|
+ isFlag.push(false);
|
|
|
+ }
|
|
|
+ count++;
|
|
|
}
|
|
|
- count++;
|
|
|
- }
|
|
|
- for (const flag of isFlag) {
|
|
|
- if (!flag) {
|
|
|
- return true;
|
|
|
+ for (const flag of isFlag) {
|
|
|
+ if (!flag) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (const element of arr) {
|
|
|
+ const flag1 = (element.saleOrg !== null) && (element.saleZone !== null) && (element.custom !== null) && (
|
|
|
+ element.dept !== null) && (element.creator !== null) && (element.materialCode !== null) && (element
|
|
|
+ .material !== null) && (element.monthly !== null) && (element.goalValue !== 0);
|
|
|
+ const flag2 = (element.saleOrg !== undefined) && (element.saleZone !== undefined) && (element.custom !==
|
|
|
+ undefined) && (element.dept !== undefined) && (element.creator !== undefined) && (element.materialCode !==
|
|
|
+ undefined) && (element.material !== undefined) && (element.monthly !== undefined);
|
|
|
+ if (flag1 && flag2) {
|
|
|
+ isFlag.push(true);
|
|
|
+ } else {
|
|
|
+ this.text += '[' + count + '] ';
|
|
|
+ isFlag.push(false);
|
|
|
+ }
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ for (const flag of isFlag) {
|
|
|
+ if (!flag) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -1056,11 +1129,11 @@
|
|
|
handleImport() {
|
|
|
this.upload.open = true;
|
|
|
if (this.open) {
|
|
|
- this.upload.title = "月销售目标填报明细导入"
|
|
|
+ this.upload.title = "月销售/月利润目标填报明细导入"
|
|
|
this.upload.url = process.env.VUE_APP_BASE_API + "goal_management/monthSaleGoalDetails/importData/" + this
|
|
|
.form.id
|
|
|
} else {
|
|
|
- this.upload.title = "月销售目标填报导入";
|
|
|
+ this.upload.title = "月销售/月利润目标填报导入";
|
|
|
this.upload.url = process.env.VUE_APP_BASE_API + "goal_management/monthSaleGoal/importData"
|
|
|
}
|
|
|
},
|
|
@@ -1196,7 +1269,7 @@
|
|
|
//模板下载
|
|
|
handleTemplateDownload() {
|
|
|
this.download('/goal_management/monthSaleGoalDetails/importTemplate', {},
|
|
|
- `月销售目标填报明细导入模板_${new Date().getTime()}.xlsx`)
|
|
|
+ `月销售/月利润目标填报明细导入模板_${new Date().getTime()}.xlsx`)
|
|
|
},
|
|
|
//导入
|
|
|
handleImport(file) {
|
|
@@ -1247,7 +1320,41 @@
|
|
|
},
|
|
|
calculate(row) {
|
|
|
row.goalValue = row.num * row.price;
|
|
|
- }
|
|
|
+ },
|
|
|
+ judge() {
|
|
|
+ this.isDept = false;
|
|
|
+ if (this.$store.state.user.deptName.indexOf('湖南公司') >= 0) {
|
|
|
+ this.isDept = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 树形参照
|
|
|
+ chooseTreeReferForMain(type, isPage, title, index) {
|
|
|
+ this.referCondition.type = type;
|
|
|
+ this.referCondition.isPage = isPage;
|
|
|
+ this.referCondition.title = title;
|
|
|
+ this.index = null;
|
|
|
+ this.index = index;
|
|
|
+ this.$refs.treeMain.init(this.referCondition);
|
|
|
+ },
|
|
|
+ selectionsToInputForMain(selection) {
|
|
|
+ this.classOptions = selection;
|
|
|
+ if (this.referCondition.title === '一级物料分类') {
|
|
|
+ if (this.classOptions[0].code.length > 2) {
|
|
|
+ return this.$message.info('请在一级分类下选择');
|
|
|
+ }
|
|
|
+ this.monthSaleGoalDetailsList[this.index].oneLevelClassifyCode = selection[0].code;
|
|
|
+ this.monthSaleGoalDetailsList[this.index].oneLevelClassify = selection[0].name;
|
|
|
+ } else if (this.referCondition.title === '二级物料分类') {
|
|
|
+ if (this.classOptions[0].code.lastIndexOf("-") == 3 || this.classOptions[0].code.indexOf("90") == 0) {
|
|
|
+ this.monthSaleGoalDetailsList[this.index].oneLevelClassifyCode = selection[0].parentCode;
|
|
|
+ this.monthSaleGoalDetailsList[this.index].oneLevelClassify = selection[0].parentName;
|
|
|
+ this.monthSaleGoalDetailsList[this.index].twoLevelClassifyCode = selection[0].code;
|
|
|
+ this.monthSaleGoalDetailsList[this.index].twoLevelClassify = selection[0].name;
|
|
|
+ } else {
|
|
|
+ return this.$message.info('请在二级分类下选择');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
|