feat: wpm添加了其他日志用于录入avg

This commit is contained in:
caoqianming 2023-11-27 13:52:27 +08:00
parent 0316f42e11
commit 98d2b3d20f
4 changed files with 244 additions and 21 deletions

View File

@ -281,26 +281,32 @@ export default {
`${config.API_URL}/wpm/wmaterial/batchs/`, `${config.API_URL}/wpm/wmaterial/batchs/`,
data); data);
} }
}
}, },
otherlog:{
list: {
name: "其他生产日志",
req: async function(data){
return await http.get(
`${config.API_URL}/wpm/otherlog/`,
data
);
}
}, },
// //值班停机关系 create: {
// stsflog: { name: "创建",
// list: { req: async function(data){
// name: "值班停机关系", return await http.post(
// req: async function(data){ `${config.API_URL}/wpm/otherlog/`,
// return await http.get( data);
// `${config.API_URL}/wpm/stsflog/`, }
// data },
// ); delete: {
// } name: "删除",
// }, req: async function(id){
// update: { return await http.delete(
// name: "值班停机关系更新", `${config.API_URL}/wpm/otherlog/${id}/`);
// req: async function(id, data){ }
// return await http.put( },
// `${config.API_URL}/wpm/stsflog/${id}/`, }
// data);
// }
// },
// },
} }

View File

@ -808,6 +808,16 @@ const routes = [
"perms": ["wpm"] "perms": ["wpm"]
}, },
"component": "wpm/worktask2" "component": "wpm/worktask2"
},
{
"name": "otherlog",
"path": "/wpm/otherlog",
"meta": {
"title": "其他日志",
"icon": "el-icon-grid",
"perms": ["wpm"]
},
"component": "wpm/otherlog"
} }
] ]
}, },

View File

@ -0,0 +1,96 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'otherlog.create'">新增</el-button>
</div>
<div class="right-panel">
<el-input v-model="query.search" placeholder="产品名称" clearable style="margin-right: 5px;"></el-input>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query">
<el-table-column type="index" width="50" />
<el-table-column label="产品名称" prop="product">
</el-table-column>
<el-table-column label="操作日期" prop="handle_date">
</el-table-column>
<el-table-column label="生产数" prop="count_real">
</el-table-column>
<el-table-column label="合格数" prop="count_ok">
</el-table-column>
<el-table-column label="交付数" prop="count_delivered">
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template #default="scope">
<el-link type="danger" @click="table_del(scope.row)" v-auth="'otherlog.delete'">
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./otherlog_form.vue";
export default {
name: "otherlog",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
apiObj: this.$API.wpm.otherlog.list,
query: {
page: 1,
page_size: 20
},
selection: [],
};
},
methods: {
//
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
async table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.wpm.otherlog.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
this.$refs.table.refresh();
return res;
}).catch((err) => {
return err;
});
}).catch(() => { });
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
},
resetQuery() {
this.query = {};
},
},
};
</script>

View File

@ -0,0 +1,111 @@
<template>
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
<el-container v-loading="loading">
<el-main>
<el-form ref="dialogForm" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="产品系列" prop="product">
<el-input v-model="form.product" placeholder="AVG" />
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="操作日期" prop="handle_date">
<el-date-picker v-model="form.handle_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">
<el-form-item label="生产数">
<el-input-number v-model="form.count_real" :min="0" style="width:100%"></el-input-number>
</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" style="width:100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="交付数">
<el-input-number v-model="form.count_delivered" :min="0"
style="width:100%"></el-input-number>
</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>
export default {
emits: ["success", "closed"],
data() {
return {
loading: false,
mode: "add",
titleMap: {
add: "新增",
edit: "编辑",
show: "查看",
},
form: {
product: 'AVG',
count_real: 0,
count_ok: 0,
count_delivered: 0
},
rules: {
handle_date: [{ required: true, message: "请选择日期", trigger: "blur" }]
},
visible: false,
isSaveing: false,
options: [],
};
},
mounted() {
},
methods: {
//
open(mode = "add") {
this.mode = mode;
this.visible = true;
return this;
},
//
submit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
this.isSaveing = true;
try {
var res;
if (this.mode == "add") {
res = await this.$API.wpm.otherlog.create.req(this.form);
} else if (this.mode == "edit") {
res = await this.$API.pum.otherlog.update.req(this.form.id, this.form);
}
this.isSaveing = false;
this.$emit("success", this.form, this.mode);
this.visible = false;
this.$message.success("操作成功");
} catch (err) {
//
this.isSaveing = false;
return err;
}
}
});
},
//
setData(data) {
Object.assign(this.form, data);
},
},
};
</script>
<style></style>