Commit 29113252 authored by 沈翠玲's avatar 沈翠玲

生产管理->生产排产

parent 69fea7b8
......@@ -12,7 +12,7 @@ export function getListData(query) {
// 修改生产任务数据
export function updateList(query) {
return request({
url: "/mes/pro/taskWorkunit/update",
url: "/mes/pro/taskWorkunit/updateTimeAndWorkunit",
method: "post",
data: query
});
......
......@@ -230,7 +230,8 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划开始时间"
@blur="submitForm(scope.row)"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'start')"
>
</el-date-picker>
<span v-else>{{
......@@ -253,7 +254,8 @@
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择计划结束时间"
@blur="submitForm(scope.row)"
@focus="writeRow(scope.row)"
@change="editTime(scope.row, 'end')"
>
</el-date-picker>
<span v-else>{{
......@@ -508,7 +510,8 @@ import BrandSelect from "@/components/TmTool/index.vue";
import OrderList from './orderList.vue'
import jobAssign from './jobAssign.vue'
import arrangCodeList from './arrangCodeList.vue'
import WorkuintSelect from "@/components/workunitSelect/single.vue";
import WorkuintSelect from "./workunitSelectSche.vue";
import dayjs from 'dayjs'
export default {
components: {BrandSelect, OrderList, arrangCodeList, WorkuintSelect, jobAssign},
dicts: ['TASK_STATUS'],
......@@ -567,6 +570,7 @@ export default {
scheduleStartDate: null,
scheduleEndDate: null,
},
editTimeLast: null,
jobAssignmentVisible: false,
arrangeCode: null,
// 表单参数
......@@ -728,6 +732,22 @@ export default {
endTime: null, };
this.resetForm("form");
},
writeRow(row) {
this.editTimeLast = JSON.parse(JSON.stringify(row))
},
editTime(row, type){
const scheduleStartDate = dayjs(this.editTimeLast.scheduleStartDate)
const scheduleEndDate = dayjs(this.editTimeLast.scheduleEndDate)
if (type === 'start') {
const duration = scheduleEndDate.diff(scheduleStartDate)
row.scheduleEndDate = dayjs(row.scheduleStartDate).add(duration).format('YYYY-MM-DD HH:mm:ss')
} else {
const duration = scheduleStartDate.diff(scheduleEndDate)
console.log('duration', duration)
row.scheduleStartDate = dayjs(row.scheduleEndDate).add(duration).format('YYYY-MM-DD HH:mm:ss')
}
this.submitForm(row)
},
/** 搜索按钮操作 */
handleWorkunitQuery() {
this.queryParams.pageNum = 1;
......
<template>
<el-dialog
title="工作单元选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal="false"
width="80%"
>
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="工作单元编码" prop="workunitCode">
<el-input
v-model="queryParams.workunitCode"
placeholder="请输入工单编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工作单元名称" prop="workunitName">
<el-input
v-model="queryParams.workunitName"
placeholder="请输入工作单元名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="工作中心" prop="workstationId">
<el-select filterable v-model="queryParams.workstationId" placeholder="请选择工作中心" clearable @change="getList">
<el-option
v-for="dict in workstationList"
:key="dict.workstationId"
:label="dict.workstationName"
:value="dict.workstationId"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="workunitList"
@current-change="handleCurrent"
@row-dblclick="handleRowDbClick"
height="500px"
>
<el-table-column width="55" align="center">
<template v-slot="scope">
<el-radio
v-model="selectedWorkunitId"
:label="scope.row.workunitId"
@change="handleRowChange(scope.row)"
>{{ "" }}</el-radio
>
</template>
</el-table-column>
<el-table-column label="工作中心名称" width="180" prop="workstationName" />
<el-table-column
label="工作单元编码"
width="200"
align="center"
prop="workunitCode"
:show-overflow-tooltip="true"
/>
<el-table-column label="工作单元名称" align="center" prop="workunitName" />
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button @click="showFlag = false">取 消</el-button>
<el-button type="primary" @click="confirmSelect">确 定</el-button>
</div>
</el-dialog>
</template>
<script>
import {
getworkstationList} from '@/api/mes/pro/scheduleList'
import { listByUser } from "@/api/system/user";
export default {
name: "WorkunitSelectSingle",
components: {},
dicts: [],
props: {
userId: undefined,
workstationName: {
type: String,
default: "",
},
workstationId: {
type: String | Number,
default: "",
},
workunitId: {
type: Number | undefined,
default: undefined,
}, //外部传入的工单过滤信息
},
data() {
return {
showFlag: false,
// 遮罩层
loading: true,
// 选中数组
selectedWorkunitId: undefined,
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 生产工单表格数据
workunitList: [],
workstationList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
workunitCode: null,
userId: this.userId,
pageNum: 1,
pageSize: 10,
workunitName: null,
workstationId: this.workstationId,
workstationName: this.workstationName,
workunitId: null,
enableFlag: "Y",
},
};
},
watch: {
showFlag: {
handler(newName) {
this.selectedWorkunitId = null
this.selectedRows = []
this.queryParams.workstationName = this.workstationName;
this.queryParams.userId = this.userId;
this.queryParams.workstationId = this.workstationId;
this.getList();
this.hanldeGetworkstationList()
},
immediate: true
}
},
created() {
},
methods: {
async hanldeGetworkstationList() {
const response = await getworkstationList({workshopId: null})
this.workstationList = response.rows
},
/** 查询生产工单列表 */
getList() {
this.loading = true;
listByUser(this.queryParams).then((response) => {
this.workunitList = response.rows;
this.loading = false;
this.total = response.total
});
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleCurrent(row) {
console.log(row);
if (row) {
this.selectedRows = row;
}
},
// 单选选中数据
handleRowChange(row) {
if (row) {
this.selectedRows = row;
}
},
//双击选中
handleRowDbClick(row) {
if (row) {
this.selectedRows = row;
this.$emit("onSelected", this.selectedRows);
this.showFlag = false;
}
},
//确定选中
confirmSelect() {
if (this.selectedWorkunitId == null || this.selectedWorkunitId == 0) {
this.$notify({
title: "提示",
type: "warning",
message: "请至少选择一条数据!",
});
return;
}
this.$emit("onSelected", this.selectedRows);
this.showFlag = false;
},
},
};
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment