| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <template>
- <div class="rule-type">
- <DialogCom
- :title="id ? '编辑履职内容库' : '新增履职内容库'"
- :visible.sync="isShow"
- @close="onHide"
- width="500px"
- >
- <div class="page-body">
- <el-form
- :model="formData"
- :rules="formDataRules"
- size="small"
- ref="form"
- label-position="right"
- label-width="130px"
- label-prefix=":"
- >
- <el-form-item prop="name" label="履职内容库名称:">
- <el-input
- v-model.trim="formData.name"
- :maxlength="50"
- placeholder="请输入履职内容库名称"
- clearable
- style="width: 280px"
- />
- </el-form-item>
- <el-form-item prop="orgType" label="履职机构类型:">
- <el-select
- style="width: 280px"
- prop="orgType"
- label="履职机构类型"
- v-model="formData.orgType"
- placeholder="请选择履职机构类型"
- clearable
- >
- <el-option
- v-for="item in orgTypeOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="status" label="状态:">
- <el-select
- style="width: 280px"
- prop="status"
- label="状态"
- v-model="formData.status"
- placeholder="请选择状态"
- clearable
- >
- <el-option
- v-for="item in statusOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="remark" label="备注">
- <el-input
- v-model="formData.remark"
- :maxlength="255"
- clearable
- style="width: 280px"
- type="textarea"
- :rows="3"
- placeholder="请输入备注"
- />
- </el-form-item>
- </el-form>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="onSubmit">确定</el-button>
- <el-button @click="isShow = false">取消</el-button>
- </div>
- </DialogCom>
- </div>
- </template>
- <script>
- import { mapState, mapMutations } from "vuex";
- import * as api from "@/api/resumption/rule";
- export default {
- data() {
- return {
- id: null,
- isShow: false,
- formData: this.reset(),
- formDataRules: {
- name: [{ required: true, message: "请输入履职内容库名称" }],
- type: [{ required: true, message: "请选择履职类型" }],
- orgType: [{ required: true, message: "请选择履职机构类型" }],
- status: [{ required: true, message: "请选择状态" }],
- },
- };
- },
- props: {
- orgTypeOptions: {
- type: Array,
- },
- ruleTypeOptions: {
- type: Array,
- },
- statusOptions: {
- type: Array,
- },
- },
- watch: {},
- computed: {
- ...mapState([]),
- },
- methods: {
- ...mapMutations([]),
- reset() {
- return {
- id: null,
- name: null,
- type: null,
- orgType: null,
- status: null,
- remark: null,
- };
- },
- async refresh(id, other) {
- this.formData = id ? (await api.get(id)).data : this.reset(other);
- },
- async show(id, other = {}) {
- this.id = id;
- await this.refresh(id, other);
- this.isShow = true;
- },
- // 事件
- onHide() {
- this.formData = this.reset();
- this.$refs.form.resetFields();
- },
- onSubmit() {
- this.$refs.form.validate(async (isValidate) => {
- if (!isValidate) return;
- await api.update(this.formData);
- this.$message.info("保存成功");
- this.$emit("success");
- this.isShow = false;
- });
- },
- // 事件
- //apimark//
- },
- mounted() {},
- components: {},
- };
- </script>
- <style lang="scss" scoped>
- .brand_info {
- .el-form {
- width: 600px;
- padding-top: 40px;
- }
- }
- </style>
|