Commit ba2af229 authored by 赵啸非's avatar 赵啸非

Merge remote-tracking branch 'origin/master'

parents 9f9ab895 a1dd531d
...@@ -367,7 +367,7 @@ export default { ...@@ -367,7 +367,7 @@ export default {
width: 100, width: 100,
formatter: (row) => { formatter: (row) => {
if (row.check) { if (row.check) {
return <span style="cursor:pointer;color:#ff0000">不选择</span>; return <span style="cursor:pointer;color:#ff0000">已选中</span>;
} else { } else {
return <span style="cursor:pointer;color:#1890ff">选择</span>; return <span style="cursor:pointer;color:#1890ff">选择</span>;
} }
......
...@@ -407,7 +407,7 @@ export default { ...@@ -407,7 +407,7 @@ export default {
width: 100, width: 100,
formatter: (row) => { formatter: (row) => {
if (row.check) { if (row.check) {
return <span style="cursor:pointer;color:#ff0000">不选择</span>; return <span style="cursor:pointer;color:#ff0000">已选中</span>;
} else { } else {
return <span style="cursor:pointer;color:#1890ff">选择</span>; return <span style="cursor:pointer;color:#1890ff">选择</span>;
} }
......
...@@ -193,7 +193,7 @@ export default { ...@@ -193,7 +193,7 @@ export default {
width: 100, width: 100,
formatter: (row) => { formatter: (row) => {
if (row.check) { if (row.check) {
return <span style="cursor:pointer;color:#ff0000">不选择</span>; return <span style="cursor:pointer;color:#ff0000">已选中</span>;
} else { } else {
return <span style="cursor:pointer;color:#1890ff">选择</span>; return <span style="cursor:pointer;color:#1890ff">选择</span>;
} }
......
<template> <template>
<!-- 弹出框表单 --> <!-- 弹出框表单 -->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body> <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<Field label="姓名" prop="name" v-model="form.name" placeholder="请输入姓名" :maxLength="20"/> <Field
<Field label="电话号码" prop="phone" v-model="form.phone" placeholder="请输入电话号码" :maxLength="11"/> label="姓名"
<Field label="工号" prop="number" v-model="form.number" placeholder="请输入工号" :maxLength="15"/> prop="name"
</el-row> v-model="form.name"
placeholder="请输入姓名"
:maxLength="20"
/>
<Field
label="电话号码"
prop="phone"
v-model="form.phone"
placeholder="请输入电话号码"
:maxLength="11"
/>
<Field
label="工号"
prop="number"
v-model="form.number"
placeholder="请输入工号"
:maxLength="15"
/>
</el-row>
<el-form-item label="所属部门" prop="deptId"> <el-form-item label="所属部门" prop="deptId">
<el-cascader v-model="deptList" style="width:50%" @change="cascaderChange" :options="dict.deptId" clearable <el-cascader
:props="{label:'label',value:'id'}"> v-model="deptList"
</el-cascader> style="width:50%"
</el-form-item> @change="cascaderChange"
:options="dict.deptId"
clearable
:props="{ label: 'label', value: 'id' }"
>
</el-cascader>
</el-form-item>
<el-form-item label="照片" prop="photoPath"> <el-form-item label="照片" prop="photoPath">
<ImageUpload :value="form.photoPath" <ImageUpload
@input="replaceImage"></ImageUpload> :value="form.photoPath"
</el-form-item> @input="replaceImage"
</el-form> ></ImageUpload>
<div slot="footer" class="dialog-footer"> </el-form-item>
<el-button type="primary" v-if="pageInfo.type !== 'view'" @click="submitForm">确 定</el-button> </el-form>
<el-button @click="cancel">取 消</el-button> <div slot="footer" class="dialog-footer">
</div> <el-button
</el-dialog> type="primary"
v-if="pageInfo.type !== 'view'"
@click="submitForm"
>确 定</el-button
>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</template> </template>
<script> <script>
import form from "@/assets/mixins/formdialog"; import form from "@/assets/mixins/formdialog";
import dialogShow from "./dialogshow"; import dialogShow from "./dialogshow";
import {findParentIds} from "@/assets/utils/common.js" import { findParentIds } from "@/assets/utils/common.js";
export default { export default {
mixins: [form], mixins: [form],
components: { components: {
dialogShow , dialogShow,
}, },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 弹出层标题 // 弹出层标题
title: "工作人员", title: "工作人员",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
toString:[ toString: [],
], // 表单校验
// 表单校验 rules: {
rules: { name: [
name: [ { required: true, message: "请输入姓名", trigger: "blur" },
{required: true,message: "请输入姓名", trigger: "blur" }, { max: 20, message: "最多只能录入20个字符", trigger: "blur" },
{max: 20,message: "最多只能录入20个字符",trigger: "blur",}, ],
], phone: [
phone: [ { required: true, message: "请输入电话号码", trigger: "blur" },
{required: true,message: "请输入电话号码", trigger: "blur" }, { max: 11, message: "最多只能录入个字符", trigger: "blur" },
{max: 11,message: "最多只能录入个字符",trigger: "blur",}, ],
] },
}, deptList: [],
deptList:[] };
} },
}, methods: {
methods: { // formSelect(){
// formSelect(){ // let treeId = getTreeIds(this.dict.deptId,this.form.deptId)
// let treeId = getTreeIds(this.dict.deptId,this.form.deptId) // },
// }, cascaderChange(val) {
cascaderChange(val){ if (this.deptList.length > 0) {
if(this.deptList.length > 0){ this.form.deptId = this.deptList[this.deptList.length - 1];
this.form.deptId = this.deptList[this.deptList.length - 1] } else {
}else{ this.form.deptId = "";
this.form.deptId = '' }
} console.log(this.form.deptId, "当前选择");
console.log(this.form.deptId,'当前选择') },
}, replaceImage(val) {
replaceImage(val){ this.form.photoPath = val;
this.form.photoPath = val },
}, /** 编辑 */
/** 编辑 */ edit(row) {
edit(row) { this.reset();
this.reset() this.query = { id: row.id };
this.query = { id: row.id }; this.urls.currUrl = "workman/edit";
this.urls.currUrl ="workman/edit"; this.getData();
this.getData(); this.pageInfo.type = "edit";
this.pageInfo.type="edit" this.title = "编辑";
this.title = "编辑"; },
}, /** 新增 */
/** 新增 */ add(row) {
add(row) { this.reset();
this.reset() this.urls.currUrl = "workman/add";
this.urls.currUrl = "workman/add"; this.getData();
this.getData(); this.pageInfo.type = "add";
this.pageInfo.type="add" this.title = "新增";
this.title = "新增"; },
/** 查看*/
view(row) {
this.reset();
this.query = { id: row.id };
this.urls.currUrl = "workman/view";
this.getData();
this.pageInfo.type = "view";
this.title = "工作人员详细";
},
/**取消按钮 */
cancel() {
this.open = false;
this.deptList = [];
},
}, /**获取数据后弹框 */
/** 查看*/ afterRender(data) {
view(row) { this.open = true;
this.reset() this.deptList = findParentIds(
this.query = { id: row.id }; this.dict.deptId,
this.urls.currUrl ="workman/view"; this.form.deptId
this.getData(); ).reverse();
this.pageInfo.type="view" this.deptList = this.deptList.concat(this.form.deptId);
this.title = "工作人员详细"; console.log(this.deptList, "ddd");
}, },
/**取消按钮 */
cancel() {
this.open = false;
this.deptList = []
},
/**获取数据后弹框 */ afterSubmit(data) {
afterRender(data) { this.open = false;
this.open = true; this.reset();
this.deptList = findParentIds(this.dict.deptId,this.form.deptId).reverse() this.deptList = [];
this.deptList = this.deptList.concat(this.form.deptId) this.$emit("ok");
console.log(this.deptList,'ddd') },
},
afterSubmit(data) { // 表单重置
this.open = false; reset() {
this.reset() this.form = {
this.deptList = [] deptId: 0,
this.$emit("ok"); name: "",
}, number: "",
phone: "",
// 表单重置 photoPath: "",
reset() { };
this.form = { this.resetForm("form");
deptId : 0, },
name : "", resetForm(refName) {
number : "", if (this.$refs[refName]) {
phone : "", this.$refs[refName].resetFields();
photoPath : "", }
}; },
this.resetForm("form"); },
}, };
resetForm(refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
}
}
}
}
</script> </script>
<style scoped> <style scoped>
.avatar-uploader .el-upload { .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.avatar-uploader .el-upload:hover { .avatar-uploader .el-upload:hover {
border-color: #409EFF; border-color: #409eff;
} }
.avatar-uploader-icon { .avatar-uploader-icon {
font-size: 28px; font-size: 28px;
color: #8c939d; color: #8c939d;
width: 178px; width: 178px;
height: 178px; height: 178px;
line-height: 178px; line-height: 178px;
text-align: center; text-align: center;
} }
.avatar { .avatar {
width: 178px; width: 178px;
height: 178px; height: 178px;
display: block; display: block;
} }
</style> </style>
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