|
@@ -1,11 +1,13 @@
|
|
|
<template>
|
|
|
<el-form
|
|
|
+ v-loading="loading"
|
|
|
ref="ruleForm"
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
|
:rules="rulesThis"
|
|
|
label-width="100px"
|
|
|
class="demo-ruleForm"
|
|
|
+ :size="size || 'medium'"
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="12"
|
|
@@ -14,6 +16,8 @@
|
|
|
v-model="ruleForm.state"
|
|
|
placeholder="请选择审核状态"
|
|
|
style="width: 100%"
|
|
|
+ :size="size || 'medium'"
|
|
|
+ @change="stateChange"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in stateList"
|
|
@@ -25,49 +29,56 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="驳回节点" prop="status">
|
|
|
+ <el-col :span="12" v-if="ruleForm.state === '0'">
|
|
|
+ <el-form-item label="驳回节点" prop="rebut">
|
|
|
<el-select
|
|
|
- v-model="ruleForm.status"
|
|
|
+ v-model="ruleForm.rebut"
|
|
|
placeholder="请选择驳回节点"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="disabled"
|
|
|
>
|
|
|
- <template v-for="item in statusList">
|
|
|
- <el-option
|
|
|
- v-if="!item.hidden"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </template>
|
|
|
+ <el-option
|
|
|
+ v-for="item in statusList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ :disabled="item.disabled"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-form-item label="审核备注" prop="contactor" style="width: 100%">
|
|
|
+ <el-form-item label="审核备注" prop="remark" style="width: 100%">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
placeholder="请输入审核备注"
|
|
|
v-model="ruleForm.remark"
|
|
|
+ :disabled="disabled"
|
|
|
maxlength="250"
|
|
|
:autosize="{ minRows: 2, maxRows: 4 }"
|
|
|
show-word-limit
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item class="fr">
|
|
|
+ <el-button v-if="!isDetail" type="primary" @click="submitForm"
|
|
|
+ >保 存
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
name: "exam-form",
|
|
|
- // mixins: [resToken],
|
|
|
- props: ["size", "statusList", "disabled"],
|
|
|
+ props: ["size", "statusList", "disabled", "isMust"],
|
|
|
/**
|
|
|
* 属性集合
|
|
|
- * @param {String} size : 组件大小 非必填
|
|
|
- * @param {Array} statusList : 驳回至备选项 必填
|
|
|
- * @param {Boolean} disabled : 是否禁用 必填
|
|
|
+ * @param {String} size : 组件大小 非必填
|
|
|
+ * @param {Array} statusList : 驳回至备选项 必填
|
|
|
+ * @param {Boolean} disabled : 是否禁用 必填
|
|
|
+ * @param {Boolean} isMust : 是否需要展示驳回节点 必填
|
|
|
+ *
|
|
|
*
|
|
|
*/
|
|
|
/**
|
|
@@ -126,41 +137,51 @@ export default {
|
|
|
if (this.isDetail !== val) {
|
|
|
this.options = [];
|
|
|
this.selectLoading = false;
|
|
|
- this.getList();
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
- this.options = [];
|
|
|
- this.selectLoading = false;
|
|
|
- this.getList();
|
|
|
+ this.initForm();
|
|
|
},
|
|
|
methods: {
|
|
|
- async selectChange(e) {
|
|
|
- this.$emit("searchChange", e);
|
|
|
+ async initForm() {
|
|
|
+ this.loading = true;
|
|
|
+ this.rulesThis = this.rules;
|
|
|
+ await this.resetForm();
|
|
|
+ this.stateChange();
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
- async getList() {
|
|
|
- this.options = [];
|
|
|
- const res = await asyncRequest.list({});
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- this.options = res.data;
|
|
|
- this.recursion(this.options);
|
|
|
+ stateChange() {
|
|
|
+ if (this.ruleForm.state === "1") {
|
|
|
+ this.rulesThis.rebut[0].required = false;
|
|
|
+ this.rulesThis.remark[0].required = false;
|
|
|
} else {
|
|
|
- this.options = [];
|
|
|
+ this.rulesThis.rebut[0].required = true;
|
|
|
+ this.rulesThis.remark[0].required = true;
|
|
|
}
|
|
|
},
|
|
|
- recursion(list) {
|
|
|
- list.map((v) => {
|
|
|
- if (v && Array.isArray(v.child)) {
|
|
|
- v.value = v.id + "";
|
|
|
- v.label = v.name;
|
|
|
- if (v.child.length === 0) {
|
|
|
- delete v["child"];
|
|
|
- } else {
|
|
|
- this.recursion(v.child);
|
|
|
- }
|
|
|
+ async resetForm() {
|
|
|
+ // 重置
|
|
|
+ await this.$nextTick(() => {
|
|
|
+ if (this.$refs.ruleForm) {
|
|
|
+ this.$refs.ruleForm.resetFields();
|
|
|
+ this.$refs.ruleForm.clearValidate();
|
|
|
+ this.ruleForm = {
|
|
|
+ state: "1", // 通过or驳回
|
|
|
+ rebut: "", //驳回至
|
|
|
+ remark: "",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async submitForm() {
|
|
|
+ await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$emit("searchChange", this.ruleForm);
|
|
|
+ } else {
|
|
|
+ console.log("error submit!!");
|
|
|
+ return false;
|
|
|
}
|
|
|
- return v;
|
|
|
});
|
|
|
},
|
|
|
},
|