This commit is contained in:
shijing 2025-09-25 08:54:43 +08:00
commit a842a1a358
6 changed files with 272 additions and 302 deletions

View File

@ -75,7 +75,7 @@ export default {
emits: ["success", "closed"],
components: { ticketd },
props: {
modelId: { type: String, default: null },
t_id: { type: String, default: null },
},
data() {
return {
@ -107,8 +107,8 @@ export default {
mounted() {
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
this.tableData = [];
if (this.modelId) {
this.getRoutePackDetail(this.modelId);
if (this.t_id) {
this.getRoutePackDetail(this.t_id);
}
},
methods: {

View File

@ -133,7 +133,8 @@
<h4 :id="titleId" :class="titleClass">工单详情</h4>
<el-button type="danger" @click="close">关闭</el-button>
</template>
<component :is="currentComponent" :ticketId="ticketId" :modelId="modelId"></component>
<component :is="currentComponent" :ticketId="ticketId" :t_id="t_id" @closed="drawer = false"
@success="()=>{drawer = false; $refs.table.refresh()}"></component>
</el-drawer>
</el-container>
</template>
@ -179,7 +180,7 @@ export default {
wfOptions: [],
currentComponent: null,
ticketId: null,
modelId: null,
t_id: null,
};
},
mounted() {
@ -220,7 +221,7 @@ export default {
handleShow(row) {
this.drawer = true;
this.ticketId = row.id;
this.modelId = row.ticket_data.t_id;
this.t_id = row.ticket_data.t_id;
const viewPath = row.workflow_.view_path;
// import
this.currentComponent = markRaw(

View File

@ -1,5 +1,5 @@
<template>
<el-collapse v-model="activeNames">
<el-collapse v-model="activeNames" style="padding-left: 2px; padding-right: 2px;">
<el-collapse-item title="基本信息" name="1">
<el-descriptions :column="1">
<el-descriptions-item>
@ -12,6 +12,10 @@
{{ actStateEnum[ticketDetail.act_state]?.text }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item label="可处理人:"
v-if="ticketDetail.participant_type == 2 || ticketDetail.participant_type == 1">
<span v-for="item in ticketDetail.participant_" :key="item.id">{{ item.name }}/</span>
</el-descriptions-item>
</el-descriptions>
</el-collapse-item>
<el-collapse-item title="操作" name="2" v-if="actionShow">
@ -85,12 +89,13 @@ const handleForm = ref({
suggestion: ""
})
onMounted(() => {
console.log('props.ticketId', props.ticketId)
console.log(props)
if (props.ticketId) {
getTicketDetail();
getTicketLog();
}
});
const emit = defineEmits(['success']);
const refreshTicket = async () => {
actionShow.value = false
isOwn.value = false
@ -100,6 +105,7 @@ const refreshTicket = async () => {
activeNames.value = ['1', '3'] //
getTicketDetail()
getTicketLog()
emit('success')
}
const getTicketDetail = () => {
@ -162,7 +168,7 @@ const handleTransition = (transitionId) => {
params.transition = transitionId;
if (props.ticket_data) {
params.ticket_data = props.ticket_data;
}else{
} else {
params.ticket_data = {};
}
params.suggestion = handleForm.value.suggestion;

View File

@ -27,9 +27,13 @@ const props = defineProps({
const workflow = ref(null);
const transitions = ref([]);
onMounted(async () => {
init()
})
const init = async () => {
if (props.ticketId != null && props.ticketId != undefined) {
API.wf.ticket.ticketTransitions.req(props.ticketId).then(res => {
transitions.value = res;
console.log("res", res)
});
}else if (props.workflow_key !=null && props.workflow_key != undefined) {
let res = await API.wf.workflow.initkey.req(props.workflow_key);
@ -38,8 +42,7 @@ onMounted(async () => {
}else{
ElMessage.error("缺少workflow_key或ticketId");
}
})
}
const isSaveing = ref(false);

View File

@ -251,8 +251,14 @@
</scTable>
</el-main>
</el-container>
<save-dialog
v-if="dialog.save"
<el-drawer
v-model="dialog.save"
:title="titleMap[mode]"
:size="'90%'"
destroy-on-close
:close-on-click-modal="false"
>
<save-dialog
ref="saveDialog"
:type="type"
:process = "processId"
@ -261,8 +267,8 @@
:mgroupId="mgroupId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
></save-dialog>
</el-drawer>
<el-dialog title="退料操作" v-model="backDialogVisible" style="width: 70%;">
<el-row v-for="item in handoverbList" :key="item.id" style="padding: 10px 10px 0 20px;">
<el-col style="display: flex;border-bottom: 1px dashed #eee;">
@ -379,6 +385,12 @@ export default {
},
route_code: "",
// setNameVisible: false,
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
mode: "add"
};
},
mounted() {
@ -410,6 +422,7 @@ export default {
//
table_add(type) {
this.dialog.save = true;
this.mode = "add";
this.type = type;
this.$nextTick(() => {
this.$refs.saveDialog.open("add",'',10);
@ -419,6 +432,7 @@ export default {
let that = this;
that.type = 10;
that.codeText = codeText;
that.mode = "add";
that.dialog.save = true;
that.$nextTick(() => {
that.$refs.saveDialog.open("add",codeText,10);
@ -429,6 +443,7 @@ export default {
this.type = 20;
that.codeText2 = codeText2;
this.dialog.save = true;
that.mode = "add";
this.$nextTick(() => {
this.$refs.saveDialog.open("add",codeText2,10);
});
@ -437,6 +452,7 @@ export default {
table_edit(row) {
this.type=row.type;
this.dialog.save = true;
this.mode = "edit";
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
@ -444,6 +460,7 @@ export default {
table_show(row){
this.type=row.type;
this.dialog.save = true;
this.mode = "show";
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
@ -561,7 +578,7 @@ export default {
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.dialog.save = false;
this.$refs.table.refresh();
},
},

View File

@ -1,217 +1,218 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
width="1000px"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-form-item label="交接物料">
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
<scScanner @scanResult="codeTextChange"></scScanner>
</el-form-item>
<el-form-item label-width="0">
<el-input
ref="codeInput"
v-model="codeText"
clearable
placeholder="物料批次"
style="width: 200px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
</el-form-item>
<el-form-item label="总计:">
{{ totalCount }}
</el-form-item>
<el-form-item label="原始物料" v-if="mode!='add'&&form.mtype==20" style="margin-left: 20px;">
<el-col >{{ form.batch }}</el-col>
</el-form-item>
</el-row>
<el-row v-show="addShow">
<el-col>
<el-container>
<el-main class="nopadding">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-form-item label="交接物料">
<xtSelect
:apiObj="apiObjM"
v-model="selectObjIds"
v-model:obj="selectObjs"
:labelField="'batch'"
style="width: 100%;"
:params = "paramsM"
:multiple="true"
@change="materialChange0"
>
<el-table-column label="物料" prop="full_name">
<template #default="scope">
<span v-if="scope.row.state==20" style="color: red;border: 1px solid red;border-radius: 3px;">不合格</span>
<span v-if="scope.row.state==30" style="color: orange;border: 1px solid orange;border-radius: 3px;">返工</span>
<span>{{ scope.row.batch }}({{ scope.row.material_name }})</span>
<span v-if="scope.row.defect_name !== null" style="color: orangered">{{ scope.row.defect_name }}</span>
</template>
</el-table-column>
<el-table-column label="可交接数量" prop="count_canhandover" width="110px"></el-table-column>
</xtSelect>
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
<scScanner @scanResult="codeTextChange"></scScanner>
</el-form-item>
</el-col>
</el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="12">
<el-form-item label="交接物料">
<el-input v-model="listItem.label" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="总数量">
<span>{{ listItem.count_cando }}</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="交接数量">
<el-input-number
v-model="listItem.count"
controls-position="right"
:min="0"
step="1"
:max="listItem.count_cando"
:disabled="mode==='show'"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="交送日期" prop="send_date">
<el-date-picker
v-model="form.send_date"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="交送人">
<el-select
v-model="form.send_user"
placeholder="交送人"
<el-form-item label-width="0">
<el-input
ref="codeInput"
v-model="codeText"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
placeholder="物料批次"
style="width: 200px;margin-left: 4px;"
@keyup.enter="codeTextChange(codeText)"
></el-input>
</el-form-item>
<el-form-item label="总计:">
{{ totalCount }}
</el-form-item>
<el-form-item label="原始物料" v-if="mode!='add'&&form.mtype==20" style="margin-left: 20px;">
<el-col >{{ form.batch }}</el-col>
</el-form-item>
</el-row>
<el-row v-show="addShow">
<el-col>
<el-form-item label="交接物料">
<xtSelect
:apiObj="apiObjM"
v-model="selectObjIds"
v-model:obj="selectObjs"
:labelField="'batch'"
style="width: 100%;"
:params = "paramsM"
:multiple="true"
@change="materialChange0"
>
<el-table-column label="物料" prop="full_name">
<template #default="scope">
<span v-if="scope.row.state==20" style="color: red;border: 1px solid red;border-radius: 3px;">不合格</span>
<span v-if="scope.row.state==30" style="color: orange;border: 1px solid orange;border-radius: 3px;">返工</span>
<span>{{ scope.row.batch }}({{ scope.row.material_name }})</span>
<span v-if="scope.row.defect_name !== null" style="color: orangered">{{ scope.row.defect_name }}</span>
</template>
</el-table-column>
<el-table-column label="可交接数量" prop="count_canhandover" width="110px"></el-table-column>
</xtSelect>
</el-form-item>
</el-col>
</el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="12">
<el-form-item label="交接物料">
<el-input v-model="listItem.label" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="总数量">
<span>{{ listItem.count_cando }}</span>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="交接数量">
<el-input-number
v-model="listItem.count"
controls-position="right"
:min="0"
step="1"
:max="listItem.count_cando"
:disabled="mode==='show'"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="交送日期" prop="send_date">
<el-date-picker
v-model="form.send_date"
type="date"
placeholder="选择时间"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
style="width: 100%"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="接收工段" prop="recive_mgroup">
<el-select
v-model="form.recive_mgroup"
placeholder="接收工段"
clearable
style="width: 100%"
:disabled="type==40||mode!=='add'"
@change="getUserList2"
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="接收人">
<el-select
v-model="form.recive_user"
placeholder="接收人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="type==10&&mtype==30">
<el-form-item label="更改批次">
<el-switch v-model="change_batch"></el-switch>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注">
<el-input v-model="form.note" placeholder="处理备注"></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="change_batch">
<el-form-item label="新批次号" prop="new_batch">
<el-input v-model="form.new_batch" placeholder="新批次号"></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="route_code=='tuihuo'">
<el-form-item label="检验附件">
<sc-upload-file
v-model="fileList"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls']"
@success = "fileUPSuccess"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer v-show="mode!=='show'">
<template v-if="(route_code=='tuihuo'&&type==10&&mtype==10)||form.ticket!=null">
<el-button
v-for="item in transitions"
:key="item.id"
type="primary"
:loading="isSaveing"
:disabled="isSaveing"
@click="submitTicketCreate(item.id)"
style="margin-right: 4px"
>{{ item.name }}</el-button>
</template>
<el-button v-else type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-dialog>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="交送人">
<el-select
v-model="form.send_user"
placeholder="交送人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="接收工段" prop="recive_mgroup">
<el-select
v-model="form.recive_mgroup"
placeholder="接收工段"
clearable
style="width: 100%"
:disabled="type==40||mode!=='add'"
@change="getUserList2"
>
<el-option
v-for="item in mgroupOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="mtype!==30">
<el-form-item label="接收人">
<el-select
v-model="form.recive_user"
placeholder="接收人"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in userList2"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="type==10&&mtype==30">
<el-form-item label="更改批次">
<el-switch v-model="change_batch"></el-switch>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注">
<el-input v-model="form.note" placeholder="处理备注"></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="change_batch">
<el-form-item label="新批次号" prop="new_batch">
<el-input v-model="form.new_batch" placeholder="新批次号"></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="route_code=='tuihuo'">
<el-form-item label="检验附件">
<sc-upload-file
v-model="fileList"
:multiple="false"
:limit="1"
:accept="['.xlsx', '.xls']"
@success = "fileUPSuccess"
>
<el-button type="primary" icon="el-icon-upload"> </el-button>
</sc-upload-file>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer v-show="mode!=='show'">
<template v-if="(route_code=='tuihuo'&&type==10&&mtype==10)||form.ticket!=null">
<ticketd_b_start :workflow_key="'backfire'" :title="'退火交接审批单'" :t_id="form.id" :ticketId="form.ticket"
@success="()=>{$emit('success')} " :submit_b_func="submit_b_func" ref="ticketd_b_start"></ticketd_b_start>
</template>
<el-button v-else type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
<el-button @click="$emit('closed')">取消</el-button>
</el-footer>
</el-main>
<el-aside width="20%" v-if="form.ticket">
<ticketd :ticketId="form.ticket" @success="$emit('success')"></ticketd>
</el-aside>
</el-container>
</template>
<script>
import ticketd_b_start from "@/views/wf/ticketd_b_start.vue";
import ticketd from '@/views/wf/ticketd.vue'
export default {
emits: ["success", "closed"],
components: {
ticketd_b_start, ticketd
},
props: {
t_id: {
type: String,
default: null
},
type: {
type: Number,
default: 10,
@ -245,12 +246,7 @@ export default {
selectItems:[],
yseorno: ["是", "否"],
loading: false,
mode: "add",
titleMap: {
add: "新增交接记录",
edit: "编辑交接记录",
show: "查看交接记录",
},
mode: "show",
lists:[],//
handle_user: [],
form: {
@ -331,7 +327,6 @@ export default {
mgroupOptions: [],
materialOptions: [],
addShow: false,
visible: false,
scanVisible:false,
isSaveing: false,
setFiltersVisible: false,
@ -380,25 +375,25 @@ export default {
}else{
that.getMgroupOptions();
}
if(that.route_code=='tuihuo'){
that.getInit();
}
that.getTid();
},
methods: {
//
getInit() {
let that = this;
if(this.form.ticket!==null){
this.$API.wf.ticket.ticketTransitions.req(this.form.ticket).then((res) => {
that.transitions = res;
})
}else{
that.$API.wf.workflow.initkey.req(" backfire").then((res) => {
that.initForm = res;
that.transitions = res.transitions;
});
getTid (){
var that = this;
if (that.t_id) {
that.$API.wpm.handover.item.req(that.t_id).then(res=>{
that.setData(res);
if(res.ticket_.state_.type == 1 && res.create_by == that.$TOOL.data.get("USER_INFO").id ) {
that.mode = "edit";
}else{
that.mode = "show";
}
that.$nextTick(()=>{
that.$refs.ticketd_b_start.init();
})
})
}
},
//
getMgroupOptions() {
@ -517,7 +512,6 @@ export default {
if(mtype==30){//
this.change_batch = true;
}
this.visible = true;
return this;
},
//handoverb
@ -560,62 +554,14 @@ export default {
fileUPSuccess(res) {
this.test_file = res.path;
},
//退,
submitTicketCreate(id) {
let that = this;
that.isSaveing = true;
that.form.oinfo_json = {};
that.form.oinfo_json.test_file = that.test_file;
async submit_b_func() {
let that = this;
if(that.mode == "add") {
that.$API.wpm.handover.create.req(that.form).then((res) => {
let ticket = {};
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}).catch((e) => {
that.isSaveing = false;
});
} else if (that.mode == "edit") {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
if (that.form.ticket == null) {
let ticket = {};
ticket.title = '退火交接审批单';
ticket.workflow = that.initForm.workflow;
ticket.ticket_data = {t_id: res.id};
ticket.transition = id;
that.$API.wf.ticket.create.req(ticket).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
} else {
let data = {transition: id, ticket_data: {}}
that.$API.wf.ticket.ticketHandle.req(that.form.ticket, data).then(res=>{
that.isSaveing = false;
that.visible = false;
that.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
})
}
}).catch((err) => {
that.isSaveing = false;
return err;
});
}
let res = await that.$API.wpm.handover.create.req(that.form);
that.form.id = res.id;
} else if (that.mode == "edit") {
await that.$API.wpm.handover.update.req(that.form.id, that.form);
}
},
//
submit() {
@ -634,7 +580,6 @@ export default {
that.$API.wpm.handover.createsubmit.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
@ -645,7 +590,6 @@ export default {
that.$API.wpm.handover.create.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;
@ -655,7 +599,6 @@ export default {
that.$API.wpm.handover.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success", that.form, that.mode);
that.visible = false;
that.$message.success("操作成功");
}).catch((err) => {
that.isSaveing = false;