| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401 |
- <template>
- <div class="app-container">
- <el-card class="fiche">
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">收起</right-toolbar>
- <span style="margin-bottom: 10px;color:#333333;font:14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,sans-serif">所选条件:</span>
- <div style="float: right;margin-right:1%">
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" style="float: ;">重置</el-button>
- <column-setting :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId" style="margin-left:5px"></column-setting>
- </div>
- <hr style="margin-top: 16px;">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="公司名称" prop="scyName">
- <el-input
- maxlength="30"
- v-model="queryParams.scyName"
- placeholder="请输入公司名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <!-- <el-form-item label="公司简称" prop="scyAbridge">
- <el-input
- v-model="queryParams.scyAbridge"
- placeholder="请输入公司简称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item> -->
- <el-form-item label="状态" prop="scyStt">
- <el-select v-model="queryParams.scyStt"
- placeholder="企业状态"
- clearable
- size="small"
- style="width: 240px">
- <el-option
- v-for="dict in statusOptions"
- :key="dict.dictValue"
- :label="dict.dictLabel"
- :value="dict.dictValue"
- ></el-option>
- </el-select>
- </el-form-item>
-
- </el-form>
- </el-card>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['system:company:add']"
- >新增</el-button>
- </el-col>
-
- </el-row>
- <el-table v-loading="loading" :data="companyList" @selection-change="handleSelectionChange" stripe border>
- <el-table-column label="序号" type="index" width="55" align="center" />
- <el-table-column label="主键" align="center" prop="scyId" v-if="isshow"/>
- <el-table-column label="公司名称" align="center" prop="scyName" :show-overflow-tooltip="true" v-if="uncheckList.scyName"/>
- <el-table-column label="公司简称" align="center" prop="scyAbridge" v-if="uncheckList.scyAbridge"/>
- <el-table-column label="公司电话" align="center" prop="scyPhone" v-if="uncheckList.scyPhone"/>
- <el-table-column label="统一社会信用代码" align="center" prop="scySocialCode" v-if="uncheckList.scySocialCode"/>
- <el-table-column label="法定代表人" align="center" prop="scyLegal" v-if="uncheckList.scyLegal" />
- <el-table-column label="公司说明描述" align="center" prop="scyDescribe" :show-overflow-tooltip="true" v-if="uncheckList.scyDescribe"/>
- <el-table-column label="备注" align="center" prop="scyRemarks" :show-overflow-tooltip="true" v-if="uncheckList.scyRemarks"/>
- <el-table-column label="状态" align="center">
- <template slot-scope="scope">
- <el-switch
- v-model="scope.row.scyStt"
- active-value="00"
- inactive-value="01"
- @change="handleStatusChange(scope.row)"
- ></el-switch>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['system:company:edit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-shopping-bag-1"
- @click="handleProduct(scope.row)"
- v-hasPermi="['system:productAttr:add']"
- >产品配置</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['system:company:remove']"
- >删除</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-cpu"
- @click="handleStyle(scope.row)"
- v-hasPermi="['system:styleConfig:update']"
- >样式配置</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改公司对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
- <el-form-item label="公司名称" prop="scyName">
- <el-input v-model="form.scyName" placeholder="请输入公司名称" style="width:560px" maxlength="20" show-word-limit/>
- </el-form-item>
- <el-form-item label="公司简称" prop="scyAbridge">
- <el-input v-model="form.scyAbridge" placeholder="请输入公司简称" maxlength="10" show-word-limit/>
- </el-form-item>
- <el-form-item label="公司电话" prop="scyPhone">
- <el-input v-model="form.scyPhone" placeholder="请输入公司电话" maxlength="13" show-word-limit/>
- </el-form-item>
- <!-- <el-form-item label="是否集团" prop="scyIsGroup">
- <el-radio-group v-model="form.scyIsGroup">
- <el-radio
- v-for="dict in spiStateOptions"
- :key="dict.dictValue"
- :label="dict.dictValue"
- >{{dict.dictLabel}}</el-radio>
- </el-radio-group>
- </el-form-item> -->
- <el-form-item label="负责人" prop="scyLeader">
- <el-input v-model="form.scyLeader" placeholder="请输入负责人姓名" maxlength="5" show-word-limit/>
- </el-form-item>
- <el-form-item label="账号登录名" prop="userName" v-if="addMessage">
- <el-input v-model="form.userName" placeholder="请输入账号登录名" maxlength="20" show-word-limit/>
- </el-form-item>
- <el-form-item label="公司地址" prop="scyAddress">
- <el-input v-model="form.scyAddress" type="textarea" placeholder="请输入公司地址" style="width:560px" maxlength="30" show-word-limit/>
- </el-form-item>
- <el-form-item label="统一社会信用代码" prop="scySocialCode">
- <el-input v-model="form.scySocialCode" placeholder="请输入统一社会信用代码" maxlength="18" show-word-limit/>
- </el-form-item>
- <el-form-item label="法定代表人" prop="scyLegal">
- <el-input v-model="form.scyLegal" placeholder="请输入法定代表人" maxlength="5" show-word-limit/>
- </el-form-item>
- <el-form-item label="公司说明描述" prop="scyDescribe">
- <el-input v-model="form.scyDescribe" type="textarea" placeholder="请输入内容" style="width:560px" maxlength="100" show-word-limit/>
- </el-form-item>
- <el-form-item label="备注" prop="scyRemarks">
- <el-input v-model="form.scyRemarks" type="textarea" placeholder="请输入内容" style="width:560px" maxlength="100" show-word-limit/>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 产品配置对话框 -->
- <el-dialog :title="title" :visible.sync="openProduct" width="800px" append-to-body>
- <el-form ref="productForm" :model="productForm" :rules="productRules" label-width="140px">
- <el-divider content-position="left">产品选择</el-divider>
- <el-form-item label="产品" prop="product">
- <el-select v-model="productForm.product" multiple collapse-tags placeholder="请选择" @change="selectAttr">
- <template v-for="item in productList">
- <el-option
- :key="item.spiProducId"
- :label="item.spiProducName"
- :value="item.spiProducId"
- v-if="item.spiState =='00'">
- </el-option>
- </template>
- </el-select>
- </el-form-item>
- <el-divider content-position="left">使用配置</el-divider>
- <el-table v-loading="loading" :data="companyProduct">
- <el-table-column label="产品名称" align="center" width="200" prop="scpProducId" :formatter="spiProducIdFormat"/>
- <el-table-column label="试用/正常" align="center" prop="scpState" width="100">
- <template slot-scope="scope">
- <el-switch v-model="scope.row.scpState" active-value="00" inactive-value="01"></el-switch>
- </template>
- </el-table-column>
- <el-table-column label="使用时间" align="center" prop="scpStartDate">
- <template slot-scope="scope">
- <el-date-picker
- v-model="scope.row.date"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- <!-- <el-date-picker v-model="scope.row.scpStartDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:200px"></el-date-picker> -->
- </template>
- </el-table-column>
- <!-- <el-table-column label="结束日期" align="center" prop="scpEndDate">
- <template slot-scope="scope">
- <el-date-picker v-model="scope.row.scpEndDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:200px"></el-date-picker>
- </template>
- </el-table-column> -->
- </el-table>
- <el-divider content-position="left" v-if="isAttr">参数配置</el-divider>
- <el-form-item
- v-for="item in productAttrList"
- :key="item.cpaCode"
- :label="codeFormat(item.cpaCode)"
- :prop="item.cpaCode"
- :rules="item.cpaCode == '00'
- ?[{ required: true, message: '请输入'+codeFormat(item.cpaCode), trigger: ['blur', 'change'] },
- { pattern:/^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/, message: '邮箱格式不正确', trigger: ['blur', 'change'] }]
- :[{ required: true, message: '请输入'+codeFormat(item.cpaCode), trigger: ['blur', 'change'] }]"
- >
- <el-select v-model="productForm[item.cpaCode]" placeholder="请选择" v-if="item.cpaCode == '01'">
- <el-option
- v-for="item in emailTypeOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue">
- </el-option>
- </el-select>
- <el-input v-model="productForm[item.cpaCode]" maxlength="20" show-word-limit style="width:300px" v-else/>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitProductForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 产品配置值对话框 -->
- <el-dialog :title="title" :visible.sync="openStyle" width="800px" append-to-body>
- <el-form ref="styleForm" :model="styleForm" :rules="styleRules" label-width="140px" :inline="true">
- <el-form-item label="域名" prop="sscDomain">
- <el-input v-model="styleForm.sscDomain" placeholder="请输入公司域名" style="width:560px" maxlength="60" show-word-limit/>
- </el-form-item>
- <!-- <el-form-item label="企业名称" prop="sscCompanyId">
- <el-input v-model="styleForm.sscCompanyId" placeholder="请输入公司简称" maxlength="10" show-word-limit/>
- </el-form-item> -->
- <el-form-item label="登录页背景图">
- <el-upload
- ref="BackgroundImg"
- class="BackgroundImg-demo"
- action=""
- accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
- :http-request="httpBackgroundImgRequest"
- multiple
- :limit="1"
- :before-upload="beforeUpload"
- :on-exceed="handleBackgroundImgExceed"
- list-type="picture-card"
- :file-list="imgList"
- :auto-upload="false">
- <i slot="default" class="el-icon-plus" ></i>
- <div slot="file" slot-scope="{file}">
- <img
- class="el-upload-list__item-thumbnail"
- :src="file.url" alt=""
- >
- <span class="el-upload-list__item-actions">
- <span
- class="el-upload-list__item-preview"
- @click="handlePictureCardPreview(file)"
- >
- <i class="el-icon-zoom-in"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleBackgroundImgDownload(file)"
- >
- <i class="el-icon-download"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleBackgroundImgRemove(file,imgList)"
- >
- <i class="el-icon-delete"></i>
- </span>
- </span>
- </div>
- </el-upload>
- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitImgUpload">上传到服务器</el-button>
- </el-form-item>
- <el-form-item label="登录页logo">
- <el-upload
- ref="Logo"
- class="Logo-demo"
- action=""
- accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
- :http-request="httpLogoRequest"
- multiple
- :limit="1"
- :before-upload="beforeLogoUpload"
- :on-exceed="handleLogoExceed"
- list-type="picture-card"
- :file-list="LogoList"
- :auto-upload="false">
- <i slot="default" class="el-icon-plus" ></i>
- <div slot="file" slot-scope="{file}">
- <img
- class="el-upload-list__item-thumbnail"
- :src="file.url" alt=""
- >
- <span class="el-upload-list__item-actions">
- <span
- class="el-upload-list__item-preview"
- @click="handleLogoPreview(file)"
- >
- <i class="el-icon-zoom-in"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleLogoDownload(file)"
- >
- <i class="el-icon-download"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleLogoRemove(file,LogoList)"
- >
- <i class="el-icon-delete"></i>
- </span>
- </span>
- </div>
- </el-upload>
- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitLogoUpload">上传到服务器</el-button>
- </el-form-item>
- <el-form-item label="首页logo">
- <el-upload
- ref="IndexLogo"
- class="IndexLogo-demo"
- action=""
- accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
- :http-request="httpIndexLogoRequest"
- multiple
- :limit="1"
- :before-upload="beforeIndexLogoUpload"
- :on-exceed="handleIndexLogoExceed"
- list-type="picture-card"
- :file-list="IndexLogoList"
- :auto-upload="false">
- <i slot="default" class="el-icon-plus" ></i>
- <div slot="file" slot-scope="{file}">
- <img
- class="el-upload-list__item-thumbnail"
- :src="file.url" alt=""
- >
- <span class="el-upload-list__item-actions">
- <span
- class="el-upload-list__item-preview"
- @click="handleIndexLogoPreview(file)"
- >
- <i class="el-icon-zoom-in"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleIndexLogoDownload(file)"
- >
- <i class="el-icon-download"></i>
- </span>
- <span
- class="el-upload-list__item-delete"
- @click="handleIndexLogoRemove(file,IndexLogoList)"
- >
- <i class="el-icon-delete"></i>
- </span>
- </span>
- </div>
- </el-upload>
- <el-button style="margin-left: 10px;" size="small" type="success" @click="submitIndexLogoUpload">上传到服务器</el-button>
- </el-form-item>
-
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitStyleForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :visible.sync="dialogVisible">
- <img width="100%" :src="dialogImageUrl" alt="">
- </el-dialog>
- </div>
- </template>
- <script>
- import { listCompany, getCompany, delCompany, addCompany, updateCompany ,updateCompanyStatus,listOwnCompany} from "@/api/system/company";
- import { listProduct,productAttrList,addCompanyProductAttr,getCompanyProduct } from "@/api/system/product";
- import { listStyleConfig, getStyleConfig, addStyleConfig, updateStyleConfig} from "@/api/system/style";
- import { uploadFileNew } from "@/api/common/file";
- import { getToken } from "@/utils/auth";
- import {columnQuery,columnfilter} from "@/api/common/columnSetting";
- import ColumnSetting from '../../../components/Table/columnSetting.vue';
- export default {
- name: "Company",
- components: {
- // uploadImg
- ColumnSetting
- },
- data() {
- return {
- dialogImageUrl: '',
- dialogVisible: false,
- //id隐藏
- isshow:false,
- //邮箱展示
- isShowTaskTime: false,
- // 遮罩层
- loading: true,
- //域名禁用
- isShowDomain:false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 公司表格数据
- companyList: [],
- //产品数据
- productList:[],
- companyProduct:[],
- productAttrList:[],
- // 状态数据字典
- statusOptions: [],
- Product: [],
- serverHost: [],
- attrCodeOptions:[],
- imgList: [],
- LogoList: [],
- IndexLogoList: [],
- sscDomain:'',
- //图片
- // pictureList: [],
- //日期范围
- dateRange: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- openProduct: false,
- openStyle: false,
- isAttr:false,
- addMessage:false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- scyName: null,
- scyAbridge: null,
- scyAddress: null,
- scyPhone: null,
- scySocialCode: null,
- scyLegal: null,
- scyLicense: null,
- scyValidityTime: null,
- scyDescribe: null,
- scyRemarks: null,
- scyStt: null
- },
- //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
- tableList: [
- {
- label: 'scyName',
- value: '公司名称'
- },
- {
- label: 'scyAbridge',
- value: '公司简称'
- },
- {
- label: 'scyPhone',
- value: '公司电话'
- },
- {
- label: 'scySocialCode',
- value: '统一社会信用代码'
- },
- {
- label: 'scyLegal',
- value: '法定代表人'
- },
- {
- label: 'scyDescribe',
- value: '公司说明描述'
- },
- {
- label: 'scyRemarks',
- value: '备注'
- },
- ],
- checkList: [],//筛选列选中的数据列表--显示隐藏列用
- uncheckList: {},//控制筛选列显示隐藏--显示隐藏列用
- selfDom : this,
- tableId:"/system/owncompany/list",
- // 表单参数
- form: {},
- productForm: {},
- styleForm: {},
- companyId:null,
- company:null,
- // 表单校验
- rules: {
- scyName: [
- { required: true, message: "公司名称不能为空", trigger: "blur" },
- {
- pattern: /^[\u4e00-\u9fa5\(\)()\da-zA-Z&]{2,50}$/gi,
- message: "公司名称格式不正确",
- trigger: "blur"
- }
- ],
- scyAbridge: [
- { required: true, message: "公司简称不能为空", trigger: "blur" }
- ],
- scyLeader: [
- { required: true, message: "负责人不能为空", trigger: "blur" }
- ],
- userName: [
- { required: true, message: "账号登录名不能为空", trigger: "blur" },
- { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
- {
- pattern:/^[a-zA-Z0-9]+$/,
- message: "请输入数字或英文",
- trigger: "blur"
- }
- ],
- // scyAddress: [
- // { required: true, message: "公司地址不能为空", trigger: "blur" }
- // ],
- scyPhone: [
- {
- pattern: /^(\+?\d{2,4})?-?(\d{3,4})?-?\d{7,8}-?(\d{1,4})?$/,
- message: "电话格式不正确",
- trigger: "blur",
- }
- ],
- scySocialCode: [
- {
- pattern: /[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}/,
- message: "社会统一信用代码格式不正确",
- trigger: "blur"
- }
- ],
- // scyLegal: [
- // { required: true, message: "法定代表人不能为空", trigger: "blur" }
- // ],
- // scsStartTime: [
- // { required: true, message: "有效开始日期不能为空", trigger: "blur" }
- // ],
- // scsEndTime: [
- // { required: true, message: "有效结束日期不能为空", trigger: "blur" }
- // ],
- scyStt: [
- { required: true, message: "状态不能为空", trigger: "blur" }
- ]
- },
- productRules:{
- product: [
- { required: true, message: "产品未选择", trigger: ["blur", "change"] }
- ],
- "00": [
- { required: true, message: "邮箱不能为空", trigger: "blur" },
- {
- // type: "email",
- pattern:/^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/,
- message: "邮箱格式不正确",
- trigger:"blur",
- }
- ],
- },
- styleRules:{
- sscDomain: [
- { required: true, message: "请填写域名", trigger: ["blur", "change"] },
- {
- pattern:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}/,
- message: "域名格式不正确",
- trigger: "blur"
- }
- ],
- },
- emailTypeOptions:[]
- // fileBlod : null
- };
- },
- created() {
- this.getList();
- this.getDicts("sys_company_state").then(response => {
- this.statusOptions = response.data;
- });
- this.getDicts("scs_product").then(response => {
- this.Product = response.data;
- });
- this.getDicts("scs_server_host").then(response => {
- this.serverHost = response.data;
- });
- this.getDicts("product_attr_code").then(response => {
- this.attrCodeOptions = response.data;
- });
- this.getDicts("sys_email_type").then(response => {
- this.emailTypeOptions = response.data;
- });
-
- },
- mounted() {
- this.columnQuery();
- },
- methods: {
- //获取当前客户是否之前设置过列展示隐藏
- columnQuery(){
- //获取页面路径
- var psfPagePath = window.location.pathname;
- //用请求后台的url作为唯一标识
- var psfTableName = this.tableId;
- var columnForm = {};
- columnForm.psfPagePath = psfPagePath;
- columnForm.psfTableName = psfTableName;
- columnQuery(columnForm).then(response => {
- if(response.data && response.data.psfShowData){
- this.checkList = response.data.psfShowData;
- }
- this.filter();
- })
- },
- //控制隐藏显示的函数
- filter(checkList) {
- if (!!checkList) {
- this.checkList = checkList;
- }
- columnfilter(this.selfDom);
- },
- /** 查询公司列表 */
- getList() {
- this.loading = true;
- listOwnCompany(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
- this.companyList = response.rows;
- this.total = response.total;
- this.loading = false;
- }
- );
- },
- /** 查询产品信息列表 */
- getProductList() {
- listProduct().then(response => {
- this.productList = response.rows;
- });
- },
- /* 查询样式配置列表 */
- getStyleList() {
- listStyleConfig().then(response => {
- });
- },
- /* 登录页背景图 */
- httpBackgroundImgRequest(param) {
- let fileObj = param.file // 相当于input里取得的files
- let fd = new FormData()// FormData 对象
- fd.append('file', fileObj)// 文件对象
- fd.append('fileType','00')//文件类型
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- uploadFileNew(fd).then(response => {
- if(response){
- this.imgList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
- setTimeout(() => {
- this.msgSuccess("上传成功");
- loading.close();
- }, 2000);
- }
- })
- },
- /* 登录页背景图限制 */
- handleBackgroundImgExceed(files, imgList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- /* 限制登录页背景图片格式 */
- beforeUpload (file) {
- var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
- let _this = this;
- let imgWidth="";
- let imgHight="";
- const isSize = new Promise(function(resolve, reject){
- let width = 1536;
- let height = 752;
- let _URL = window.URL || window.webkitURL;
- let img = new Image();
- img.onload = function(){
- imgWidth = img.width;
- console.log(imgWidth)
- imgHight = img.height;
- let valid = img.width < width && img.height < height;
- valid ? resolve() : reject();
- }
- img.src = _URL.createObjectURL(file);
- }).then(()=>{
- return file;
- }, ()=>{
- _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于1536px,高需要小于752px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
- return Promise.reject()
- return false;//必须加上return false; 才能阻止
- })
- return isSize;
- //进行图片类型和大小的限制
- const isLt2M = file.size / 1024 / 1024 < 1;
- if(!isLt2M) {
- this.$message({
- message: '上传文件大小不能超过1MB!',
- type: 'warning'
- });
- return false;
- }return isLt2M;
- },
- /* 预览登录页背景图 */
- handlePictureCardPreview(file) {
- this.dialogImageUrl = file.url+'/'+getToken();
- this.dialogVisible = true;
- },
- //上传登录页背景图
- submitImgUpload(){
- this.$refs.BackgroundImg.submit();
- },
- /* 下载登录页背景图 */
- handleBackgroundImgDownload(file) {
- var a = document.createElement('a');
- var event = new MouseEvent('click');
- a.download = file.name;
- a.href = file.url+'/'+getToken();
- a.dispatchEvent(event);
- },
- //登录页背景图移除提示
- handleBackgroundImgRemove(file) {
- console.log(this.$refs.BackgroundImg.uploadFiles)
- for(let i = 0;i< this.imgList.length;i++){
- if(file.uid == this.imgList[i].uid){
- this.imgList.splice(i, 1);
- break;
- }
- }
- for(let i = 0;i< this.$refs.BackgroundImg.uploadFiles.length;i++){
- if(file.uid == this.$refs.BackgroundImg.uploadFiles[i].uid){
- this.$refs.BackgroundImg.uploadFiles.splice(i, 1);
- break;
- }
- }
- },
- /* 登录页logo */
- httpLogoRequest(param) {
- let fileObj = param.file // 相当于input里取得的files
- let fd = new FormData()// FormData 对象
- fd.append('file', fileObj)// 文件对象
- fd.append('fileType','00')//文件类型
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- uploadFileNew(fd).then(response => {
- if(response){
- this.LogoList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
- setTimeout(() => {
- this.msgSuccess("上传成功");
- loading.close();
- }, 2000);
- }
- })
- },
-
- /* 登录页logo限制 */
- handleLogoExceed(files, LogoList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- /* 限制登录页logo图片格式 */
- beforeLogoUpload (file) {
- var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
- let _this = this;
- let imgWidth="";
- let imgHight="";
- const isSize = new Promise(function(resolve, reject){
- let width = 860;
- let height = 66;
- let _URL = window.URL || window.webkitURL;
- let img = new Image();
- img.onload = function(){
- imgWidth = img.width;
- console.log(imgWidth)
- imgHight = img.height;
- let valid = img.width < width && img.height < height;
- valid ? resolve() : reject();
- }
- img.src = _URL.createObjectURL(file);
- }).then(()=>{
- return file;
- }, ()=>{
- _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于860px,高需要小于66px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
- return Promise.reject()
- return false;//必须加上return false; 才能阻止
- })
- return isSize;
- //进行图片类型和大小的限制
- const isLt2M = file.size / 1024 / 1024 < 1;
- if(!isLt2M) {
- this.$message({
- message: '上传文件大小不能超过1MB!',
- type: 'warning'
- });
- return false;
- }return isLt2M;
- },
- /* 预览登录页logo */
- handleLogoPreview(file) {
- this.dialogImageUrl = file.url+'/'+getToken();
- this.dialogVisible = true;
- },
- /* 下载登录页logo */
- handleLogoDownload(file) {
- var a = document.createElement('a');
- var event = new MouseEvent('click');
- a.download = file.name;
- a.href = file.url+'/'+getToken();
- a.dispatchEvent(event);
- },
- //登录页logo移除提示
- handleLogoRemove(file) {
- console.log(this.$refs.Logo.uploadFiles)
- for(let i = 0;i< this.LogoList.length;i++){
- if(file.uid == this.LogoList[i].uid){
- this.LogoList.splice(i, 1);
- break;
- }
- }
- for(let i = 0;i< this.$refs.Logo.uploadFiles.length;i++){
- if(file.uid == this.$refs.Logo.uploadFiles[i].uid){
- this.$refs.Logo.uploadFiles.splice(i, 1);
- break;
- }
- }
- },
- //上传登录页logo
- submitLogoUpload(){
- this.$refs.Logo.submit();
- },
- /* 首页logo */
- httpIndexLogoRequest(param) {
- let fileObj = param.file // 相当于input里取得的files
- let fd = new FormData()// FormData 对象
- fd.append('file', fileObj)// 文件对象
- fd.append('fileType','00')//文件类型
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- uploadFileNew(fd).then(response => {
- if(response){
- this.IndexLogoList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
- setTimeout(() => {
- this.msgSuccess("上传成功");
- loading.close();
- }, 2000);
- }
- })
- },
-
- /* 首页logo限制 */
- handleIndexLogoExceed(files, IndexLogoList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- /* 限制首页logo图片格式 */
- beforeIndexLogoUpload (file) {
- var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
- let _this = this;
- let imgWidth="";
- let imgHight="";
- const isSize = new Promise(function(resolve, reject){
- debugger
- console.log(isSize)
- let width = 155;
- let height = 32;
- let _URL = window.URL || window.webkitURL;
- let img = new Image();
- img.onload = function(){
- imgWidth = img.width;
- console.log(imgWidth)
- imgHight = img.height;
- let valid = img.width < width && img.height < height;
- valid ? resolve() : reject();
- }
- img.src = _URL.createObjectURL(file);
- }).then(()=>{
- return file;
- }, ()=>{
- _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于155px,高需要小于32px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
- return Promise.reject()
- return false;//必须加上return false; 才能阻止
- })
- return isSize;
- //进行图片类型和大小的限制
- const isLt2M = file.size / 1024 / 1024 < 1;
- if(!isLt2M) {
- this.$message({
- message: '上传文件大小不能超过1MB!',
- type: 'warning'
- });
- return false;
- }return isLt2M;
- },
- /* 预览首页logo */
- handleIndexLogoPreview(file) {
- this.dialogImageUrl = file.url+'/'+getToken();
- this.dialogVisible = true;
- },
- /* 下载首页logo */
- handleIndexLogoDownload(file) {
- var a = document.createElement('a');
- var event = new MouseEvent('click');
- a.download = file.name;
- a.href = file.url+'/'+getToken();
- a.dispatchEvent(event);
- },
- //首页logo移除提示
- handleIndexLogoRemove(file) {
- console.log(this.$refs.IndexLogo.uploadFiles)
- for(let i = 0;i< this.IndexLogoList.length;i++){
- if(file.uid == this.IndexLogoList[i].uid){
- this.LogoList.splice(i, 1);
- break;
- }
- }
- for(let i = 0;i< this.$refs.IndexLogo.uploadFiles.length;i++){
- if(file.uid == this.$refs.IndexLogo.uploadFiles[i].uid){
- this.$refs.IndexLogo.uploadFiles.splice(i, 1);
- break;
- }
- }
- },
- //上传首页logo
- submitIndexLogoUpload(){
- this.$refs.IndexLogo.submit();
- },
- handleStatusChange(row) {
- let text = row.scyStt === "00" ? "启用" : "停用";
- this.$confirm('确认要' + text + '"' + row.scyName + '"企业吗?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return updateCompanyStatus(row.scyId, row.scyStt);
- }).then(() => {
- this.msgSuccess(text + "成功");
- }).catch(function() {
- row.scyStt = row.scyStt === "00" ? "01" : "00";
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.openProduct = false;
- this.openStyle = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- scyId: null,
- scyName: null,
- scyAbridge: null,
- scyAddress: null,
- scyPhone: null,
- scySocialCode: null,
- scyLegal: null,
- scyLicense: null,
- scsStartTime: null,
- scsEndTime: null,
- scyDescribe: null,
- scyRemarks: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null,
- scsTrial:'01',
- scyStt: '00'
- };
- this.isAttr = false,
- this.addMessage = false,
- this.productList = [],
- this.companyProduct = [],
- this.productAttrList = [],
- this.imgList = [],
- this.LogoList = [],
- this.IndexLogoList = [],
- this.productForm = {},
- this.styleForm = {},
- this.resetForm("form");
- this.resetForm("productForm");
- this.resetForm("styleForm");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.dateRange = [];
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.scyId)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.addMessage = true,
- this.title = "添加公司";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const scyId = row.scyId || this.ids
- getCompany(scyId).then(response => {
- this.form = response.data;
- // console.log(this.form);
- this.open = true;
- this.title = "修改公司";
- });
- },
- /** 产品配置按钮操作 */
- handleProduct(row) {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- this.reset();
- const scyId = row.scyId || this.ids
- this.companyId = scyId
-
- getCompanyProduct(scyId).then(response => {
- this.productForm = response.data
- this.companyProduct = response.data.companyProduct
- this.productAttrList = response.data.productAttrList
- this.isAttr = response.data.productAttr
- this.openProduct = true;
- this.title = "产品配置";
- loading.close()
- }).catch((r) => {
- loading.close();
- });
- this.getProductList();
- },
- /* 样式配置按钮操作 */
- handleStyle(row) {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- const sscCompanyId = row.scyId || this.ids
- console.log(sscCompanyId)
- this.companyId = sscCompanyId
-
- getStyleConfig(sscCompanyId).then(response => {
- debugger
- this.openStyle = true;
- this.isShowDomain = false;
- if(response.data.length > 0){
- this.styleForm = response.data[0];
- if(response.data[0].sscDomain){
- this.isShowDomain = true;
- }
- var json = response.data[0].sscConfig;
- const imgForm = JSON.parse(json);
- const BackgroundImg = imgForm.BackgroundImg;
- const indexLogo = imgForm.indexLogo;
- const logo = imgForm.logo;
- if(BackgroundImg){
- this.imgList.push({url:BackgroundImg});
- }
- if(indexLogo){
- this.IndexLogoList.push({url:indexLogo});
- }
- if(logo){
- this.LogoList.push({url:logo});
- }
- }
- this.title = "样式配置";
- loading.close()
- }).catch((r) => {
- loading.close();
- });
- this.getStyleList();
- },
- /** 提交按钮 */
- submitForm() {
- var self = this;
- this.$refs["form"].validate(valid => {
- let fd = new FormData();
- for(var key in self.form){
- fd.append(key, self.form[key]);
- // console.log(self.form[key]);
- }
- // fd.append("fileBlod", self.fileBlod);
- if (valid) {
- if (this.form.scyId != null) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- })
- updateCompany(self.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- loading.close();
- } else {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- })
- addCompany(self.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- loading.close();
- }
- }
- });
- },
- /** 产品配置提交按钮 */
- submitProductForm() {
- this.$refs["productForm"].validate(valid => {
- this.productForm.companyProduct = this.companyProduct
- this.productForm.companyId = this.companyId
- var flag = true
- this.companyProduct.forEach(element => {
- if(!element.date){
- this.$message({
- message: '请选择使用时间',
- type: 'warning'
- });
- flag = false;
- }
- });
- // console.log(this.productForm)
- if (valid) {
- if(flag){
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- addCompanyProductAttr(this.productForm).then(response => {
- this.msgSuccess("配置成功");
- loading.close();
- this.openProduct = false;
- this.getList();
- }).catch((r) => {
- loading.close();
- });
- }
- }
- });
- },
- /** 样式配置提交按钮 */
- submitStyleForm() {
- this.$refs["styleForm"].validate(valid => {
- debugger
- if(this.imgList[0]){
- if(this.imgList[0].fileUrl){
- this.styleForm.BackgroundImg = this.imgList[0].fileUrl;
- }else{
- this.styleForm.BackgroundImg = this.imgList[0].url;
- }
- }
- const BackgroundImg = this.styleForm.BackgroundImg;
- console.log(BackgroundImg)
- if(this.LogoList[0]){
- if(this.LogoList[0].fileUrl){
- this.styleForm.logo = this.LogoList[0].fileUrl;
- }else{
- this.styleForm.logo = this.LogoList[0].url;
- }
- }
- const logo = this.styleForm.logo;
- console.log(logo)
- if(this.IndexLogoList[0]){
- if(this.IndexLogoList[0].fileUrl){
- this.styleForm.indexLogo = this.IndexLogoList[0].fileUrl;
- }else{
- this.styleForm.indexLogo = this.IndexLogoList[0].url;
- }
- }
- const indexLogo = this.styleForm.indexLogo;
- console.log(indexLogo)
- if(this.companyId){
- this.styleForm.sscCompanyId = this.companyId;
- }else{
- this.styleForm.sscCompanyId = '';
- }
- if (valid) {
- const sscCompanyId = this.companyId;
- console.log(sscCompanyId)
- const sscDomain = this.styleForm.sscDomain;
- getStyleConfig(sscCompanyId).then(response => {
- if(response.data.length > 0){
- const sscId = response.data[0].sscId;
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- updateStyleConfig(BackgroundImg,logo,indexLogo,sscCompanyId,sscDomain,sscId).then(response => {
- this.msgSuccess("配置成功");
- loading.close();
- this.openStyle = false;
- this.getList();
- }).catch((r) => {
- loading.close();
- });
- this.reset();
- } else {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- addStyleConfig(this.styleForm).then(response => {
- this.msgSuccess("配置成功");
- loading.close();
- this.openStyle = false;
- this.getList();
- }).catch((r) => {
- loading.close();
- });
- this.reset();
- }
- });
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const scyIds = row.scyId || this.ids;
- const scyName = row.scyName;
- this.$confirm('是否确认删除公司名称为"' + scyName + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delCompany(scyIds);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- })
- .catch(() => {
- this.$message({
- type: "warning",
- message: "已取消删除",
-
- });
- });
- },
- /** change 触发事件 */
- selectAttr(item) {
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
- let companyProduct = [];
- //循环判断选中选项是否存在
- item.forEach(element => {
- //是否没有标识
- var flag = false
- if(this.companyProduct){
- for (let i = 0;i < this.companyProduct.length; i++){
- if(this.companyProduct[i].scpProducId == element){
- //原集合中存在则取原值并跳出循环
- companyProduct.push(this.companyProduct[i])
- flag = false
- break;
- }else{
- flag = true
- }
- }
- }else{
- flag = true
- }
- //原集合中没有则新增
- if(flag){
- companyProduct.push({scpProducId:element})
- }
- });
- this.companyProduct = companyProduct
- // console.log(this.companyProduct)
- // console.log(item)
- productAttrList(item).then(response => {
- this.productAttrList = response.data;
- // console.log(response)
- if(this.productAttrList&&this.productAttrList.length!='0'){
- this.isAttr = true
- }else{
- this.isAttr = false
- }
- loading.close();
- // console.log(response)
- }).catch((r) => {
- loading.close();
- });
- },
- /** 产品名称格式化 */
- spiProducIdFormat(row, column){
- // console.log(row)
- return this.selectProducName(this.productList, row.scpProducId);
- },
- /** 附加字段code字典 */
- codeFormat(code){
- return this.selectDictLabel(this.attrCodeOptions, code);
- },
- // 产品字典
- selectProducName(datas, value) {
- var actions = [];
- Object.keys(datas).some((key) => {
- if (datas[key].spiProducId == ('' + value)) {
- actions.push(datas[key].spiProducName);
- return true;
- }
- })
- return actions.join('');
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('/system/company/export', {
- ...this.queryParams
- }, `system_company.xlsx`)
- },
- timing() {
- this.isShowTaskTime = true;
- },
- // getFileBold(data) {
- // debugger;
- // this.fileBlod = data[0].raw;
- // console.log(this.fileBlod);
- // }
- }
- };
- </script>
|