fix:fmlog接口声明

This commit is contained in:
shijing 2024-09-05 09:10:58 +08:00
parent 25ca2a9e03
commit b0777bdb12
9 changed files with 1699 additions and 45 deletions

View File

@ -126,9 +126,53 @@ export default {
}, },
}, },
}, },
fmlog: {
list: {
name: "列表",
req: async function (data) {
return await http.get(`${config.API_URL}/wpm/fmlog/`, data);
},
},
item: {
name: "获取详情",
req: async function (id) {
return await http.get(`${config.API_URL}/wpm/fmlog/${id}/`);
},
},
cquery: {
name: "复杂查询",
req: async function (data) {
return await http.post(
`${config.API_URL}/wpm/fmlog/cquery/`,
data
);
},
},
update: {
name: "更新",
req: async function (id, data) {
return await http.put(
`${config.API_URL}/wpm/fmlog/${id}/`,
data
);
},
},
create: {
name: "创建",
req: async function (data) {
return await http.post(`${config.API_URL}/wpm/fmlog/`, data);
},
},
delete: {
name: "删除",
req: async function (id) {
return await http.delete(`${config.API_URL}/wpm/fmlog/${id}/`);
},
},
},
mlog: { mlog: {
list: { list: {
name: "值班记录列表", name: "列表",
req: async function (data) { req: async function (data) {
return await http.get(`${config.API_URL}/wpm/mlog/`, data); return await http.get(`${config.API_URL}/wpm/mlog/`, data);
}, },

View File

@ -0,0 +1,553 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="100px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="生产设备">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
filterable
:disabled="mode == 'edit'"
class="width100"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
>
<span style="float:left">{{item.name}}</span>
<span style="float:right">{{item.number}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="个人任务">
<el-select
v-model="form.mtaskb"
placeholder="个人任务"
clearable
filterable
:disabled="mode == 'edit'"
class="width100"
>
<el-option
v-for="item in mtaskbOtions"
:key="item.id"
:label="item.handle_user_name"
:value="item.id"
>
<span style="float:left">{{item.handle_user_name}}</span>
<span style="float:right">{{item.count}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="开始时间" prop="work_start_time">
<el-date-picker
:disabled="mode == 'edit'"
v-model="form.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
class="width100"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="结束时间" prop="work_end_time">
<el-date-picker
v-model="form.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
class="width100"
:disabledDate="disabledDateFn"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班次">
<el-select
v-model="form.shift"
placeholder="班次"
clearable
filterable
:disabled="mode == 'edit'"
class="width100"
>
<el-option
v-for="item in shiftOtions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="批次号" prop="wm_in">
<el-select
v-model="form.wm_in"
placeholder="交接物料"
clearable
class="width100"
>
<el-option
v-for="item in materialOptions"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<div
style="
display: flex;
justify-content: space-between;
"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="领用数量">
<el-input-number
v-model="form.count_use"
:min="1"
controls-position="right"
class="width100"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="加工前不良" prop="count_n_jgqbl">
<el-input-number
v-model="form.count_n_jgqbl"
:min="0"
class="width100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="实际生产数">
<el-input-number
v-model="form.count_real"
:min="0"
class="width100"
controls-position="right"
@change="countChanges"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input-number
v-model="form.count_ok"
:min="0"
class="width100"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="不合格数量">
<el-input-number
v-model="form.count_notok"
:min="0"
class="width100"
@change="countChanges"
controls-position="right"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input
v-model="form.note"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
v-model="form.count_n_hs"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="气泡">
<el-input-number
v-model="form.count_n_qp"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="水纹">
<el-input-number
v-model="form.count_n_swen"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="崩边">
<el-input-number
v-model="form.count_n_bb"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="雾面">
<el-input-number
v-model="form.count_n_wm"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="小崩边">
<el-input-number
v-model="form.count_n_xbb"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="麻点">
<el-input-number
v-model="form.count_n_md"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="线痕">
<el-input-number
v-model="form.count_n_xh"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="破损">
<el-input-number
v-model="form.count_n_ps"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
<!-- <el-col :md="12" :sm="24">
<el-form-item label="棕圈">
<el-input-number
v-model="form.count_n_zq"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col> -->
<el-col :md="12" :sm="24">
<el-form-item label="其他">
<el-input-number
v-model="form.count_n_qt"
:min="0"
class="width100"
controls-position="right"
@change="countChange"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
batch: null,
equipment: null,
mtaskb: null,
shift: null,
wm_in: null,
work_start_time:'',
work_end_time:'',
material_out:'',
count_n_jgqbl:0,
count_use:0,
count_real: 0,
count_ok: 0,
count_notok: 0,
count_n_hs: 0,
count_n_qp: 0,
count_n_swen: 0,
count_n_bb: 0,
count_n_xbb:0,
count_n_md: 0,
count_n_xh: 0,
count_n_ps: 0,
count_n_qt: 0,
count_n_wm: 0,
count_n_zq:0,
note:''
};
export default {
props: {
fmlogId: {
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
mtask: {
type: String,
default: "",
},
},
computed: {
title() {
return this.titleMap[this.mode];
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增日志",
edit: "编辑日志",
show: "查看日志",
},
//
form: Object.assign({}, defaultForm),
//
rules: {
work_start_time: [
{
required: true,
message: "请选择生产开始时间",
trigger: "blur",
},
],
route: [
{
required: true,
message: "请选择工艺路线",
trigger: "blur",
},
]
},
material_in:'',
material_out:'',
shiftOtions:[],
mtaskbOtions:[],
visible: false,
isSaveing: false,
options: [],
routeOptions: [],
supplierOptions: [],
materialOptions:[],
setFiltersVisible: false,
};
},
mounted() {
this.getShift();
this.getMgroup();
this.getMtask();
this.getMtaskb();
},
methods: {
disabledDateFn(time) {
return time.getTime() > new Date().getTime();
},
getShift(){
let that = this;
that.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
that.shiftOtions = res;
});
},
getMgroup(){
let that = this;
that.$API.mtm.mgroup.item.req(that.mgroup).then((res) => {
that.deptId = res.belong_dept;
that.process = res.process;
that.getEquipment();
});
},
getEquipment() {
let that = this;
that.$API.em.equipment.list.req({ page: 0, type: 10,belong_dept:that.deptId }).then((res) => {
that.options = res;
});
},
getMtask() {
let that = this;
that.$API.pm.mtask.item.req(that.mtask).then(res=>{
that.material_in = res.material_in;
that.material_out = that.form.material_out = res.material_out;
that.getMaterial();
});
},
getMtaskb() {
let that = this;
that.$API.pm.mtaskb.list.req({ page: 0, mtask:that.mtask }).then((res) => {
that.mtaskbOtions = res;
});
},
//
getMaterial() {
let that = this;
that.$API.wpm.wmaterial.list.req({mgroupx: that.mgroup,material: that.material_in,page: 0,}).then((res) => {
that.materialOptions = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
console.log("data", data);
Object.assign(this.form, data);
this.getRoute(data.id);
},
countChange() {
this.form.count_notok =
this.form.count_n_hs +
this.form.count_n_qp +
this.form.count_n_swen +
this.form.count_n_bb +
this.form.count_n_xbb +
this.form.count_n_md +
this.form.count_n_xh +
this.form.count_n_ps +
this.form.count_n_zq +
this.form.count_n_qt +
this.form.count_n_wm;
this.form.count_ok = this.form.count_real - this.form.count_notok;
},
countChanges(){
this.form.count_ok = this.form.count_real - this.form.count_notok;
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
that.form.mgroup = that.mgroup;
if (that.mode === "add") {
that.$API.wpm.mlog.create.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
} else {
let obj = {};
obj.work_end_time = that.form.work_end_time;
obj.handle_user = that.form.handle_user;
obj.note = that.form.note;
that.$API.wpm.mlog.change.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
}
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
.form_unit {
position: absolute;
right: -25px;
}
.width100{
width: 100%;
}
</style>

View File

@ -0,0 +1,352 @@
<template>
<el-drawer
title="日志列表"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
fmlogItem.routepack_name
}}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{
fmlogItem.mtask_number
}}</el-descriptions-item>
<el-descriptions-item label="部门/车间">{{
fmlogItem.belong_dept_name
}}</el-descriptions-item>
</el-descriptions>
<!-- <div style="padding: 5px 10px;display: flex;justify-content: end;">
<el-button
type="primary"
v-if="fmlogItem.submit_time == null&&(fmlogItem.ticket==null||fmlogItem.ticket_.state_.type==1)"
@click="mlogUpdate"
style="margin-right: 10px;"
v-auth="'mlog.update'"
>
编辑
</el-button>
<el-button
type="primary"
v-if="fmlogItem.mgroup_name!='退火'&&fmlogItem.submit_time == null"
:loading="isSaveing"
@click="mlogSubmit"
>提交</el-button
>
</div> -->
</el-card>
<!-- mlog -->
<el-card
style="width: 100%; margin: 1vh 0"
shadow="never"
>
<div>
<el-button
type="primary"
v-if="fmlogItem.submit_time == null&&(fmlogItem.ticket==null||fmlogItem.ticket_.state_.type==1)"
icon="el-icon-plus"
@click="table_add"
>新增</el-button
>
</div>
<div style="height: 4px"></div>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="params"
@row-click="table_detail"
>
<el-table-column
label="#"
type="index"
width="50"
></el-table-column>
<el-table-column
label="生产设备"
prop="equipment_name"
min-width="150"
></el-table-column>
<el-table-column
label="部门/工段"
prop="belong_dept_name"
>
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="处理人"
prop="handle_user_name"
width="80"
></el-table-column>
<el-table-column
label="开始时间"
prop="work_start_time"
></el-table-column>
<el-table-column
label="结束时间"
prop="work_end_time"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="150"
>
<template #default="scope">
<el-button
link
size="small"
v-auth="'mlog.update'"
v-if="scope.row.submit_time == null"
type="primary"
@click.stop="table_edit(scope.row)"
>编辑</el-button
>
<el-button
link
size="small"
@click="table_detail(scope.row)"
type="primary"
>详情</el-button
>
<el-button
link
size="small"
v-auth="'mlog.delete'"
type="danger"
v-if="scope.row.submit_time == null"
@click.stop="table_del(scope.row, scope.$index)"
>删除</el-button
>
<el-button
link
v-else
size="small"
type="danger"
@click.stop="mlogRevert(scope.row)"
>撤回</el-button
>
</template>
</el-table-column>
</scTable>
</el-card>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:fmlog="fmlogId"
:mgroup="mgroup"
:mtask="mtask"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<check-dialog
v-if="dialog.check"
ref="checkDialog"
@success="handleCheckSuccess"
@closed="dialog.check = false"
>
</check-dialog>
</div>
</el-drawer>
</template>
<script>
import saveDialog from "./f_mlogs_form.vue";
import checkDialog from "./mlogb_check.vue";
export default {
props: {
fmlogId: {
type: String,
default: "",
},
},
components: {
saveDialog,
checkDialog,
},
emits: ["success", "closed"],
data() {
return {
loading: false,
//
form: {},
dialog: {
save: false,
edit: false,
check: false,
},
apiObj: null,
params: {
page: 0,
fmlog: "",
},
mgroup: "",
fmlogItem: {},
saveInForm: {
count_use: 0,
count_n_jgqbl: 0,
},
oinfo_json:{
退火炉号:'',
退火时间:'',
退火温度:'',
抽检结果:'',
抽检数:'',
强度落球:'',
},
fileList:[],
test_file:'',
deptId: "",
visible: false,
isSaveing: false,
options: [],
saveInDialog: false,
ticketDialog:false,
setFiltersVisible: false,
rules: {
count_use: [
{
required: true,
message: "请输入领取数量",
trigger: "blur",
},
],
},
};
},
mounted() {
this.getfmlogItem();
this.params.fmlog = this.fmlogId;
this.apiObj = this.$API.wpm.mlog.list;
this.getInit();
},
methods: {
open() {
this.visible = true;
},
getfmlogItem() {
let that = this;
that.$API.wpm.fmlog.item.req(that.fmlogId).then((res) => {
that.fmlogItem = res;
that.mgroup = res.mgroup;
that.mtask = res.mtask;
});
},
//
setData(data) {
Object.assign(this.form, data);
this.getRoute(data.id);
},
//
mlogUpdate() {
this.dialog.edit = true;
this.$nextTick(() => {
this.$refs.editDialog.open("edit").setData(this.fmlogItem);
});
},
// mlogUpdate(data) {
// this.$refs.editDialog.open().setData(data);
// },
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open();
});
},
//
table_in_edit(row) {
this.saveInForm = row;
this.saveInDialog = true;
},
//
saveInSubmit() {
let that = this;
that.$refs.saveInForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.count_use = that.saveInForm.count_use;
obj.count_n_jgqbl = that.saveInForm.count_n_jgqbl;
that.$API.wpm.mlogb.updateIn
.req(that.saveInForm.id, obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("操作成功");
that.saveInDialog = false;
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
})
.catch(() => {
that.isSaveing = false;
});
}
});
},
table_in_del(row) {
let that = this;
that.$confirm("确定删除吗?").then(() => {
that.$API.wpm.mlogb.delIn.req(row.id).then((res) => {
that.$message.success("操作成功");
that.$refs.tableIn.refresh();
that.$refs.tableOut.refresh();
//inout
});
});
},
table_out_check(row) {
this.dialog.check = true;
let obj = {};
Object.assign(obj, row);
obj.mgroup_name = this.fmlogItem.mgroup_name;
this.$nextTick(() => {
this.$refs.checkDialog.open(obj);
});
},
//
mlogSubmit() {
let that = this;
that.$API.wpm.mlog.submit.req(that.fmlogItem.id).then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
});
},
//
getInit() {
let that = this;
that.$API.wf.workflow.initkey.req(" backfire").then((res) => {
that.initForm = res;
});
},
handleSaveSuccess() {
this.$refs.tableIn.refresh();
this.$refs.tableOut.refresh();
},
handleCheckSuccess() {
this.$refs.tableOut.refresh();
},
fileUPSuccess(res) {
console.log('res',res);
this.test_file = res.id;
},
handleEditSuccess() {},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style></style>

View File

@ -0,0 +1,232 @@
<template>
<el-dialog
:title="titleMap[mode]"
v-model="visible"
:size="1000"
destroy-on-close
@closed="$emit('closed')"
>
<el-container v-loading="loading">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
:rules="rules"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="工艺路线" prop="route">
<el-select
v-model="form.route"
placeholder="工艺路线"
clearable
filterable
style="width: 100%"
:disabled="mode == 'edit'"
>
<el-option
v-for="item in routeOptions"
:key="item.id"
:label="item.process_name"
:value="item.id"
>
<span
>{{ item.routepack_name }}-{{
item.process_name
}}</span
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="关联任务">
<el-select
v-model="form.mtask"
placeholder="关联任务"
clearable
style="width: 100%"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.number"
:value="item.id"
>
<!-- <span>{{ item.material_out_name }}</span>/ -->
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="备注">
<el-input
v-model="form.note"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-container>
</el-dialog>
</template>
<script>
const defaultForm = {
route: "",
mtask:"",
mgroup:"",
note:'',
};
export default {
props: {
process: {
type: String,
default: "",
},
mgroupName:{
type: String,
default: "",
},
mgroup: {
type: String,
default: "",
},
dept: {
type: String,
default: "",
},
},
computed: {
title() {
return this.titleMap[this.mode];
},
},
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增日志",
edit: "编辑日志",
show: "查看日志",
},
//
form: Object.assign({}, defaultForm),
//
rules: {
route: [
{
required: true,
message: "请选择工艺路线",
trigger: "blur",
},
],
},
visible: false,
isSaveing: false,
options: [],
routeOptions: [],
setFiltersVisible: false,
};
},
mounted() {
this.$nextTick(() => {
this.getRoute();
this.getMtask();
})
},
methods: {
disabledDateFn(time) {
return time.getTime() > new Date().getTime();
},
getMtask() {
let that = this;
this.$API.pm.mtask.list
.req({ page: 0, mgroup: that.mgroup, state: 20 })
.then((res) => {
that.options = res;
});
},
getRoute(id) {
let that = this;
that.$API.mtm.route.list
.req({ process: that.process, page: 0, routepack__state: 30 })
.then((res) => {
that.routeOptions = res;
});
},
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
setData(data) {
console.log("data", data);
Object.assign(this.form, data);
this.getRoute(data.id);
},
//
submit() {
let that = this;
that.$refs.dialogForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
if (that.mode === "add") {
that.form.mgroup = that.mgroup;
that.$API.wpm.fmlog.create.req(that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
} else {
that.$API.wpm.fmlog.update.req(that.form.id, that.form).then((res) => {
that.isSaveing = false;
that.$emit("success");
that.visible = false;
that.$message.success("操作成功");
}).catch(()=>{
that.isSaveing = false;
});
}
}
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style>
.form_unit {
position: absolute;
right: -25px;
}
</style>

239
src/views/wpm_gx/fmlogs.vue Normal file
View File

@ -0,0 +1,239 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="table_add"
v-auth="'mlog.create'"
>新增</el-button
>
</div>
<div class="right-panel">
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main>
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="params"
@row-click="table_detail"
>
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="工艺路线" prop="routepack_name">
</el-table-column>
<el-table-column label="任务编号" prop="mtask_number">
</el-table-column>
<el-table-column label="部门/工段" prop="belong_dept_name">
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column label="创建时间" prop="create_time"></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="150"
>
<template #default="scope">
<el-button
link
size="small"
v-auth="'mlog.update'"
v-if="scope.row.submit_time == null"
type="primary"
@click.stop="table_edit(scope.row)"
>编辑</el-button
>
<el-button
link
size="small"
@click="table_detail(scope.row)"
type="primary"
>详情</el-button
>
<el-button
link
size="small"
v-auth="'mlog.delete'"
type="danger"
v-if="scope.row.submit_time == null"
@click.stop="table_del(scope.row, scope.$index)"
>删除</el-button
>
<el-button
link
v-else
size="small"
type="danger"
@click.stop="mlogRevert(scope.row)"
>撤回</el-button
>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
:process="processId"
:mgroup="mgroupId"
:dept="deptId"
:mgroupName = "mgroupName"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</save-dialog>
<detail-drawer
v-if="dialog.detail"
ref="detailDialog"
:fmlogId="fmlogId"
@closed="detailClose"
>
</detail-drawer>
</el-container>
</template>
<script>
import saveDialog from "./fmlog_form.vue";
import detailDrawer from "./fmlog_detail.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
name: "mlog",
components: {
saveDialog,
detailDrawer,
},
data() {
return {
apiObj: null,
params: { mgroup: "" },
query: {},
dialog: {
save: false,
detail: false,
},
tableData: [],
selection: [],
mtask: "",
mlogId: "",
deptId: null,
processId: "",
processCate: "",
};
},
mounted() {
let that = this;
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;
}
that.mgroupId = res[0].id;
that.deptId = res[0].belong_dept;
that.processId = res[0].process;
that.processCate = res[0].process_cate;
that.params.mgroup = res[0].id;
that.apiObj = that.$API.wpm.fmlog.list;
});
},
methods: {
detailClose() {
this.dialog.detail = false;
this.$refs.table.refresh();
},
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_detail(row) {
this.fmlogId = row.id;
this.dialog.detail = true;
this.$nextTick(() => {
this.$refs.detailDialog.open();
});
},
//
table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
var id = row.id;
this.$API.wpm.mlog.delete.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
});
});
},
//
mlogRevert(row) {
this.$confirm(`确定撤回该日志吗?`, "提示", {
type: "warning",
}).then(() => {
var id = row.id;
this.$API.wpm.mlog.revert.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("撤回成功");
}
});
});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
handleQuery() {
this.$refs.table.queryData(this.query);
},
//
//
handleSaveSuccess(data, mode) {
this.dialog.save = true;
this.$refs.table.refresh();
},
},
};
</script>
<style scoped></style>

View File

@ -37,7 +37,7 @@
<div style="padding: 5px 10px;display: flex;justify-content: end;"> <div style="padding: 5px 10px;display: flex;justify-content: end;">
<el-button <el-button
type="primary" type="primary"
v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||mlogItem.ticket_.state_.type==1)" v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1))"
@click="mlogUpdate" @click="mlogUpdate"
style="margin-right: 10px;" style="margin-right: 10px;"
v-auth="'mlog.update'" v-auth="'mlog.update'"
@ -54,7 +54,7 @@
<!-- 退火--> <!-- 退火-->
<el-button <el-button
type="primary" type="primary"
v-if="mlogItem.mgroup_name=='退火'&&(mlogItem.ticket==null||mlogItem.ticket_.state_.type==1)" v-if="mlogItem.mgroup_name=='退火'&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1))"
:loading="isSaveing" :loading="isSaveing"
@click="createTicket" @click="createTicket"
>放行审批</el-button> >放行审批</el-button>
@ -69,7 +69,7 @@
<div> <div>
<el-button <el-button
type="primary" type="primary"
v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||mlogItem.ticket_.state_.type==1)" v-if="mlogItem.submit_time == null&&(mlogItem.ticket==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1))"
icon="el-icon-plus" icon="el-icon-plus"
@click="table_add" @click="table_add"
>新增</el-button >新增</el-button
@ -113,13 +113,13 @@
link link
type="primary" type="primary"
@click="table_in_edit(scope.row)" @click="table_in_edit(scope.row)"
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||mlogItem.ticket_.state_.type!==1" :disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1)"
> >
编辑 编辑
</el-button> </el-button>
<el-button <el-button
link link
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||mlogItem.ticket_.state_.type!==1" :disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1)"
type="danger" type="danger"
@click="table_in_del(scope.row)" @click="table_in_del(scope.row)"
> >
@ -251,7 +251,7 @@
<el-button <el-button
link link
type="primary" type="primary"
:disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||mlogItem.ticket_.state_.type!==1" :disabled="mlogItem.submit_time !== null||mlogItem.ticket!==null||(mlogItem.ticket_&&mlogItem.ticket_.state_.type!==1)"
@click="table_out_check(scope.row)" @click="table_out_check(scope.row)"
> >
检验 检验

View File

@ -8,23 +8,10 @@
row-key="id" row-key="id"
:params="params" :params="params"
> >
<el-table-column <el-table-column label="任务列表" type="index" width="80"></el-table-column>
label="任务列表" <el-table-column label="产品名" prop="material_out_name" show-overflow-tooltip>
type="index"
width="80"
></el-table-column>
<el-table-column
label="产品名"
prop="material_out_name"
show-overflow-tooltip
>
</el-table-column> </el-table-column>
<el-table-column <el-table-column label="任务编号" prop="number" width="140" show-overflow-tooltip>
label="任务编号"
prop="number"
width="140"
show-overflow-tooltip
>
</el-table-column> </el-table-column>
<el-table-column label="任务量" prop="count"> </el-table-column> <el-table-column label="任务量" prop="count"> </el-table-column>
<el-table-column label="开始时间" prop="start_date"> <el-table-column label="开始时间" prop="start_date">
@ -33,31 +20,50 @@
</el-table-column> </el-table-column>
<el-table-column label="合格数" prop="count_ok"> <el-table-column label="合格数" prop="count_ok">
</el-table-column> </el-table-column>
<el-table-column label="状态" prop="state"> <el-table-column label="分配人数" prop="mtaskb">
<template #default="scope"> <template #default="scope">
<el-tag :type="elTagType(scope.row.state)"> <span v-if="scope.row.mtaskb.length>0">
{{ state_[scope.row.state] }} {{scope.row.mtaskb.length}}
</el-tag> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" width="60"> <el-table-column label="操作" fixed="right" width="90">
<template #default="scope"> <template #default="scope">
<el-link <el-button
type="primary" link
@click="mtask_submit(scope.row)" size="small"
v-auth="'mtask.submit'" v-auth="'mtask.submit'"
v-if=" type="primary"
scope.row.state != 40 && scope.row.state != 34 v-if="scope.row.state == 20 "
" @click="mtask_submit(scope.row)"
>提交 >提交
</el-link> </el-button>
<el-button
link
size="small"
v-auth="'mtask.submit'"
type="primary"
v-if="scope.row.state == 20 "
@click="mtask_deliver(scope.row)"
>分配
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
</el-main> </el-main>
<deliver-drawer
v-if="deliverShow"
ref="detailDialog"
:mgroup="mgroupId"
:dept="deptId"
@success = "refreshMtask"
@closed="detailClose"
>
</deliver-drawer>
</el-container> </el-container>
</template> </template>
<script> <script>
import deliverDrawer from "./mtask_deliver.vue";
export default { export default {
props: { props: {
mgroupName: { mgroupName: {
@ -65,11 +71,14 @@ export default {
default: "", default: "",
}, },
}, },
components: {
deliverDrawer,
},
name: "mtask", name: "mtask",
data() { data() {
return { return {
apiObj: null, apiObj: null,
params: { mgroup: "" }, params: { mgroup: "",state:20 },
query: {}, query: {},
tableData: [], tableData: [],
@ -85,13 +94,15 @@ export default {
34: "danger", 34: "danger",
40: "success", 40: "success",
}, },
state_: { // state_: {
10: "创建中", // 10: "",
20: "已下达", // 20: "",
30: "生产中", // 30: "",
34: "已终止", // 34: "",
40: "已提交", // 40: "",
}, // },
deptId: null,
deliverShow:false,
}; };
}, },
mounted() { mounted() {
@ -104,17 +115,38 @@ export default {
return; return;
} }
that.mgroupId = res[0].id; that.mgroupId = res[0].id;
that.deptId = res[0].belong_dept;
that.processId = res[0].process; that.processId = res[0].process;
that.processCate = res[0].process_cate; that.processCate = res[0].process_cate;
that.params.mgroup = res[0].id; that.params.mgroup = res[0].id;
that.apiObj = this.$API.pm.mtask.list; that.apiObj = this.$API.pm.mtask.list;
console.log("mgroupId", res[0].id);
}); });
}, },
methods: { methods: {
elTagType(state) { elTagType(state) {
return this.type_[state]; return this.type_[state];
}, },
mtask_submit(row){
this.$confirm('确定提交该任务吗?提交后不可更改相关信息', "提示", {
type: "warning",
}).then(() => {
this.$API.pm.mtask.submit.req(row.id).then((res) => {
this.$message.success("操作成功");
this.$refs.table_mtask.refresh();
this.mtaskClick(this.currentMtask);
})
.catch((err) => {});
});
},
mtask_deliver(row){
this.deliverShow = true;
this.$nextTick(() => {
this.$refs.detailDialog.open(row);
});
},
refreshMtask(){
this.$refs.table.refresh();
},
// //
selectionChange(selection) { selectionChange(selection) {
this.selection = selection; this.selection = selection;

View File

@ -0,0 +1,202 @@
<template>
<el-drawer
title="任务分配"
v-model="visible"
:size="'90%'"
destroy-on-close
@closed="$emit('closed')"
>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<el-descriptions>
<el-descriptions-item label="名称">{{
mtaskObj.material_out_name
}}</el-descriptions-item>
<el-descriptions-item label="任务编号">{{
mtaskObj.number
}}</el-descriptions-item>
<el-descriptions-item label="任务量">{{
mtaskObj.count
}}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{
mtaskObj.start_date
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{
mtaskObj.end_date
}}</el-descriptions-item>
</el-descriptions>
</el-card>
<!-- 选择人员 -->
<el-form
:model="form"
:rules="rules"
label-width="100px"
ref="form"
style="margin-top: 10px;margin-bottom:50px"
>
<el-row>
<el-col :span="24">
<el-form-item label="操作人员">
<el-checkbox-group
v-model="choose_user"
@change="userChange"
>
<el-checkbox class="checkboxItem" v-for="item in userList" :key="item.id" :label="item.name" :value="item.id">
{{ item.name }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
</el-row>
<el-divider style="margin-top:0"></el-divider>
<el-row>
<el-col :md="6" :sm="8" v-for="item in cUserList" :key="item.id">
<el-form-item :label="item.handle_user_name">
<el-input-number
v-model="item.count"
:precision="0"
:min="1"
style="width: 90%"
controls-position="right"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="footer">
<el-button type="primary" @click="mtaskb_submit">提交</el-button>
</div>
</div>
</el-drawer>
</template>
<script>
export default {
props: {
mgroup: {
type: String,
default: "",
},
dept: {
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
return {
form: {},
apiObj: null,
loading: false,
visible: false,
isSaveing: false,
mtaskObj:{},
userList:[],
cUserList:[],//
choose_user:[],//id
rules: {
count_use: [
{
required: true,
message: "请输入领取数量",
trigger: "blur",
},
],
},
};
},
mounted() {
this.$nextTick(() => {
this.getUsers();
})
},
methods: {
open(data) {
let that = this;
this.visible = true;
this.mtaskObj = data;
that.cUserList = data.mtaskb;
that.choose_user = [];
if(that.cUserList.length>0){
that.cUserList.forEach(item=>{
that.choose_user.push(item.handle_user);
})
}
},
getUsers() {
let that = this;
// that.$API.system.user.list.req({ belong_dept: that.dept, page: 0 }).then(res => {
that.$API.system.user.list.req({ page:1,page_size:60}).then(res => {
that.userList = res.results;
})
},
userChange(){
let that = this;
let average = Math.floor( that.mtaskObj.count/that.choose_user.length);
let remainder = that.mtaskObj.count%that.choose_user.length;//
that.cUserList = [];
console.log('that.choose_user',that.choose_user);
that.userList.forEach(item=>{
if(that.choose_user.indexOf(item.id)>-1){
let obj = {};
obj.handle_user_name = item.name;
obj.handle_user = item.id;
obj.count = average;
that.cUserList.push(obj);
}
})
console.log('that.cUserList',that.cUserList);
for(let i=0;i<remainder;i++){
that.cUserList[i].count += 1;
}
},
mtaskb_submit() {
let that = this;
console.log(that.cUserList);
let sum = 0;
that.cUserList.forEach(item => {
sum+=item.count;
});
console.log(sum-that.mtaskObj.count)
if(sum-that.mtaskObj.count==0){
that.isSaveing = true;
that.$API.pm.mtaskbAdd.req(that.mtaskObj.id,that.cUserList).then((res) => {
that.isSaveing = false;
that.visible = false;
this.$emit("success");
that.$message.success("提交成功");
}).catch((e) => {
that.isSaveing = false;
});
}else{
that.$message.error("分配数量与任务总数不匹配,请确认后再提交");
}
},
handleEditSuccess() {},
//
setFilters(filters) {
this.selectionFilters = filters;
this.setFiltersVisible = true;
},
},
};
</script>
<style scoped>
.checkboxItem{
width:80px;
}
.footer{
position: absolute;
bottom: 0px;
width: 100%;
z-index: 10;
text-align: center;
background: #ffffff;
height: 40px;
}
</style>

View File

@ -32,7 +32,7 @@
<script> <script>
import inm from "./inm.vue"; import inm from "./inm.vue";
import mlogs from "./mlogs.vue"; import mlogs from "./fmlogs.vue";
import mtask from "./mtask.vue"; import mtask from "./mtask.vue";
import handover from "./handover.vue"; import handover from "./handover.vue";
export default { export default {