You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

301 lines
9.1 KiB

<template>
<el-form>
<div style="background-color: #ffffff;height: 845px;padding: 2% 4%;">
<avue-form :option="option" ref="myForm" v-model="form">
<template #input="{row}">
<el-tag>序号:{{row.$index}}-数据:{{row.input}}</el-tag>
</template>
</avue-form>
<div style="position: fixed;bottom: 7%;left: 40%;width: 100%">
<div style="width: 100%">
<el-button type="primary" @click="submitForm" style="margin-right: 20%" :disabled=this.isDis>确定</el-button>
<el-button type="primary" @click="cancellation" >取消</el-button>
</div>
</div>
</div>
</el-form>
</template>
<script>
import { getDetail as getDetailWarehouse } from '@/api/basicdata/basicdataWarehouse';
import { add, getDetail, update } from '@/api/basic/basicLine';
import {getListpage,getList} from '@/api/basic/basicLineNode'
import { getList as carrierData } from '@/api/basicdata/basicdataCarrier';
export default {
name: "basicLineform",
props: {
lineformdata:{
type:Object,
},
},
created(){
if (!!this.lineformdata.id){this.initData()}
},
data() {
return {
//防止重复点击
isDis:false,
nodequery:{},
// option: {
// emptyBtn: false, //隐藏清空按钮
// submitBtn: false, //隐藏提交按钮
// tableData: [],
// },
form: {
linenode: [{}]
},
// 分页信息
nodepage: {
currentPage: 1,
pageSize: 50,
total: 40
},
option: {
emptyBtn: false, //隐藏清空按钮
submitBtn: false,
column: [
{
label: '线路节点',
prop: 'linenode',
type: 'dynamic',
span: 24,
hight:20,
children: {
align: 'center',
headerAlign: 'center',
rowAdd: (done) => {
this.$message.success('新增回调');
done({
input: '默认值'
});
},
rowDel: (row, done) => {
this.$message.success('删除回调' + JSON.stringify(row));
done();
},
column: [{
label: '仓库',
prop: "warehouseId",
type: 'select',
width: 200,
dicUrl: "/api/logpm-basicdata/warehouse/dictionary",
props: {
label: "name",
value: "id",
},
rules: [{ required: true, message: '请选择仓库!',trigger: 'blur'}],
change: (val) => {
if (!!val.value){
getDetailWarehouse(val.value).then(res => {
// $this.$set($this.option.column[0], 'contacts', res.data.data.linkman);
this.form.linenode[val.index].contacts =res.data.data.linkman
this.form.linenode[val.index].telephone =res.data.data.contactNumber
this.form.linenode[val.index].addressNotes =res.data.remarks
this.form.linenode[val.index].warehouseAddress =res.data.data.warehouseAddress
this.form.linenode[val.index].warehouseName =res.data.data.name
// if (val.index ==0){
// this.form.lineName =
// }
this.form.lineName = this.form.linenode[0].warehouseName;
for (let i = 1; i < this.form.linenode.length; i++) {
this.form.lineName += ("->"+this.form.linenode[i].warehouseName)
}
});
}
},
},{
width: 200,
label: '仓库地址',
prop: "warehouseAddress",
// disabled:true,
readonly : true
},
{
width: 200,
label: '地址备注',
prop: "addressNotes",
// disabled:true,
},
{
width: 200,
label: '联系人',
prop: "contacts",
readonly : true
// disabled:true,
},
{
width: 200,
label: '联系电话',
prop: "telephone",
readonly : true
// disabled:true,
},{
width: 200,
label: '里程(km)',
prop: "route",
rules: [ { required: true, message: '请填写里程!',trigger: 'blur'},{pattern: /(^[1-9]\d{0,9}(\.\d{1,3})?$)|(^0(\.\d{1,2})?$)/, message: '格式不正确!'}],
change: (val) => {
if (!!val.value){
this.form.lineRoute = 0;
for (let i = 0; i < this.form.linenode.length; i++) {
this.form.lineRoute = (this.form.lineRoute*10000 + this.form.linenode[i].route*10000)/10000
}
}
},
},{
width: 200,
label: '时效(h)',
prop: "ageing",
type: 'number',
rules: [ { required: true, message: '请填写时效!',trigger: 'blur'},{pattern: /(^[1-9]\d{0,9}(\.\d{1,3})?$)|(^0(\.\d{1,2})?$)/, message: '格式不正确!'}],
change: (val) => {
if (!!val.value){
this.form.lineAgeing = 0;
for (let i = 0; i < this.form.linenode.length; i++) {
this.form.lineAgeing = (this.form.lineAgeing*10000 + this.form.linenode[i].ageing*10000)/10000
}
}
},
},
]
}
},
{
label: '车线编号',
prop: 'lineNumber',
span: 11,
},
{
label: '车线名称',
prop: 'lineName',
span: 11,
readonly : true
},
{
label: '车线类型',
prop: 'lineType',
type: 'select',
span: 11,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=basic_line_type',
props: {
label: 'dictValue',
value: 'dictKey',
},
rules: [{required: true, message: '请填写类型!',trigger: 'blur'}],
},
{
label: '车线总里程',
prop: 'lineRoute',
span: 11,
type: 'number',
readonly : true
},
{
label: '车线总时效',
prop: 'lineAgeing',
type: 'number',
span: 11,
readonly : true
},
{
label: '备注',
prop: 'notes',
type: 'input',
span: 11,
},
{
label: '状态',
prop: 'state',
type: 'switch',
props: {
label: 'name',
value: 'code'
},
dicData: [{
name: '关闭',
code: '1'
}, {
name: '启用',
code: '2'
}]
},
]
},
}
},
methods: {
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
console.log("type>>>>>>>",type);
}
done();
},
initData(){
//查询子表
let params ={
masterId: this.lineformdata.id
}
getList(this.nodepage.currentPage, this.nodepage.pageSize,Object.assign(params, this.nodequery)).then(res => {
this.form = this.lineformdata;
this.form.linenode = res.data.data.records;
});
},
cancellation(){
let str = {
val: false
}
this.$emit("returnline", str);
},
submitForm(){
this.$refs.myForm.validate(valid => {
if (valid) {
this.isDis = true;
let row = this.form
if (!!row.id){
update(row).then(() => {
this.$message({
type: "success",
message: "操作成功!"
});
let str = {
val: true
}
this.isDis = false;
this.$emit("returnline", str);
}, error => {
this.isDis = false;
loading();
console.log(error);
});
}else {
add(row).then(() => {
this.$message({
type: "success",
message: "操作成功!"
});
let str = {
val: true
}
this.isDis = false;
this.$emit("returnline", str);
}, error => {
this.isDis = false;
loading();
window.console.log(error);
});
}
}
});
}
}
}
</script>
<style scoped>
</style>