|
|
|
@ -1,62 +1,47 @@ |
|
|
|
<template> |
|
|
|
<div style="display: flex"> |
|
|
|
<div :style="'margin-left: 5px;width:' + (window.pageWidth - 200 - 120 - 25) + 'px;'"> |
|
|
|
<div :style="'margin-left: 5px;width:' + (window.pageWidth - 200 - 110 - 20) + 'px;'"> |
|
|
|
<!--overflow-y: scroll;height:200px;--> |
|
|
|
<el-form ref="form" :model="form" label-width="85px" :rules="rules" size="medium"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="上级单位" prop="parentId"> |
|
|
|
<el-cascader v-model="form.parentId" :options="customerOrg.customerOrgTree" |
|
|
|
:props="{checkStrictly: true,expandTrigger: 'hover',...customerOrg.treeprops,}" |
|
|
|
:props="{ checkStrictly: true, expandTrigger: 'hover', ...customerOrg.treeprops, }" |
|
|
|
:show-all-levels="false" clearable filterable disabled |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 600) / 3) + 'px;'"> |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'"> |
|
|
|
</el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="单位名称" prop="displayName"> |
|
|
|
<el-input class="enterToTab" v-model="form.displayName" placeholder="请输入单位名称" :disabled="customerOrg.oprStatus ? false:true"/> |
|
|
|
<el-input class="enterToTab" v-model="form.displayName" placeholder="请输入单位名称" |
|
|
|
:disabled="customerOrg.oprStatus ? false : true" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="单位简称" prop="shortName"> |
|
|
|
<el-input class="enterToTab" v-model="form.shortName" placeholder="请输入单位简称" :disabled="customerOrg.oprStatus ? false:true"/> |
|
|
|
<el-input class="enterToTab" v-model="form.shortName" placeholder="请输入单位简称" |
|
|
|
:disabled="customerOrg.oprStatus ? false : true" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="体检中心" prop="organizationUnitId"> |
|
|
|
<el-select |
|
|
|
v-model="form.organizationUnitId" |
|
|
|
placeholder="请选择" |
|
|
|
filterable |
|
|
|
:disabled="peisid ? true : false" |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 600) / 3) + 'px;'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in data.organizationdata" |
|
|
|
:key="item.id" |
|
|
|
:label="item.displayName" |
|
|
|
:value="item.id" |
|
|
|
/> |
|
|
|
<el-select v-model="form.organizationUnitId" placeholder="请选择" filterable :disabled="peisid ? true : false" |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'"> |
|
|
|
<el-option v-for="item in data.organizationdata" :key="item.id" :label="item.displayName" |
|
|
|
:value="item.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="单位性质" prop="orgTypeId"> |
|
|
|
<el-select class="enterToTab" |
|
|
|
v-model="form.orgTypeId" |
|
|
|
placeholder="请选择" |
|
|
|
filterable |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 600) / 3) + 'px;'" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in data.customerOrgType" |
|
|
|
:key="item.id" |
|
|
|
:label="item.displayName" |
|
|
|
:value="item.id" |
|
|
|
/> |
|
|
|
<el-select class="enterToTab" v-model="form.orgTypeId" placeholder="请选择" filterable |
|
|
|
:style="'width:' + Math.floor((window.pageWidth - 585) / 3) + 'px;'"> |
|
|
|
<el-option v-for="item in data.customerOrgType" :key="item.id" :label="item.displayName" |
|
|
|
:value="item.id" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
@ -130,12 +115,7 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="地址" prop="address"> |
|
|
|
<el-input class="enterToTab" |
|
|
|
v-model="form.address" |
|
|
|
placeholder="请输入地址" |
|
|
|
maxlength="50" |
|
|
|
show-word-limit |
|
|
|
/> |
|
|
|
<el-input class="enterToTab" v-model="form.address" placeholder="请输入地址" maxlength="50" show-word-limit /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
@ -152,13 +132,7 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="7"> |
|
|
|
<el-form-item label="创建时间"> |
|
|
|
<el-date-picker |
|
|
|
v-model="form.creationTime" |
|
|
|
type="datetime" |
|
|
|
size="small" |
|
|
|
style="width: 100%" |
|
|
|
disabled |
|
|
|
/> |
|
|
|
<el-date-picker v-model="form.creationTime" type="datetime" size="small" style="width: 100%" disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="5"> |
|
|
|
@ -168,13 +142,8 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="7"> |
|
|
|
<el-form-item label="修改时间"> |
|
|
|
<el-date-picker |
|
|
|
v-model="form.lastModificationTime" |
|
|
|
type="datetime" |
|
|
|
size="small" |
|
|
|
style="width: 100%" |
|
|
|
disabled |
|
|
|
/> |
|
|
|
<el-date-picker v-model="form.lastModificationTime" type="datetime" size="small" style="width: 100%" |
|
|
|
disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -182,22 +151,17 @@ |
|
|
|
</div> |
|
|
|
<!-- 按钮区域 --> |
|
|
|
<div style="width: 110px; margin-left: 10px; margin-top: 3%"> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs,'新增单位')" class="btnList"> |
|
|
|
<el-button type="primary" @click="add('form', '')" class="commonbutton" |
|
|
|
>新增单位</el-button |
|
|
|
> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs, '新增单位')" class="btnList"> |
|
|
|
<el-button type="primary" @click="btnAdd('form', '')" class="commonbutton">新增单位</el-button> |
|
|
|
</div> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs,'新增子单位')" class="btnList"> |
|
|
|
<el-button type="primary" @click="add('form', 'child')" class="commonbutton" |
|
|
|
>新增子单位</el-button |
|
|
|
> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs, '新增子单位')" class="btnList"> |
|
|
|
<el-button type="primary" @click="btnAdd('form', 'child')" class="commonbutton">新增子单位</el-button> |
|
|
|
</div> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs,'保存')" class="btnList"> |
|
|
|
<el-button type="success" @click="btnSubmit('form')" class="commonbutton" |
|
|
|
><i class="el-icon-check"></i>保存</el-button |
|
|
|
> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs, '保存')" class="btnList"> |
|
|
|
<el-button type="success" @click="btnSubmit('form')" class="commonbutton"><i |
|
|
|
class="el-icon-check"></i>保存</el-button> |
|
|
|
</div> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs,'删除')" class="btnList"> |
|
|
|
<div v-show="checkPagePriv(pagePriv.privs, '删除')" class="btnList"> |
|
|
|
<el-button type="danger" @click="del('form')" class="commonbutton"> |
|
|
|
<i class="el-icon-delete"></i>删除 |
|
|
|
</el-button> |
|
|
|
@ -208,7 +172,7 @@ |
|
|
|
<script> |
|
|
|
import { mapState, mapMutations } from "vuex"; |
|
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
|
import { getPagePriv,checkPagePriv,tcdate, objCopy, deepCopy, arrayExistObj } from "../../utlis/proFunc"; |
|
|
|
import { getPagePriv, checkPagePriv, tcdate, objCopy, deepCopy, arrayExistObj } from "../../utlis/proFunc"; |
|
|
|
import { getTreeNode, getTreePids } from "../../utlis/tree"; |
|
|
|
|
|
|
|
export default { |
|
|
|
@ -216,9 +180,9 @@ export default { |
|
|
|
props: ["id"], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
pagePriv:{ |
|
|
|
routeUrlorPageName:'customerOrg', //当前页面归属路由或归属页面权限名称 |
|
|
|
privs:[] // 页面权限 |
|
|
|
pagePriv: { |
|
|
|
routeUrlorPageName: 'customerOrg', //当前页面归属路由或归属页面权限名称 |
|
|
|
privs: [] // 页面权限 |
|
|
|
}, |
|
|
|
isActiveBox: false, |
|
|
|
customerOrgEditStyle: "height:400px;", |
|
|
|
@ -252,15 +216,15 @@ export default { |
|
|
|
lastModifierName: "", |
|
|
|
lastModificationTime: null, |
|
|
|
}, //初始化 单位 记录 目前新增与更新是一致 |
|
|
|
|
|
|
|
formInit: {}, |
|
|
|
rules: { |
|
|
|
displayName: [{ required: true, message: "请输入单位名称", trigger: "blur" }], |
|
|
|
shortName: [{ required: true, message: "请输入单位简写", trigger: "blur" }], |
|
|
|
orgTypeId: [{ required: true, message: "请输入单位性质", trigger: "blur" }], |
|
|
|
organizationUnitId: [ |
|
|
|
{ required: true, message: "请输入体检中心", trigger: "blur" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
|
|
|
|
isshow: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
@ -268,12 +232,13 @@ export default { |
|
|
|
created() { |
|
|
|
//获取用户当前页面的权限 |
|
|
|
let userPriv = window.sessionStorage.getItem('userPriv') |
|
|
|
if(userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)) |
|
|
|
if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)) |
|
|
|
|
|
|
|
this.peisid = window.sessionStorage.getItem("peisid"); |
|
|
|
if (!this.form.id) { |
|
|
|
this.form.organizationUnitId = this.peisid; |
|
|
|
} |
|
|
|
this.formInit = deepCopy(this.form) |
|
|
|
}, |
|
|
|
|
|
|
|
//挂载完成 |
|
|
|
@ -281,22 +246,17 @@ export default { |
|
|
|
// 表单中 回车 代替 tab |
|
|
|
this.enterToTab(); |
|
|
|
|
|
|
|
//获取体中心字典数据 |
|
|
|
this.getoraniztion(); |
|
|
|
|
|
|
|
//获取单位类别列表 |
|
|
|
this.getOrgType(); |
|
|
|
|
|
|
|
this.getCustomerOrgRd(this.id); |
|
|
|
|
|
|
|
// 初始化 字典数据 |
|
|
|
this.dictInit() |
|
|
|
|
|
|
|
this.getCustomerOrgRd(this.dataTransOpts.tableS.customer_org.id); |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
...mapState(["customerOrg", "window"]), |
|
|
|
...mapState(["customerOrg", "window", "dataTransOpts"]), |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapMutations(["setData"]),checkPagePriv, |
|
|
|
...mapMutations(["setData"]), checkPagePriv, |
|
|
|
|
|
|
|
changeBox(type) { |
|
|
|
//赋值 |
|
|
|
@ -309,9 +269,13 @@ export default { |
|
|
|
|
|
|
|
//获取单位信息 |
|
|
|
getCustomerOrgRd(id) { |
|
|
|
if (!id) return; |
|
|
|
if (!id){ |
|
|
|
this.form = deepCopy(this.formInit) |
|
|
|
return; |
|
|
|
} |
|
|
|
getapi(`/api/app/customer-org/${id}`).then((res) => { |
|
|
|
if (res.code != -1) { |
|
|
|
this.dataTransOpts.tableS.customer_org.id = res.data.id |
|
|
|
objCopy(res.data, this.form); |
|
|
|
|
|
|
|
if (res.data.isActive == "Y") { |
|
|
|
@ -328,15 +292,14 @@ export default { |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 初始化 字典数据 |
|
|
|
dictInit() { |
|
|
|
//获取组织体检中心数据 |
|
|
|
getoraniztion() { |
|
|
|
getapi("/api/app/organization-units/organization-unit-by-is-peis").then((res) => { |
|
|
|
this.data.organizationdata = res.data; |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//获取单位类别列表 |
|
|
|
getOrgType() { |
|
|
|
getapi("/api/app/customer-org-type/in-filter").then((res) => { |
|
|
|
this.data.customerOrgType = res.data.items; |
|
|
|
}); |
|
|
|
@ -359,7 +322,7 @@ export default { |
|
|
|
}; |
|
|
|
|
|
|
|
if (body.parentId) { |
|
|
|
let pNode = getTreeNode(this.customerOrg.customerOrgTree,"treeChildren","id",body.parentId); |
|
|
|
let pNode = getTreeNode(this.customerOrg.customerOrgTree, "treeChildren", "id", body.parentId); |
|
|
|
if (!pNode.treeChildren) this.$set(pNode, 'treeChildren', []); |
|
|
|
//pNode.treeChildren = [] |
|
|
|
pNode.treeChildren.push(node); |
|
|
|
@ -368,7 +331,7 @@ export default { |
|
|
|
this.customerOrg.customerOrgTree.push(node); |
|
|
|
} |
|
|
|
this.customerOrg.defaultExpandedKeys = [] |
|
|
|
if(body.parentId){ |
|
|
|
if (body.parentId) { |
|
|
|
this.customerOrg.defaultExpandedKeys.push(body.parentId) |
|
|
|
} |
|
|
|
this.customerOrg.defaultExpandedKeys.push(body.id) |
|
|
|
@ -402,7 +365,7 @@ export default { |
|
|
|
body |
|
|
|
); |
|
|
|
//tree, childNodeName, pidName, idName, idVal getTreeNode(this.customerOrg.customerOrgTree, "treeChildren", "id", body); |
|
|
|
console.log('pids',pids,body) |
|
|
|
console.log('pids', pids, body) |
|
|
|
if (!pids || pids.length < 2) { |
|
|
|
lfind = arrayExistObj(this.customerOrg.customerOrgTree, "id", body); |
|
|
|
if (lfind > -1) this.customerOrg.customerOrgTree.splice(lfind, 1); |
|
|
|
@ -423,8 +386,8 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
onkeyup(e){ |
|
|
|
console.log('onkeyup e',e) |
|
|
|
onkeyup(e) { |
|
|
|
console.log('onkeyup e', e) |
|
|
|
}, |
|
|
|
|
|
|
|
//提交 |
|
|
|
@ -486,45 +449,42 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
//新增弹框 |
|
|
|
async add(formName, child) { |
|
|
|
async btnAdd(formName, child) { |
|
|
|
await this.$refs[formName].resetFields(); |
|
|
|
//console.log('this.peisid',this.peisid) |
|
|
|
if(!this.peisid || this.peisid == 'null'){ |
|
|
|
if (!this.peisid || this.peisid == 'null') { |
|
|
|
this.$message.warning("该用户未选归属体检中心,不能执行此操作!"); |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
this.form = deepCopy(this.formInit) |
|
|
|
if (child) { |
|
|
|
if (!this.customerOrg.customerOrgId) { |
|
|
|
if (!this.dataTransOpts.tableS.customer_org.id) { |
|
|
|
this.$message.warning("请先选择上级单位"); |
|
|
|
this.customerOrg.oprStatus = '' |
|
|
|
return; |
|
|
|
} |
|
|
|
this.customerOrg.customerOrgRd.id = ""; |
|
|
|
this.customerOrg.customerOrgRd = { |
|
|
|
id: "", |
|
|
|
isLock: "N", |
|
|
|
isActive: "Y", |
|
|
|
parentId: this.customerOrg.customerOrgId, |
|
|
|
}; |
|
|
|
this.form.parentId = this.dataTransOpts.tableS.customer_org.id |
|
|
|
} else { |
|
|
|
this.customerOrg.customerOrgRd = { |
|
|
|
id: "", |
|
|
|
isLock: "N", |
|
|
|
isActive: "Y", |
|
|
|
parentId: null, |
|
|
|
}; |
|
|
|
// 新增一级单位时,清除 vuex 一级单位ID |
|
|
|
this.dataTransOpts.tableS.customer_org.parent_id = '' |
|
|
|
} |
|
|
|
this.customerOrg.oprStatus = 'add' |
|
|
|
// this.customerOrg.customerOrgId = ""; |
|
|
|
|
|
|
|
this.dataTransOpts.tableS.customer_org.id = '' |
|
|
|
setTimeout(() => { |
|
|
|
this.dataTransOpts.refresh.customer_org_register.M++ |
|
|
|
this.dataTransOpts.refresh.contact_person.M++ |
|
|
|
}, 20); |
|
|
|
|
|
|
|
objCopy(this.customerOrg.customerOrgRd, this.form); |
|
|
|
this.customerOrg.customerOrgId = ""; |
|
|
|
}, |
|
|
|
|
|
|
|
//删除 |
|
|
|
del(formName) { |
|
|
|
if(!this.customerOrg.customerOrgRd.id){ |
|
|
|
if (!this.customerOrg.customerOrgRd.id) { |
|
|
|
this.$message.warning("请先选中要删除的节点") |
|
|
|
return |
|
|
|
} |
|
|
|
@ -565,7 +525,7 @@ export default { |
|
|
|
let inputs = document.querySelectorAll("form input"); //用数组可以读取多个标签的元素 //.inline-input |
|
|
|
//console.log('inputs',inputs); |
|
|
|
// 为每个输入框添加键盘事件监听器 |
|
|
|
inputs.forEach((input,i) => { |
|
|
|
inputs.forEach((input, i) => { |
|
|
|
|
|
|
|
input.addEventListener('keydown', (event) => { |
|
|
|
|
|
|
|
@ -577,8 +537,8 @@ export default { |
|
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
// 跳至下一个输入框 |
|
|
|
for(let j=i+1; j<inputs.length;j++){ |
|
|
|
if(inputs[j].getAttribute('disabled') != "disabled" ){ |
|
|
|
for (let j = i + 1; j < inputs.length; j++) { |
|
|
|
if (inputs[j].getAttribute('disabled') != "disabled") { |
|
|
|
inputs[j].focus(); |
|
|
|
break; |
|
|
|
} |
|
|
|
@ -591,10 +551,12 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
watch: { |
|
|
|
id(newVal, oldVal) { |
|
|
|
console.log("watch getCustomerOrgRd ", newVal, oldVal); |
|
|
|
if (newVal != oldVal && newVal != "") { |
|
|
|
this.getCustomerOrgRd(newVal); |
|
|
|
// 单位id未变时,强制刷新 |
|
|
|
"dataTransOpts.refresh.customer_org.S": { |
|
|
|
// immediate: true, |
|
|
|
handler(newVal, oldVal) { |
|
|
|
console.log(`watch 体检单位 newVal:${newVal} oldVal:${oldVal} customerOrgId: ${this.dataTransOpts.tableS.customer_org.id}`); |
|
|
|
this.getCustomerOrgRd(this.dataTransOpts.tableS.customer_org.id); |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|