Commit 985533a1 by zhaopanyu

zpy 8.16

parent 87ed926a
......@@ -81,9 +81,13 @@
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="管理员" prop="admin">
<el-input v-model="selectedAdmin.admin" placeholder="请选择管理员" @focus="selectChange"
style="width: 100%"></el-input>
<el-form-item label="管理员" prop="adminId">
<el-select v-model="postForm.adminId" filterable placeholder="请选择管理员" clearable
style="width: 100%;">
<el-option v-for="(item, index) in adminUser" :key="index" :label="item.admin"
:value="item.adminId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
......@@ -93,32 +97,7 @@
<el-button @click="cancel"> 取 消 </el-button>
</div>
</el-dialog>
<!-- 选择管理员弹出框 -->
<el-dialog :title="title" :visible.sync="workableVehicle" width="500px" append-to-body>
<el-form :model="queryVehicleForm" inline @submit.native.prevent>
<el-form-item label="管理员" prop="admin">
<el-input v-model="queryVehicleForm.adminId" placeholder="请输入管理员"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQueryVehicle">搜索
</el-button>
<el-button plain size="small" icon="el-icon-refresh" @click="resetQueryVehicle">重置
</el-button>
</el-form-item>
</el-form>
<el-table :data="vehicleList" max-height="350" ref="vehicleSelectTable" @row-click="rowClick"
@selection-change="selectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="管理员" align="center" prop="admin">
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="abolish" :disabled="!multi">确 定</el-button>
<el-button @click="abolish">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -142,19 +121,6 @@ export default {
dicts: ["vehicle_type", "vehicle_state"],
data() {
return {
// 管理员列表总数
NaN: 0,
// 可选管理员列表
vehicleList: [],
// 管理员列表
queryVehicleForm: {
admin: '',
adminId: '',
},
//父设备分类下拉框
deptOptions: [],
// 是否显示选择管理员弹出层
workableVehicle: false,
// 是否禁用输入框
isDisabled: false,
queryForm: {
......@@ -175,6 +141,7 @@ export default {
parentId: undefined,
equipmentType: '',
model: '',
admin: '',
adminId: '',
orderNum: '',
},
......@@ -194,12 +161,11 @@ export default {
classificationCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }],
equipmentType: [{ required: true, message: '设备分类不能为空', trigger: 'blur' }],
orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
adminId: [{ required: true, message: '管理员不能为空', trigger: 'blur' }],
},
//管理员
selectedAdmin: {
admin: '',
adminId: '',
}
adminUser: [],
}
},
......@@ -207,6 +173,8 @@ export default {
created() {
this.getList();
this.enuqLeader();
this.getAdminUserList();
},
methods: {
......@@ -219,62 +187,7 @@ export default {
this.loading = false;
})
},
// 选择管理员对话框选中数据
selectionChange(selection) {
this.selectedAdmin = selection[0];
console.log('this.selectedAdmin', this.selectedAdmin);
this.multi = selection.length === 1;
},
// 可选管理员取消按钮
abolish() {
this.workableVehicle = false;
this.$nextTick(() => {
this.$refs.postForm.validateField('admin');
})
},
// 列表查询管理员列表
getVehicleList() {
this.vehicleLoading = true;
console.log('this.queryVehicleForm', this.queryVehicleForm)
getAdmin(this.queryVehicleForm).then(response => {
this.vehicleLoading = false;
this.vehicleList = response.data;
console.log('this.vehicleList', this.vehicleList);
this.NaN = response.NaN;
}).catch(err => {
this.vehicleLoading = false;
})
},
rowClick(row) {
this.$refs.vehicleSelectTable.clearSelection();
this.$refs.vehicleSelectTable.toggleRowSelection(row, true);
},
// 查询管理员列表
handleQueryVehicle() {
this.throttle(() => {
this.getVehicleList();
})
},
// 重置管理员列表查询
resetQueryVehicle() {
this.queryVehicleForm = {
pageNum: 1,
pageSize: 8,
admin: ''
};
this.handleQueryVehicle();
},
// 弹出选择管理员对话框
selectChange() {
this.workableVehicle = true;
this.handleQueryVehicle();
},
// 展开/折叠
toggleExpandAll() {
......@@ -284,14 +197,19 @@ export default {
this.refreshTable = true;
});
},
//获取管理员人列表
getAdminUserList() {
getAdmin().then(res => {
if (res.code == 200) {
this.adminUser = res.data
console.log(this.adminUser);
}
})
},
// 新增
handleAdd(row) {
this.reset();
this.selectedAdmin.admin = null;
this.queryVehicleForm.adminId = null;
this.open = true;
this.getList();
if (row != null && row.id) {
......@@ -319,7 +237,7 @@ export default {
getProductCategory().then(((res) => {
if (res.code == 200) {
this.sbflOptions = res.data;
console.log('this.sbflOptions', this.sbflOptions);
// console.log('this.sbflOptions', this.sbflOptions);
}
}))
......@@ -329,7 +247,8 @@ export default {
this.reset();
queryProduct(row.id).then(response => {
this.postForm = response.data;
this.selectedAdmin.admin = response.data.admin;
this.getAdminUserList();
console.log('this.postForm修改', this.postForm);
this.open = true;
this.title = "修改资产信息";
});
......@@ -343,6 +262,7 @@ export default {
return deleteProduct(row.id);
}).then(() => {
this.getList();
this.enuqLeader();
this.loading = false;
this.$modal.msgSuccess("删除成功");
}).catch(() => {
......@@ -351,22 +271,31 @@ export default {
},
// 确定
submitForm() {
this.postForm.adminId = this.selectedAdmin.adminId;
console.log('this.postForm', this.postForm);
const adminId = this.postForm.adminId
this.postForm.admin = adminId == '' ? '' : this.adminUser.find(item => item.adminId == adminId).admin
this.$refs["postForm"].validate(valid => {
if (valid) {
if (this.postForm.id != null) {
editProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.enuqLeader();
});
} else {
addProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
// if (this.postForm.parentId === 0) {
// console.log(1111, this.postForm.parentId);
// }
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.enuqLeader();
});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment