还款计算修改
parent
df135edb0b
commit
16a3098cc1
@ -1,213 +1,214 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :close-on-click-model="false" v-dialogDrag :title="staffTitle" :visible.sync="dialogVisible" width="500px" append-to-body>
|
<el-dialog :close-on-click-model="false" v-dialogDrag :title="staffTitle" :visible.sync="dialogVisible" width="500px" append-to-body>
|
||||||
<el-button size="mini" type="primary" @click="add()">添加</el-button>
|
<el-button size="mini" type="primary" @click="add()">添加</el-button>
|
||||||
<el-button size="mini" type="primary" @click="del()">删除</el-button>
|
<el-button size="mini" type="primary" @click="del()">删除</el-button>
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-table :data="list" max-height="600">
|
<el-table :data="list" max-height="600">
|
||||||
<el-table-column align="center" :label="staffTitle">
|
<el-table-column align="center" :label="staffTitle">
|
||||||
<el-table-column min-width="140" align="center" label="员工">
|
<el-table-column min-width="140" align="center" label="员工">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select filterable default-first-option v-model="scope.row.label" placeholder="请选择" @change="editChange($event,scope.$index)">
|
<el-select filterable default-first-option v-model="scope.row.label" placeholder="请选择" @change="editChange($event,scope.$index)">
|
||||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
|
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="100" align="center" label="占比">
|
<el-table-column min-width="100" align="center" label="占比">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-focus type="number" @blur="endEdit(scope.row,scope.$index)" :disabled="scope.$index==0" size="samll" v-model="scope.row.ratio"></el-input>
|
<el-input v-focus type="number" @blur="endEdit(scope.row,scope.$index)" :disabled="scope.$index==0" size="samll" v-model="scope.row.ratio"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button size="mini" type="primary" plain @click="dialogVisible = false">取 消</el-button>
|
<el-button size="mini" type="primary" plain @click="dialogVisible = false">取 消</el-button>
|
||||||
<el-button size="mini" type="primary" @click="confirms()">确 定
|
<el-button size="mini" type="primary" @click="confirms()">确 定
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { selectList, selectListType, QuerCompetent } from "@/api/eashier.js";
|
import { selectList, selectListType, QuerCompetent } from "@/api/eashier.js";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false, //弹窗开关
|
dialogVisible: false, //弹窗开关
|
||||||
staffList: [],
|
staffList: [],
|
||||||
list: [], //主数组
|
list: [], //主数组
|
||||||
form: {}, //主对象
|
form: {}, //主对象
|
||||||
options: [{ label: "10001-刘乐乐" }],
|
options: [{ label: "10001-刘乐乐" }],
|
||||||
staffText: "",
|
staffText: "",
|
||||||
staffTitle: "",
|
staffTitle: "",
|
||||||
staffListCopy: [],
|
staffListCopy: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
add() {
|
add() {
|
||||||
this.list.push({});
|
this.list.push({});
|
||||||
this.changeStaff();
|
this.changeStaff();
|
||||||
},
|
},
|
||||||
endEdit(row, index) {
|
endEdit(row, index) {
|
||||||
if (!row.ratio) {
|
if (row.ratio || row.ratio * 1 < 101) {
|
||||||
row.ratio = 0;
|
row.ratio = row.ratio * 1;
|
||||||
}
|
} else {
|
||||||
row.ratio = row.ratio * 1;
|
row.ratio = 0;
|
||||||
let number = 0;
|
}
|
||||||
this.list.forEach((item, index) => {
|
let number = 0;
|
||||||
if (index != 0) {
|
this.list.forEach((item, index) => {
|
||||||
number += item.ratio * 1;
|
if (index != 0) {
|
||||||
}
|
number += item.ratio * 1;
|
||||||
});
|
}
|
||||||
this.list[0].ratio = 100 - number;
|
});
|
||||||
this.changeStaff();
|
this.list[0].ratio = 100 - number;
|
||||||
},
|
this.changeStaff();
|
||||||
editChange(e, index) {
|
},
|
||||||
let row = this.list[index];
|
editChange(e, index) {
|
||||||
let form = {};
|
let row = this.list[index];
|
||||||
this.options.forEach((item) => {
|
let form = {};
|
||||||
if (e == item.id) {
|
this.options.forEach((item) => {
|
||||||
form = { ...item };
|
if (e == item.id) {
|
||||||
}
|
form = { ...item };
|
||||||
});
|
}
|
||||||
if (row.ratio > 0) {
|
});
|
||||||
form.ratio = row.ratio;
|
if (row.ratio > 0) {
|
||||||
}
|
form.ratio = row.ratio;
|
||||||
this.list.splice(index, 1, form);
|
}
|
||||||
|
this.list.splice(index, 1, form);
|
||||||
console.log(this.options);
|
|
||||||
this.changeStaff();
|
console.log(this.options);
|
||||||
},
|
this.changeStaff();
|
||||||
del() {
|
},
|
||||||
let index = this.list.length - 1;
|
del() {
|
||||||
this.list[0].ratio += this.list[index].ratio;
|
let index = this.list.length - 1;
|
||||||
this.list.splice(index, 1);
|
this.list[0].ratio += this.list[index].ratio;
|
||||||
this.changeStaff();
|
this.list.splice(index, 1);
|
||||||
},
|
this.changeStaff();
|
||||||
//组件传值
|
},
|
||||||
show(form, text) {
|
//组件传值
|
||||||
this.list = [];
|
show(form, text) {
|
||||||
this.form = { ...form };
|
this.list = [];
|
||||||
this.staffText = text;
|
this.form = { ...form };
|
||||||
if (text == "zhonggongList") {
|
this.staffText = text;
|
||||||
this.staffTitle = "美发师";
|
if (text == "zhonggongList") {
|
||||||
}
|
this.staffTitle = "美发师";
|
||||||
if (text == "largeList") {
|
}
|
||||||
this.staffTitle = "美容师";
|
if (text == "largeList") {
|
||||||
}
|
this.staffTitle = "美容师";
|
||||||
if (text == "smallList") {
|
}
|
||||||
this.staffTitle = "助理";
|
if (text == "smallList") {
|
||||||
}
|
this.staffTitle = "助理";
|
||||||
if (text == "technicianList") {
|
}
|
||||||
this.staffTitle = "技师";
|
if (text == "technicianList") {
|
||||||
}
|
this.staffTitle = "技师";
|
||||||
if (text == "adminList") {
|
}
|
||||||
this.staffTitle = "门店管理层";
|
if (text == "adminList") {
|
||||||
}
|
this.staffTitle = "门店管理层";
|
||||||
if (text == "managerList") {
|
}
|
||||||
this.staffTitle = "高管";
|
if (text == "managerList") {
|
||||||
}
|
this.staffTitle = "高管";
|
||||||
this.list = form[text];
|
}
|
||||||
this.list.forEach((item) => {
|
this.list = form[text];
|
||||||
if (item.id) {
|
this.list.forEach((item) => {
|
||||||
item.label = item.brandNumber + "-" + item.staffName;
|
if (item.id) {
|
||||||
}
|
item.label = item.brandNumber + "-" + item.staffName;
|
||||||
});
|
}
|
||||||
this.dialogVisible = true;
|
});
|
||||||
this.getData();
|
this.dialogVisible = true;
|
||||||
this.changeStaff();
|
this.getData();
|
||||||
this.endEdit()
|
this.changeStaff();
|
||||||
},
|
this.endEdit();
|
||||||
changeStaff() {
|
},
|
||||||
var that = this;
|
changeStaff() {
|
||||||
console.log(that.list);
|
var that = this;
|
||||||
console.log(that.staffListCopy);
|
console.log(that.list);
|
||||||
var list = that.list.concat(that.staffListCopy).filter(function (v) {
|
console.log(that.staffListCopy);
|
||||||
return (
|
var list = that.list.concat(that.staffListCopy).filter(function (v) {
|
||||||
that.list.indexOf(v) === -1 || that.staffListCopy.indexOf(v) === -1
|
return (
|
||||||
);
|
that.list.indexOf(v) === -1 || that.staffListCopy.indexOf(v) === -1
|
||||||
});
|
);
|
||||||
this.options = list;
|
});
|
||||||
},
|
this.options = list;
|
||||||
//获取数据
|
},
|
||||||
async getData() {
|
//获取数据
|
||||||
if (this.text == "adminList") {
|
async getData() {
|
||||||
selectListType({ type: 0 }).then((res) => {
|
if (this.text == "adminList") {
|
||||||
if (res.code == "000000") {
|
selectListType({ type: 0 }).then((res) => {
|
||||||
res.rows.forEach((item) => {
|
if (res.code == "000000") {
|
||||||
item.label = item.brandNumber + "-" + item.staffName;
|
res.rows.forEach((item) => {
|
||||||
item.ratio = 100;
|
item.label = item.brandNumber + "-" + item.staffName;
|
||||||
delete item.state;
|
item.ratio = 100;
|
||||||
});
|
delete item.state;
|
||||||
this.options = res.rows;
|
});
|
||||||
this.staffListCopy = res.rows;
|
this.options = res.rows;
|
||||||
} else {
|
this.staffListCopy = res.rows;
|
||||||
this.$alert(res.message, "加载员工提示", {
|
} else {
|
||||||
confirmButtonText: "确定",
|
this.$alert(res.message, "加载员工提示", {
|
||||||
confirmButtonClass: "confirmbtnFalses",
|
confirmButtonText: "确定",
|
||||||
type: "warning",
|
confirmButtonClass: "confirmbtnFalses",
|
||||||
center: true,
|
type: "warning",
|
||||||
callback: (action) => {},
|
center: true,
|
||||||
});
|
callback: (action) => {},
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
} else if (this.text == "managerList") {
|
});
|
||||||
QuerCompetent({ type: 0, pageSize: 999 }).then((res) => {
|
} else if (this.text == "managerList") {
|
||||||
if (res.code == "000000") {
|
QuerCompetent({ type: 0, pageSize: 999 }).then((res) => {
|
||||||
res.pageInfo.list.forEach((item) => {
|
if (res.code == "000000") {
|
||||||
item.label = item.brandNumber + "-" + item.staffName;
|
res.pageInfo.list.forEach((item) => {
|
||||||
item.ratio = 100;
|
item.label = item.brandNumber + "-" + item.staffName;
|
||||||
delete item.state;
|
item.ratio = 100;
|
||||||
});
|
delete item.state;
|
||||||
this.options = res.pageInfo.list;
|
});
|
||||||
this.staffListCopy = res.pageInfo.list;
|
this.options = res.pageInfo.list;
|
||||||
} else {
|
this.staffListCopy = res.pageInfo.list;
|
||||||
this.$alert(res.message, "加载高管提示", {
|
} else {
|
||||||
confirmButtonText: "确定",
|
this.$alert(res.message, "加载高管提示", {
|
||||||
confirmButtonClass: "confirmbtnFalses",
|
confirmButtonText: "确定",
|
||||||
type: "warning",
|
confirmButtonClass: "confirmbtnFalses",
|
||||||
center: true,
|
type: "warning",
|
||||||
callback: (action) => {},
|
center: true,
|
||||||
});
|
callback: (action) => {},
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
} else {
|
});
|
||||||
let form = { id: "" };
|
} else {
|
||||||
if (this.staffName) {
|
let form = { id: "" };
|
||||||
form.staffName = this.staffName;
|
if (this.staffName) {
|
||||||
}
|
form.staffName = this.staffName;
|
||||||
selectList(form).then((res) => {
|
}
|
||||||
if (res.code == "000000") {
|
selectList(form).then((res) => {
|
||||||
res.rows.forEach((item) => {
|
if (res.code == "000000") {
|
||||||
item.label = item.brandNumber + "-" + item.staffName;
|
res.rows.forEach((item) => {
|
||||||
item.ratio = 0;
|
item.label = item.brandNumber + "-" + item.staffName;
|
||||||
});
|
item.ratio = 0;
|
||||||
this.options = res.rows;
|
});
|
||||||
this.staffListCopy = res.rows;
|
this.options = res.rows;
|
||||||
} else {
|
this.staffListCopy = res.rows;
|
||||||
this.$alert(res.message, "提示", {
|
} else {
|
||||||
confirmButtonText: "确定",
|
this.$alert(res.message, "提示", {
|
||||||
confirmButtonClass: "confirmbtnFalses",
|
confirmButtonText: "确定",
|
||||||
type: "warning",
|
confirmButtonClass: "confirmbtnFalses",
|
||||||
center: true,
|
type: "warning",
|
||||||
callback: (action) => {},
|
center: true,
|
||||||
});
|
callback: (action) => {},
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
},
|
}
|
||||||
confirms() {
|
},
|
||||||
let form = {
|
confirms() {
|
||||||
text: this.staffText,
|
let form = {
|
||||||
list: this.list,
|
text: this.staffText,
|
||||||
};
|
list: this.list,
|
||||||
this.$emit("staffratioData", form);
|
};
|
||||||
this.dialogVisible = false;
|
this.$emit("staffratioData", form);
|
||||||
},
|
this.dialogVisible = false;
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
</script>
|
};
|
||||||
|
</script>
|
||||||
<style>
|
|
||||||
</style>
|
<style>
|
||||||
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue