123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <div class="hui-flex hui-dialog">
- <div class="hui-flex-box hui-dialog-content">
- <el-form :model="departmentForm" label-position="top">
- <el-form-item label="资产名称">
- <el-input type="text" v-model="departmentForm.name"></el-input>
- </el-form-item>
- <el-form-item label="资产描述">
- <el-input type="text" v-model="departmentForm.remark"></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="hui-dialog-submit">
- <el-button size="medium" @click="$emit('callback')">取 消</el-button>
- <el-button size="medium" type="primary" @click="submit" :loading="loading">保 存</el-button>
- </div>
- </div>
- </template>
- <script>
- import {
- insertDeviceDepartment,
- updateDeviceDepartment
- } from '@/httpApi/property'
- export default {
- props: ['isUpdate', 'part'],
- data() {
- return {
- departmentForm: {
- name: '',
- remark: '',
- operateOrganizationId: '',
- parentId: -1,
- isp: 0
- },
- departmentRuler: {},
- loading: false
- }
- },
- created() {
- if (this.isUpdate) {
- this.departmentForm = JSON.parse(JSON.stringify(this.part));
- } else {
- this.departmentForm['operateOrganizationId'] = this.$store.getters.organization.id;
- this.departmentForm['parentId'] = this.part.id || -1;
- this.departmentForm['projectId'] = this.$store.getters.project.id;
- }
- },
- methods: {
- submit() {
- this.loading = true;
- if (this.isUpdate) {
- updateDeviceDepartment(this.departmentForm).then(this.successFunc)
- } else {
- insertDeviceDepartment(this.departmentForm).then(this.successFunc)
- }
- },
- successFunc(res) {
- this.loading = false;
- if (res.state) {
- this.$message.success('操作成功');
- this.$emit('callback', 'init');
- }
- }
- }
- }
- </script>
- <style lang="scss"></style>
|