2023-02-14 13:35:22 +08:00
|
|
|
<template>
|
|
|
|
|
<el-drawer
|
|
|
|
|
:title="controlWindows.addInfo.title"
|
2023-02-16 15:34:21 +08:00
|
|
|
direction="ltr"
|
2023-02-14 13:35:22 +08:00
|
|
|
size="40%"
|
2023-02-21 16:24:12 +08:00
|
|
|
:visible.sync="controlWindows.add"
|
2023-02-14 13:35:22 +08:00
|
|
|
@opened="openDrawer"
|
|
|
|
|
:before-close="closeWindow"
|
|
|
|
|
>
|
|
|
|
|
<div class="add">
|
2023-02-22 13:19:23 +08:00
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
2023-02-14 13:35:22 +08:00
|
|
|
<el-form-item label="账户名称" prop="accountName">
|
|
|
|
|
<el-input
|
|
|
|
|
maxlength="50"
|
|
|
|
|
v-model="form.accountName"
|
|
|
|
|
placeholder="请输入账户名称"
|
|
|
|
|
></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="账户类型" prop="accountType">
|
|
|
|
|
<el-select v-model="form.accountType" placeholder="请选择账户类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(item, index) in refineryAccountTypeEnum"
|
|
|
|
|
:key="index"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="炼厂名称" prop="refineryId">
|
2023-02-17 16:15:01 +08:00
|
|
|
<!-- <el-autocomplete
|
|
|
|
|
label
|
2023-02-14 13:35:22 +08:00
|
|
|
v-model="form.refineryId"
|
2023-02-17 16:15:01 +08:00
|
|
|
:fetch-suggestions="querySearchAsync"
|
|
|
|
|
value-key="refineryName"
|
|
|
|
|
value="id"
|
2023-02-14 13:35:22 +08:00
|
|
|
placeholder="请选择炼厂"
|
2023-02-17 16:15:01 +08:00
|
|
|
></el-autocomplete> -->
|
|
|
|
|
|
|
|
|
|
<autocomplete :params="form" :config="configAutocomplete" />
|
2023-02-14 13:35:22 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="buttons">
|
|
|
|
|
<el-button @click="closeWindow">取消 </el-button>
|
|
|
|
|
<el-button @click="submit">确定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import refineryInfoServe from "api/refineryInfo.js";
|
|
|
|
|
import serve from "api/refineryAccount.js";
|
2023-02-17 16:15:01 +08:00
|
|
|
|
|
|
|
|
import autocomplete from "components/autocomplete/index.vue";
|
2023-02-14 13:35:22 +08:00
|
|
|
export default {
|
2023-02-17 16:15:01 +08:00
|
|
|
components: {
|
|
|
|
|
autocomplete,
|
|
|
|
|
},
|
2023-02-14 13:35:22 +08:00
|
|
|
props: {
|
|
|
|
|
controlWindows: Object,
|
|
|
|
|
refineryAccountTypeEnum: Array,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
2023-02-17 16:15:01 +08:00
|
|
|
let validatorRefineryId = (rule, value, callback) => {
|
|
|
|
|
if (this.form.refineryId) callback();
|
|
|
|
|
else callback("请选择炼厂");
|
|
|
|
|
};
|
2023-02-14 13:35:22 +08:00
|
|
|
return {
|
|
|
|
|
form: {},
|
|
|
|
|
refineryList: [],
|
2023-02-17 16:15:01 +08:00
|
|
|
configAutocomplete: {
|
|
|
|
|
serveTarget: refineryInfoServe.findByEntity,
|
2023-02-20 10:45:44 +08:00
|
|
|
autocompleteKey: "refineryName",
|
|
|
|
|
labelKey: "refineryName",
|
|
|
|
|
valueKey: "id",
|
2023-02-17 16:15:01 +08:00
|
|
|
placeholder: "炼厂名称",
|
|
|
|
|
querykey: "refineryId",
|
|
|
|
|
},
|
2023-02-14 13:35:22 +08:00
|
|
|
rules: {
|
|
|
|
|
accountName: [
|
|
|
|
|
{ required: true, message: "请输入账户名称", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
accountType: [
|
|
|
|
|
{ required: true, message: "请输入账户名称", trigger: "blur" },
|
|
|
|
|
],
|
|
|
|
|
refineryId: [
|
2023-02-17 16:15:01 +08:00
|
|
|
{ required: true, validator: validatorRefineryId, trigger: "change" },
|
2023-02-14 13:35:22 +08:00
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-02-17 16:15:01 +08:00
|
|
|
openDrawer() {},
|
2023-02-14 13:35:22 +08:00
|
|
|
submit() {
|
|
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.judgeInterface(this.form).then((res) => {
|
|
|
|
|
if (res.code === 20000) {
|
|
|
|
|
this.$message.success(res.msg);
|
|
|
|
|
this.closeWindow();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
judgeInterface(form) {
|
|
|
|
|
let { id } = this.controlWindows.addInfo;
|
|
|
|
|
if (id) return serve.update(form);
|
|
|
|
|
else return serve.save(form);
|
|
|
|
|
},
|
|
|
|
|
closeWindow() {
|
|
|
|
|
this.$emit("closeWindow");
|
|
|
|
|
this.form = {};
|
|
|
|
|
this.controlWindows.addInfo = {};
|
2023-02-17 14:24:56 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.form.clearValidate();
|
|
|
|
|
this.controlWindows.add = false;
|
|
|
|
|
});
|
2023-02-14 13:35:22 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.add {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
.el-input,
|
|
|
|
|
.el-select,
|
2023-02-17 16:15:01 +08:00
|
|
|
.el-textarea,
|
|
|
|
|
.el-autocomplete {
|
2023-02-14 13:35:22 +08:00
|
|
|
width: 300px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.buttons {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
padding-right: 40px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 80px;
|
|
|
|
|
line-height: 80px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
border-top: 1px solid #f2f3f5;
|
|
|
|
|
.el-button {
|
|
|
|
|
text-align: right;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|