Commit 7a6c0f56 authored by 李志鸣's avatar 李志鸣

fea(报工点查询): 功能联调(40%)

parent b8174d29
<template>
<el-dialog
title="报工点补扫"
:show-close="false"
:close-on-press-escape="false"
:close-on-click-modal="false"
:visible.sync="dialogToggle"
width="400px">
<el-form
label-width="100px"
label-position="top"
ref="form"
:model="formData"
:rules="formRules">
<el-row :gutter="30">
<el-col :span="24">
<el-form-item
label="工单号"
prop="vin"
required>
<el-input
maxlength="50"
v-model="formData.vin"
size="small"
style="width: 100%;"
placeholder="自动带出"
disabled>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
<el-form-item
label="报工点"
prop="stationName"
required>
<el-input
maxlength="50"
v-model="formData.stationName"
size="small"
style="width: 100%;"
placeholder="自动带出"
disabled>
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
<el-form-item
label="工位编码"
prop="stationNo"
required>
<el-select
v-model="formData.stationNo"
size="small"
style="width: 100%;"
placeholder="请选择工位编码">
<el-option
v-for="(item, index) in stationNoList"
:key="index"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="24">
<el-form-item
label="过站时间"
prop="createTime"
required>
<el-date-picker
v-model="formData.createTime"
size="small"
type="datetime"
style="width: 100%;"
placeholder="请选择过站时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button :loading="loadingToggle" size="small" type="primary" icon="el-icon-check" @click="doConfirmClick('form')">确认</el-button>
<el-button size="small" icon="el-icon-close" @click="doCancelClick('form')">取消</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: 'DutyStationMakeUpDialog',
props: {
vin: {
type: String,
default: () => {
return {}
}
},
stationName: {
type: String,
default: () => {
return {}
}
}
},
watch: {
dialogToggle (newVal, oldVal) {
if (this.dialogToggle) {
this.formData.vin = this.vin;
this.formData.stationName = this.stationName;
// 根据报工点查询工位编号
this.getStationNoByStationName();
}
}
},
data () {
return {
// 工位编码列表
stationNoList: [],
// 数据提交开关
loadingToggle: false,
// 弹窗开关
dialogToggle: false,
// 表单数据
formData: {
vin: '',
stationName: '',
stationNo: '',
createTime: ''
},
// 表单校验规则
formRules: {
// 工单号
vin: [
{
validator: (rule, value, callback) => {
if (_.trim(value) === '') {
callback(new Error('请输入工单号'))
}
callback()
},
trigger: ['change', 'blur']
}
],
// 报工点
stationName: [
{
validator: (rule, value, callback) => {
if (_.trim(value) === '') {
callback(new Error('请输入报工点'))
}
callback()
},
trigger: ['change', 'blur']
}
],
// 工位编码
stationNo: [
{
validator: (rule, value, callback) => {
if (_.trim(value) === '') {
callback(new Error('请输入工位编码'))
}
callback()
},
trigger: ['change', 'blur']
}
],
// 过站时间
createTime: [
{
validator: (rule, value, callback) => {
if (_.trim(value) === '') {
callback(new Error('请选择过站时间'))
}
callback()
},
trigger: ['change', 'blur']
}
]
}
}
},
methods: {
// 根据报工点查询工位编号
async getStationNoByStationName () {
try {
let response = await this.$service('GET', '/pass/getStationNo/{stationName}', { stationName: this.stationName });
this.stationNoList = _.cloneDeep(response);
} catch (error) {
throw error;
}
},
// 点击确认按钮
doConfirmClick (formName) {
this.$refs[formName].validate(vaild => {
if (vaild) {
// 保存缺失的过站信息
this.saveDutyStationInfo(formName);
}
})
},
// 保存缺失的过站信息
async saveDutyStationInfo (formName) {
try {
this.loadingToggle = true;
let params = { ...this.formData };
let response = await this.$service('POST', '/pass/savePassInfo', params);
if (Array.isArray(response)) {
this.loadingToggle = false;
this.$message.success('报工点补扫成功');
this.dialogToggle = false;
this.$refs[formName].resetFields();
this.$emit('doDutyStationMakeUpConfirmClick');
for (let key in this.formData) {
this.formData[key] = '';
}
}
} catch (error) {
this.loadingToggle = false;
throw error;
}
},
// 点击取消按钮
doCancelClick (formName) {
this.dialogToggle = false;
this.$refs[formName].resetFields();
this.$emit('doCancelClick');
for (let key in this.formData) {
this.formData[key] = '';
}
}
}
}
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
......@@ -52,9 +52,31 @@
</template>
</el-table-column>
</template>
<template slot="operationColumn">
<el-table-column
fixed="right"
width="55"
label="操作">
<template slot-scope="scope">
<el-button
type="text"
@click="doEditClick(scope.row)">
编辑
</el-button>
</template>
</el-table-column>
</template>
</Table>
</div>
</div>
<!-- 报工点补扫弹窗 -->
<DutyStationMakeUpDialog
ref="DutyStationMakeUpDialog"
:vin="vin"
:stationName="stationName"
@doDutyStationMakeUpConfirmClick="doDutyStationMakeUpConfirmClick">
</DutyStationMakeUpDialog>
</div>
</template>
......@@ -63,11 +85,14 @@
import Table from '@/components/Table/index.vue';
import Search from '@/components/Search';
import DutyStationMakeUpDialog from './components/DutyStationMakeUpDialog';
export default {
name: 'DutyStationIndex',
components: {
Search,
Table
Table,
DutyStationMakeUpDialog
},
data () {
return {
......@@ -90,7 +115,11 @@
currentPage: 1,
pageSize: 20
}
}
},
// 工单号
vin: '',
// 报工点
stationName: ''
}
},
methods: {
......@@ -136,6 +165,17 @@
} catch (error) {
throw error;
}
},
// 点击编辑按钮
doEditClick (dutyStation) {
this.$refs.DutyStationMakeUpDialog.dialogToggle = true;
this.vin = dutyStation.vin;
this.stationName = dutyStation.stationName;
},
// 点击报工点补扫弹窗确认按钮
doDutyStationMakeUpConfirmClick () {
// 获取报工点记录
this.getDutyStationResult();
}
},
mounted () {
......
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