parent
e816ee151c
commit
51ed3a5dbf
4 changed files with 244 additions and 10 deletions
@ -0,0 +1,163 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="800" |
||||
:visible="visible" |
||||
:confirmLoading="confirmLoading" |
||||
switchFullscreen |
||||
@cancel="handleCancel" |
||||
@ok="handleCancel" |
||||
cancelText="关闭"> |
||||
|
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules"> |
||||
|
||||
|
||||
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="departId" label="车间名称"> |
||||
<!-- <j-dict-select-tag type="list" v-model="model.departId" dictCode="sys_depart,depart_name,id,org_category='2'" placeholder="请选择车间" />--> |
||||
|
||||
<!-- <j-tree-select v-model="model.departId" |
||||
dict="sys_depart,depart_name,id" |
||||
pidField="parent_id" |
||||
placeholder="请选择车间" |
||||
condition='{"org_category":"2"}' |
||||
hasChildField="1" |
||||
> |
||||
</j-tree-select>--> |
||||
|
||||
<j-dict-select-tag type="list" v-model="model.departId" |
||||
dictCode="sys_depart,depart_name,id,org_category='2'" |
||||
placeholder="请选择车间"/> |
||||
|
||||
</a-form-model-item> |
||||
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stationName" label="工位名称"> |
||||
<a-input placeholder="请输入工位名称" v-model="model.stationName"/> |
||||
</a-form-model-item> |
||||
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stationNum" label="工位序号"> |
||||
<a-input-number v-model="model.stationNum"/> |
||||
</a-form-model-item> |
||||
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description" label="备注"> |
||||
<a-input placeholder="请输入备注" v-model="model.description"/> |
||||
</a-form-model-item> |
||||
|
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getAction, httpAction} from '@/api/manage' |
||||
import moment from "moment" |
||||
|
||||
export default { |
||||
name: "StationModal", |
||||
data() { |
||||
return { |
||||
title: "操作", |
||||
visible: false, |
||||
formDisabled:true, |
||||
model: {}, |
||||
labelCol: { |
||||
xs: {span: 24}, |
||||
sm: {span: 5}, |
||||
}, |
||||
wrapperCol: { |
||||
xs: {span: 24}, |
||||
sm: {span: 16}, |
||||
}, |
||||
|
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
departId: [ |
||||
{required: true, message: "部门不能为空"}, |
||||
], |
||||
stationName: [ |
||||
{required: true,message:"工位名称不能为空"}, |
||||
{pattern: /(^[\u4e00-\u9fa5_a-zA-Z0-9_]{1,10}$)/, message: '工位名称为空且长度不能超过10!'} |
||||
], |
||||
stationNum: [ |
||||
{required: true,message:"工位序号不能不空"}, |
||||
{pattern: /^[1-9]{0,100}$/, message: '工位序号不能为空且长度为(1-100)间正整数'} |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/team/station/add", |
||||
edit: "/team/station/edit", |
||||
}, |
||||
} |
||||
}, |
||||
created() { |
||||
}, |
||||
methods: { |
||||
|
||||
async bianhao() { |
||||
//var n=6 |
||||
getAction(this.url.sort, {id: this.model.clothsTypeId}).then((res) => { |
||||
//let num = res.result; |
||||
console.log("+6++++aaa: " + res.result) |
||||
//num=num.toString() |
||||
//while(num.length<n){ |
||||
//num="0"+num |
||||
//} |
||||
//console.log(num) |
||||
this.model.nums = res.result; |
||||
}) |
||||
}, |
||||
add() { |
||||
//初始化默认值 |
||||
this.edit({}); |
||||
}, |
||||
edit(record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
close() { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
this.$refs.form.clearValidate(); |
||||
}, |
||||
handleOk() { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if (!this.model.id) { |
||||
httpurl += this.url.add; |
||||
method = 'post'; |
||||
} else { |
||||
httpurl += this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl, this.model, method).then((res) => { |
||||
if (res.success) { |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
} else { |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
that.close(); |
||||
}) |
||||
} else { |
||||
return false; |
||||
} |
||||
}) |
||||
}, |
||||
handleCancel() { |
||||
this.close() |
||||
}, |
||||
|
||||
|
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue