185 lines
5.0 KiB
Vue
185 lines
5.0 KiB
Vue
|
|
<template>
|
|||
|
|
<a-modal
|
|||
|
|
:title="title"
|
|||
|
|
:width="800"
|
|||
|
|
:visible="visible"
|
|||
|
|
:confirmLoading="confirmLoading"
|
|||
|
|
@ok="handleOk"
|
|||
|
|
@cancel="handleCancel"
|
|||
|
|
okText="保存"
|
|||
|
|
cancelText="关闭">
|
|||
|
|
|
|||
|
|
<a-spin :spinning="confirmLoading">
|
|||
|
|
<a-upload
|
|||
|
|
directory
|
|||
|
|
v-model:fileList="fileList"
|
|||
|
|
:customRequest="customRequest"
|
|||
|
|
:beforeUpload="beforeUpload"
|
|||
|
|
@change="handleChange"
|
|||
|
|
:multiple="true"
|
|||
|
|
>
|
|||
|
|
<a-button>
|
|||
|
|
<upload-outlined></upload-outlined>
|
|||
|
|
选择文件夹上传(仅.txt/.csv)
|
|||
|
|
</a-button>
|
|||
|
|
</a-upload>
|
|||
|
|
</a-spin>
|
|||
|
|
</a-modal>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import moment from "moment"
|
|||
|
|
import JCron from "@/components/jeecg/JCron";
|
|||
|
|
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
|
|||
|
|
import pick from 'lodash.pick'
|
|||
|
|
|
|||
|
|
|
|||
|
|
export default {
|
|||
|
|
name: "fileDataLinkModal",
|
|||
|
|
components: {
|
|||
|
|
JCron,
|
|||
|
|
JSelectMultiple
|
|||
|
|
},
|
|||
|
|
data () {
|
|||
|
|
return {
|
|||
|
|
title:"操作",
|
|||
|
|
buttonStyle: 'solid',
|
|||
|
|
visible: false,
|
|||
|
|
dateFormat:'YYYY-MM-DD HH:mm',
|
|||
|
|
status:'',
|
|||
|
|
model: {},
|
|||
|
|
confirmLoading: false,
|
|||
|
|
form: this.$form.createForm(this),
|
|||
|
|
strategys:[],
|
|||
|
|
dataStrategySelected:'',
|
|||
|
|
idcDataStrategyId:"",
|
|||
|
|
shipMode:{},
|
|||
|
|
shipNum:{},
|
|||
|
|
rangeTime:[],
|
|||
|
|
queryParam: {
|
|||
|
|
pageNum :1,
|
|||
|
|
pageSize:20
|
|||
|
|
},
|
|||
|
|
labelCol: {
|
|||
|
|
xs: { span: 24 },
|
|||
|
|
sm: { span: 5 },
|
|||
|
|
},
|
|||
|
|
wrapperCol: {
|
|||
|
|
xs: { span: 24 },
|
|||
|
|
sm: { span: 16 },
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
created () {
|
|||
|
|
this.loadData();
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
loadData() {
|
|||
|
|
shipModelPageList(this.queryParam).then((res) => {
|
|||
|
|
if (res.success) {
|
|||
|
|
this.shipMode = res.result.rows
|
|||
|
|
} else {
|
|||
|
|
this.$message.warning(res.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
shipNumPageList(this.queryParam).then((res) => {
|
|||
|
|
if (res.success) {
|
|||
|
|
this.shipNum = res.result.rows
|
|||
|
|
} else {
|
|||
|
|
this.$message.warning(res.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
filterOption(input, option) {
|
|||
|
|
return (
|
|||
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|||
|
|
);
|
|||
|
|
},
|
|||
|
|
selectModel(value){
|
|||
|
|
shipNumQueryByModelId({modelId:value}).then((res) => {
|
|||
|
|
if (res.success) {
|
|||
|
|
this.shipNum = res.result
|
|||
|
|
} else {
|
|||
|
|
this.$message.warning(res.message);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
add () {
|
|||
|
|
this.rangeTime=[];
|
|||
|
|
this.edit({});
|
|||
|
|
},
|
|||
|
|
edit (record) {
|
|||
|
|
this.visible =true;
|
|||
|
|
let that = this;
|
|||
|
|
that.form.resetFields();
|
|||
|
|
this.model = Object.assign({},record);
|
|||
|
|
this.rangeTime.push(moment(this.model.startTime),moment(this.model.endTime))
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
this.form.setFieldsValue(pick(this.model,'name','describe','shipModelId','shipNumId'));
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
onChange(value, dateString) {
|
|||
|
|
this.model.startDate = dateString[0];
|
|||
|
|
this.model.endDate = dateString[1];
|
|||
|
|
},
|
|||
|
|
onOk(value) {
|
|||
|
|
this.model.startDate = moment(value[0],dateFormat);
|
|||
|
|
this.model.endDate = moment(value[1],dateFormat);
|
|||
|
|
},
|
|||
|
|
close () {
|
|||
|
|
this.$emit('close');
|
|||
|
|
this.visible = false;
|
|||
|
|
},
|
|||
|
|
handleOk () {
|
|||
|
|
const that = this;
|
|||
|
|
// 触发表单验证
|
|||
|
|
this.form.validateFields((err, values) => {
|
|||
|
|
console.log('values',values)
|
|||
|
|
if (!err) {
|
|||
|
|
that.confirmLoading = true;
|
|||
|
|
if(!this.model.id){
|
|||
|
|
this.model.name = values.name;
|
|||
|
|
this.model.shipModelId = values.shipModelId;
|
|||
|
|
this.model.shipNumId = values.shipNumId;
|
|||
|
|
this.model.describe = values.describe;
|
|||
|
|
taskCreate(this.model).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{
|
|||
|
|
taskUpdateById({id:this.model.id,name:values.name,describe:values.describe,shipModelId:values.shipModelId,shipNumId:values.shipNumId,
|
|||
|
|
startTime:this.model.startTime,endTime:this.model.endTime
|
|||
|
|
}).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();
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},
|
|||
|
|
handleCancel () {
|
|||
|
|
this.close()
|
|||
|
|
},
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style scoped>
|
|||
|
|
.disabled{
|
|||
|
|
pointer-events: none;
|
|||
|
|
}
|
|||
|
|
</style>
|