|
|
|
|
@ -19,13 +19,9 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<!-- -->
|
|
|
|
|
<el-button size="mini" type="primary" plain @click="handleClose">取 消</el-button>
|
|
|
|
|
<el-button size="mini" type="primary" @click="confirms()">确 定
|
|
|
|
|
</el-button>
|
|
|
|
|
@ -35,31 +31,42 @@
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { selectList, selectListType, QuerCompetent } from "@/api/eashier.js";
|
|
|
|
|
import { create } from "domain";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
dialogVisible: false, //弹窗开关
|
|
|
|
|
staffList: [],
|
|
|
|
|
ratios:100,
|
|
|
|
|
list: [], //主数组
|
|
|
|
|
form: {}, //主对象
|
|
|
|
|
openList: [],
|
|
|
|
|
staffText: "",
|
|
|
|
|
staffTitle: "",
|
|
|
|
|
staffListCopy: [],
|
|
|
|
|
ratioscontent:0,
|
|
|
|
|
len:0,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
handleClose() {
|
|
|
|
|
Object.assign(this.$data, this.$options.data.call(this));
|
|
|
|
|
},
|
|
|
|
|
add() {
|
|
|
|
|
this.list.push({});
|
|
|
|
|
this.changeStaff();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
endEdit(row, index) {
|
|
|
|
|
if (row.ratio || row.ratio * 1 < 101) {
|
|
|
|
|
row.ratio = row.ratio * 1;
|
|
|
|
|
} else {
|
|
|
|
|
row.ratio = 0;
|
|
|
|
|
}
|
|
|
|
|
let number = 0;
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
if (index != 0) {
|
|
|
|
|
number += item.ratio * 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.list[0].ratio = 100 - number;
|
|
|
|
|
this.changeStaff();
|
|
|
|
|
},
|
|
|
|
|
editChange(e, index) {
|
|
|
|
|
let row = this.list[index];
|
|
|
|
|
let form = {};
|
|
|
|
|
@ -73,29 +80,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.list.splice(index, 1, form);
|
|
|
|
|
|
|
|
|
|
// console.log(this.openList);
|
|
|
|
|
console.log(this.openList);
|
|
|
|
|
this.changeStaff();
|
|
|
|
|
|
|
|
|
|
// this.openList.forEach((item) => {
|
|
|
|
|
// if (item.id == e) {
|
|
|
|
|
// item.ratio = this.staffLists[index].ratio;
|
|
|
|
|
// item.staffNames = item.brandNumber + "--" + item.staffName;
|
|
|
|
|
// this.staffLists.splice(index, 1, item);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// this.staffLists.forEach((item, indexs) => {
|
|
|
|
|
// if (index != indexs && v == item.id) {
|
|
|
|
|
// this.staffLists.splice(index, 1, { ratio: 0 });
|
|
|
|
|
// this.setRatio();
|
|
|
|
|
// this.$message.warning({ message: "员工已存在列表中" });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// let length = this.staffLists.length - 1;
|
|
|
|
|
// if (this.staffLists[length].id) {
|
|
|
|
|
// this.staffLists.push({ ratio: 0 });
|
|
|
|
|
// }
|
|
|
|
|
// this.confirms();
|
|
|
|
|
// this.changeStaff();
|
|
|
|
|
},
|
|
|
|
|
del() {
|
|
|
|
|
let index = this.list.length - 1;
|
|
|
|
|
@ -108,7 +94,6 @@ export default {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.list = JSON.parse(JSON.stringify([]));
|
|
|
|
|
this.form = { ...form };
|
|
|
|
|
console.log(this.form)
|
|
|
|
|
this.staffText = text;
|
|
|
|
|
if (text == "zhonggongList") {
|
|
|
|
|
this.staffTitle = "美发师";
|
|
|
|
|
@ -136,41 +121,18 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
this.dialogVisible = true;
|
|
|
|
|
this.getData();
|
|
|
|
|
this.list.push({});
|
|
|
|
|
console.log(this.list)
|
|
|
|
|
if(this.list.length==1){
|
|
|
|
|
this.list[0].ratio=100;
|
|
|
|
|
}
|
|
|
|
|
// else{
|
|
|
|
|
// this.list[0].ratio=this.ratioscontents;
|
|
|
|
|
// }
|
|
|
|
|
// this.len=this.list.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// else{
|
|
|
|
|
// this.list[0].ratio=this.ratioscontent
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// console.log(this.list)
|
|
|
|
|
// this.endEdit();
|
|
|
|
|
// console.log(form)
|
|
|
|
|
// this.endEdits();
|
|
|
|
|
this.changeStaff();
|
|
|
|
|
// console.log(this.list)
|
|
|
|
|
// this.list.push({});
|
|
|
|
|
// let number = 0;
|
|
|
|
|
// this.list.forEach((item, index) => {
|
|
|
|
|
// if (index != 0) {
|
|
|
|
|
// number += item.ratio * 1;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// if (this.list.length > 0) {
|
|
|
|
|
// this.list[0].ratio = (100 - number).toFixed(2) * 1;
|
|
|
|
|
// }
|
|
|
|
|
let number = 0;
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
if (index != 0) {
|
|
|
|
|
number += item.ratio * 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// console.log(this.list);
|
|
|
|
|
if (this.list.length > 0) {
|
|
|
|
|
this.list[0].ratio = (100 - number).toFixed(2) * 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log(this.list);
|
|
|
|
|
}, 300);
|
|
|
|
|
},
|
|
|
|
|
changeStaff() {
|
|
|
|
|
@ -266,39 +228,13 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
endEdit(row, index) {
|
|
|
|
|
if (row.ratio < 101 || row.ratio * 1 < 101) {
|
|
|
|
|
row.ratio = row.ratio * 1;
|
|
|
|
|
} else {
|
|
|
|
|
row.ratio = 0;
|
|
|
|
|
}
|
|
|
|
|
// console.log(row.ratio)
|
|
|
|
|
|
|
|
|
|
let number = 0;
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
if (index != 0) {
|
|
|
|
|
number += item.ratio * 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.list[0].ratio = 100 - number;
|
|
|
|
|
this.ratioscontent=this.list[0].ratio
|
|
|
|
|
this.changeStaff();
|
|
|
|
|
},
|
|
|
|
|
confirms() {
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
var objectlength=Object.keys(item)
|
|
|
|
|
if (objectlength.length<= 1) {
|
|
|
|
|
this.list.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
let flag = this.isRepeat(this.list, "brandNumber");
|
|
|
|
|
let form = {
|
|
|
|
|
text: this.staffText,
|
|
|
|
|
list: this.list,
|
|
|
|
|
};
|
|
|
|
|
this.ratioscontents=this.list[0].ratio
|
|
|
|
|
|
|
|
|
|
// console.log(flag);
|
|
|
|
|
console.log(flag);
|
|
|
|
|
if (flag) {
|
|
|
|
|
this.$emit("staffratioData", form);
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
@ -312,20 +248,8 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleClose() {
|
|
|
|
|
//取消消除多余的输入框
|
|
|
|
|
this.list.forEach((item, index) => {
|
|
|
|
|
var objectlength=Object.keys(item)
|
|
|
|
|
if (objectlength.length<= 1) {
|
|
|
|
|
this.list.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// this.list.splice(this.len+1),
|
|
|
|
|
this.dialogVisible = false;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|