|
@@ -1,31 +1,52 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="dialog-moveto">
|
|
<div class="dialog-moveto">
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- title="移动到"
|
|
|
|
|
|
|
+ :title="title"
|
|
|
:visible.sync="dialogVisible"
|
|
:visible.sync="dialogVisible"
|
|
|
width="30%"
|
|
width="30%"
|
|
|
:before-close="handleClose"
|
|
:before-close="handleClose"
|
|
|
>
|
|
>
|
|
|
<div class="form">
|
|
<div class="form">
|
|
|
<el-form
|
|
<el-form
|
|
|
- label-width="77px"
|
|
|
|
|
|
|
+ label-width="120px"
|
|
|
:rules="rules"
|
|
:rules="rules"
|
|
|
:model="addForm"
|
|
:model="addForm"
|
|
|
ref="form"
|
|
ref="form"
|
|
|
class="ele-form-search"
|
|
class="ele-form-search"
|
|
|
>
|
|
>
|
|
|
- <el-form-item label="设备分类" label-width="100px" prop="id">
|
|
|
|
|
- <template>
|
|
|
|
|
- <el-select v-model="addForm.id" placeholder="请选择">
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in list"
|
|
|
|
|
- :label="item.name"
|
|
|
|
|
- :value="item.id"
|
|
|
|
|
- :key="item.id"
|
|
|
|
|
- >
|
|
|
|
|
- </el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </template>
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="componentsType == 'move'"
|
|
|
|
|
+ label="设备分类"
|
|
|
|
|
+ label-width="100px"
|
|
|
|
|
+ prop="id"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-select v-model="addForm.id" placeholder="请选择">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in list"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ v-if="componentsType == 'person'"
|
|
|
|
|
+ label="片区负责人部门"
|
|
|
|
|
+ prop="repairGroupId"
|
|
|
|
|
+ >
|
|
|
|
|
+ <DeptSelect v-model="addForm.repairGroupId" @input="getwhbm" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item v-if="componentsType == 'person'" label="片区负责人">
|
|
|
|
|
+ <el-select v-model="addForm.repairUserId" placeholder="请选择">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in personList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-option>
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
@@ -39,35 +60,68 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
- import { changeSubstanceCateId } from '@/api/ledgerAssets';
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ changeSubstanceCateId,
|
|
|
|
|
+ updateRepairUserAndGroup
|
|
|
|
|
+ } from '@/api/ledgerAssets';
|
|
|
import { getTreeByPid } from '@/api/classifyManage';
|
|
import { getTreeByPid } from '@/api/classifyManage';
|
|
|
|
|
+ import DeptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
|
|
+ import { getUserPage } from '@/api/system/organization';
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ components: { DeptSelect },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ componentsType: '',
|
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
|
addForm: {},
|
|
addForm: {},
|
|
|
loading: false,
|
|
loading: false,
|
|
|
checkoutArr: [],
|
|
checkoutArr: [],
|
|
|
rules: {
|
|
rules: {
|
|
|
- id: [{ required: true, message: '请选择设备分类', trigger: 'blur' }]
|
|
|
|
|
|
|
+ id: [{ required: true, message: '请选择设备分类', trigger: 'blur' }],
|
|
|
|
|
+ repairGroupId: [
|
|
|
|
|
+ { required: true, message: '请选择片区负责人部门', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
- list: []
|
|
|
|
|
|
|
+ list: [],
|
|
|
|
|
+ title: '',
|
|
|
|
|
+ personList: []
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ async getwhbm() {
|
|
|
|
|
+ if (!this.addForm.repairGroupId) return;
|
|
|
|
|
+ let data = await getUserPage({
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ size: 9999,
|
|
|
|
|
+ groupId: this.addForm.repairGroupId
|
|
|
|
|
+ });
|
|
|
|
|
+ this.personList = data.list;
|
|
|
|
|
+ },
|
|
|
submit() {
|
|
submit() {
|
|
|
this.$refs.form.validate(async (flag) => {
|
|
this.$refs.form.validate(async (flag) => {
|
|
|
if (flag) {
|
|
if (flag) {
|
|
|
try {
|
|
try {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- const paramsArr = this.checkoutArr.map((item) => {
|
|
|
|
|
- return { categoryLevelId: this.addForm.id, id: item.id };
|
|
|
|
|
- });
|
|
|
|
|
- console.log(paramsArr);
|
|
|
|
|
- const res = await changeSubstanceCateId(paramsArr);
|
|
|
|
|
|
|
+ if (this.componentsType == 'move') {
|
|
|
|
|
+ const paramsArr = this.checkoutArr.map((item) => {
|
|
|
|
|
+ return { categoryLevelId: this.addForm.id, id: item.id };
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log(paramsArr);
|
|
|
|
|
+ await changeSubstanceCateId(paramsArr);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const listId = this.checkoutArr.map((item) => {
|
|
|
|
|
+ return item.id;
|
|
|
|
|
+ });
|
|
|
|
|
+ const newObj = {
|
|
|
|
|
+ ...this.addForm,
|
|
|
|
|
+ id: listId
|
|
|
|
|
+ };
|
|
|
|
|
+ console.log(newObj);
|
|
|
|
|
+ await updateRepairUserAndGroup(newObj);
|
|
|
|
|
+ }
|
|
|
this.$message.success('成功!');
|
|
this.$message.success('成功!');
|
|
|
this.dialogVisible = false;
|
|
this.dialogVisible = false;
|
|
|
- this.$emit('success');
|
|
|
|
|
|
|
+ this.$emit('success', true);
|
|
|
} finally {
|
|
} finally {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
}
|
|
}
|
|
@@ -77,11 +131,17 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- open(arr, current) {
|
|
|
|
|
|
|
+ open(arr, current, type) {
|
|
|
this.addForm = {};
|
|
this.addForm = {};
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
|
|
|
+ this.componentsType = type;
|
|
|
this.checkoutArr = arr;
|
|
this.checkoutArr = arr;
|
|
|
- this.getTreeData(current);
|
|
|
|
|
|
|
+ if (type === 'move') {
|
|
|
|
|
+ this.getTreeData(current);
|
|
|
|
|
+ this.title = '移动到';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.title = '批量设置片区负责人';
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
async getTreeData(current) {
|
|
async getTreeData(current) {
|
|
|
const res = await getTreeByPid(4);
|
|
const res = await getTreeByPid(4);
|