Commit d4f8c6cb by yiyu.li

标准节拍-工序修改

parent 5ce97470
<template>
<div class="testdiv">
<div class="divborder newSearchDiv" style="margin:0px;">
<div class="filter">
<label>{{$t('1132')}}</label>
<Cascader
:data="datalevel"
:value="leveldata"
trigger="click"
change-on-select
class="searchSelect"
@on-change="getlevel"
style="width:220px"
></Cascader>
</div>
<div class="filter">
<label>{{$t('100088')}}</label>
<Input class="searchSelect" type="text" v-model="productname" />
</div>
<div class="filter">
<label>{{$t('100090')}}</label>
<Input class="searchSelect" type="text" v-model="drawcode" />
</div>
<div class="searchBtn">
<Button type="primary" class="twoWord" icon="ios-search" @click="tosearch()">{{$t('1001')}}</Button>
<Button type="success" class="twoWord" icon="md-add-circle" @click="add()">{{$t('1002')}}</Button>
<Button type="warning" class="twoWord" icon="ios-build" @click="edit()">{{$t('1003')}}</Button>
<Button
type="error"
class="twoWord intervalRight"
icon="md-close-circle"
@click="dele()"
>{{$t('1004')}}</Button>
<Button
type="primary"
class="fourWord"
icon="md-download"
@click="loadexcel()"
>{{$t('1005')}}</Button>
<Upload
style="display:inline-block"
ref="upload"
:action="action"
name="excel-file"
:headers="headers"
:show-upload-list="false"
:on-format-error="handleFormatError"
:on-success="handleSuccess"
:on-error="handleError"
:format="['xlsx']"
>
<Button type="primary" class="fourWord" icon="md-cloud-upload">{{$t('1006')}}</Button>
</Upload>
</div>
</div>
<div class="divborder newTableDiv">
<Table
class="tableClass"
@on-current-change="handleRowChange"
highlight-row
:data="tableData1"
@on-selection-change="handleSelectRow"
:columns="tableColumns1"
></Table>
<div class="pageDiv">
<div class="pageDirection">
<Page
:total="total"
:current="page"
@on-change="changePage"
show-elevator
show-sizer
show-total
@on-page-size-change="handlePageSize"
:page-size-opts="[10,20,30,40,100]"
></Page>
</div>
</div>
<Modal class="newModalClass" :title="$t('1002')" v-model="addmodal" :styles="{width:'700px'}">
<div class="modal_body" style="height:430px!important;">
<div style="width:280px;float:left;height:400px;overflow-y:scroll">
<template>
<Tree :data="treeContents" ref="tree" @on-select-change="getList()"></Tree>
</template>
</div>
<div style="width:360px;float:left;height:400px;padding-left:5px;">
<div class="filter">
<label>
<i>*</i>
{{this.$t('500107')}}:
</label>
<Input class="searchInput" type="text" v-model="addobj.program_number" />
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('100088')}}:
</label>
<Select
v-model="addobj.product"
label-in-value
clearable
filterable
class="searchSelect"
>
<Option v-for="item in products" :value="item.id" :key="item.id">{{ item.name }}</Option>
</Select>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('900880')}}:
</label>
<Input class="searchInput" type="text" v-model="addobj.route_number" />
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('900967')}}:
</label>
<Input class="searchInput" type="text" v-model="addobj.route_name" />
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('500098')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.standard_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('500221')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.updown_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
</div>
<div class="testdiv">
<div class="divborder newSearchDiv" style="margin: 0px">
<div class="filter">
<label>
<i>*</i>
{{this.$t('800281')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.daily_standard_output"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('901087')}}</span>
<label>{{ $t("1132") }}</label>
<Cascader
:data="datalevel"
:value="leveldata"
trigger="click"
change-on-select
class="searchSelect"
@on-change="getlevel"
style="width: 220px"
></Cascader>
</div>
<div class="filter">
<label>{{this.$t('810000')}}:</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.time_num"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
<label>{{ $t("100088") }}</label>
<Input class="searchSelect" type="text" v-model="productname" />
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('950009')}}:
</label>
<InputNumber
:min="1"
class="searchInput"
type="number"
v-model="addobj.yieldrate"
value="1"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<label>{{ $t("100090") }}</label>
<Input class="searchSelect" type="text" v-model="drawcode" />
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{this.$t('1049')}}:
</label>
<DatePicker type="date" v-model="addobj.start_time" class="searchInput"></DatePicker>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{this.$t('1050')}}:
</label>
<DatePicker type="date" v-model="addobj.end_time" class="searchInput"></DatePicker>
<div class="searchBtn">
<Button
type="primary"
class="twoWord"
icon="ios-search"
@click="tosearch()"
>{{ $t("1001") }}</Button
>
<Button
type="success"
class="twoWord"
icon="md-add-circle"
@click="add()"
>{{ $t("1002") }}</Button
>
<Button
type="warning"
class="twoWord"
icon="ios-build"
@click="edit()"
>{{ $t("1003") }}</Button
>
<Button
type="error"
class="twoWord intervalRight"
icon="md-close-circle"
@click="dele()"
>{{ $t("1004") }}</Button
>
<Button
type="primary"
class="fourWord"
icon="md-download"
@click="loadexcel()"
>{{ $t("1005") }}</Button
>
<Upload
style="display: inline-block"
ref="upload"
:action="action"
name="excel-file"
:headers="headers"
:show-upload-list="false"
:on-format-error="handleFormatError"
:on-success="handleSuccess"
:on-error="handleError"
:format="['xlsx']"
>
<Button
type="primary"
class="fourWord"
icon="md-cloud-upload"
>{{ $t("1006") }}</Button
>
</Upload>
</div>
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="closeadd()">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="adddata()">{{$t('1011')}}</Button>
</div>
</Modal>
<Modal
class="newModalClass"
:title="$t('1003')"
v-model="editmodal"
:styles="{width:'500px'}"
>
<div class="modal_body" style="height:400px!important;">
<div class="filter">
<label>{{this.$t('200003')}}:</label>
<label class="labelInfo">{{sectionname}}</label>
</div>
<div class="filter">
<label>{{this.$t('500107')}}:</label>
<label class="labelInfo">{{editobj.process_number}}</label>
</div>
<div class="filter">
<label>{{this.$t('100088')}}:</label>
<label class="labelInfo">{{editobj.product_name_text}}</label>
</div>
<div class="filter">
<label>{{this.$t('900967')}}:</label>
<label class="labelInfo">{{editobj.route_name}}</label>
</div>
<div class="filter">
<label>{{this.$t('900880')}}:</label>
<label class="labelInfo">{{editobj.route_number}}</label>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('500098')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.standard_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('500221')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.updown_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('800281')}}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.daily_standard_output"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('901087')}}</span>
</div>
<div class="filter">
<label>{{this.$t('810000')}}:</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.time_num"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{this.$t('1104')}}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{this.$t('950009')}}:
</label>
<InputNumber
:min="1"
class="searchInput"
type="text"
v-model="editobj.yieldrate"
value="1"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{this.$t('1049')}}:
</label>
<DatePicker type="date" v-model="editobj.start_time" class="searchInput"></DatePicker>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{this.$t('1050')}}:
</label>
<DatePicker type="date" v-model="editobj.end_time" class="searchInput"></DatePicker>
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="closeedit()">{{$t('1033')}}</Button>
<Button type="primary" size="large" @click="editdata()">{{$t('1011')}}</Button>
<div class="divborder newTableDiv">
<Table
class="tableClass"
@on-current-change="handleRowChange"
highlight-row
:data="tableData1"
@on-selection-change="handleSelectRow"
:columns="tableColumns1"
></Table>
<div class="pageDiv">
<div class="pageDirection">
<Page
:total="total"
:current="page"
@on-change="changePage"
show-elevator
show-sizer
show-total
@on-page-size-change="handlePageSize"
:page-size-opts="[10, 20, 30, 40, 100]"
></Page>
</div>
</div>
<Modal
class="newModalClass"
:title="$t('1002')"
v-model="addmodal"
:styles="{ width: '700px' }"
>
<div class="modal_body" style="height: 430px !important">
<div
style="
width: 280px;
float: left;
height: 400px;
overflow-y: scroll;
"
>
<template>
<Tree
:data="treeContents"
ref="tree"
@on-select-change="getList()"
></Tree>
</template>
</div>
<div
style="
width: 360px;
float: left;
height: 400px;
padding-left: 5px;
"
>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("500107") }}:
</label>
<Input
class="searchInput"
type="text"
v-model="addobj.program_number"
/>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("100088") }}:
</label>
<Select
v-model="addobj.product"
label-in-value
clearable
filterable
class="searchSelect"
@on-change="getRoutesByProduct"
>
<Option
v-for="item in products"
:value="item.id"
:key="item.id"
>{{ item.name }}</Option
>
</Select>
</div>
<!-- <div class="filter">
<label>
<i>*</i>
{{ this.$t("900880") }}:
</label>
<Input
class="searchInput"
type="text"
v-model="addobj.route_number"
/>
</div> -->
<div class="filter">
<label>
<i>*</i>
{{ this.$t("900967") }}:
</label>
<!-- <Input
class="searchInput"
type="text"
v-model="addobj.route_name"
/> -->
<Select
v-model="addobj.route_id"
label-in-value
clearable
filterable
class="searchSelect"
>
<Option
v-for="item in routeList"
:value="item.id"
:key="item.id"
>{{ item.serialnumber+'-'+item.name }}</Option
>
</Select>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("500098") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.standard_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("500221") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.updown_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("800281") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.daily_standard_output"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("901087") }}</span>
</div>
<div class="filter">
<label>{{ this.$t("810000") }}:</label>
<InputNumber
:min="0"
class="searchInput"
type="number"
v-model="addobj.time_num"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("950009") }}:
</label>
<InputNumber
:min="1"
class="searchInput"
type="number"
v-model="addobj.yieldrate"
value="1"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{ this.$t("1049") }}:
</label>
<DatePicker
type="date"
v-model="addobj.start_time"
class="searchInput"
></DatePicker>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{ this.$t("1050") }}:
</label>
<DatePicker
type="date"
v-model="addobj.end_time"
class="searchInput"
></DatePicker>
</div>
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="closeadd()">{{
$t("1033")
}}</Button>
<Button type="primary" size="large" @click="adddata()">{{
$t("1011")
}}</Button>
</div>
</Modal>
<Modal
class="newModalClass"
:title="$t('1003')"
v-model="editmodal"
:styles="{ width: '500px' }"
>
<div class="modal_body" style="height: 400px !important">
<div class="filter">
<label>{{ this.$t("200003") }}:</label>
<label class="labelInfo">{{ sectionname }}</label>
</div>
<div class="filter">
<label>{{ this.$t("500107") }}:</label>
<label class="labelInfo">{{
editobj.process_number
}}</label>
</div>
<div class="filter">
<label>{{ this.$t("100088") }}:</label>
<label class="labelInfo">{{
editobj.product_name_text
}}</label>
</div>
<div class="filter">
<label>{{ this.$t("900967") }}:</label>
<label class="labelInfo">{{
editobj.route_name
}}</label>
</div>
<div class="filter">
<label>{{ this.$t("900880") }}:</label>
<label class="labelInfo">{{
editobj.route_number
}}</label>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("500098") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.standard_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("500221") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.updown_besat"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("800281") }}:
</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.daily_standard_output"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("901087") }}</span>
</div>
<div class="filter">
<label>{{ this.$t("810000") }}:</label>
<InputNumber
:min="0"
class="searchInput"
type="text"
v-model="editobj.time_num"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
<span>{{ this.$t("1104") }}</span>
</div>
<div class="filter">
<label>
<i>*</i>
{{ this.$t("950009") }}:
</label>
<InputNumber
:min="1"
class="searchInput"
type="text"
v-model="editobj.yieldrate"
value="1"
onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
/>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{ this.$t("1049") }}:
</label>
<DatePicker
type="date"
v-model="editobj.start_time"
class="searchInput"
></DatePicker>
</div>
<div class="filter">
<label>
<!-- <i>*</i> -->
{{ this.$t("1050") }}:
</label>
<DatePicker
type="date"
v-model="editobj.end_time"
class="searchInput"
></DatePicker>
</div>
</div>
<div slot="footer">
<Button type="text" size="large" @click="closeedit()">{{
$t("1033")
}}</Button>
<Button type="primary" size="large" @click="editdata()">{{
$t("1011")
}}</Button>
</div>
</Modal>
</div>
</Modal>
</div>
</div>
</template>
<script>
import axios from "@/libs/api.request";
export default {
name: "producetime", // 组件不刷新
data() {
return {
action:
axios.publicPath + "cnc/upload/submit?templateName=BeatAllocation",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
leveldata: [], // 产线层级集合
levelid: 0, // 产线层级id
datalevel: [],
tableData1: [],
total: 0,
page: 1,
pagesize: 10,
addmodal: false,
detailobj: {},
editmodal: false,
addobj: {},
editobj: {},
selectids: "",
treeContents: [],
timetype: "time",
sectionId: "",
sectionname: "",
productname: "",
drawcode: "",
products: [],
machineId: 0,
map: {
value: "value",
label: "label",
children: "children",
expand: true,
selected: false,
},
tableColumns1: [
{
type: "selection",
width: 50,
align: "center",
},
{
type: "index2",
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
name: "producetime", // 组件不刷新
data() {
return {
action:
axios.publicPath +
"cnc/upload/submit?templateName=BeatAllocation",
headers: {
token: localStorage.getItem("token"),
timestamp: localStorage.getItem("timestamp"),
nonce: localStorage.getItem("nonce"),
sign: localStorage.getItem("sign"),
},
leveldata: [], // 产线层级集合
levelid: 0, // 产线层级id
datalevel: [],
tableData1: [],
total: 0,
page: 1,
pagesize: 10,
addmodal: false,
detailobj: {},
editmodal: false,
addobj: {},
editobj: {},
selectids: "",
treeContents: [],
timetype: "time",
sectionId: "",
sectionname: "",
productname: "",
drawcode: "",
products: [],
routeList:[], //工序列表
machineId: 0,
map: {
value: "value",
label: "label",
children: "children",
expand: true,
selected: false,
},
tableColumns1: [
{
type: "selection",
width: 50,
align: "center",
},
{
type: "index2",
title: this.$t("1008"),
key: "xuhao",
render: (h, params) => {
return h(
"span",
params.index + (this.page - 1) * this.pagesize + 1
);
},
width: "60px",
},
{
title: this.$t("900868"),
key: "stationName",
width: "120px",
},
{
title: this.$t("800278"),
key: "sectionName",
width: "120px",
},
{
title: this.$t("800279"),
key: "process_number",
width: "100px",
},
{
title: this.$t("100088"),
key: "product_name_text",
},
{
title: this.$t("600567"),
key: "drawing_number",
},
{
title: this.$t("900967"),
key: "routeName",
},
{
title: this.$t("500135"),
key: "standard_besat",
width: 150,
},
{
title: this.$t("500223"),
key: "updown_besat",
width: 150,
},
{
title: this.$t("900869"),
key: "daily_standard_output",
width: 150,
},
{
title: this.$t("900870"),
key: "time_num",
width: 150,
},
{
title: this.$t("950009"),
key: "yieldrate",
},
],
};
},
created() {
this.initlevel();
// this.tosearch();
// 格式化表格样式
this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
},
methods: {
handleFormatError(file) {
this.$Message.error(
this.$t("950396") + file.name + this.$t("950397")
);
},
width: "60px",
},
{
title: this.$t("900868"),
key: "stationName",
width: "120px",
handleSuccess(res, file) {
if (res.ret == 1) {
this.$Message.success(this.$t("950398"));
this.search(this.page, this.pagesize);
} else {
if ((res.msg + "").indexOf(",") != -1) {
this.page = 1;
this.search(this.page, this.pagesize);
inittip(res.msg);
} else {
this.$Message.error(this.$t(res.msg));
}
}
},
{
title: this.$t("800278"),
key: "sectionName",
width: "120px",
handleError() {
this.$Message.error(this.$t("2010006") + "!");
},
{
title: this.$t("800279"),
key: "process_number",
width: "100px",
// 产线层级
initlevel() {
axios
.request({
url: "config/ProjectLevelSection/GetSectionTree",
method: "get",
})
.then((res) => {
const arr = [];
this.datalevel = res.data.data;
let sdata = res.data.data;
if (
sdata != null &&
sdata != undefined &&
sdata &&
sdata.length > 0
) {
arr.push(res.data.data[0].value);
this.levelid = res.data.data[0].value;
}
this.leveldata = arr;
this.tosearch();
});
},
{
title: this.$t("100088"),
key: "product_name_text",
getproduct() {
axios
.request({
url:
"/config/ProjectProduct/GetProductsByCode?code=&name=&count=99",
method: "get",
})
.then((res) => {
this.products = res.data.data;
});
},
{
title: this.$t("600567"),
key: "drawing_number",
getRoutesByProduct(val) {
// 选择产品查询工艺路径
let id = 0;
id = val.value?val.value:0;
var params = {
productId: id,
page: 1,
pagesize: 100,
};
axios
.request({
url: "/config/ProductRoute/GetPagedRoutes",
params,
method: "get",
})
.then((res) => {
if (res.data.ret == 1) {
this.routeList = res.data.data;
}
});
},
{
title: this.$t("900967"),
key: "routeName",
// 产线层级选择
getlevel: function (data) {
this.levelid = data[data.length - 1];
},
{
title: this.$t("500135"),
key: "standard_besat",
width: 150,
tosearch() {
this.page = 1;
this.pageszie = 10;
this.search();
},
{
title: this.$t("500223"),
key: "updown_besat",
width: 150,
search() {
var params = {
sectionID: this.levelid,
product_name_text: this.productname,
drawing_number: this.drawcode,
page: this.page,
pagesize: this.pagesize,
};
this.detailobj = {};
this.selectids = [];
axios
.request({
url: "/cnc/BeatAllocation/ShowBeatAllocation",
params,
method: "get",
})
.then((res) => {
this.total = res.data.total;
this.mockTableData1(res.data.data);
});
},
{
title: this.$t("900869"),
key: "daily_standard_output",
width: 150,
mockTableData1(tablelist) {
let data = [];
tablelist.forEach((item) => {
if (item) {
data.push({
stationName: item.stationName,
sectionName: item.sectionName,
process_number: item.process_number,
product_name_text: item.product_name_text,
drawing_number: item.drawing_number,
routeName: item.routeName,
route_number: item.route_number,
standard_besat: item.standard_besat,
updown_besat: item.updown_besat,
daily_standard_output: item.daily_standard_output,
time_num: item.time_num,
yieldrate: item.yieldrate,
machineID: item.machineID,
start_time: item.start_time,
end_time: item.end_time,
id: item.id,
});
}
});
this.tableData1 = data;
},
{
title: this.$t("900870"),
key: "time_num",
width: 150,
handleSelectRow: function (data) {
var ids = [];
for (var i in data) {
ids.push(data[i].id);
}
this.selectids = ids;
},
{
title: this.$t("950009"),
key: "yieldrate",
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
},
],
};
},
created() {
this.initlevel();
// this.tosearch();
// 格式化表格样式
this.tableColumns1 = this.$time.initTableTitle(this.tableColumns1);
},
methods: {
handleFormatError(file) {
this.$Message.error(this.$t("950396") + file.name + this.$t("950397"));
},
handleSuccess(res, file) {
if (res.ret == 1) {
this.$Message.success(this.$t("950398"));
this.search(this.page, this.pagesize);
} else {
if ((res.msg + "").indexOf(",") != -1) {
this.page = 1;
this.search(this.page, this.pagesize);
inittip(res.msg);
} else {
this.$Message.error(this.$t(res.msg));
}
}
},
handleError() {
this.$Message.error(this.$t("2010006") + "!");
},
// 产线层级
initlevel() {
axios
.request({
url: "config/ProjectLevelSection/GetSectionTree",
method: "get",
})
.then((res) => {
const arr = [];
this.datalevel = res.data.data;
let sdata = res.data.data
if(sdata!=null&&sdata!=undefined&&sdata&&sdata.length >0){
arr.push(res.data.data[0].value)
this.levelid = res.data.data[0].value;
}
this.leveldata = arr;
this.tosearch();
});
},
getproduct() {
axios
.request({
url: "/config/ProjectProduct/GetProductsByCode?code=&name=&count=99",
method: "get",
})
.then((res) => {
this.products = res.data.data;
});
},
// 产线层级选择
getlevel: function (data) {
this.levelid = data[data.length - 1];
},
tosearch() {
this.page = 1;
this.pageszie = 10;
this.search();
},
search() {
var params = {
sectionID: this.levelid,
product_name_text: this.productname,
drawing_number: this.drawcode,
page: this.page,
pagesize: this.pagesize,
};
this.detailobj = {};
this.selectids = [];
axios
.request({
url: "/cnc/BeatAllocation/ShowBeatAllocation",
params,
method: "get",
})
.then((res) => {
this.total = res.data.total;
this.mockTableData1(res.data.data);
});
},
mockTableData1(tablelist) {
let data = [];
tablelist.forEach((item) => {
if (item) {
data.push({
stationName: item.stationName,
sectionName: item.sectionName,
process_number: item.process_number,
product_name_text: item.product_name_text,
drawing_number: item.drawing_number,
routeName: item.routeName,
route_number: item.route_number,
standard_besat: item.standard_besat,
updown_besat: item.updown_besat,
daily_standard_output: item.daily_standard_output,
time_num: item.time_num,
yieldrate: item.yieldrate,
machineID: item.machineID,
start_time: item.start_time,
end_time: item.end_time,
id: item.id,
});
}
});
this.tableData1 = data;
},
handleSelectRow: function (data) {
var ids = [];
for (var i in data) {
ids.push(data[i].id);
}
this.selectids = ids;
},
handleRowChange(currentRow, oldCurrentRow) {
this.detailobj = currentRow;
},
handlePageSize(value) {
this.pagesize = value;
this.search();
},
changePage(value) {
this.page = value;
this.search();
},
add() {
this.addmodal = true;
this.addobj = {
program_number: "",
product: "",
route_number: "",
route_name: "",
standard_besat: 0,
updown_besat: 0,
daily_standard_output: 0,
time_num: 0,
yieldrate: 1,
start_time: "",
end_time: "",
};
this.sectionId = "";
this.machineId = 0;
this.inittree();
this.getproduct();
},
inittree() {
axios
.request({
url: "/config/ProjectLevelSection/GetSectionTree",
method: "get",
})
.then((res) => {
if (res.data.ret == 1) {
this.treeContents = res.data.data;
this.contentTree(this.treeContents);
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
// 树形数据转换
contentTree(arr) {
arr.forEach((ele) => {
ele.title = ele.label;
ele.expand = true;
if (
ele.children.length != 0 &&
ele.children != undefined &&
ele.children != null
) {
this.contentTree(ele.children);
}
});
},
// 获取树id
getList() {
let node = this.$refs.tree.getSelectedNodes();
if (node.length > 0) {
if (node[0].children && node[0].children.length > 0) {
this.$Message.error("请选择具体工位");
} else {
// this.machine = node[0].title;
this.sectionId = node[0].value;
this.getmachine();
}
}
},
getmachine() {
axios
.request({
url: "/config/Machine/GetmachineidBySection?id=" + this.sectionId,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
this.machineId = res.data.data.machine_id;
}
});
},
closeadd() {
this.addmodal = false;
},
adddata() {
if (this.sectionId === "" || this.sectionId === undefined) {
this.$Message.error(this.$t(1052));
return false;
}
if (this.machineId === 0) {
this.$Message.error(this.$t(100177));
return false;
}
// 验证非空
if (
this.addobj.program_number === "" ||
this.addobj.program_number === undefined
) {
this.$Message.error(this.$t(800291));
return false;
}
if (this.addobj.product === "" || this.addobj.product === undefined) {
this.$Message.error(this.$t("100064"));
return false;
}
if (
this.addobj.route_number == "" ||
this.addobj.route_number == undefined
) {
this.$Message.error(this.$t(666620));
return false;
}
if (
this.addobj.route_name === "" ||
this.addobj.route_name === undefined
) {
this.$Message.error(this.$t("901088"));
return false;
}
if (
this.addobj.standard_besat === "" ||
this.addobj.standard_besat === undefined ||
this.addobj.standard_besat === 0
) {
this.$Message.error(this.$t("800294"));
return false;
}
if (
this.addobj.updown_besat === "" ||
this.addobj.updown_besat === undefined ||
this.addobj.updown_besat === 0
) {
this.$Message.error(this.$t("500222"));
return false;
}
if (
this.addobj.daily_standard_output === "" ||
this.addobj.daily_standard_output === undefined ||
this.addobj.daily_standard_output === 0
) {
this.$Message.error(this.$t("800295"));
return false;
}
if (
this.addobj.yieldrate === "" ||
this.addobj.yieldrate === undefined ||
this.addobj.yieldrate === 0
) {
this.$Message.error(this.$t("950156"));
return false;
}
// if (
// this.addobj.start_time === "" ||
// this.addobj.start_time === undefined
// ) {
// this.$Message.error(this.$t("9000127"));
// return false;
// }
// if (this.addobj.end_time === "" || this.addobj.end_time === undefined) {
// this.$Message.error(this.$t("9000128"));
// return false;
// }
if (this.addobj.start_time && this.addobj.end_time && this.addobj.start_time > this.addobj.end_time) {
this.$Message.error(this.$t("100218"));
return false;
}
let data = {
sectionid: this.sectionId,
machineid: this.machineId,
program_number: this.addobj.program_number,
product_name_text: "",
product_name: this.addobj.product,
drawing_number: "",
standard_besat: this.addobj.standard_besat,
daily_standard_output: this.addobj.daily_standard_output,
time_num: this.addobj.time_num,
route_name: this.addobj.route_name,
route_number: this.addobj.route_number,
updown_besat: this.addobj.updown_besat, // 上下料节拍
yieldratio: this.addobj.yieldrate, // 产量系数
start_time: this.addobj.start_time,
end_time: this.addobj.end_time,
};
axios
.request({
url: "/cnc/BeatAllocation/AddBeatAllocation",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1055"));
this.addmodal = false;
this.tosearch();
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
dele() {
if (
this.selectids === undefined ||
this.selectids === "" ||
this.selectids === []
) {
this.$Message.error(this.$t("1017"));
return false;
} else {
let data = {
ids: this.selectids,
};
this.$Modal.confirm({
title: this.$t("1018"),
content: "",
width: "290px",
closable: true,
okText: this.$t("1004"),
onOk: () => {
handlePageSize(value) {
this.pagesize = value;
this.search();
},
changePage(value) {
this.page = value;
this.search();
},
add() {
this.addmodal = true;
this.addobj = {
program_number: "",
product: "",
route_number: "",
route_name: "",
standard_besat: 0,
updown_besat: 0,
daily_standard_output: 0,
time_num: 0,
yieldrate: 1,
start_time: "",
end_time: "",
};
this.sectionId = "";
this.machineId = 0;
this.inittree();
this.getproduct();
},
inittree() {
axios
.request({
url: "/cnc/BeatAllocation/DeleteMultipleBeats",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1058"));
this.tosearch();
this.detailobj = {};
.request({
url: "/config/ProjectLevelSection/GetSectionTree",
method: "get",
})
.then((res) => {
if (res.data.ret == 1) {
this.treeContents = res.data.data;
this.contentTree(this.treeContents);
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
// 树形数据转换
contentTree(arr) {
arr.forEach((ele) => {
ele.title = ele.label;
ele.expand = true;
if (
ele.children.length != 0 &&
ele.children != undefined &&
ele.children != null
) {
this.contentTree(ele.children);
}
});
},
// 获取树id
getList() {
let node = this.$refs.tree.getSelectedNodes();
if (node.length > 0) {
if (node[0].children && node[0].children.length > 0) {
this.$Message.error("请选择具体工位");
} else {
this.$Message.error(this.$t(res.data.msg));
// this.machine = node[0].title;
this.sectionId = node[0].value;
this.getmachine();
}
});
},
});
}
},
edit() {
if (this.detailobj === undefined || this.detailobj.id === undefined) {
this.$Message.error(this.$t("1017"));
return false;
}
this.sectionname = this.detailobj.stationName;
this.sectionId = this.detailobj.section_id;
this.machineId = this.detailobj.machineID;
this.editobj.route_number = this.detailobj.route_number;
this.editobj.process_number = this.detailobj.process_number;
this.editobj.product_name_text = this.detailobj.product_name_text;
this.editobj.standard_besat = this.detailobj.standard_besat;
this.editobj.daily_standard_output = this.detailobj.daily_standard_output;
this.editobj.time_num = this.detailobj.time_num;
this.editobj.route_name = this.detailobj.routeName;
this.editobj.updown_besat = this.detailobj.updown_besat;
this.editobj.yieldrate = this.detailobj.yieldrate;
this.editobj.start_time = this.detailobj.start_time;
this.editobj.end_time = this.detailobj.end_time;
this.editmodal = true;
},
editdata() {
// 验证非空
if (
this.editobj.standard_besat === "" ||
this.editobj.standard_besat === undefined ||
this.editobj.standard_besat === 0
) {
this.$Message.error(this.$t("800294"));
return false;
}
if (
this.editobj.updown_besat === "" ||
this.editobj.updown_besat === undefined
) {
this.$Message.error(this.$t("500222"));
return false;
}
if (
this.editobj.daily_standard_output === "" ||
this.editobj.daily_standard_output === undefined ||
this.editobj.daily_standard_output === 0
) {
this.$Message.error(this.$t("800295"));
return false;
}
if (
this.editobj.yieldrate === "" ||
this.editobj.yieldrate === undefined ||
this.editobj.yieldrate === 0
) {
this.$Message.error(this.$t("950156"));
return false;
}
// if (
// this.editobj.start_time === "" ||
// this.editobj.start_time === undefined
// ) {
// this.$Message.error(this.$t("9000127"));
// return false;
// }
// if (this.editobj.end_time === "" || this.editobj.end_time === undefined) {
// this.$Message.error(this.$t("9000128"));
// return false;
// }
if (this.editobj.start_time && this.editobj.end_time && this.editobj.start_time > this.editobj.end_time) {
this.$Message.error(this.$t("100218"));
return false;
}
let data = {
sectionid: this.sectionId,
machineid: this.machineId,
standard_besat: this.editobj.standard_besat,
daily_standard_output: this.editobj.daily_standard_output,
time_num: this.editobj.time_num,
updown_besat: this.editobj.updown_besat, // 上下料节拍
yieldratio: this.editobj.yieldrate, // 产量系数
start_time: this.editobj.start_time,
end_time: this.editobj.end_time,
id: this.detailobj.id,
};
axios
.request({
url: "/cnc/BeatAllocation/EditBeatAllocation",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1060"));
}
},
getmachine() {
axios
.request({
url:
"/config/Machine/GetmachineidBySection?id=" +
this.sectionId,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
this.machineId = res.data.data.machine_id;
}
});
},
closeadd() {
this.addmodal = false;
},
adddata() {
if (this.sectionId === "" || this.sectionId === undefined) {
this.$Message.error(this.$t(1052));
return false;
}
if (this.machineId === 0) {
this.$Message.error(this.$t(100177));
return false;
}
// 验证非空
if (
this.addobj.program_number === "" ||
this.addobj.program_number === undefined
) {
this.$Message.error(this.$t(800291));
return false;
}
if (
this.addobj.product === "" ||
this.addobj.product === undefined
) {
this.$Message.error(this.$t("100064"));
return false;
}
// if (
// this.addobj.route_number == "" ||
// this.addobj.route_number == undefined
// ) {
// this.$Message.error(this.$t(666620));
// return false;
// }
if (
this.addobj.route_id === "" ||
this.addobj.route_id === undefined || this.addobj.route_id === 0
) {
this.$Message.error(this.$t("901088"));
return false;
}
if (
this.addobj.standard_besat === "" ||
this.addobj.standard_besat === undefined ||
this.addobj.standard_besat === 0
) {
this.$Message.error(this.$t("800294"));
return false;
}
if (
this.addobj.updown_besat === "" ||
this.addobj.updown_besat === undefined ||
this.addobj.updown_besat === 0
) {
this.$Message.error(this.$t("500222"));
return false;
}
if (
this.addobj.daily_standard_output === "" ||
this.addobj.daily_standard_output === undefined ||
this.addobj.daily_standard_output === 0
) {
this.$Message.error(this.$t("800295"));
return false;
}
if (
this.addobj.yieldrate === "" ||
this.addobj.yieldrate === undefined ||
this.addobj.yieldrate === 0
) {
this.$Message.error(this.$t("950156"));
return false;
}
// if (
// this.addobj.start_time === "" ||
// this.addobj.start_time === undefined
// ) {
// this.$Message.error(this.$t("9000127"));
// return false;
// }
// if (this.addobj.end_time === "" || this.addobj.end_time === undefined) {
// this.$Message.error(this.$t("9000128"));
// return false;
// }
if (
this.addobj.start_time &&
this.addobj.end_time &&
this.addobj.start_time > this.addobj.end_time
) {
this.$Message.error(this.$t("100218"));
return false;
}
let data = {
sectionid: this.sectionId,
machineid: this.machineId,
program_number: this.addobj.program_number,
product_name_text: "",
product_name: this.addobj.product,
drawing_number: "",
standard_besat: this.addobj.standard_besat,
daily_standard_output: this.addobj.daily_standard_output,
time_num: this.addobj.time_num,
route_id:this.addobj.route_id,
route_name: this.addobj.route_name,
route_number: this.addobj.route_number,
updown_besat: this.addobj.updown_besat, // 上下料节拍
yieldratio: this.addobj.yieldrate, // 产量系数
start_time: this.addobj.start_time,
end_time: this.addobj.end_time,
};
axios
.request({
url: "/cnc/BeatAllocation/AddBeatAllocation",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1055"));
this.addmodal = false;
this.tosearch();
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
dele() {
if (
this.selectids === undefined ||
this.selectids === "" ||
this.selectids === []
) {
this.$Message.error(this.$t("1017"));
return false;
} else {
let data = {
ids: this.selectids,
};
this.$Modal.confirm({
title: this.$t("1018"),
content: "",
width: "290px",
closable: true,
okText: this.$t("1004"),
onOk: () => {
axios
.request({
url: "/cnc/BeatAllocation/DeleteMultipleBeats",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1058"));
this.tosearch();
this.detailobj = {};
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
});
}
},
edit() {
if (
this.detailobj === undefined ||
this.detailobj.id === undefined
) {
this.$Message.error(this.$t("1017"));
return false;
}
this.sectionname = this.detailobj.stationName;
this.sectionId = this.detailobj.section_id;
this.machineId = this.detailobj.machineID;
this.editobj.route_number = this.detailobj.route_number;
this.editobj.process_number = this.detailobj.process_number;
this.editobj.product_name_text = this.detailobj.product_name_text;
this.editobj.standard_besat = this.detailobj.standard_besat;
this.editobj.daily_standard_output = this.detailobj.daily_standard_output;
this.editobj.time_num = this.detailobj.time_num;
this.editobj.route_name = this.detailobj.routeName;
this.editobj.updown_besat = this.detailobj.updown_besat;
this.editobj.yieldrate = this.detailobj.yieldrate;
this.editobj.start_time = this.detailobj.start_time;
this.editobj.end_time = this.detailobj.end_time;
this.editmodal = true;
},
editdata() {
// 验证非空
if (
this.editobj.standard_besat === "" ||
this.editobj.standard_besat === undefined ||
this.editobj.standard_besat === 0
) {
this.$Message.error(this.$t("800294"));
return false;
}
if (
this.editobj.updown_besat === "" ||
this.editobj.updown_besat === undefined
) {
this.$Message.error(this.$t("500222"));
return false;
}
if (
this.editobj.daily_standard_output === "" ||
this.editobj.daily_standard_output === undefined ||
this.editobj.daily_standard_output === 0
) {
this.$Message.error(this.$t("800295"));
return false;
}
if (
this.editobj.yieldrate === "" ||
this.editobj.yieldrate === undefined ||
this.editobj.yieldrate === 0
) {
this.$Message.error(this.$t("950156"));
return false;
}
// if (
// this.editobj.start_time === "" ||
// this.editobj.start_time === undefined
// ) {
// this.$Message.error(this.$t("9000127"));
// return false;
// }
// if (this.editobj.end_time === "" || this.editobj.end_time === undefined) {
// this.$Message.error(this.$t("9000128"));
// return false;
// }
if (
this.editobj.start_time &&
this.editobj.end_time &&
this.editobj.start_time > this.editobj.end_time
) {
this.$Message.error(this.$t("100218"));
return false;
}
let data = {
sectionid: this.sectionId,
machineid: this.machineId,
standard_besat: this.editobj.standard_besat,
daily_standard_output: this.editobj.daily_standard_output,
time_num: this.editobj.time_num,
updown_besat: this.editobj.updown_besat, // 上下料节拍
yieldratio: this.editobj.yieldrate, // 产量系数
start_time: this.editobj.start_time,
end_time: this.editobj.end_time,
id: this.detailobj.id,
};
axios
.request({
url: "/cnc/BeatAllocation/EditBeatAllocation",
data,
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
this.$Message.success(this.$t("1060"));
this.editmodal = false;
this.search();
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
closeedit() {
this.editmodal = false;
this.search();
} else {
this.$Message.error(this.$t(res.data.msg));
}
});
},
closeedit() {
this.editmodal = false;
},
loadexcel() {
let params = {};
axios
.request({
url: "/config/BeatSetDownLoad/GetTemplate",
params,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href = axios.publicPath + "" + res.data.data;
} else {
this.error(res.data.msg);
}
});
},
Export() {
axios
.request({
url: "/cnc/Upload/Submit?templateName=BeatAllocation",
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href = axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(res.data.msg);
}
});
},
loadexcel() {
let params = {};
axios
.request({
url: "/config/BeatSetDownLoad/GetTemplate",
params,
method: "get",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
axios.publicPath + "" + res.data.data;
} else {
this.error(res.data.msg);
}
});
},
Export() {
axios
.request({
url: "/cnc/Upload/Submit?templateName=BeatAllocation",
method: "post",
})
.then((res) => {
if (res.data.ret === 1) {
window.location.href =
axios.publicPath + "" + res.data.data;
} else {
this.$Message.error(res.data.msg);
}
});
},
},
},
};
</script>
<style lang="less" scoped>
.treeSelect {
span {
background: #2d8cf1;
color: #fff;
margin: 0;
padding: 0 4px;
border-radius: 3px;
cursor: pointer;
vertical-align: top;
}
span {
background: #2d8cf1;
color: #fff;
margin: 0;
padding: 0 4px;
border-radius: 3px;
cursor: pointer;
vertical-align: top;
}
}
.labelInfo {
text-align: left !important;
text-align: left !important;
}
</style>
......@@ -3,7 +3,7 @@
<div class="divborder newSearchDiv" style="margin:0px;">
<div class="filter">
<label>{{$t('100088')}}</label>
<!-- <Select v-model="productname" label-in-value filterable clearable remote
<!-- <Select v-model="productname " label-in-value filterable clearable remote
:remote-method="remoteMethod"
:loading="loading1" class="searchSelect" >
<Option v-for="item in products" :value="item.id" :key="item.id">{{ item.name }}({{item.code}})</Option>
......
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