utiller 1.0.357 → 1.0.359
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utiller/index.js +46 -61
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/utiller/index.js
CHANGED
|
@@ -4156,10 +4156,10 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
4156
4156
|
value: function checkPeriodConflict(newTask, existingTasks) {
|
|
4157
4157
|
var resourceCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
4158
4158
|
// 1️⃣ 解析 timeSlot 拆成日期與時間
|
|
4159
|
-
var _newTask$
|
|
4160
|
-
_newTask$
|
|
4161
|
-
datePart = _newTask$
|
|
4162
|
-
timePart = _newTask$
|
|
4159
|
+
var _newTask$content$spli = newTask.content.split("|"),
|
|
4160
|
+
_newTask$content$spli2 = (0, _slicedToArray2["default"])(_newTask$content$spli, 2),
|
|
4161
|
+
datePart = _newTask$content$spli2[0],
|
|
4162
|
+
timePart = _newTask$content$spli2[1];
|
|
4163
4163
|
var date = (0, _momentTimezone["default"])(datePart.split(" ")[0], "YYYY/MM/DD");
|
|
4164
4164
|
var _timePart$split = timePart.split("-"),
|
|
4165
4165
|
_timePart$split2 = (0, _slicedToArray2["default"])(_timePart$split, 2),
|
|
@@ -4191,63 +4191,48 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
4191
4191
|
items: conflictItems // 衝突的任務列表
|
|
4192
4192
|
};
|
|
4193
4193
|
}
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
}
|
|
4237
|
-
*/
|
|
4238
|
-
|
|
4239
|
-
// 測試:兩人資源
|
|
4240
|
-
console.log(checkPeriodConflict(newTask, existingTasks, 2));
|
|
4241
|
-
/*
|
|
4242
|
-
{
|
|
4243
|
-
conflict: false,
|
|
4244
|
-
items: [
|
|
4245
|
-
{ id: 'T005', period: '202508201630-202508201700' },
|
|
4246
|
-
{ id: 'T006', period: '202508201645-202508201700' }
|
|
4247
|
-
]
|
|
4248
|
-
}
|
|
4249
|
-
*/
|
|
4250
|
-
}
|
|
4194
|
+
|
|
4195
|
+
// testOfConflict() {
|
|
4196
|
+
// // ===== 測試資料 =====
|
|
4197
|
+
// const newTask = {
|
|
4198
|
+
// timeSlot: "2025/08/20 (三)|16:00-17:00", // 格式: YYYY/MM/DD (週)|HH:mm-HH:mm
|
|
4199
|
+
// id: "JOB001",
|
|
4200
|
+
// description: "安裝冷氣"
|
|
4201
|
+
// };
|
|
4202
|
+
//
|
|
4203
|
+
// const existingTasks = [
|
|
4204
|
+
// { id: "T001", period: "202508151400-202508151500" },
|
|
4205
|
+
// { id: "T002", period: "202508151600-202508151700" },
|
|
4206
|
+
// { id: "T003", period: "202508161400-202508161500" },
|
|
4207
|
+
// { id: "T004", period: "202508171600-202508171700" },
|
|
4208
|
+
// { id: "T005", period: "202508201630-202508201700" }, // 衝突
|
|
4209
|
+
// { id: "T006", period: "202508201645-202508201700" } // 衝突
|
|
4210
|
+
// ];
|
|
4211
|
+
//
|
|
4212
|
+
// // 測試:一人資源
|
|
4213
|
+
// console.log(this.checkPeriodConflict(newTask, existingTasks, 1));
|
|
4214
|
+
// /*
|
|
4215
|
+
// {
|
|
4216
|
+
// conflict: true,
|
|
4217
|
+
// items: [
|
|
4218
|
+
// { id: 'T005', period: '202508201630-202508201700' },
|
|
4219
|
+
// { id: 'T006', period: '202508201645-202508201700' }
|
|
4220
|
+
// ]
|
|
4221
|
+
// }
|
|
4222
|
+
// */
|
|
4223
|
+
//
|
|
4224
|
+
// // 測試:兩人資源
|
|
4225
|
+
// console.log(this.checkPeriodConflict(newTask, existingTasks, 2));
|
|
4226
|
+
// /*
|
|
4227
|
+
// {
|
|
4228
|
+
// conflict: false,
|
|
4229
|
+
// items: [
|
|
4230
|
+
// { id: 'T005', period: '202508201630-202508201700' },
|
|
4231
|
+
// { id: 'T006', period: '202508201645-202508201700' }
|
|
4232
|
+
// ]
|
|
4233
|
+
// }
|
|
4234
|
+
// */
|
|
4235
|
+
// }
|
|
4251
4236
|
/** ============== 排課系統公式 結束 ============== */
|
|
4252
4237
|
}]);
|
|
4253
4238
|
}();
|
package/package.json
CHANGED