|
|
@@ -991,22 +991,27 @@ export default {
|
|
|
},
|
|
|
// 用户状态修改
|
|
|
handleStatusChange(row, index) {
|
|
|
- eval("row.status=" + "row.day" + (index > 9 ? index : "0" + index));
|
|
|
- let text = row.status === "0" ? "正常" : "休息";
|
|
|
- var workDay = "day" + (index > 9 ? index : "0" + index);
|
|
|
- this.$confirm('确认要"' + text + '""' + index + '"工作日状态吗?').then(function () {
|
|
|
- var node = {
|
|
|
- "sequenceId": row.sequenceId,
|
|
|
- [workDay]: row.status,
|
|
|
- }
|
|
|
+ const dayKey = 'day' + (index > 9 ? index : '0' + index);
|
|
|
+ const newStatus = row[dayKey] === 0 ? 0 : 1;
|
|
|
+ row[dayKey] = newStatus;
|
|
|
+ const text = newStatus === 0 ? "休息" : "正常";
|
|
|
+ this.$confirm(`确认要将第 ${index} 天设为 "${text}" 状态吗?`)
|
|
|
+ .then(() => {
|
|
|
+ const node = {
|
|
|
+ sequenceId: row.sequenceId,
|
|
|
+ [dayKey]: newStatus,
|
|
|
+ };
|
|
|
+ return updateSchedule(node);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$message.success(text + "成功");
|
|
|
+ this.getList();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ row[dayKey] = newStatus == 0 ? 1 : 0;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- return updateSchedule(node);
|
|
|
- }).then(() => {
|
|
|
- this.$message.success(text + "成功");
|
|
|
- }).catch(function () {
|
|
|
- row.status = row.status === "0" ? "1" : "0";
|
|
|
- });
|
|
|
- },
|
|
|
}
|
|
|
};
|
|
|
</script>
|