重构: 入库改为工序选项(废弃勾选框) + TaskTreeNode增加remark调试log + isWarehouse计算属性
This commit is contained in:
@ -87,6 +87,11 @@ export default {
|
||||
currentUsername: { type: String, default: "" },
|
||||
},
|
||||
emits: ["action", "editRecord", "viewRecords"],
|
||||
mounted() {
|
||||
console.log("TaskTreeNode task keys:", Object.keys(this.task));
|
||||
console.log("task.remark =", this.task.remark);
|
||||
console.log("task.description =", this.task.description);
|
||||
},
|
||||
computed: {
|
||||
canEditRecord() {
|
||||
if (this.task.assignee_id == this.currentUserId) return true;
|
||||
|
||||
@ -252,8 +252,8 @@
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 接收人选择 (Picker,单选) -->
|
||||
<view class="form-item">
|
||||
<!-- 接收人选择(仅非入库时显示) -->
|
||||
<view v-if="!isWarehouse" class="form-item">
|
||||
<text class="form-label">接收人 <text class="required">*</text></text>
|
||||
<picker mode="selector" :range="userOptions" range-key="name" @change="onUserChange">
|
||||
<view class="picker-value">
|
||||
@ -265,19 +265,21 @@
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- 同时入库 -->
|
||||
<label class="wh-label" @tap="transferForm.warehouse = !transferForm.warehouse">
|
||||
<checkbox :checked="transferForm.warehouse" style="transform:scale(0.8)" /> 同时入库 (virtual_warehouse)
|
||||
</label>
|
||||
<!-- 入库提示 -->
|
||||
<view v-if="isWarehouse" class="warehouse-hint">
|
||||
📦 该任务将直接入库,任务状态变为「已入库」
|
||||
</view>
|
||||
|
||||
<input v-model="transferForm.note" class="popup-input" placeholder="交接备注(选填)" />
|
||||
|
||||
<view v-if="transferForm.assignees.length && transferForm.next_task_name" class="preview-hint">
|
||||
将创建 {{ transferForm.assignees.length }}{{ transferForm.warehouse ? ' (+仓库)' : '' }} 个「{{ transferForm.next_task_name }}」任务
|
||||
<view v-if="transferForm.next_task_name" class="preview-hint">
|
||||
{{ isWarehouse ? '产品将入库并从个人待办中移除' : '将创建 1 个「' + transferForm.next_task_name + '」任务指派给 ' + (selectedUserName || '—') }}
|
||||
</view>
|
||||
<view class="popup-btns">
|
||||
<button class="btn-cancel" @tap="closeActionPopup">取消</button>
|
||||
<button class="btn-primary" :disabled="actionLoading || !transferForm.next_task_name || (!transferForm.assignees.length && !transferForm.warehouse)" @tap="doTransfer">确认转交</button>
|
||||
<button class="btn-primary" :disabled="actionLoading || !transferForm.next_task_name || (!isWarehouse && !transferForm.assignees.length)" @tap="doTransfer">
|
||||
{{ isWarehouse ? '📦 确认入库' : '确认转交' }}
|
||||
</button>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
@ -348,6 +350,9 @@ export default {
|
||||
const u = this.userOptions.find(u => u.id === this.transferForm.selectedUserId);
|
||||
return u ? u.name : "";
|
||||
},
|
||||
isWarehouse() {
|
||||
return this.transferForm.next_task_name === "🏭 入库 (virtual_warehouse)";
|
||||
},
|
||||
activeTask() {
|
||||
// 查找树中第一个 WIP 或 PENDING 任务作为底部 Footer 的操作目标
|
||||
const findActive = (tasks) => {
|
||||
@ -644,7 +649,7 @@ export default {
|
||||
try {
|
||||
if (!this.userOptions.length) await this.loadUsers();
|
||||
if (!this.processOptions.length) {
|
||||
this.processOptions = [...TASK_NAME_OPTIONS];
|
||||
this.processOptions = ["🏭 入库 (virtual_warehouse)", ...TASK_NAME_OPTIONS];
|
||||
}
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
@ -690,15 +695,16 @@ export default {
|
||||
},
|
||||
async doTransfer() {
|
||||
this.actionLoading = true;
|
||||
const finalAssignees = [...this.transferForm.assignees];
|
||||
if (this.transferForm.warehouse) finalAssignees.push("virtual_warehouse");
|
||||
const finalAssignees = this.isWarehouse
|
||||
? ["virtual_warehouse"]
|
||||
: [...this.transferForm.assignees];
|
||||
try {
|
||||
await post(`/tasks/${this.actionPopup.task.id}/transfer`, {
|
||||
next_assignees: finalAssignees,
|
||||
next_task_name: this.transferForm.next_task_name.trim(),
|
||||
note: this.transferForm.note.trim() || undefined,
|
||||
});
|
||||
uni.showToast({ title: "转交成功", icon: "success" });
|
||||
uni.showToast({ title: this.isWarehouse ? "已入库" : "转交成功", icon: "success" });
|
||||
this.closeActionPopup();
|
||||
this.doQuery(this.product.serial_number);
|
||||
} catch {} finally { this.actionLoading = false; }
|
||||
@ -784,6 +790,7 @@ export default {
|
||||
.popup-tag-wh { background: #ede9fe; color: #7c3aed; }
|
||||
.popup-add-row { display: flex; gap: 6px; }
|
||||
.wh-label { font-size: 13px; display: flex; align-items: center; gap: 4px; margin-top: 6px; color: #6b7280; }
|
||||
.warehouse-hint { font-size: 13px; background: #ede9fe; color: #7c3aed; padding: 10px 14px; border-radius: 10px; margin: 8px 0; text-align: center; }
|
||||
.preview-hint { font-size: 12px; background: #f0fdf4; color: #16a34a; padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
|
||||
|
||||
/* Picker & 表单 */
|
||||
|
||||
Reference in New Issue
Block a user