This commit is contained in:
shijing 2023-10-20 18:03:04 +08:00
parent 740c73ec1f
commit ce1e98df96
11 changed files with 403 additions and 103 deletions

View File

@ -1,7 +1,7 @@
import config from "@/config"
import http from "@/utils/request"
export default {
// 仓库
// 生产小任务
mtask: {
list: {
name: "生产任务列表",
@ -29,7 +29,7 @@ export default {
}
},
item: {
name: "获取仓库详情",
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/pm/mtask/${id}/`
@ -51,11 +51,98 @@ export default {
`${config.API_URL}/pm/mtask/${id}/`);
}
},
schedueOrderitem:{
name: "物料批次",
daylist:{
name: "获取指定车间指定日期的最后工序生产任务",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/mtask/schedue_from_orderitems/`,
`${config.API_URL}/pm/mtask/day/`,
data
);
}
},
submitSameDay:{
name: "提交同一天的该部门下的所有兄弟小任务",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/mtask/submit_related_same_day/`,
data
);
}
},
},
// 生产小任务
utask: {
list: {
name: "生产任务列表",
req: async function(data){
return await http.get(
`${config.API_URL}/pm/utask/`,
data
);
}
},
create: {
name: "创建",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/utask/`,
data);
}
},
cquery: {
name: "复杂查询",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/utask/cquery/`,
data);
}
},
item: {
name: "获取详情",
req: async function(id){
return await http.get(
`${config.API_URL}/pm/utask/${id}/`
);
}
},
update: {
name: "更新",
req: async function(id, data){
return await http.put(
`${config.API_URL}/pm/utask/${id}/`,
data);
}
},
delete: {
name: "删除",
req: async function(id){
return await http.delete(
`${config.API_URL}/pm/utask/${id}/`);
}
},
assgin:{
name: "下达任务",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/utask/assgin/`,
data
);
}
},
scheduemtasks:{
name: "下达任务",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/utask/schedue_mtasks/`,
data
);
}
},
schedueutasks:{
name: "从多个订单明细生成大任务",
req: async function(data){
return await http.post(
`${config.API_URL}/pm/utask/schedue_utasks/`,
data
);
}

View File

@ -1,5 +1,10 @@
import config from "@/config"
import http from "@/utils/request"
import data from './../../../src/utils/baseJson';
const baseInFo = data[data.current];
console.log(data);
// console.log(baseInFo);
export default {
config:{
@ -7,7 +12,7 @@ export default {
url: `${config.API_URL}/system/base_config/`,
name: "账户信息",
req: async function(){
return await http.get(this.url);
return baseInFo
}
},
},

View File

@ -6,7 +6,7 @@ const routes = [
//工作台
{
"name": "workSpace",
"path": "/workSpace",
"path": "/",
"meta": {
"title": "工作台",
"icon": "el-icon-home-filled",
@ -17,7 +17,7 @@ const routes = [
//首页
{
"name": "home",
"path": "/home",
"path": "/",
"meta": {
"title": "首页",
"icon": "el-icon-home-filled",
@ -27,7 +27,7 @@ const routes = [
"children": [
{
"name": "dashboard",
"path": "/dashboard",
"path": "/",
"meta": {
"title": "控制台",
"icon": "el-icon-monitor",

24
src/utils/baseJson.json Normal file
View File

@ -0,0 +1,24 @@
{
"current": "gz",
"tkx":{
"base": {
"base_name": "托克逊能化绿色建材厂能源管理平台",
"base_logo": "/media/default/logo.png",
"base_name_short": "托克逊能管",
"base_logo_side": "/media/default/logo_side.jpg"
},
"apk": {
"apk_version": "1.01.44",
"apk_file": "/media/default/zc_ehs.apk",
"apk_remark": "修复了部分错误"
}
},
"gz":{
"base": {
"base_name": "中建材光子科技有限公司",
"base_logo": "/media/default/gz_logo.png",
"base_name_short": "光子科技",
"base_logo_side": "/media/default/logo_side.jpg"
}
}
}

44
src/utils/exportExcel.js Normal file
View File

@ -0,0 +1,44 @@
import * as XLSX from 'xlsx';
/**
* eg: .columns = [
* { header: 'Id', key: 'id', wpx: 10 },
* { header: 'Name', key: 'name', wch: 32 },
* { header: 'D.O.B.', key: 'dob', width: 10, hidden: true }
* ]
* data: [{id: 1, name: 'John Doe', dob: new Date(1970,1,1)}]
* @param columns 定义列属性数组
* @param data 数据
* @param name 文件名
*/
export const generateExcel = (columns = [], data = [], name = '') => {
const headers = columns.map((item) => item.header);
const otherConfigs = columns.map(({ key, header, ...item }) => item);
const dataList = data.map((item) => {
let obj = {};
columns.forEach((col) => {
obj[col.header] = item[col.key];
});
return obj;
});
const workbook = XLSX.utils.book_new();
workbook.SheetNames.push(name);
const worksheet = XLSX.utils.json_to_sheet(dataList, {
header: headers,
});
worksheet['!cols'] = otherConfigs;
workbook.Sheets[name] = worksheet;
// 生成Blob数据
const excelData = XLSX.write(workbook, { type: 'array', bookType: 'xlsx' });
const blobData = new Blob([excelData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
// 创建Blob URL
const blobUrl = URL.createObjectURL(blobData);
// 创建一个隐藏的<a>标签并设置href属性为Blob URL
const link = document.createElement('a');
link.href = blobUrl;
link.target = '_blank';
link.download = `${name}.xlsx`;
// 触发点击操作,开始下载文件
link.click();
// 释放Blob URL
URL.revokeObjectURL(blobUrl);
};

View File

@ -124,7 +124,7 @@ export default {
apiMtask: this.$API.pm.mtask.list,
apiOrderItem: this.$API.sam.orderitem.list,
paramsOrderItem: { utask__isnull: true },
paramsMtask: { parent__isnull: true, mgroup__belong_dept__name: '6车间', material_out__is_hidden: false },
paramsMtask: { parent__isnull: true, mgroup__belong_dept__name: '6车间', material_out__is_hidden: true },
query: {
page: 1,
page_size: 20,

View File

@ -24,9 +24,10 @@
</el-select>
</el-form-item>
<sc-form-table ref="table" v-model="formList" :addTemplate="addTemplate" drag-sort placeholder="暂无数据">
<el-table-column prop="type" label="工序" min-width="120">
<el-table-column prop="type" label="工序" min-width="100">
<template #default="scope">
<el-select v-model="scope.row.process" placeholder="请选择">
<span v-if="!scope.row.change">{{ scope.row.processName }}</span>
<el-select v-else v-model="scope.row.process" placeholder="请选择">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select>
</template>
@ -89,7 +90,8 @@ import { index } from 'd3';
export default {
emits: ["success", "closed"],
props:{
puPlan: { type: String, default: '' },
mtask: { type: String, default: '' },
materialId: { type: String, default: '' },
},
data() {
return {
@ -103,6 +105,7 @@ import { index } from 'd3';
form:{},
addTemplate: {
process: '',
processName: '',
count_use:1,
count_ok: 1,
count_no1: 1,
@ -110,19 +113,9 @@ import { index } from 'd3';
count_no3: 1,
handle_user:'',
user_name:'',
change:true
},
formList: [
{
process: '',
count_use:1,
count_ok: 1,
count_no1: 1,
count_no2: 1,
count_no3: 1,
handle_user:'',
user_name:'',
}
],
formList: [],
material:'',
visible: false,
isSaveing: false,
@ -133,9 +126,28 @@ import { index } from 'd3';
},
mounted() {
this.getProcess();
// this.getList();
this.getFormList();
},
methods: {
getFormList(){
this.$API.mtm.route.list.req({page:0,material:this.materialId}).then((res) => {
res.forEach(item=>{
let obj = {
process: item.process,
processName: item.process_name,
count_use:1,
count_ok: 1,
count_no1: 0,
count_no2: 0,
count_no3: 0,
handle_user:'',
user_name:'',
change:false
}
this.formList.push(obj)
})
})
},
//
getProcess(){
var res = this.$API.mtm.process.list.req({page:0}).then(res=>{
@ -145,6 +157,7 @@ import { index } from 'd3';
pushRow(){
let obj = {
process: '',
processName:"",
count_use:1,
count_ok: 1,
count_no1: 1,
@ -152,6 +165,7 @@ import { index } from 'd3';
count_no3: 1,
handle_user:'',
user_name:'',
change:true
}
this.formList.push(obj);
},

View File

@ -56,8 +56,8 @@
</el-form-item>
<el-form-item prop="type" label="带班人">
<span style="display:flex">
<el-input readonly v-model="handle_name"></el-input>
<ehsUserSelect :multiple="false" @submit="getReceptionist"/>
<el-input readonly v-model="leader_name"></el-input>
<ehsUserSelect :multiple="false" @submit="getLeader"/>
</span>
</el-form-item>
</el-form>
@ -92,6 +92,7 @@ import { index } from 'd3';
isSaveing: false,
setFiltersVisible: false,
handle_name:'',
leader_name:''
};
},
mounted() {
@ -101,6 +102,10 @@ import { index } from 'd3';
this.form.handle_user=data.id;
this.handle_name=data.name
},
getLeader(data){
this.form.leader_user=data.id;
this.leader_name=data.name
},
//
open(mode = "add") {
this.mode = mode;

View File

@ -10,6 +10,7 @@
stripe
:height="topHeight"
:params="query"
hidePagination
>
<el-table-column type="index" width="50"/>
<el-table-column label="任务编号" prop="number">
@ -220,11 +221,12 @@ export default {
dialog: {
save: false,
},
apiObj: this.$API.pm.mtask.list,
apiObj: this.$API.pm.mtask.daylist,
query: {
page:1,
page_size:20,
date:''
belong_dept_name:'6车间',
date:'2023-10-20'
},
activeName:'first',
tableData: [],

View File

@ -1,10 +1,9 @@
<template>
<el-container style="flex-direction: column">
<el-main id="topContainer" class="nopadding" style="position: relative;height: 50%;margin-bottom: 10px;">
<el-row :gutter="10">
<el-col :span="10" style="border-right: 1px solid #eeeeee;position: relative;">
<div class="right-panel" style=" display: inline-block;position: absolute;right: 20px;margin-top: 4px;">
<div class="right-panel" style=" display: inline-block;position: absolute;right: 20px;margin-top: 4px;z-index:100">
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
<el-button type="primary" icon="el-icon-plus" @click="add">任务下达</el-button>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" >导出</el-button>
@ -42,73 +41,118 @@
</el-col>
<el-col :span="14">
<el-form label-width="100px" style="border-bottom: 1px solid #eeeeee;padding: 4px 0;">
<el-row>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="产品名称:"></el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="产品型号:"></el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="计划数量:">
<span></span>
<el-input></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin-top: 10px;">
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
<el-button type="primary" @click="add">合计</el-button>
</div>
<scTable
ref="table"
:data="flogs"
row-key="id"
stripe
:height="tableHeight"
:params="query"
>
<el-table-column type="index" width="40"/>
<el-table-column type="selection" width="40"/>
<el-table-column label="产品编号" prop="material">
</el-table-column>
<el-table-column label="产品名称" prop="number">
</el-table-column>
<el-table-column label="型号" prop="number">
</el-table-column>
<el-table-column label="规格" prop="number">
</el-table-column>
<el-table-column label="领料数量" prop="count">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-if="scope.row.status==10"
v-auth="'equipment.update'"
>编辑
</el-link>
<!-- 提交后变查看 -->
<el-link
v-else
type="primary"
@click="table_edit(scope.row)"
v-auth="'equipment.update'"
>查看
</el-link>
<el-link
type="primary"
@click="table_edit(scope.row)"
>删除
</el-link>
</template>
</el-table-column>
</scTable>
<el-row>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="产品名称:"></el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="产品型号:"></el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item class="infoForm" label="计划数量:">
<span></span>
<el-input></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin-top: 10px;">
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
<el-button type="primary" @click="sum">合计</el-button>
</div>
<scTable
ref="table"
:data="flogs"
row-key="id"
stripe
:height="rightHeight"
:params="query"
>
<el-table-column type="index" width="40"/>
<el-table-column type="selection" width="40"/>
<el-table-column label="产品编号" prop="material">
</el-table-column>
<el-table-column label="产品名称" prop="number">
</el-table-column>
<el-table-column label="型号" prop="number">
</el-table-column>
<el-table-column label="规格" prop="number">
</el-table-column>
<el-table-column label="领料数量" prop="count">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-if="scope.row.status==10"
v-auth="'equipment.update'"
>编辑
</el-link>
<!-- 提交后变查看 -->
<el-link
v-else
type="primary"
@click="table_edit(scope.row)"
v-auth="'equipment.update'"
>查看
</el-link>
<el-link
type="primary"
@click="table_edit(scope.row)"
>删除
</el-link>
</template>
</el-table-column>
</scTable>
<scTable
ref="table"
:data="flogs"
row-key="id"
stripe
:height="rightHeight"
:params="query"
>
<el-table-column type="index" width="40"/>
<el-table-column label="班组" prop="material">
</el-table-column>
<el-table-column label="产品编号" prop="material">
</el-table-column>
<el-table-column label="产品名称" prop="number">
</el-table-column>
<el-table-column label="型号" prop="number">
</el-table-column>
<el-table-column label="规格" prop="number">
</el-table-column>
<el-table-column label="领料数量" prop="count">
</el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="120">
<template #default="scope">
<el-link
type="primary"
@click="table_edit(scope.row)"
v-if="scope.row.status==10"
v-auth="'equipment.update'"
>编辑
</el-link>
<!-- 提交后变查看 -->
<el-link
v-else
type="primary"
@click="table_edit(scope.row)"
v-auth="'equipment.update'"
>查看
</el-link>
<el-link
type="primary"
@click="table_edit(scope.row)"
>删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-col>
</el-row>
</el-main>
<save-dialog
v-if="dialog.save"
@ -117,9 +161,56 @@
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
<el-dialog
title="合计"
ref="sumDialog"
v-model="sumLog"
:size="1000"
destroy-on-close
@success="handleSuccess"
@closed="sumLog = false"
>
<sc-form-table hideAdd="false" ref="sumLogtable" v-model="formList" placeholder="暂无数据">
<el-table-column prop="count1" label="生产总数" min-width="100"></el-table-column>
<el-table-column prop="count2" label="合格总数" min-width="100"></el-table-column>
<el-table-column prop="rate" label="合格率" min-width="100"></el-table-column>
<el-table-column label="不合格原因及数量" align="center">
<el-table-column prop="val" label="原因1" min-width="100">
<template #default="scope">
<el-input v-model="scope.row.count_no1" placeholder="不合格数量1"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="原因2" min-width="100">
<template #default="scope">
<el-input v-model="scope.row.count_no2" placeholder="不合格数量2"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="原因3" min-width="100">
<template #default="scope">
<el-input v-model="scope.row.count_no3" placeholder="不合格数量3"></el-input>
</template>
</el-table-column>
<el-table-column prop="val" label="总计" min-width="100">
<template #default="scope">
<el-input v-model="scope.row.count_noall" placeholder="不合格数量3"></el-input>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="val" label="碎料" min-width="100">
<template #default="scope">
<el-input v-model="scope.row.material" placeholder="请输入内容"></el-input>
</template>
</el-table-column>
</sc-form-table>
<el-footer>
<el-button @click="resetForm">取消</el-button>
<el-button type="primary" @click="submitForm">提交</el-button>
</el-footer>
</el-dialog>
</el-container>
</template>
<script>
import {generateExcel} from "@/utils/exportExcel.js";
import saveDialog from "./task2flog_form.vue";
import GanttComponent from '@/components/GanttComponent.vue';
export default {
@ -150,6 +241,7 @@ export default {
dialog: {
save: false,
},
sumLog:false,
apiObj: this.$API.pm.mtask.list,
query: {
page:1,
@ -157,6 +249,12 @@ export default {
date:''
},
flogs:[],
flogsData: [{id: 1, name: 'John Doe', dob: new Date(1970,1,1)}],
columns : [
{ header: 'Id', key: 'id', wpx: 40 },
{ header: 'Name', key: 'name', wch: 15 },
{ header: 'D.O.B.', key: 'dob', width: 32 }
],
activeName:'first',
activeNameSub:'order',
selection: [],
@ -168,7 +266,19 @@ export default {
},
mtask:'',
rightHeight:null,
tableHeight:null
tableHeight:null,
formList:[
{
count1:0,
count2:0,
rate:0,
count_no1:0,
count_no2:0,
count_no3:0,
count_noall:0,
material:0,
}
]
};
},
created() {
@ -179,7 +289,8 @@ export default {
let heights = document.getElementById('topContainer').clientHeight;
console.log('heights',heights)
this.tableHeight = (heights-50)+'px';
this.rightHeight = (heights-80)+'px';
let rightHeight = heights-100;
this.rightHeight = rightHeight/2+'px'
},
methods: {
//
@ -251,7 +362,10 @@ export default {
});
}).catch(() => {});
},
//
sum(){
this.sumLog = true;
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
@ -261,7 +375,9 @@ export default {
}
},
handleQuery() {
this.$refs.table.queryData(this.query)
// this.$refs.table.queryData(this.query)
debugger;
generateExcel(this.columns,this.flogsData,'测试')
},
resetQuery() {
this.query = {};

View File

@ -77,6 +77,7 @@
v-if="dialog.save"
ref="saveDialog"
:mtask="mtask"
:materialId="materialId"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
@ -101,6 +102,7 @@
page:1,
page_size:20
},
materialId:'',
};
},
mounted(){
@ -111,9 +113,10 @@
//
getTask(){
this.$API.pm.mtask.item.req(this.mtask).then((res) => {
debugger;
console.log(res);
this.orderObj = res;
this.$API.pm.utask.item.req(res.utask).then((res1) => {
this.materialId = res1.material;
})
})
},
//