修改默认值问题

master
CJYXTX\27961 7 months ago
parent 54a8ae8754
commit 6ca355024e

@ -63,4 +63,7 @@ public class HousingEstateEntity {
private Integer deleteMark; private Integer deleteMark;
@TableField("F_TENANT_ID") @TableField("F_TENANT_ID")
private String tenantId; private String tenantId;
@TableField(value = "ENTERPRISE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String enterpriseId;
} }

@ -47,4 +47,8 @@ public class HousingEstateForm {
/** 来源 **/ /** 来源 **/
@JsonProperty("sourceType") @JsonProperty("sourceType")
private Object sourceType; private Object sourceType;
/** 企业 **/
@JsonProperty("enterpriseId")
private Object enterpriseId;
} }

@ -76,7 +76,7 @@
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <!-- <el-col :span="8">
<jnpf-form-tip-item label="回收站名称" prop="stationName"> <jnpf-form-tip-item label="回收站名称" prop="stationName">
<JnpfInput <JnpfInput
v-model="dataForm.stationName" v-model="dataForm.stationName"
@ -87,10 +87,11 @@
> >
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col> -->
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="企业公司" prop="enterpriseId"> <!-- {{ this.$store.getters.userInfo.organizeId }} -->
<jnpf-form-tip-item label="所属商户" prop="enterpriseId">
<JnpfDepSelect <JnpfDepSelect
v-model="dataForm.enterpriseId" v-model="dataForm.enterpriseId"
@change="changeData('enterpriseId', -1)" @change="changeData('enterpriseId', -1)"
@ -98,12 +99,29 @@
selectType="all" selectType="all"
:ableIds="ableAll.enterpriseIdableIds" :ableIds="ableAll.enterpriseIdableIds"
clearable clearable
disabled="true"
:style="{ width: '100%' }" :style="{ width: '100%' }"
> >
</JnpfDepSelect> </JnpfDepSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<!-- <el-col :span="8">
<jnpf-form-tip-item label="所属商户" prop="enterpriseId">
<JnpfOrganizeSelect
v-model="dataForm.enterpriseId"
@change="changeData('enterpriseId', -1)"
placeholder="请选择"
selectType="all"
:ableIds="ableAll.enterpriseIdableIds"
disabled
clearable
:style="{ width: '100%' }"
>
</JnpfOrganizeSelect>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item <jnpf-form-tip-item
class="site-item" class="site-item"
@ -281,87 +299,6 @@
</JnpfTextarea> </JnpfTextarea>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<!-- <el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>价格配置</h2>
</div>
<el-table :data="dataForm.recycleStationPriceList" size="mini">
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column label="回收类目" prop="recycleTypeId">
<template slot="header" v-if="false">
<span class="required-sign">*</span>回收类目
</template>
<template slot-scope="scope">
<JnpfSelect
v-model="scope.row.recycleTypeId"
@change="
changeData(
'recyclestationprice-recycleTypeId',
scope.$index
)
"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="recyclestationpricerecycleTypeIdOptions"
:props="recyclestationpricerecycleTypeIdProps"
>
</JnpfSelect>
</template>
</el-table-column>
<el-table-column label="单价(kg)" prop="unitPrice">
<template slot="header" v-if="false">
<span class="required-sign">*</span>单价(kg)
</template>
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.unitPrice"
@change="
changeData(
'recyclestationprice-unitPrice',
scope.$index
)
"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
class="JNPF-table-delBtn"
@click="delrecycleStationPriceList(scope.$index)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<div
class="table-actions"
@click="addrecycleStationPriceList()"
>
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col> -->
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item> <jnpf-form-tip-item>
@ -656,7 +593,7 @@ export default {
Vmodel: "", Vmodel: "",
currVmodel: "", currVmodel: "",
dataForm: { dataForm: {
enterpriseId: [], enterpriseId: undefined,
stationCode: undefined, stationCode: undefined,
stationName: undefined, stationName: undefined,
address: undefined, // address: undefined, //
@ -1096,7 +1033,10 @@ export default {
this.dataForm.enterpriseId = this.userInfo.organizeIdList; this.dataForm.enterpriseId = this.userInfo.organizeIdList;
} }
this.dataForm.firstContactPerson = this.userInfo.userId; this.dataForm.firstContactPerson = this.userInfo.userId;
if(this.$store.getters.userInfo.organizeId && this.$store.getters.userInfo.organizeId != null){ if (
this.$store.getters.userInfo.organizeId &&
this.$store.getters.userInfo.organizeId != null
) {
this.dataForm.enterpriseId = this.$store.getters.userInfo.organizeId; this.dataForm.enterpriseId = this.$store.getters.userInfo.organizeId;
} }
}, },

@ -762,6 +762,7 @@ export default {
addOrUpdateHandle(row, isDetail) { addOrUpdateHandle(row, isDetail) {
let id = row ? row.id : ""; let id = row ? row.id : "";
this.formVisible = true; this.formVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list); this.$refs.JNPFForm.init(id, isDetail, this.list);
}); });

@ -5,34 +5,60 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="JNPF-preview-main"> <div class="JNPF-preview-main">
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建':'编辑'" /> <el-page-header
@back="goBack"
:content="!dataForm.id ? '新建' : '编辑'"
/>
<div class="options"> <div class="options">
<el-dropdown class="dropdown" placement="bottom"> <el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px"> <el-button style="width: 70px">
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id"> <template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'> <el-dropdown-item @click.native="prev" :disabled="prevDis">
{{'上一条'}} {{ "上一条" }}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'> <el-dropdown-item @click.native="next" :disabled="nextDis">
{{'下一条'}} {{ "下一条" }}
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" <el-dropdown-item
:loading="continueBtnLoading" :disabled='btnLoading'> type="primary"
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-dropdown-item> @click.native="dataFormSubmit(2)"
:loading="continueBtnLoading"
:disabled="btnLoading"
>
{{
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" <el-button
:disabled='continueBtnLoading'> </el-button> type="primary"
@click="dataFormSubmit()"
:loading="btnLoading"
:disabled="continueBtnLoading"
>
</el-button
>
<el-button @click="goBack"> </el-button> <el-button @click="goBack"> </el-button>
</div> </div>
</div> </div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}"> <el-row
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="default" :gutter="15"
label-width="100px" label-position="right"> class="main"
:style="{ margin: '0 auto', width: '100%' }"
>
<el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="default"
label-width="100px"
label-position="right"
>
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="24"> <el-col :span="24">
@ -43,22 +69,53 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="小区名" prop="name"> <jnpf-form-tip-item label="小区名" prop="name">
<JnpfInput v-model="dataForm.name" @change="changeData('name',-1)" placeholder="请输入" <JnpfInput
clearable :style='{"width":"100%"}'> v-model="dataForm.name"
@change="changeData('name', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8">
<!-- {{ this.$store.getters.userInfo.organizeId }} -->
<jnpf-form-tip-item label="所属商户" prop="enterpriseId">
<JnpfDepSelect
v-model="dataForm.enterpriseId"
@change="changeData('enterpriseId', -1)"
placeholder="请选择"
selectType="all"
:ableIds="ableAll.enterpriseIdableIds"
clearable
disabled="true"
:style="{ width: '100%' }"
>
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="10"> <el-col :span="10">
<jnpf-form-tip-item label="小区详细地址" prop="address"> <jnpf-form-tip-item label="小区详细地址" prop="address">
<JnpfInput v-model="dataForm.address" @change="changeData('address',-1)" <JnpfInput
placeholder="请输入" clearable :style='{"width":"100%"}'> v-model="dataForm.address"
@change="changeData('address', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="启用禁用" prop="enabledMark"> <jnpf-form-tip-item label="启用禁用" prop="enabledMark">
<JnpfSwitch v-model="dataForm.enabledMark" @change="changeData('enabledMark',-1)" <JnpfSwitch
:active-value="1" :inactive-value="0"> v-model="dataForm.enabledMark"
@change="changeData('enabledMark', -1)"
:active-value="1"
:inactive-value="0"
>
</JnpfSwitch> </JnpfSwitch>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
@ -84,54 +141,87 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="定时定点回收" prop="hasSchedule"> <jnpf-form-tip-item label="定时定点回收" prop="hasSchedule">
<JnpfSwitch v-model="dataForm.hasSchedule" @change="changeData('hasSchedule',-1)" <JnpfSwitch
:active-value="1" :inactive-value="0"> v-model="dataForm.hasSchedule"
@change="changeData('hasSchedule', -1)"
:active-value="1"
:inactive-value="0"
>
</JnpfSwitch> </JnpfSwitch>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="回收地址" prop="recycleAddress"> <jnpf-form-tip-item label="回收地址" prop="recycleAddress">
<JnpfInput v-model="dataForm.recycleAddress" <JnpfInput
@change="changeData('recycleAddress',-1)" placeholder="请输入" clearable v-model="dataForm.recycleAddress"
:style='{"width":"100%"}'> @change="changeData('recycleAddress', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="回收时间起" prop="appointmentTimeStart"> <jnpf-form-tip-item
<JnpfTimePicker v-model="dataForm.appointmentTimeStart" label="回收时间起"
@change="changeData('appointmentTimeStart',-1)" prop="appointmentTimeStart"
:startTime="time(false,1,1,'','HH:mm','')" >
:endTime="time(false,1,1,'','HH:mm','')" placeholder="请选择" clearable <JnpfTimePicker
:style='{"width":"100%"}' format="HH:mm"> v-model="dataForm.appointmentTimeStart"
@change="changeData('appointmentTimeStart', -1)"
:startTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
format="HH:mm"
>
</JnpfTimePicker> </JnpfTimePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="回收时间止" prop="appointmentTimeEnd"> <jnpf-form-tip-item label="回收时间止" prop="appointmentTimeEnd">
<JnpfTimePicker v-model="dataForm.appointmentTimeEnd" <JnpfTimePicker
@change="changeData('appointmentTimeEnd',-1)" v-model="dataForm.appointmentTimeEnd"
:startTime="time(false,1,1,'','HH:mm','')" @change="changeData('appointmentTimeEnd', -1)"
:endTime="time(false,1,1,'','HH:mm','')" placeholder="请选择" clearable :startTime="time(false, 1, 1, '', 'HH:mm', '')"
:style='{"width":"100%"}' format="HH:mm"> :endTime="time(false, 1, 1, '', 'HH:mm', '')"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
format="HH:mm"
>
</JnpfTimePicker> </JnpfTimePicker>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="来源" prop="sourceType"> <jnpf-form-tip-item label="来源" prop="sourceType">
<JnpfSelect v-model="dataForm.sourceType" @change="changeData('sourceType',-1)" <JnpfSelect
placeholder="请选择" clearable :style='{"width":"100%"}' :options="sourceTypeOptions" v-model="dataForm.sourceType"
:props="sourceTypeProps"> @change="changeData('sourceType', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="sourceTypeOptions"
:props="sourceTypeProps"
>
</JnpfSelect> </JnpfSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" <SelectDialog
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false" /> v-if="selectDialogVisible"
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row> </el-row>
</div> </div>
</transition> </transition>
@ -139,14 +229,20 @@
<script> <script>
import request from '@/utils/request' import request from "@/utils/request";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface' import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from '@/api/permission/user' import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize' import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js' import {
import { thousandsFormat } from "@/components/Generator/utils/index" getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime,
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
export default { export default {
components: {}, components: {},
props: [], props: [],
@ -161,23 +257,21 @@ export default {
visible: false, visible: false,
loading: false, loading: false,
btnLoading: false, btnLoading: false,
formRef: 'formRef', formRef: "formRef",
setting: {}, setting: {},
eventType: '', eventType: "",
userBoxVisible: false, userBoxVisible: false,
selectDialogVisible: false, selectDialogVisible: false,
currTableConf: {}, currTableConf: {},
dataValueAll: {}, dataValueAll: {},
addTableConf: { addTableConf: {},
},
// //
ableAll: { ableAll: {},
}, tableRows: {},
tableRows: {
},
Vmodel: "", Vmodel: "",
currVmodel: "", currVmodel: "",
dataForm: { dataForm: {
enterpriseId: undefined,
name: undefined, name: undefined,
address: undefined, address: undefined,
enabledMark: 1, enabledMark: 1,
@ -190,21 +284,31 @@ export default {
sourceType: "1", sourceType: "1",
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: dataRule: {
{
name: [ name: [
{ {
required: true, required: true,
message: '请输入', message: "请输入",
trigger: 'blur' trigger: "blur",
}, },
], ],
enterpriseId: [
{
required: true,
message: "请输入",
trigger: "change",
}, },
sourceTypeOptions: [{ "fullName": "系统导入", "id": "1" }, { "fullName": "用户自定义", "id": "2" }], ],
sourceTypeProps: { "label": "fullName", "value": "id" }, },
sourceTypeOptions: [
{ fullName: "系统导入", id: "1" },
{ fullName: "用户自定义", id: "2" },
],
sourceTypeProps: { label: "fullName", value: "id" },
childIndex: -1, childIndex: -1,
isEdit: false, isEdit: false,
interfaceRes: { interfaceRes: {
enterpriseId: [],
name: [], name: [],
address: [], address: [],
enabledMark: [], enabledMark: [],
@ -216,60 +320,60 @@ export default {
appointmentTimeEnd: [], appointmentTimeEnd: [],
sourceType: [], sourceType: [],
}, },
} };
}, },
computed: { computed: {
...mapGetters(['userInfo']) ...mapGetters(["userInfo"]),
}, },
watch: {}, watch: {},
created() { created() {
this.dataAll() this.dataAll();
this.initDefaultData() this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)) this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
}, },
mounted() { }, mounted() {},
methods: { methods: {
prev() { prev() {
this.index-- this.index--;
if (this.index === 0) { if (this.index === 0) {
this.prevDis = true this.prevDis = true;
} }
this.nextDis = false this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
next() { next() {
this.index++ this.index++;
if (this.index === this.allList.length - 1) { if (this.index === this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
this.prevDis = false this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
getInfo(id) { getInfo(id) {
request({ request({
url: '/api/scm/HousingEstate/' + id, url: "/api/scm/HousingEstate/" + id,
method: 'get' method: "get",
}).then(res => { }).then((res) => {
this.dataInfo(res.data) this.dataInfo(res.data);
}); });
}, },
goBack() { goBack() {
this.visible = false this.visible = false;
this.$emit('refreshDataList', true) this.$emit("refreshDataList", true);
}, },
changeData(model, index) { changeData(model, index) {
this.isEdit = false this.isEdit = false;
this.childIndex = index this.childIndex = index;
let modelAll = model.split("-"); let modelAll = model.split("-");
let faceMode = ""; let faceMode = "";
for (let i = 0; i < modelAll.length; i++) { for (let i = 0; i < modelAll.length; i++) {
@ -277,14 +381,14 @@ export default {
} }
for (let key in this.interfaceRes) { for (let key in this.interfaceRes) {
if (key != faceMode) { if (key != faceMode) {
let faceReList = this.interfaceRes[key] let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) { for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) { if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options'; let options = "get" + key + "Options";
if (this[options]) { if (this[options]) {
this[options]() this[options]();
} }
this.changeData(key, index) this.changeData(key, index);
} }
} }
} }
@ -295,205 +399,221 @@ export default {
if (type == 2) { if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) { for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) { if (index == -1) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} else if (index == i) { } else if (index == i) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} }
} }
} else { } else {
this.dataForm[data] = defaultValue this.dataForm[data] = defaultValue;
} }
} }
}, },
dataAll() { dataAll() {},
},
goBack() { goBack() {
this.$emit('refresh') this.$emit("refresh");
}, },
clearData() { clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)) this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
}, },
init(id, isDetail, allList) { init(id, isDetail, allList) {
this.prevDis = false this.prevDis = false;
this.nextDis = false this.nextDis = false;
this.allList = allList || [] this.allList = allList || [];
if (allList.length) { if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id) this.index = this.allList.findIndex((item) => item.id === id);
if (this.index == 0) { if (this.index == 0) {
this.prevDis = true this.prevDis = true;
} }
if (this.index == this.allList.length - 1) { if (this.index == this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
} else { } else {
this.prevDis = true this.prevDis = true;
this.nextDis = true this.nextDis = true;
} }
this.dataForm.id = id || 0; this.dataForm.id = id || 0;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.loading = true this.loading = true;
request({ request({
url: '/api/scm/HousingEstate/' + this.dataForm.id, url: "/api/scm/HousingEstate/" + this.dataForm.id,
method: 'get' method: "get",
}).then(res => { }).then((res) => {
this.dataInfo(res.data) this.dataInfo(res.data);
this.loading = false this.loading = false;
}); });
} else { } else {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
} }
}); });
this.$store.commit('generator/UPDATE_RELATION_DATA', {}) this.$store.commit("generator/UPDATE_RELATION_DATA", {});
}, },
// //
initDefaultData() { initDefaultData() {
if (
this.userInfo.organizeIdList instanceof Array &&
this.userInfo.organizeIdList.length > 0
) {
this.dataForm.enterpriseId = this.userInfo.organizeIdList;
}
this.dataForm.firstContactPerson = this.userInfo.userId;
if (
this.$store.getters.userInfo.organizeId &&
this.$store.getters.userInfo.organizeId != null
) {
this.dataForm.enterpriseId = this.$store.getters.userInfo.organizeId;
}
}, },
// //
dataFormSubmit(type) { dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0 this.dataFormSubmitType = type ? type : 0;
this.$refs['formRef'].validate((valid) => { this.$refs["formRef"].validate((valid) => {
if (valid) { if (valid) {
this.request() this.request();
} }
}) });
}, },
request() { request() {
let _data = this.dataList() let _data = this.dataList();
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true this.continueBtnLoading = true;
} else { } else {
this.btnLoading = true this.btnLoading = true;
} }
if (!this.dataForm.id) { if (!this.dataForm.id) {
request({ request({
url: '/api/scm/HousingEstate', url: "/api/scm/HousingEstate",
method: 'post', method: "post",
data: _data data: _data,
}).then((res) => { })
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
}) });
this.continueBtnLoading = false this.continueBtnLoading = false;
return return;
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
} }
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
}) })
}).catch(() => { .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
} else { } else {
request({ request({
url: '/api/scm/HousingEstate/' + this.dataForm.id, url: "/api/scm/HousingEstate/" + this.dataForm.id,
method: 'PUT', method: "PUT",
data: _data data: _data,
}).then((res) => { })
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false if (this.dataFormSubmitType == 2)
this.visible = false return (this.continueBtnLoading = false);
this.btnLoading = false this.visible = false;
this.$emit('refresh', true) this.btnLoading = false;
} this.$emit("refresh", true);
}) },
}).catch(() => { });
this.btnLoading = false
this.continueBtnLoading = false
}) })
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
} }
}, },
openSelectDialog(key) { openSelectDialog(key) {
this.currTableConf = this.addTableConf[key] this.currTableConf = this.addTableConf[key];
this.currVmodel = key this.currVmodel = key;
this.selectDialogVisible = true this.selectDialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectDialog.init() this.$refs.selectDialog.init();
}) });
}, },
addForSelect(data) { addForSelect(data) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let t = data[i] let t = data[i];
if (this['get' + this.currVmodel]) { if (this["get" + this.currVmodel]) {
this['get' + this.currVmodel](t) this["get" + this.currVmodel](t);
} }
} }
}, },
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) { dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null; let timeDataValue = null;
let timeValue = Number(timeValueData) let timeValue = Number(timeValueData);
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue timeDataValue = timeValue;
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = new Date().getTime() timeDataValue = new Date().getTime();
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue) previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime() timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
} }
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getLaterData(timeValue) previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime() timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
} }
} }
} }
return timeDataValue; return timeDataValue;
}, },
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) { time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null let timeDataValue = null;
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue || '00:00:00' timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(':').length == 3) { if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue timeDataValue = timeDataValue;
} else { } else {
timeDataValue = timeDataValue + ':00' timeDataValue = timeDataValue + ":00";
} }
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format) timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue) previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue) previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} }
} }
return timeDataValue; return timeDataValue;
@ -503,13 +623,12 @@ export default {
return _data; return _data;
}, },
dataInfo(dataAll) { dataInfo(dataAll) {
let _dataAll = dataAll let _dataAll = dataAll;
this.dataForm = _dataAll this.dataForm = _dataAll;
this.isEdit = true this.isEdit = true;
this.dataAll() this.dataAll();
this.childIndex = -1 this.childIndex = -1;
}, },
}, },
} };
</script> </script>

@ -79,7 +79,7 @@
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <!-- <el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId"> <jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfOrganizeSelect <JnpfOrganizeSelect
v-model="dataForm.buinessId" v-model="dataForm.buinessId"
@ -92,7 +92,24 @@
> >
</JnpfOrganizeSelect> </JnpfOrganizeSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> -->
<el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="buinessId">
<JnpfDepSelect
v-model="dataForm.buinessId"
@change="changeData('buinessId', -1)"
placeholder="请选择"
selectType="all"
:ableIds="ableAll.buinessId"
clearable
disabled="true"
:style="{ width: '100%' }"
>
</JnpfDepSelect>
</jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<jnpf-form-tip-item label="价格类型" prop="priceType"> <jnpf-form-tip-item label="价格类型" prop="priceType">
<JnpfSelect <JnpfSelect
@ -669,6 +686,13 @@ export default {
) { ) {
this.dataForm.buinessId = this.userInfo.organizeIdList; this.dataForm.buinessId = this.userInfo.organizeIdList;
} }
this.dataForm.firstContactPerson = this.userInfo.userId;
if (
this.$store.getters.userInfo.organizeId &&
this.$store.getters.userInfo.organizeId != null
) {
this.dataForm.buinessId = this.$store.getters.userInfo.organizeId;
}
}, },
// //
dataFormSubmit(type) { dataFormSubmit(type) {

@ -2,97 +2,156 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'" <el-dialog
:close-on-click-modal="false" append-to-body :title="!dataForm.id ? '新建' : '编辑'"
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll :close-on-click-modal="false"
width="600px"> append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="600px"
>
<el-row :gutter="15" class=""> <el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" > <el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="100px"
label-position="right"
>
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="12" > <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="编码" prop="code">
label="编码" prop="code" > <JnpfInput
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)" v-model="dataForm.code"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'> @change="changeData('code', -1)"
placeholder="系统自动生成"
readonly
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12" > <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="名称" prop="name">
label="名称" prop="name" > <JnpfInput
<JnpfInput v-model="dataForm.name" @change="changeData('name',-1)" v-model="dataForm.name"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('name', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12" > <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="规格" prop="spec">
label="规格" prop="spec" > <JnpfInput
<JnpfInput v-model="dataForm.spec" @change="changeData('spec',-1)" v-model="dataForm.spec"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('spec', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12" > <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="库存单位" prop="unit">
label="库存单位" prop="unit" > <JnpfSelect
<JnpfSelect v-model="dataForm.unit" @change="changeData('unit',-1)" v-model="dataForm.unit"
placeholder="请选择" clearable :style='{"width":"100%"}' :options="unitOptions" :props="unitProps" > @change="changeData('unit', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="unitOptions"
:props="unitProps"
>
</JnpfSelect> </JnpfSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24" > <el-col :span="24">
<jnpf-form-tip-item <jnpf-form-tip-item label="描述" prop="description">
label="描述" prop="description" > <JnpfInput
<JnpfInput v-model="dataForm.description" @change="changeData('description',-1)" v-model="dataForm.description"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('description', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24" > <el-col :span="24">
<jnpf-form-tip-item <jnpf-form-tip-item label="图片" prop="photo">
label="图片" prop="photo" > <JnpfUploadImg
<JnpfUploadImg v-model="dataForm.photo" @change="changeData('photo',-1)" v-model="dataForm.photo"
:fileSize="10" sizeUnit="MB" :limit="1" pathType="defaultPath" :isAccount="0" > @change="changeData('photo', -1)"
:fileSize="10"
sizeUnit="MB"
:limit="1"
pathType="defaultPath"
:isAccount="0"
>
</JnpfUploadImg> </JnpfUploadImg>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" <SelectDialog
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/> v-if="selectDialogVisible"
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row> </el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id"> <div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'> <el-button @click="prev" :disabled="prevDis">
{{'上一条'}} {{ "上一条" }}
</el-button> </el-button>
<el-button @click="next" :disabled='nextDis'> <el-button @click="next" :disabled="nextDis">
{{'下一条'}} {{ "下一条" }}
</el-button> </el-button>
</div> </div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading"> <el-button
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button> type="primary"
@click="dataFormSubmit(2)"
:loading="continueBtnLoading"
>
{{ !dataForm.id ? "确定并新增" : "确定并继续" }}</el-button
>
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button> <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">
</el-button
>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import request from '@/utils/request' import request from "@/utils/request";
import {mapGetters} from "vuex"; import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface' import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from '@/api/permission/user' import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize' import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js' import {
import { thousandsFormat } from "@/components/Generator/utils/index" getDateDay,
export default { getLaterData,
components: { }, getBeforeData,
getBeforeTime,
getLaterTime,
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
export default {
components: {},
props: [], props: [],
data() { data() {
return { return {
@ -105,137 +164,137 @@
visible: false, visible: false,
loading: false, loading: false,
btnLoading: false, btnLoading: false,
formRef: 'formRef', formRef: "formRef",
setting:{}, setting: {},
eventType: '', eventType: "",
userBoxVisible:false, userBoxVisible: false,
selectDialogVisible: false, selectDialogVisible: false,
currTableConf:{}, currTableConf: {},
dataValueAll:{}, dataValueAll: {},
addTableConf:{ addTableConf: {},
},
// //
ableAll:{ ableAll: {},
}, tableRows: {},
tableRows:{ Vmodel: "",
}, currVmodel: "",
Vmodel:"",
currVmodel:"",
dataForm: { dataForm: {
code : undefined, code: undefined,
name : undefined, name: undefined,
spec : undefined, spec: undefined,
unit : undefined, unit: undefined,
description : undefined, description: undefined,
creatorTime : undefined, creatorTime: undefined,
creatorUserId : undefined, creatorUserId: undefined,
lastModifyTime : undefined, lastModifyTime: undefined,
lastModifyUserId : undefined, lastModifyUserId: undefined,
photo : [], photo: [],
version: 0, version: 0,
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: dataRule: {
{
name: [ name: [
{ {
required: true, required: true,
message: '请输入', message: "请输入",
trigger: 'blur' trigger: "blur",
}, },
], ],
spec: [ spec: [
{ {
required: true, required: true,
message: '请输入', message: "请输入",
trigger: 'blur' trigger: "blur",
}, },
], ],
unit: [ unit: [
{ {
required: true, required: true,
message: '请选择', message: "请选择",
trigger: 'change' trigger: "change",
}, },
], ],
photo: [ photo: [
{ {
required: true, required: true,
message: '请至少选择一个', message: "请至少选择一个",
trigger: 'change' trigger: "change",
}, },
], ],
}, },
unitOptions:[{"fullName":"克","id":"1"},{"fullName":"千克","id":"2"},{"fullName":"吨","id":"3"}], unitOptions: [
unitProps:{"label":"fullName","value":"id" }, { fullName: "克", id: "1" },
childIndex:-1, { fullName: "千克", id: "2" },
isEdit:false, { fullName: "吨", id: "3" },
],
unitProps: { label: "fullName", value: "id" },
childIndex: -1,
isEdit: false,
interfaceRes: { interfaceRes: {
code:[] , code: [],
name:[] , name: [],
spec:[] , spec: [],
unit:[] , unit: [],
description:[] , description: [],
creatorTime:[] , creatorTime: [],
creatorUserId:[] , creatorUserId: [],
lastModifyTime:[] , lastModifyTime: [],
lastModifyUserId:[] , lastModifyUserId: [],
photo:[] , photo: [],
}, },
} };
}, },
computed: { computed: {
...mapGetters(['userInfo']) ...mapGetters(["userInfo"]),
}, },
watch: {}, watch: {},
created() { created() {
this.dataAll() this.dataAll();
this.initDefaultData() this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)) this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
}, },
mounted() {}, mounted() {},
methods: { methods: {
prev() { prev() {
this.index-- this.index--;
if (this.index === 0) { if (this.index === 0) {
this.prevDis = true this.prevDis = true;
} }
this.nextDis = false this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
next() { next() {
this.index++ this.index++;
if (this.index === this.allList.length - 1) { if (this.index === this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
this.prevDis = false this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
getInfo(id) { getInfo(id) {
request({ request({
url: '/api/scm/NxProduct/'+ id, url: "/api/scm/NxProduct/" + id,
method: 'get' method: "get",
}).then(res => { }).then((res) => {
this.dataInfo(res.data) this.dataInfo(res.data);
}); });
}, },
goBack() { goBack() {
this.visible = false this.visible = false;
this.$emit('refreshDataList', true) this.$emit("refreshDataList", true);
}, },
changeData(model, index) { changeData(model, index) {
this.isEdit = false this.isEdit = false;
this.childIndex = index this.childIndex = index;
let modelAll = model.split("-"); let modelAll = model.split("-");
let faceMode = ""; let faceMode = "";
for (let i = 0; i < modelAll.length; i++) { for (let i = 0; i < modelAll.length; i++) {
@ -243,236 +302,237 @@
} }
for (let key in this.interfaceRes) { for (let key in this.interfaceRes) {
if (key != faceMode) { if (key != faceMode) {
let faceReList = this.interfaceRes[key] let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) { for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) { if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options'; let options = "get" + key + "Options";
if(this[options]){ if (this[options]) {
this[options]() this[options]();
} }
this.changeData(key, index) this.changeData(key, index);
} }
} }
} }
} }
}, },
changeDataFormData(type, data, model,index,defaultValue) { changeDataFormData(type, data, model, index, defaultValue) {
if(!this.isEdit) { if (!this.isEdit) {
if (type == 2) { if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) { for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) { if (index == -1) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} else if (index == i) { } else if (index == i) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} }
} }
} else { } else {
this.dataForm[data] = defaultValue this.dataForm[data] = defaultValue;
} }
} }
}, },
dataAll(){ dataAll() {},
}, clearData() {
clearData(){ this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
}, },
init(id,isDetail,allList) { init(id, isDetail, allList) {
this.prevDis = false this.prevDis = false;
this.nextDis = false this.nextDis = false;
this.allList = allList || [] this.allList = allList || [];
if (allList.length) { if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id) this.index = this.allList.findIndex((item) => item.id === id);
if (this.index == 0) { if (this.index == 0) {
this.prevDis = true this.prevDis = true;
} }
if (this.index == this.allList.length - 1) { if (this.index == this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
} else { } else {
this.prevDis = true this.prevDis = true;
this.nextDis = true this.nextDis = true;
} }
this.dataForm.id = id || 0; this.dataForm.id = id || 0;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
if(this.dataForm.id){ if (this.dataForm.id) {
this.loading = true this.loading = true;
request({ request({
url: '/api/scm/NxProduct/'+this.dataForm.id, url: "/api/scm/NxProduct/" + this.dataForm.id,
method: 'get' method: "get",
}).then(res => { }).then((res) => {
this.dataInfo(res.data) this.dataInfo(res.data);
this.loading = false this.loading = false;
}); });
}else{ } else {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
} }
}); });
this.$store.commit('generator/UPDATE_RELATION_DATA', {}) this.$store.commit("generator/UPDATE_RELATION_DATA", {});
}, },
// //
initDefaultData() { initDefaultData() {},
},
// //
dataFormSubmit(type) { dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0 this.dataFormSubmitType = type ? type : 0;
this.$refs['formRef'].validate((valid) => { this.$refs["formRef"].validate((valid) => {
if (valid) { if (valid) {
this.request() this.request();
} }
}) });
}, },
request() { request() {
let _data =this.dataList() let _data = this.dataList();
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true this.continueBtnLoading = true;
} else { } else {
this.btnLoading = true this.btnLoading = true;
} }
if (!this.dataForm.id) { if (!this.dataForm.id) {
request({ request({
url: '/api/scm/NxProduct', url: "/api/scm/NxProduct",
method: 'post', method: "post",
data: _data data: _data,
}).then((res) => { })
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
}) });
this.continueBtnLoading = false this.continueBtnLoading = false;
return return;
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
} }
this.visible = false;
this.btnLoading = false;
this.$emit("refresh", true);
},
});
}) })
}).catch(()=>{ .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
}else{ } else {
request({ request({
url: '/api/scm/NxProduct/'+this.dataForm.id, url: "/api/scm/NxProduct/" + this.dataForm.id,
method: 'PUT', method: "PUT",
data: _data data: _data,
}).then((res) => { })
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false if (this.dataFormSubmitType == 2)
this.visible = false return (this.continueBtnLoading = false);
this.btnLoading = false this.visible = false;
this.$emit('refresh', true) this.btnLoading = false;
} this.$emit("refresh", true);
}) },
}).catch(()=>{ });
this.btnLoading = false
this.continueBtnLoading = false
}) })
.catch(() => {
this.btnLoading = false;
this.continueBtnLoading = false;
});
} }
}, },
openSelectDialog(key) { openSelectDialog(key) {
this.currTableConf=this.addTableConf[key] this.currTableConf = this.addTableConf[key];
this.currVmodel=key this.currVmodel = key;
this.selectDialogVisible = true this.selectDialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectDialog.init() this.$refs.selectDialog.init();
}) });
}, },
addForSelect(data) { addForSelect(data) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let t = data[i] let t = data[i];
if(this['get'+this.currVmodel]){ if (this["get" + this.currVmodel]) {
this['get'+this.currVmodel](t) this["get" + this.currVmodel](t);
} }
} }
}, },
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) { dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null; let timeDataValue = null;
let timeValue = Number(timeValueData) let timeValue = Number(timeValueData);
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue timeDataValue = timeValue;
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = new Date().getTime() timeDataValue = new Date().getTime();
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue) previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime() timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
} }
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getLaterData(timeValue) previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime() timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
} }
} }
} }
return timeDataValue; return timeDataValue;
}, },
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) { time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null let timeDataValue = null;
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue || '00:00:00' timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(':').length == 3) { if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue timeDataValue = timeDataValue;
} else { } else {
timeDataValue = timeDataValue + ':00' timeDataValue = timeDataValue + ":00";
} }
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format) timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue) previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue) previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} }
} }
return timeDataValue; return timeDataValue;
}, },
dataList(){ dataList() {
var _data = this.dataForm; var _data = this.dataForm;
return _data; return _data;
}, },
dataInfo(dataAll){ dataInfo(dataAll) {
let _dataAll =dataAll let _dataAll = dataAll;
this.dataForm = _dataAll this.dataForm = _dataAll;
this.isEdit = true this.isEdit = true;
this.dataAll() this.dataAll();
this.childIndex=-1 this.childIndex = -1;
}, },
}, },
} };
</script> </script>

@ -2,91 +2,159 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="JNPF-preview-main org-form"> <div class="JNPF-preview-main org-form">
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header @back="goBack" <el-page-header
:content="!dataForm.id ? $t(`Organize.addCompany`) : $t(`Organize.editCompany`)" /> @back="goBack"
:content="
!dataForm.id
? $t(`Organize.addCompany`)
: $t(`Organize.editCompany`)
"
/>
<div class="options"> <div class="options">
<el-button type="primary" :loading="btnLoading" @click="handleConfirm()"> <el-button
{{$t('common.confirmButton')}}</el-button> type="primary"
<el-button @click="goBack">{{$t('common.cancelButton')}}</el-button> :loading="btnLoading"
@click="handleConfirm()"
>
{{ $t("common.confirmButton") }}</el-button
>
<el-button @click="goBack">{{ $t("common.cancelButton") }}</el-button>
</div> </div>
</div> </div>
<div class="main" v-loading="formLoading"> <div class="main" v-loading="formLoading">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="80px"> <el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="80px"
>
<div class="JNPF-common-title mb-20"> <div class="JNPF-common-title mb-20">
<h2 class="bold">基础信息</h2> <h2 class="bold">基础信息</h2>
</div> </div>
<el-row :gutter="20" class="custom-row"> <el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="上级公司" prop="parentId"> <el-form-item label="上级公司" prop="parentId">
<JnpfOrganizeSelect v-model="organizeIdTree" placeholder="选择上级公司" auth isOnlyOrg <JnpfOrganizeSelect
@change="onOrganizeChange" :currOrgId="dataForm.id||'0'" v-model="organizeIdTree"
:parentId="parentId||'0'" /> placeholder="选择上级公司"
auth
isOnlyOrg
@change="onOrganizeChange"
:currOrgId="dataForm.id || '0'"
:parentId="parentId || '0'"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司名称" prop="fullName"> <el-form-item label="公司名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入名称" maxlength="50" /> <el-input
v-model="dataForm.fullName"
placeholder="输入名称"
maxlength="50"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司编码" prop="enCode"> <el-form-item label="公司编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入公司编码" /> <el-input
v-model="dataForm.enCode"
placeholder="输入公司编码"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司简称" prop="propertyJson.shortName"> <el-form-item label="公司简称" prop="propertyJson.shortName">
<el-input v-model="dataForm.propertyJson.shortName" placeholder="输入公司简称" /> <el-input
v-model="dataForm.propertyJson.shortName"
placeholder="输入公司简称"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司性质" prop="propertyJson.enterpriseNature"> <el-form-item
<JnpfTreeSelect v-model="dataForm.propertyJson.enterpriseNature" label="公司性质"
:options="natureData" placeholder="请选择公司性质" style="width: 100%" /> prop="propertyJson.enterpriseNature"
>
<JnpfTreeSelect
v-model="dataForm.propertyJson.enterpriseNature"
:options="natureData"
placeholder="请选择公司性质"
style="width: 100%"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="所属行业" prop="propertyJson.industry"> <el-form-item label="所属行业" prop="propertyJson.industry">
<JnpfTreeSelect v-model="dataForm.propertyJson.industry" :options="industryData" <JnpfTreeSelect
placeholder="请选择所属行业" style="width: 100%" /> v-model="dataForm.propertyJson.industry"
:options="industryData"
placeholder="请选择所属行业"
style="width: 100%"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="成立时间" prop="propertyJson.foundedTime"> <el-form-item label="成立时间" prop="propertyJson.foundedTime">
<el-date-picker v-model="dataForm.propertyJson.foundedTime" type="date" <el-date-picker
value-format="timestamp" placeholder="选择日期" :picker-options="pickerOptions" v-model="dataForm.propertyJson.foundedTime"
style="width: 100%"> type="date"
value-format="timestamp"
placeholder="选择日期"
:picker-options="pickerOptions"
style="width: 100%"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司电话" prop="propertyJson.telePhone"> <el-form-item label="公司电话" prop="propertyJson.telePhone">
<el-input v-model="dataForm.propertyJson.telePhone" placeholder="输入公司电话" /> <el-input
v-model="dataForm.propertyJson.telePhone"
placeholder="输入公司电话"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司传真" prop="propertyJson.fax"> <el-form-item label="公司传真" prop="propertyJson.fax">
<el-input v-model="dataForm.propertyJson.fax" placeholder="输入公司传真" /> <el-input
v-model="dataForm.propertyJson.fax"
placeholder="输入公司传真"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司主页" prop="propertyJson.webSite"> <el-form-item label="公司主页" prop="propertyJson.webSite">
<el-input v-model="dataForm.propertyJson.webSite" placeholder="输入公司主页" /> <el-input
v-model="dataForm.propertyJson.webSite"
placeholder="输入公司主页"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="公司地址" prop="propertyJson.address"> <el-form-item label="公司地址" prop="propertyJson.address">
<el-input v-model="dataForm.propertyJson.address" placeholder="输入公司地址" /> <el-input
v-model="dataForm.propertyJson.address"
placeholder="输入公司地址"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="排序" prop="sortCode"> <el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode" <el-input-number
controls-position="right" /> :min="0"
:max="999999"
v-model="dataForm.sortCode"
controls-position="right"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="说明" prop="description"> <el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" /> <el-input
v-model="dataForm.description"
type="textarea"
:rows="3"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -96,37 +164,62 @@
<el-row :gutter="20" class="custom-row"> <el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司法人" prop="propertyJson.managerName"> <el-form-item label="公司法人" prop="propertyJson.managerName">
<el-input v-model="dataForm.propertyJson.managerName" placeholder="输入公司法人" /> <el-input
v-model="dataForm.propertyJson.managerName"
placeholder="输入公司法人"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系电话" prop="propertyJson.managerTelePhone"> <el-form-item label="联系电话" prop="managerTelePhone">
<el-input v-model="dataForm.propertyJson.managerTelePhone" placeholder="输入联系电话" /> <el-input
v-model="dataForm.propertyJson.managerTelePhone"
placeholder="输入联系电话"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系手机" prop="propertyJson.managerMobilePhone"> <el-form-item
<el-input v-model="dataForm.propertyJson.managerMobilePhone" placeholder="输入联系手机" /> label="联系手机"
prop="propertyJson.managerMobilePhone"
>
<el-input
v-model="dataForm.propertyJson.managerMobilePhone"
placeholder="输入联系手机"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系邮箱" prop="propertyJson.manageEmail"> <el-form-item label="联系邮箱" prop="propertyJson.manageEmail">
<el-input v-model="dataForm.propertyJson.manageEmail" placeholder="输入联系邮箱" /> <el-input
v-model="dataForm.propertyJson.manageEmail"
placeholder="输入联系邮箱"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="开户银行" prop="propertyJson.bankName"> <el-form-item label="开户银行" prop="propertyJson.bankName">
<el-input v-model="dataForm.propertyJson.bankName" placeholder="输入开户银行" /> <el-input
v-model="dataForm.propertyJson.bankName"
placeholder="输入开户银行"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="银行账户" prop="propertyJson.bankAccount"> <el-form-item label="银行账户" prop="propertyJson.bankAccount">
<el-input v-model="dataForm.propertyJson.bankAccount" placeholder="输入银行账户" /> <el-input
v-model="dataForm.propertyJson.bankAccount"
placeholder="输入银行账户"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="经营范围" prop="propertyJson.businessscope"> <el-form-item label="经营范围" prop="propertyJson.businessscope">
<el-input v-model="dataForm.propertyJson.businessscope" type="textarea" :rows="3" /> <el-input
v-model="dataForm.propertyJson.businessscope"
type="textarea"
:rows="3"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -137,7 +230,11 @@
</template> </template>
<script> <script>
import { createOrganize, updateOrganize, getOrganizeInfo } from '@/api/permission/organize' import {
createOrganize,
updateOrganize,
getOrganizeInfo,
} from "@/api/permission/organize";
export default { export default {
data() { data() {
@ -146,116 +243,142 @@ export default {
btnLoading: false, btnLoading: false,
formLoading: false, formLoading: false,
dataForm: { dataForm: {
id: '', id: "",
parentId: '', parentId: "",
fullName: '', fullName: "",
enCode: '', enCode: "",
enabledMark: 1, enabledMark: 1,
sortCode: 0, sortCode: 0,
description: '', description: "",
propertyJson: { propertyJson: {
shortName: '', shortName: "",
enterpriseNature: '', enterpriseNature: "",
industry: '', industry: "",
foundedTime: '', foundedTime: "",
telePhone: '', telePhone: "",
fax: '', fax: "",
webSite: '', webSite: "",
address: '', address: "",
managerName: '', managerName: "",
managerTelePhone: '', managerTelePhone: "",
managerMobilePhone: '', managerMobilePhone: "",
manageEmail: '', manageEmail: "",
bankName: '', bankName: "",
bankAccount: '', bankAccount: "",
businessscope: '' businessscope: "",
} },
}, },
parentId: '', parentId: "",
organizeIdTree: [], organizeIdTree: [],
natureData: [], natureData: [],
industryData: [], industryData: [],
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() > Date.now(); return time.getTime() > Date.now();
} },
}, },
dataRule: { dataRule: {
parentId: [ parentId: [
{ required: true, message: '上级公司不能为空', trigger: 'change' } { required: true, message: "上级公司不能为空", trigger: "change" },
], ],
fullName: [ fullName: [
{ required: true, message: '请输入公司名称', trigger: 'blur' } { required: true, message: "请输入公司名称", trigger: "blur" },
], ],
enCode: [ enCode: [
{ required: true, message: '请输入公司编码', trigger: 'blur' }, { required: true, message: "请输入公司编码", trigger: "blur" },
{ validator: this.formValidate('enCode', '公司编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' }, {
{ max: 50, message: '公司编码最多为50个字符', trigger: 'blur' } validator: this.formValidate(
"enCode",
"公司编码只能输入英文、数字和小数点且小数点不能放在首尾"
),
trigger: "blur",
},
{ max: 50, message: "公司编码最多为50个字符", trigger: "blur" },
],
managerTelePhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
{
pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/,
message: "请输入联系电话",
trigger: "blur",
},
], ],
} },
} };
}, },
methods: { methods: {
init(id, parentId) { init(id, parentId) {
this.visible = true this.visible = true;
this.dataForm.id = id || '' this.dataForm.id = id || "";
this.parentId = parentId || '' this.parentId = parentId || "";
this.organizeIdTree = [] this.organizeIdTree = [];
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs["dataForm"].resetFields();
// //
this.$store.dispatch('base/getDictionaryData', { sort: 'EnterpriseNature' }).then(res => { this.$store
this.natureData = res .dispatch("base/getDictionaryData", { sort: "EnterpriseNature" })
}) .then((res) => {
this.natureData = res;
});
// //
this.$store.dispatch('base/getDictionaryData', { sort: 'IndustryType' }).then(res => { this.$store
this.industryData = res .dispatch("base/getDictionaryData", { sort: "IndustryType" })
}) .then((res) => {
this.industryData = res;
});
if (this.dataForm.id) { if (this.dataForm.id) {
this.formLoading = true this.formLoading = true;
getOrganizeInfo(this.dataForm.id).then(res => { getOrganizeInfo(this.dataForm.id)
this.dataForm = res.data .then((res) => {
this.organizeIdTree = res.data.organizeIdTree || [] this.dataForm = res.data;
const propertyJson = res.data.propertyJson ? JSON.parse(res.data.propertyJson) : {} this.organizeIdTree = res.data.organizeIdTree || [];
this.dataForm.propertyJson = propertyJson const propertyJson = res.data.propertyJson
this.formLoading = false ? JSON.parse(res.data.propertyJson)
}).catch(() => { this.formLoading = false }) : {};
} this.dataForm.propertyJson = propertyJson;
this.formLoading = false;
}) })
.catch(() => {
this.formLoading = false;
});
}
});
}, },
goBack() { goBack() {
this.$emit('close') this.$emit("close");
}, },
onOrganizeChange(val) { onOrganizeChange(val) {
if (!val || !val.length) return this.dataForm.parentId = '' if (!val || !val.length) return (this.dataForm.parentId = "");
this.dataForm.parentId = val[val.length - 1] this.dataForm.parentId = val[val.length - 1];
}, },
handleConfirm() { handleConfirm() {
this.$refs['dataForm'].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true;
const formMethod = this.dataForm.id ? updateOrganize : createOrganize const formMethod = this.dataForm.id ? updateOrganize : createOrganize;
formMethod(this.dataForm).then(res => { formMethod(this.dataForm)
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.visible = false this.visible = false;
this.btnLoading = false this.btnLoading = false;
this.$store.commit('generator/SET_COMPANY_TREE', []) this.$store.commit("generator/SET_COMPANY_TREE", []);
this.$store.commit('generator/SET_DEP_TREE', []) this.$store.commit("generator/SET_DEP_TREE", []);
this.$emit('close', true) this.$emit("close", true);
} },
}) });
}).catch(() => {
this.btnLoading = false
})
}
}) })
.catch(() => {
this.btnLoading = false;
});
} }
} });
} },
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {

@ -5,15 +5,21 @@
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
<el-col :span="6"> <el-col :span="6">
<el-form-item :label="$t('common.keyword')"> <el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')" <el-input
clearable @keyup.enter.native="search()" /> v-model="listQuery.keyword"
:placeholder="$t('common.enterKeyword')"
clearable
@keyup.enter.native="search()"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"> <el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button> {{ $t("common.search") }}</el-button
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}} >
<el-button icon="el-icon-refresh-right" @click="reset()"
>{{ $t("common.reset") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -26,58 +32,110 @@
新建<i class="el-icon-arrow-down el-icon--right"></i> 新建<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="addOrUpdateHandle('','company')">新建公司 <!-- <el-dropdown-item @click.native="addOrUpdateHandle('','company')">新建公司
</el-dropdown-item> </el-dropdown-item> -->
<el-dropdown-item @click.native="addOrUpdateHandle()">新建部门</el-dropdown-item> <el-dropdown-item @click.native="addOrUpdateHandle()"
>新建部门</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<div class="JNPF-common-head-right"> <div class="JNPF-common-head-right">
<el-tooltip effect="dark" content="展开" placement="top"> <el-tooltip effect="dark" content="展开" placement="top">
<el-link v-show="!expands" type="text" <el-link
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon" :underline="false" v-show="!expands"
@click="toggleExpand()" /> type="text"
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon"
:underline="false"
@click="toggleExpand()"
/>
</el-tooltip> </el-tooltip>
<el-tooltip effect="dark" content="折叠" placement="top"> <el-tooltip effect="dark" content="折叠" placement="top">
<el-link v-show="expands" type="text" <el-link
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon" :underline="false" v-show="expands"
@click="toggleExpand()" /> type="text"
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon"
:underline="false"
@click="toggleExpand()"
/>
</el-tooltip> </el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top"> <el-tooltip
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false" effect="dark"
@click="initData()" /> :content="$t('common.refresh')"
placement="top"
>
<el-link
icon="icon-ym icon-ym-Refresh JNPF-common-head-icon"
:underline="false"
@click="initData()"
/>
</el-tooltip> </el-tooltip>
</div> </div>
</div> </div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable" <JNPF-table
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}"> v-loading="listLoading"
:data="treeList"
row-key="id"
v-if="refreshTable"
:default-expand-all="expands"
:tree-props="{ children: 'children', hasChildren: '' }"
>
<el-table-column prop="fullName" label="名称"> <el-table-column prop="fullName" label="名称">
<template slot-scope="scope"> <template slot-scope="scope">
<i :class="'table-icon icon-my '+scope.row.icon"></i>{{scope.row.fullName}} <i :class="'table-icon icon-my ' + scope.row.icon"></i
>{{ scope.row.fullName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="enCode" label="编码" /> <el-table-column prop="enCode" label="编码" />
<el-table-column prop="index" label="层级" width="100" align="center" /> <el-table-column
prop="index"
label="层级"
width="100"
align="center"
/>
<el-table-column prop="type" label="类型" width="100" align="center"> <el-table-column prop="type" label="类型" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.type==='company'?'公司':'部门'}} {{ scope.row.type === "company" ? "公司" : "部门" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间" <el-table-column
width="120" /> prop="creatorTime"
<el-table-column prop="sortCode" label="排序" width="70" align="center" /> :formatter="jnpf.tableDateFormat"
label="创建时间"
width="120"
/>
<el-table-column
prop="sortCode"
label="排序"
width="70"
align="center"
/>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id,scope.row.type,scope.row.parentId)" <tableOpts
@del="handleDel(scope.row.id)"> @edit="
addOrUpdateHandle(
scope.row.id,
scope.row.type,
scope.row.parentId
)
"
@del="handleDel(scope.row.id)"
>
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<el-button type="text" size="mini">{{$t('common.moreBtn')}}<i <el-button type="text" size="mini"
class="el-icon-arrow-down el-icon--right"></i> >{{ $t("common.moreBtn")
}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="checkMembers(scope.row.id,scope.row.fullName)"> <el-dropdown-item
查看成员</el-dropdown-item> @click.native="
checkMembers(scope.row.id, scope.row.fullName)
"
>
查看成员</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</tableOpts> </tableOpts>
@ -89,23 +147,26 @@
<Form v-show="formVisible" ref="Form" @close="closeForm" /> <Form v-show="formVisible" ref="Form" @close="closeForm" />
<DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" /> <DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" />
<CheckUser v-if="checkUserFormVisible" ref="checkUserForm" <CheckUser
@close="checkUserFormVisible=false" /> v-if="checkUserFormVisible"
ref="checkUserForm"
@close="checkUserFormVisible = false"
/>
</div> </div>
</template> </template>
<script> <script>
import { getOrganizeList, delOrganize } from '@/api/permission/organize' import { getOrganizeList, delOrganize } from "@/api/permission/organize";
import Form from './Form' import Form from "./Form";
import DepForm from './depForm' import DepForm from "./depForm";
import CheckUser from './checkUser.vue' import CheckUser from "./checkUser.vue";
export default { export default {
name: 'permission-organize', name: "permission-organize",
components: { Form, DepForm, CheckUser }, components: { Form, DepForm, CheckUser },
data() { data() {
return { return {
listQuery: { listQuery: {
keyword: '' keyword: "",
}, },
treeList: [], treeList: [],
expands: true, expands: true,
@ -114,27 +175,29 @@ export default {
listLoading: true, listLoading: true,
formVisible: false, formVisible: false,
depFormVisible: false, depFormVisible: false,
checkUserFormVisible: false checkUserFormVisible: false,
} };
}, },
created() { created() {
this.initData() this.initData();
}, },
methods: { methods: {
initData() { initData() {
this.loading = true this.loading = true;
getOrganizeList(this.listQuery).then(res => { getOrganizeList(this.listQuery)
this.treeList = res.data.list .then((res) => {
this.treeList = res.data.list;
if (this.treeList.length > 0) this.setTableIndex(this.treeList); if (this.treeList.length > 0) this.setTableIndex(this.treeList);
this.listLoading = false this.listLoading = false;
this.btnLoading = false this.btnLoading = false;
}).catch(() => {
this.listLoading = false
this.btnLoading = false
}) })
.catch(() => {
this.listLoading = false;
this.btnLoading = false;
});
}, },
search() { search() {
this.initData() this.initData();
}, },
// index // index
setTableIndex(arr, index) { setTableIndex(arr, index) {
@ -145,51 +208,49 @@ export default {
}); });
}, },
reset() { reset() {
this.listQuery.keyword = '' this.listQuery.keyword = "";
this.initData() this.initData();
}, },
addOrUpdateHandle(id, type, parentId) { addOrUpdateHandle(id, type, parentId) {
if (type === 'company') { if (type === "company") {
this.addOrUpdateOrganize(id, parentId) this.addOrUpdateOrganize(id, parentId);
} else { } else {
this.addOrUpdateDep(id) this.addOrUpdateDep(id);
} }
}, },
addOrUpdateOrganize(id, parentId) { addOrUpdateOrganize(id, parentId) {
this.formVisible = true this.formVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.Form.init(id, parentId) this.$refs.Form.init(id, parentId);
}) });
}, },
addOrUpdateDep(id) { addOrUpdateDep(id) {
this.depFormVisible = true this.depFormVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.depForm.init(id) this.$refs.depForm.init(id);
}) });
}, },
closeForm(isRefresh) { closeForm(isRefresh) {
this.formVisible = false this.formVisible = false;
if (isRefresh) { if (isRefresh) {
this.keyword = '' this.keyword = "";
this.initData() this.initData();
} }
}, },
closeDepForm(isRefresh) { closeDepForm(isRefresh) {
this.depFormVisible = false this.depFormVisible = false;
if (isRefresh) { if (isRefresh) {
this.keyword = '' this.keyword = "";
this.initData() this.initData();
} }
}, },
checkMembers(id, name) { checkMembers(id, name) {
this.checkUserFormVisible = true this.checkUserFormVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.checkUserForm.init(id, name) this.$refs.checkUserForm.init(id, name);
}) });
},
checkUser() {
}, },
checkUser() {},
toggleExpand() { toggleExpand() {
this.refreshTable = false; this.refreshTable = false;
this.expands = !this.expands; this.expands = !this.expands;
@ -198,25 +259,27 @@ export default {
}); });
}, },
handleDel(id) { handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), { this.$confirm(this.$t("common.delTip"), this.$t("common.tipTitle"), {
type: 'warning' type: "warning",
}).then(() => { })
delOrganize(id).then(res => { .then(() => {
delOrganize(id).then((res) => {
this.$message({ this.$message({
type: 'success', type: "success",
message: res.msg, message: res.msg,
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.$store.commit('generator/SET_COMPANY_TREE', []) this.$store.commit("generator/SET_COMPANY_TREE", []);
this.$store.commit('generator/SET_DEP_TREE', []) this.$store.commit("generator/SET_DEP_TREE", []);
this.initData() this.initData();
} },
}) });
});
}) })
}).catch(() => { }) .catch(() => {});
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table-icon { .table-icon {

@ -2,91 +2,159 @@
<transition name="el-zoom-in-center"> <transition name="el-zoom-in-center">
<div class="JNPF-preview-main org-form"> <div class="JNPF-preview-main org-form">
<div class="JNPF-common-page-header"> <div class="JNPF-common-page-header">
<el-page-header @back="goBack" <el-page-header
:content="!dataForm.id ? $t(`Organize.addCompany`) : $t(`Organize.editCompany`)" /> @back="goBack"
:content="
!dataForm.id
? $t(`Organize.addCompany`)
: $t(`Organize.editCompany`)
"
/>
<div class="options"> <div class="options">
<el-button type="primary" :loading="btnLoading" @click="handleConfirm()"> <el-button
{{$t('common.confirmButton')}}</el-button> type="primary"
<el-button @click="goBack">{{$t('common.cancelButton')}}</el-button> :loading="btnLoading"
@click="handleConfirm()"
>
{{ $t("common.confirmButton") }}</el-button
>
<el-button @click="goBack">{{ $t("common.cancelButton") }}</el-button>
</div> </div>
</div> </div>
<div class="main" v-loading="formLoading"> <div class="main" v-loading="formLoading">
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="80px"> <el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="80px"
>
<div class="JNPF-common-title mb-20"> <div class="JNPF-common-title mb-20">
<h2 class="bold">基础信息</h2> <h2 class="bold">基础信息</h2>
</div> </div>
<el-row :gutter="20" class="custom-row"> <el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="上级公司" prop="parentId"> <el-form-item label="上级公司" prop="parentId">
<JnpfOrganizeSelect v-model="organizeIdTree" placeholder="选择上级公司" auth isOnlyOrg <JnpfOrganizeSelect
@change="onOrganizeChange" :currOrgId="dataForm.id||'0'" v-model="organizeIdTree"
:parentId="parentId||'0'" /> placeholder="选择上级公司"
auth
isOnlyOrg
@change="onOrganizeChange"
:currOrgId="dataForm.id || '0'"
:parentId="parentId || '0'"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司名称" prop="fullName"> <el-form-item label="公司名称" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="输入名称" maxlength="50" /> <el-input
v-model="dataForm.fullName"
placeholder="输入名称"
maxlength="50"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司编码" prop="enCode"> <el-form-item label="公司编码" prop="enCode">
<el-input v-model="dataForm.enCode" placeholder="输入公司编码" /> <el-input
v-model="dataForm.enCode"
placeholder="输入公司编码"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司简称" prop="propertyJson.shortName"> <el-form-item label="公司简称" prop="propertyJson.shortName">
<el-input v-model="dataForm.propertyJson.shortName" placeholder="输入公司简称" /> <el-input
v-model="dataForm.propertyJson.shortName"
placeholder="输入公司简称"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司性质" prop="propertyJson.enterpriseNature"> <el-form-item
<JnpfTreeSelect v-model="dataForm.propertyJson.enterpriseNature" label="公司性质"
:options="natureData" placeholder="请选择公司性质" style="width: 100%" /> prop="propertyJson.enterpriseNature"
>
<JnpfTreeSelect
v-model="dataForm.propertyJson.enterpriseNature"
:options="natureData"
placeholder="请选择公司性质"
style="width: 100%"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="所属行业" prop="propertyJson.industry"> <el-form-item label="所属行业" prop="propertyJson.industry">
<JnpfTreeSelect v-model="dataForm.propertyJson.industry" :options="industryData" <JnpfTreeSelect
placeholder="请选择所属行业" style="width: 100%" /> v-model="dataForm.propertyJson.industry"
:options="industryData"
placeholder="请选择所属行业"
style="width: 100%"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="成立时间" prop="propertyJson.foundedTime"> <el-form-item label="成立时间" prop="propertyJson.foundedTime">
<el-date-picker v-model="dataForm.propertyJson.foundedTime" type="date" <el-date-picker
value-format="timestamp" placeholder="选择日期" :picker-options="pickerOptions" v-model="dataForm.propertyJson.foundedTime"
style="width: 100%"> type="date"
value-format="timestamp"
placeholder="选择日期"
:picker-options="pickerOptions"
style="width: 100%"
>
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司电话" prop="propertyJson.telePhone"> <el-form-item label="公司电话" prop="propertyJson.telePhone">
<el-input v-model="dataForm.propertyJson.telePhone" placeholder="输入公司电话" /> <el-input
v-model="dataForm.propertyJson.telePhone"
placeholder="输入公司电话"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司传真" prop="propertyJson.fax"> <el-form-item label="公司传真" prop="propertyJson.fax">
<el-input v-model="dataForm.propertyJson.fax" placeholder="输入公司传真" /> <el-input
v-model="dataForm.propertyJson.fax"
placeholder="输入公司传真"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司主页" prop="propertyJson.webSite"> <el-form-item label="公司主页" prop="propertyJson.webSite">
<el-input v-model="dataForm.propertyJson.webSite" placeholder="输入公司主页" /> <el-input
v-model="dataForm.propertyJson.webSite"
placeholder="输入公司主页"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="公司地址" prop="propertyJson.address"> <el-form-item label="公司地址" prop="propertyJson.address">
<el-input v-model="dataForm.propertyJson.address" placeholder="输入公司地址" /> <el-input
v-model="dataForm.propertyJson.address"
placeholder="输入公司地址"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="排序" prop="sortCode"> <el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" :max="999999" v-model="dataForm.sortCode" <el-input-number
controls-position="right" /> :min="0"
:max="999999"
v-model="dataForm.sortCode"
controls-position="right"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="说明" prop="description"> <el-form-item label="说明" prop="description">
<el-input v-model="dataForm.description" type="textarea" :rows="3" /> <el-input
v-model="dataForm.description"
type="textarea"
:rows="3"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -96,37 +164,66 @@
<el-row :gutter="20" class="custom-row"> <el-row :gutter="20" class="custom-row">
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="公司法人" prop="propertyJson.managerName"> <el-form-item label="公司法人" prop="propertyJson.managerName">
<el-input v-model="dataForm.propertyJson.managerName" placeholder="输入公司法人" /> <el-input
v-model="dataForm.propertyJson.managerName"
placeholder="输入公司法人"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系电话" prop="propertyJson.managerTelePhone"> <el-form-item
<el-input v-model="dataForm.propertyJson.managerTelePhone" placeholder="输入联系电话" /> label="联系电话"
prop="propertyJson.managerTelePhone"
>
<el-input
v-model="dataForm.propertyJson.managerTelePhone"
placeholder="输入联系电话"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系手机" prop="propertyJson.managerMobilePhone"> <el-form-item
<el-input v-model="dataForm.propertyJson.managerMobilePhone" placeholder="输入联系手机" /> :rules="dataRule"
label="联系手机"
prop="propertyJson.managerMobilePhone"
>
<el-input
v-model="dataForm.propertyJson.managerMobilePhone"
placeholder="输入联系手机"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="联系邮箱" prop="propertyJson.manageEmail"> <el-form-item label="联系邮箱" prop="propertyJson.manageEmail">
<el-input v-model="dataForm.propertyJson.manageEmail" placeholder="输入联系邮箱" /> <el-input
v-model="dataForm.propertyJson.manageEmail"
placeholder="输入联系邮箱"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="开户银行" prop="propertyJson.bankName"> <el-form-item label="开户银行" prop="propertyJson.bankName">
<el-input v-model="dataForm.propertyJson.bankName" placeholder="输入开户银行" /> <el-input
v-model="dataForm.propertyJson.bankName"
placeholder="输入开户银行"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :sm="12" :xs="24"> <el-col :sm="12" :xs="24">
<el-form-item label="银行账户" prop="propertyJson.bankAccount"> <el-form-item label="银行账户" prop="propertyJson.bankAccount">
<el-input v-model="dataForm.propertyJson.bankAccount" placeholder="输入银行账户" /> <el-input
v-model="dataForm.propertyJson.bankAccount"
placeholder="输入银行账户"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="经营范围" prop="propertyJson.businessscope"> <el-form-item label="经营范围" prop="propertyJson.businessscope">
<el-input v-model="dataForm.propertyJson.businessscope" type="textarea" :rows="3" /> <el-input
v-model="dataForm.propertyJson.businessscope"
type="textarea"
:rows="3"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -137,7 +234,11 @@
</template> </template>
<script> <script>
import { createOrganize, updateOrganize, getOrganizeInfo } from '@/api/permission/organize' import {
createOrganize,
updateOrganize,
getOrganizeInfo,
} from "@/api/permission/organize";
export default { export default {
data() { data() {
@ -146,116 +247,142 @@ export default {
btnLoading: false, btnLoading: false,
formLoading: false, formLoading: false,
dataForm: { dataForm: {
id: '', id: "",
parentId: '', parentId: "",
fullName: '', fullName: "",
enCode: '', enCode: "",
enabledMark: 1, enabledMark: 1,
sortCode: 0, sortCode: 0,
description: '', description: "",
propertyJson: { propertyJson: {
shortName: '', shortName: "",
enterpriseNature: '', enterpriseNature: "",
industry: '', industry: "",
foundedTime: '', foundedTime: "",
telePhone: '', telePhone: "",
fax: '', fax: "",
webSite: '', webSite: "",
address: '', address: "",
managerName: '', managerName: "",
managerTelePhone: '', managerTelePhone: "",
managerMobilePhone: '', managerMobilePhone: "",
manageEmail: '', manageEmail: "",
bankName: '', bankName: "",
bankAccount: '', bankAccount: "",
businessscope: '' businessscope: "",
} },
}, },
parentId: '', parentId: "",
organizeIdTree: [], organizeIdTree: [],
natureData: [], natureData: [],
industryData: [], industryData: [],
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
return time.getTime() > Date.now(); return time.getTime() > Date.now();
} },
}, },
dataRule: { dataRule: {
parentId: [ parentId: [
{ required: true, message: '上级公司不能为空', trigger: 'change' } { required: true, message: "上级公司不能为空", trigger: "change" },
], ],
fullName: [ fullName: [
{ required: true, message: '请输入公司名称', trigger: 'blur' } { required: true, message: "请输入公司名称", trigger: "blur" },
],
managerTelePhone: [
{ required: true, message: "请输入联系电话", trigger: "blur" },
{
pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/,
message: "请输入联系电话",
trigger: "blur",
},
], ],
enCode: [ enCode: [
{ required: true, message: '请输入公司编码', trigger: 'blur' }, { required: true, message: "请输入公司编码", trigger: "blur" },
{ validator: this.formValidate('enCode', '公司编码只能输入英文、数字和小数点且小数点不能放在首尾'), trigger: 'blur' }, {
{ max: 50, message: '公司编码最多为50个字符', trigger: 'blur' } validator: this.formValidate(
"enCode",
"公司编码只能输入英文、数字和小数点且小数点不能放在首尾"
),
trigger: "blur",
},
{ max: 50, message: "公司编码最多为50个字符", trigger: "blur" },
], ],
} },
} };
}, },
methods: { methods: {
init(id, parentId) { init(id, parentId) {
this.visible = true this.visible = true;
this.dataForm.id = id || '' this.dataForm.id = id || "";
this.parentId = parentId || '' this.parentId = parentId || "";
this.organizeIdTree = [] this.organizeIdTree = [];
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs["dataForm"].resetFields();
// //
this.$store.dispatch('base/getDictionaryData', { sort: 'EnterpriseNature' }).then(res => { this.$store
this.natureData = res .dispatch("base/getDictionaryData", { sort: "EnterpriseNature" })
}) .then((res) => {
this.natureData = res;
});
// //
this.$store.dispatch('base/getDictionaryData', { sort: 'IndustryType' }).then(res => { this.$store
this.industryData = res .dispatch("base/getDictionaryData", { sort: "IndustryType" })
}) .then((res) => {
this.industryData = res;
});
if (this.dataForm.id) { if (this.dataForm.id) {
this.formLoading = true this.formLoading = true;
getOrganizeInfo(this.dataForm.id).then(res => { getOrganizeInfo(this.dataForm.id)
this.dataForm = res.data .then((res) => {
this.organizeIdTree = res.data.organizeIdTree || [] this.dataForm = res.data;
const propertyJson = res.data.propertyJson ? JSON.parse(res.data.propertyJson) : {} this.organizeIdTree = res.data.organizeIdTree || [];
this.dataForm.propertyJson = propertyJson const propertyJson = res.data.propertyJson
this.formLoading = false ? JSON.parse(res.data.propertyJson)
}).catch(() => { this.formLoading = false }) : {};
} this.dataForm.propertyJson = propertyJson;
this.formLoading = false;
}) })
.catch(() => {
this.formLoading = false;
});
}
});
}, },
goBack() { goBack() {
this.$emit('close') this.$emit("close");
}, },
onOrganizeChange(val) { onOrganizeChange(val) {
if (!val || !val.length) return this.dataForm.parentId = '' if (!val || !val.length) return (this.dataForm.parentId = "");
this.dataForm.parentId = val[val.length - 1] this.dataForm.parentId = val[val.length - 1];
}, },
handleConfirm() { handleConfirm() {
this.$refs['dataForm'].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (valid) { if (valid) {
this.btnLoading = true this.btnLoading = true;
const formMethod = this.dataForm.id ? updateOrganize : createOrganize const formMethod = this.dataForm.id ? updateOrganize : createOrganize;
formMethod(this.dataForm).then(res => { formMethod(this.dataForm)
.then((res) => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.visible = false this.visible = false;
this.btnLoading = false this.btnLoading = false;
this.$store.commit('generator/SET_COMPANY_TREE', []) this.$store.commit("generator/SET_COMPANY_TREE", []);
this.$store.commit('generator/SET_DEP_TREE', []) this.$store.commit("generator/SET_DEP_TREE", []);
this.$emit('close', true) this.$emit("close", true);
} },
}) });
}).catch(() => {
this.btnLoading = false
})
}
}) })
.catch(() => {
this.btnLoading = false;
});
} }
} });
} },
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main { .main {

@ -5,15 +5,21 @@
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
<el-col :span="6"> <el-col :span="6">
<el-form-item :label="$t('common.keyword')"> <el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')" <el-input
clearable @keyup.enter.native="search()" /> v-model="listQuery.keyword"
:placeholder="$t('common.enterKeyword')"
clearable
@keyup.enter.native="search()"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"> <el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button> {{ $t("common.search") }}</el-button
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}} >
<el-button icon="el-icon-refresh-right" @click="reset()"
>{{ $t("common.reset") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -26,58 +32,109 @@
新建<i class="el-icon-arrow-down el-icon--right"></i> 新建<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="addOrUpdateHandle('','company')">新建公司 <el-dropdown-item @click.native="addOrUpdateHandle('', 'company')"
>新建公司
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item @click.native="addOrUpdateHandle()">新建部门</el-dropdown-item> <!-- <el-dropdown-item @click.native="addOrUpdateHandle()">新建部门</el-dropdown-item> -->
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
<div class="JNPF-common-head-right"> <div class="JNPF-common-head-right">
<el-tooltip effect="dark" content="展开" placement="top"> <el-tooltip effect="dark" content="展开" placement="top">
<el-link v-show="!expands" type="text" <el-link
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon" :underline="false" v-show="!expands"
@click="toggleExpand()" /> type="text"
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon"
:underline="false"
@click="toggleExpand()"
/>
</el-tooltip> </el-tooltip>
<el-tooltip effect="dark" content="折叠" placement="top"> <el-tooltip effect="dark" content="折叠" placement="top">
<el-link v-show="expands" type="text" <el-link
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon" :underline="false" v-show="expands"
@click="toggleExpand()" /> type="text"
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon"
:underline="false"
@click="toggleExpand()"
/>
</el-tooltip> </el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top"> <el-tooltip
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false" effect="dark"
@click="initData()" /> :content="$t('common.refresh')"
placement="top"
>
<el-link
icon="icon-ym icon-ym-Refresh JNPF-common-head-icon"
:underline="false"
@click="initData()"
/>
</el-tooltip> </el-tooltip>
</div> </div>
</div> </div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable" <JNPF-table
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}"> v-loading="listLoading"
:data="treeList"
row-key="id"
v-if="refreshTable"
:default-expand-all="expands"
:tree-props="{ children: 'children', hasChildren: '' }"
>
<el-table-column prop="fullName" label="名称"> <el-table-column prop="fullName" label="名称">
<template slot-scope="scope"> <template slot-scope="scope">
<i :class="'table-icon icon-my '+scope.row.icon"></i>{{scope.row.fullName}} <i :class="'table-icon icon-my ' + scope.row.icon"></i
>{{ scope.row.fullName }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="enCode" label="编码" /> <el-table-column prop="enCode" label="编码" />
<el-table-column prop="index" label="层级" width="100" align="center" /> <el-table-column
prop="index"
label="层级"
width="100"
align="center"
/>
<el-table-column prop="type" label="类型" width="100" align="center"> <el-table-column prop="type" label="类型" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.type==='company'?'公司':'部门'}} {{ scope.row.type === "company" ? "公司" : "部门" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间" <el-table-column
width="120" /> prop="creatorTime"
<el-table-column prop="sortCode" label="排序" width="70" align="center" /> :formatter="jnpf.tableDateFormat"
label="创建时间"
width="120"
/>
<el-table-column
prop="sortCode"
label="排序"
width="70"
align="center"
/>
<el-table-column label="操作" width="150"> <el-table-column label="操作" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id,scope.row.type,scope.row.parentId)" <tableOpts
@del="handleDel(scope.row.id)"> @edit="
addOrUpdateHandle(
scope.row.id,
scope.row.type,
scope.row.parentId
)
"
@del="handleDel(scope.row.id)"
>
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<el-button type="text" size="mini">{{$t('common.moreBtn')}}<i <el-button type="text" size="mini"
class="el-icon-arrow-down el-icon--right"></i> >{{ $t("common.moreBtn")
}}<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="checkMembers(scope.row.id,scope.row.fullName)"> <el-dropdown-item
查看成员</el-dropdown-item> @click.native="
checkMembers(scope.row.id, scope.row.fullName)
"
>
查看成员</el-dropdown-item
>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</tableOpts> </tableOpts>
@ -89,23 +146,26 @@
<Form v-show="formVisible" ref="Form" @close="closeForm" /> <Form v-show="formVisible" ref="Form" @close="closeForm" />
<DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" /> <DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" />
<CheckUser v-if="checkUserFormVisible" ref="checkUserForm" <CheckUser
@close="checkUserFormVisible=false" /> v-if="checkUserFormVisible"
ref="checkUserForm"
@close="checkUserFormVisible = false"
/>
</div> </div>
</template> </template>
<script> <script>
import { getOrganizeList, delOrganize } from '@/api/permission/organize' import { getOrganizeList, delOrganize } from "@/api/permission/organize";
import Form from './Form' import Form from "./Form";
import DepForm from './depForm' import DepForm from "./depForm";
import CheckUser from './checkUser.vue' import CheckUser from "./checkUser.vue";
export default { export default {
name: 'permission-organize', name: "permission-organize",
components: { Form, DepForm, CheckUser }, components: { Form, DepForm, CheckUser },
data() { data() {
return { return {
listQuery: { listQuery: {
keyword: '' keyword: "",
}, },
treeList: [], treeList: [],
expands: true, expands: true,
@ -114,27 +174,29 @@ export default {
listLoading: true, listLoading: true,
formVisible: false, formVisible: false,
depFormVisible: false, depFormVisible: false,
checkUserFormVisible: false checkUserFormVisible: false,
} };
}, },
created() { created() {
this.initData() this.initData();
}, },
methods: { methods: {
initData() { initData() {
this.loading = true this.loading = true;
getOrganizeList(this.listQuery).then(res => { getOrganizeList(this.listQuery)
this.treeList = res.data.list .then((res) => {
this.treeList = res.data.list;
if (this.treeList.length > 0) this.setTableIndex(this.treeList); if (this.treeList.length > 0) this.setTableIndex(this.treeList);
this.listLoading = false this.listLoading = false;
this.btnLoading = false this.btnLoading = false;
}).catch(() => {
this.listLoading = false
this.btnLoading = false
}) })
.catch(() => {
this.listLoading = false;
this.btnLoading = false;
});
}, },
search() { search() {
this.initData() this.initData();
}, },
// index // index
setTableIndex(arr, index) { setTableIndex(arr, index) {
@ -145,51 +207,49 @@ export default {
}); });
}, },
reset() { reset() {
this.listQuery.keyword = '' this.listQuery.keyword = "";
this.initData() this.initData();
}, },
addOrUpdateHandle(id, type, parentId) { addOrUpdateHandle(id, type, parentId) {
if (type === 'company') { if (type === "company") {
this.addOrUpdateOrganize(id, parentId) this.addOrUpdateOrganize(id, parentId);
} else { } else {
this.addOrUpdateDep(id) this.addOrUpdateDep(id);
} }
}, },
addOrUpdateOrganize(id, parentId) { addOrUpdateOrganize(id, parentId) {
this.formVisible = true this.formVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.Form.init(id, parentId) this.$refs.Form.init(id, parentId);
}) });
}, },
addOrUpdateDep(id) { addOrUpdateDep(id) {
this.depFormVisible = true this.depFormVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.depForm.init(id) this.$refs.depForm.init(id);
}) });
}, },
closeForm(isRefresh) { closeForm(isRefresh) {
this.formVisible = false this.formVisible = false;
if (isRefresh) { if (isRefresh) {
this.keyword = '' this.keyword = "";
this.initData() this.initData();
} }
}, },
closeDepForm(isRefresh) { closeDepForm(isRefresh) {
this.depFormVisible = false this.depFormVisible = false;
if (isRefresh) { if (isRefresh) {
this.keyword = '' this.keyword = "";
this.initData() this.initData();
} }
}, },
checkMembers(id, name) { checkMembers(id, name) {
this.checkUserFormVisible = true this.checkUserFormVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.checkUserForm.init(id, name) this.$refs.checkUserForm.init(id, name);
}) });
},
checkUser() {
}, },
checkUser() {},
toggleExpand() { toggleExpand() {
this.refreshTable = false; this.refreshTable = false;
this.expands = !this.expands; this.expands = !this.expands;
@ -198,25 +258,27 @@ export default {
}); });
}, },
handleDel(id) { handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), { this.$confirm(this.$t("common.delTip"), this.$t("common.tipTitle"), {
type: 'warning' type: "warning",
}).then(() => { })
delOrganize(id).then(res => { .then(() => {
delOrganize(id).then((res) => {
this.$message({ this.$message({
type: 'success', type: "success",
message: res.msg, message: res.msg,
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.$store.commit('generator/SET_COMPANY_TREE', []) this.$store.commit("generator/SET_COMPANY_TREE", []);
this.$store.commit('generator/SET_DEP_TREE', []) this.$store.commit("generator/SET_DEP_TREE", []);
this.initData() this.initData();
} },
}) });
});
}) })
}).catch(() => { }) .catch(() => {});
} },
} },
} };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table-icon { .table-icon {

Loading…
Cancel
Save