index.vue 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401
  1. <template>
  2. <div class="app-container">
  3. <el-card class="fiche">
  4. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">收起</right-toolbar>
  5. <span style="margin-bottom: 10px;color:#333333;font:14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,sans-serif">所选条件:</span>
  6. <div style="float: right;margin-right:1%">
  7. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  8. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" style="float: ;">重置</el-button>
  9. <column-setting :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId" style="margin-left:5px"></column-setting>
  10. </div>
  11. <hr style="margin-top: 16px;">
  12. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  13. <el-form-item label="公司名称" prop="scyName">
  14. <el-input
  15. maxlength="30"
  16. v-model="queryParams.scyName"
  17. placeholder="请输入公司名称"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <!-- <el-form-item label="公司简称" prop="scyAbridge">
  24. <el-input
  25. v-model="queryParams.scyAbridge"
  26. placeholder="请输入公司简称"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item> -->
  32. <el-form-item label="状态" prop="scyStt">
  33. <el-select v-model="queryParams.scyStt"
  34. placeholder="企业状态"
  35. clearable
  36. size="small"
  37. style="width: 240px">
  38. <el-option
  39. v-for="dict in statusOptions"
  40. :key="dict.dictValue"
  41. :label="dict.dictLabel"
  42. :value="dict.dictValue"
  43. ></el-option>
  44. </el-select>
  45. </el-form-item>
  46. </el-form>
  47. </el-card>
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button
  51. type="primary"
  52. icon="el-icon-plus"
  53. size="mini"
  54. @click="handleAdd"
  55. v-hasPermi="['system:company:add']"
  56. >新增</el-button>
  57. </el-col>
  58. </el-row>
  59. <el-table v-loading="loading" :data="companyList" @selection-change="handleSelectionChange" stripe border>
  60. <el-table-column label="序号" type="index" width="55" align="center" />
  61. <el-table-column label="主键" align="center" prop="scyId" v-if="isshow"/>
  62. <el-table-column label="公司名称" align="center" prop="scyName" :show-overflow-tooltip="true" v-if="uncheckList.scyName"/>
  63. <el-table-column label="公司简称" align="center" prop="scyAbridge" v-if="uncheckList.scyAbridge"/>
  64. <el-table-column label="公司电话" align="center" prop="scyPhone" v-if="uncheckList.scyPhone"/>
  65. <el-table-column label="统一社会信用代码" align="center" prop="scySocialCode" v-if="uncheckList.scySocialCode"/>
  66. <el-table-column label="法定代表人" align="center" prop="scyLegal" v-if="uncheckList.scyLegal" />
  67. <el-table-column label="公司说明描述" align="center" prop="scyDescribe" :show-overflow-tooltip="true" v-if="uncheckList.scyDescribe"/>
  68. <el-table-column label="备注" align="center" prop="scyRemarks" :show-overflow-tooltip="true" v-if="uncheckList.scyRemarks"/>
  69. <el-table-column label="状态" align="center">
  70. <template slot-scope="scope">
  71. <el-switch
  72. v-model="scope.row.scyStt"
  73. active-value="00"
  74. inactive-value="01"
  75. @change="handleStatusChange(scope.row)"
  76. ></el-switch>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  80. <template slot-scope="scope">
  81. <el-button
  82. size="mini"
  83. type="text"
  84. icon="el-icon-edit"
  85. @click="handleUpdate(scope.row)"
  86. v-hasPermi="['system:company:edit']"
  87. >修改</el-button>
  88. <el-button
  89. size="mini"
  90. type="text"
  91. icon="el-icon-shopping-bag-1"
  92. @click="handleProduct(scope.row)"
  93. v-hasPermi="['system:productAttr:add']"
  94. >产品配置</el-button>
  95. <el-button
  96. size="mini"
  97. type="text"
  98. icon="el-icon-delete"
  99. @click="handleDelete(scope.row)"
  100. v-hasPermi="['system:company:remove']"
  101. >删除</el-button>
  102. <el-button
  103. size="mini"
  104. type="text"
  105. icon="el-icon-cpu"
  106. @click="handleStyle(scope.row)"
  107. v-hasPermi="['system:styleConfig:update']"
  108. >样式配置</el-button>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <pagination
  113. v-show="total>0"
  114. :total="total"
  115. :page.sync="queryParams.pageNum"
  116. :limit.sync="queryParams.pageSize"
  117. @pagination="getList"
  118. />
  119. <!-- 添加或修改公司对话框 -->
  120. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  121. <el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
  122. <el-form-item label="公司名称" prop="scyName">
  123. <el-input v-model="form.scyName" placeholder="请输入公司名称" style="width:560px" maxlength="20" show-word-limit/>
  124. </el-form-item>
  125. <el-form-item label="公司简称" prop="scyAbridge">
  126. <el-input v-model="form.scyAbridge" placeholder="请输入公司简称" maxlength="10" show-word-limit/>
  127. </el-form-item>
  128. <el-form-item label="公司电话" prop="scyPhone">
  129. <el-input v-model="form.scyPhone" placeholder="请输入公司电话" maxlength="13" show-word-limit/>
  130. </el-form-item>
  131. <!-- <el-form-item label="是否集团" prop="scyIsGroup">
  132. <el-radio-group v-model="form.scyIsGroup">
  133. <el-radio
  134. v-for="dict in spiStateOptions"
  135. :key="dict.dictValue"
  136. :label="dict.dictValue"
  137. >{{dict.dictLabel}}</el-radio>
  138. </el-radio-group>
  139. </el-form-item> -->
  140. <el-form-item label="负责人" prop="scyLeader">
  141. <el-input v-model="form.scyLeader" placeholder="请输入负责人姓名" maxlength="5" show-word-limit/>
  142. </el-form-item>
  143. <el-form-item label="账号登录名" prop="userName" v-if="addMessage">
  144. <el-input v-model="form.userName" placeholder="请输入账号登录名" maxlength="20" show-word-limit/>
  145. </el-form-item>
  146. <el-form-item label="公司地址" prop="scyAddress">
  147. <el-input v-model="form.scyAddress" type="textarea" placeholder="请输入公司地址" style="width:560px" maxlength="30" show-word-limit/>
  148. </el-form-item>
  149. <el-form-item label="统一社会信用代码" prop="scySocialCode">
  150. <el-input v-model="form.scySocialCode" placeholder="请输入统一社会信用代码" maxlength="18" show-word-limit/>
  151. </el-form-item>
  152. <el-form-item label="法定代表人" prop="scyLegal">
  153. <el-input v-model="form.scyLegal" placeholder="请输入法定代表人" maxlength="5" show-word-limit/>
  154. </el-form-item>
  155. <el-form-item label="公司说明描述" prop="scyDescribe">
  156. <el-input v-model="form.scyDescribe" type="textarea" placeholder="请输入内容" style="width:560px" maxlength="100" show-word-limit/>
  157. </el-form-item>
  158. <el-form-item label="备注" prop="scyRemarks">
  159. <el-input v-model="form.scyRemarks" type="textarea" placeholder="请输入内容" style="width:560px" maxlength="100" show-word-limit/>
  160. </el-form-item>
  161. </el-form>
  162. <div slot="footer" class="dialog-footer">
  163. <el-button type="primary" @click="submitForm">确 定</el-button>
  164. <el-button @click="cancel">取 消</el-button>
  165. </div>
  166. </el-dialog>
  167. <!-- 产品配置对话框 -->
  168. <el-dialog :title="title" :visible.sync="openProduct" width="800px" append-to-body>
  169. <el-form ref="productForm" :model="productForm" :rules="productRules" label-width="140px">
  170. <el-divider content-position="left">产品选择</el-divider>
  171. <el-form-item label="产品" prop="product">
  172. <el-select v-model="productForm.product" multiple collapse-tags placeholder="请选择" @change="selectAttr">
  173. <template v-for="item in productList">
  174. <el-option
  175. :key="item.spiProducId"
  176. :label="item.spiProducName"
  177. :value="item.spiProducId"
  178. v-if="item.spiState =='00'">
  179. </el-option>
  180. </template>
  181. </el-select>
  182. </el-form-item>
  183. <el-divider content-position="left">使用配置</el-divider>
  184. <el-table v-loading="loading" :data="companyProduct">
  185. <el-table-column label="产品名称" align="center" width="200" prop="scpProducId" :formatter="spiProducIdFormat"/>
  186. <el-table-column label="试用/正常" align="center" prop="scpState" width="100">
  187. <template slot-scope="scope">
  188. <el-switch v-model="scope.row.scpState" active-value="00" inactive-value="01"></el-switch>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="使用时间" align="center" prop="scpStartDate">
  192. <template slot-scope="scope">
  193. <el-date-picker
  194. v-model="scope.row.date"
  195. type="daterange"
  196. value-format="yyyy-MM-dd"
  197. range-separator="至"
  198. start-placeholder="开始日期"
  199. end-placeholder="结束日期">
  200. </el-date-picker>
  201. <!-- <el-date-picker v-model="scope.row.scpStartDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:200px"></el-date-picker> -->
  202. </template>
  203. </el-table-column>
  204. <!-- <el-table-column label="结束日期" align="center" prop="scpEndDate">
  205. <template slot-scope="scope">
  206. <el-date-picker v-model="scope.row.scpEndDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:200px"></el-date-picker>
  207. </template>
  208. </el-table-column> -->
  209. </el-table>
  210. <el-divider content-position="left" v-if="isAttr">参数配置</el-divider>
  211. <el-form-item
  212. v-for="item in productAttrList"
  213. :key="item.cpaCode"
  214. :label="codeFormat(item.cpaCode)"
  215. :prop="item.cpaCode"
  216. :rules="item.cpaCode == '00'
  217. ?[{ required: true, message: '请输入'+codeFormat(item.cpaCode), trigger: ['blur', 'change'] },
  218. { 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'] }]
  219. :[{ required: true, message: '请输入'+codeFormat(item.cpaCode), trigger: ['blur', 'change'] }]"
  220. >
  221. <el-select v-model="productForm[item.cpaCode]" placeholder="请选择" v-if="item.cpaCode == '01'">
  222. <el-option
  223. v-for="item in emailTypeOptions"
  224. :key="item.dictValue"
  225. :label="item.dictLabel"
  226. :value="item.dictValue">
  227. </el-option>
  228. </el-select>
  229. <el-input v-model="productForm[item.cpaCode]" maxlength="20" show-word-limit style="width:300px" v-else/>
  230. </el-form-item>
  231. </el-form>
  232. <div slot="footer" class="dialog-footer">
  233. <el-button type="primary" @click="submitProductForm">确 定</el-button>
  234. <el-button @click="cancel">取 消</el-button>
  235. </div>
  236. </el-dialog>
  237. <!-- 产品配置值对话框 -->
  238. <el-dialog :title="title" :visible.sync="openStyle" width="800px" append-to-body>
  239. <el-form ref="styleForm" :model="styleForm" :rules="styleRules" label-width="140px" :inline="true">
  240. <el-form-item label="域名" prop="sscDomain">
  241. <el-input v-model="styleForm.sscDomain" placeholder="请输入公司域名" style="width:560px" maxlength="60" show-word-limit/>
  242. </el-form-item>
  243. <!-- <el-form-item label="企业名称" prop="sscCompanyId">
  244. <el-input v-model="styleForm.sscCompanyId" placeholder="请输入公司简称" maxlength="10" show-word-limit/>
  245. </el-form-item> -->
  246. <el-form-item label="登录页背景图">
  247. <el-upload
  248. ref="BackgroundImg"
  249. class="BackgroundImg-demo"
  250. action=""
  251. accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
  252. :http-request="httpBackgroundImgRequest"
  253. multiple
  254. :limit="1"
  255. :before-upload="beforeUpload"
  256. :on-exceed="handleBackgroundImgExceed"
  257. list-type="picture-card"
  258. :file-list="imgList"
  259. :auto-upload="false">
  260. <i slot="default" class="el-icon-plus" ></i>
  261. <div slot="file" slot-scope="{file}">
  262. <img
  263. class="el-upload-list__item-thumbnail"
  264. :src="file.url" alt=""
  265. >
  266. <span class="el-upload-list__item-actions">
  267. <span
  268. class="el-upload-list__item-preview"
  269. @click="handlePictureCardPreview(file)"
  270. >
  271. <i class="el-icon-zoom-in"></i>
  272. </span>
  273. <span
  274. class="el-upload-list__item-delete"
  275. @click="handleBackgroundImgDownload(file)"
  276. >
  277. <i class="el-icon-download"></i>
  278. </span>
  279. <span
  280. class="el-upload-list__item-delete"
  281. @click="handleBackgroundImgRemove(file,imgList)"
  282. >
  283. <i class="el-icon-delete"></i>
  284. </span>
  285. </span>
  286. </div>
  287. </el-upload>
  288. <el-button style="margin-left: 10px;" size="small" type="success" @click="submitImgUpload">上传到服务器</el-button>
  289. </el-form-item>
  290. <el-form-item label="登录页logo">
  291. <el-upload
  292. ref="Logo"
  293. class="Logo-demo"
  294. action=""
  295. accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
  296. :http-request="httpLogoRequest"
  297. multiple
  298. :limit="1"
  299. :before-upload="beforeLogoUpload"
  300. :on-exceed="handleLogoExceed"
  301. list-type="picture-card"
  302. :file-list="LogoList"
  303. :auto-upload="false">
  304. <i slot="default" class="el-icon-plus" ></i>
  305. <div slot="file" slot-scope="{file}">
  306. <img
  307. class="el-upload-list__item-thumbnail"
  308. :src="file.url" alt=""
  309. >
  310. <span class="el-upload-list__item-actions">
  311. <span
  312. class="el-upload-list__item-preview"
  313. @click="handleLogoPreview(file)"
  314. >
  315. <i class="el-icon-zoom-in"></i>
  316. </span>
  317. <span
  318. class="el-upload-list__item-delete"
  319. @click="handleLogoDownload(file)"
  320. >
  321. <i class="el-icon-download"></i>
  322. </span>
  323. <span
  324. class="el-upload-list__item-delete"
  325. @click="handleLogoRemove(file,LogoList)"
  326. >
  327. <i class="el-icon-delete"></i>
  328. </span>
  329. </span>
  330. </div>
  331. </el-upload>
  332. <el-button style="margin-left: 10px;" size="small" type="success" @click="submitLogoUpload">上传到服务器</el-button>
  333. </el-form-item>
  334. <el-form-item label="首页logo">
  335. <el-upload
  336. ref="IndexLogo"
  337. class="IndexLogo-demo"
  338. action=""
  339. accept=".jpg, .jpeg, .png, .JPG, .JPEG, .PNG"
  340. :http-request="httpIndexLogoRequest"
  341. multiple
  342. :limit="1"
  343. :before-upload="beforeIndexLogoUpload"
  344. :on-exceed="handleIndexLogoExceed"
  345. list-type="picture-card"
  346. :file-list="IndexLogoList"
  347. :auto-upload="false">
  348. <i slot="default" class="el-icon-plus" ></i>
  349. <div slot="file" slot-scope="{file}">
  350. <img
  351. class="el-upload-list__item-thumbnail"
  352. :src="file.url" alt=""
  353. >
  354. <span class="el-upload-list__item-actions">
  355. <span
  356. class="el-upload-list__item-preview"
  357. @click="handleIndexLogoPreview(file)"
  358. >
  359. <i class="el-icon-zoom-in"></i>
  360. </span>
  361. <span
  362. class="el-upload-list__item-delete"
  363. @click="handleIndexLogoDownload(file)"
  364. >
  365. <i class="el-icon-download"></i>
  366. </span>
  367. <span
  368. class="el-upload-list__item-delete"
  369. @click="handleIndexLogoRemove(file,IndexLogoList)"
  370. >
  371. <i class="el-icon-delete"></i>
  372. </span>
  373. </span>
  374. </div>
  375. </el-upload>
  376. <el-button style="margin-left: 10px;" size="small" type="success" @click="submitIndexLogoUpload">上传到服务器</el-button>
  377. </el-form-item>
  378. </el-form>
  379. <div slot="footer" class="dialog-footer">
  380. <el-button type="primary" @click="submitStyleForm">确 定</el-button>
  381. <el-button @click="cancel">取 消</el-button>
  382. </div>
  383. </el-dialog>
  384. <el-dialog :visible.sync="dialogVisible">
  385. <img width="100%" :src="dialogImageUrl" alt="">
  386. </el-dialog>
  387. </div>
  388. </template>
  389. <script>
  390. import { listCompany, getCompany, delCompany, addCompany, updateCompany ,updateCompanyStatus,listOwnCompany} from "@/api/system/company";
  391. import { listProduct,productAttrList,addCompanyProductAttr,getCompanyProduct } from "@/api/system/product";
  392. import { listStyleConfig, getStyleConfig, addStyleConfig, updateStyleConfig} from "@/api/system/style";
  393. import { uploadFileNew } from "@/api/common/file";
  394. import { getToken } from "@/utils/auth";
  395. import {columnQuery,columnfilter} from "@/api/common/columnSetting";
  396. import ColumnSetting from '../../../components/Table/columnSetting.vue';
  397. export default {
  398. name: "Company",
  399. components: {
  400. // uploadImg
  401. ColumnSetting
  402. },
  403. data() {
  404. return {
  405. dialogImageUrl: '',
  406. dialogVisible: false,
  407. //id隐藏
  408. isshow:false,
  409. //邮箱展示
  410. isShowTaskTime: false,
  411. // 遮罩层
  412. loading: true,
  413. //域名禁用
  414. isShowDomain:false,
  415. // 选中数组
  416. ids: [],
  417. // 非单个禁用
  418. single: true,
  419. // 非多个禁用
  420. multiple: true,
  421. // 显示搜索条件
  422. showSearch: true,
  423. // 总条数
  424. total: 0,
  425. // 公司表格数据
  426. companyList: [],
  427. //产品数据
  428. productList:[],
  429. companyProduct:[],
  430. productAttrList:[],
  431. // 状态数据字典
  432. statusOptions: [],
  433. Product: [],
  434. serverHost: [],
  435. attrCodeOptions:[],
  436. imgList: [],
  437. LogoList: [],
  438. IndexLogoList: [],
  439. sscDomain:'',
  440. //图片
  441. // pictureList: [],
  442. //日期范围
  443. dateRange: [],
  444. // 弹出层标题
  445. title: "",
  446. // 是否显示弹出层
  447. open: false,
  448. openProduct: false,
  449. openStyle: false,
  450. isAttr:false,
  451. addMessage:false,
  452. // 查询参数
  453. queryParams: {
  454. pageNum: 1,
  455. pageSize: 10,
  456. scyName: null,
  457. scyAbridge: null,
  458. scyAddress: null,
  459. scyPhone: null,
  460. scySocialCode: null,
  461. scyLegal: null,
  462. scyLicense: null,
  463. scyValidityTime: null,
  464. scyDescribe: null,
  465. scyRemarks: null,
  466. scyStt: null
  467. },
  468. //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
  469. tableList: [
  470. {
  471. label: 'scyName',
  472. value: '公司名称'
  473. },
  474. {
  475. label: 'scyAbridge',
  476. value: '公司简称'
  477. },
  478. {
  479. label: 'scyPhone',
  480. value: '公司电话'
  481. },
  482. {
  483. label: 'scySocialCode',
  484. value: '统一社会信用代码'
  485. },
  486. {
  487. label: 'scyLegal',
  488. value: '法定代表人'
  489. },
  490. {
  491. label: 'scyDescribe',
  492. value: '公司说明描述'
  493. },
  494. {
  495. label: 'scyRemarks',
  496. value: '备注'
  497. },
  498. ],
  499. checkList: [],//筛选列选中的数据列表--显示隐藏列用
  500. uncheckList: {},//控制筛选列显示隐藏--显示隐藏列用
  501. selfDom : this,
  502. tableId:"/system/owncompany/list",
  503. // 表单参数
  504. form: {},
  505. productForm: {},
  506. styleForm: {},
  507. companyId:null,
  508. company:null,
  509. // 表单校验
  510. rules: {
  511. scyName: [
  512. { required: true, message: "公司名称不能为空", trigger: "blur" },
  513. {
  514. pattern: /^[\u4e00-\u9fa5\(\)()\da-zA-Z&]{2,50}$/gi,
  515. message: "公司名称格式不正确",
  516. trigger: "blur"
  517. }
  518. ],
  519. scyAbridge: [
  520. { required: true, message: "公司简称不能为空", trigger: "blur" }
  521. ],
  522. scyLeader: [
  523. { required: true, message: "负责人不能为空", trigger: "blur" }
  524. ],
  525. userName: [
  526. { required: true, message: "账号登录名不能为空", trigger: "blur" },
  527. { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' },
  528. {
  529. pattern:/^[a-zA-Z0-9]+$/,
  530. message: "请输入数字或英文",
  531. trigger: "blur"
  532. }
  533. ],
  534. // scyAddress: [
  535. // { required: true, message: "公司地址不能为空", trigger: "blur" }
  536. // ],
  537. scyPhone: [
  538. {
  539. pattern: /^(\+?\d{2,4})?-?(\d{3,4})?-?\d{7,8}-?(\d{1,4})?$/,
  540. message: "电话格式不正确",
  541. trigger: "blur",
  542. }
  543. ],
  544. scySocialCode: [
  545. {
  546. pattern: /[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}/,
  547. message: "社会统一信用代码格式不正确",
  548. trigger: "blur"
  549. }
  550. ],
  551. // scyLegal: [
  552. // { required: true, message: "法定代表人不能为空", trigger: "blur" }
  553. // ],
  554. // scsStartTime: [
  555. // { required: true, message: "有效开始日期不能为空", trigger: "blur" }
  556. // ],
  557. // scsEndTime: [
  558. // { required: true, message: "有效结束日期不能为空", trigger: "blur" }
  559. // ],
  560. scyStt: [
  561. { required: true, message: "状态不能为空", trigger: "blur" }
  562. ]
  563. },
  564. productRules:{
  565. product: [
  566. { required: true, message: "产品未选择", trigger: ["blur", "change"] }
  567. ],
  568. "00": [
  569. { required: true, message: "邮箱不能为空", trigger: "blur" },
  570. {
  571. // type: "email",
  572. pattern:/^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/,
  573. message: "邮箱格式不正确",
  574. trigger:"blur",
  575. }
  576. ],
  577. },
  578. styleRules:{
  579. sscDomain: [
  580. { required: true, message: "请填写域名", trigger: ["blur", "change"] },
  581. {
  582. pattern:/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}/,
  583. message: "域名格式不正确",
  584. trigger: "blur"
  585. }
  586. ],
  587. },
  588. emailTypeOptions:[]
  589. // fileBlod : null
  590. };
  591. },
  592. created() {
  593. this.getList();
  594. this.getDicts("sys_company_state").then(response => {
  595. this.statusOptions = response.data;
  596. });
  597. this.getDicts("scs_product").then(response => {
  598. this.Product = response.data;
  599. });
  600. this.getDicts("scs_server_host").then(response => {
  601. this.serverHost = response.data;
  602. });
  603. this.getDicts("product_attr_code").then(response => {
  604. this.attrCodeOptions = response.data;
  605. });
  606. this.getDicts("sys_email_type").then(response => {
  607. this.emailTypeOptions = response.data;
  608. });
  609. },
  610. mounted() {
  611. this.columnQuery();
  612. },
  613. methods: {
  614. //获取当前客户是否之前设置过列展示隐藏
  615. columnQuery(){
  616. //获取页面路径
  617. var psfPagePath = window.location.pathname;
  618. //用请求后台的url作为唯一标识
  619. var psfTableName = this.tableId;
  620. var columnForm = {};
  621. columnForm.psfPagePath = psfPagePath;
  622. columnForm.psfTableName = psfTableName;
  623. columnQuery(columnForm).then(response => {
  624. if(response.data && response.data.psfShowData){
  625. this.checkList = response.data.psfShowData;
  626. }
  627. this.filter();
  628. })
  629. },
  630. //控制隐藏显示的函数
  631. filter(checkList) {
  632. if (!!checkList) {
  633. this.checkList = checkList;
  634. }
  635. columnfilter(this.selfDom);
  636. },
  637. /** 查询公司列表 */
  638. getList() {
  639. this.loading = true;
  640. listOwnCompany(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  641. this.companyList = response.rows;
  642. this.total = response.total;
  643. this.loading = false;
  644. }
  645. );
  646. },
  647. /** 查询产品信息列表 */
  648. getProductList() {
  649. listProduct().then(response => {
  650. this.productList = response.rows;
  651. });
  652. },
  653. /* 查询样式配置列表 */
  654. getStyleList() {
  655. listStyleConfig().then(response => {
  656. });
  657. },
  658. /* 登录页背景图 */
  659. httpBackgroundImgRequest(param) {
  660. let fileObj = param.file // 相当于input里取得的files
  661. let fd = new FormData()// FormData 对象
  662. fd.append('file', fileObj)// 文件对象
  663. fd.append('fileType','00')//文件类型
  664. const loading = this.$loading({
  665. lock: true,
  666. text: 'Loading',
  667. spinner: 'el-icon-loading',
  668. background: 'rgba(0, 0, 0, 0.7)'
  669. });
  670. uploadFileNew(fd).then(response => {
  671. if(response){
  672. this.imgList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
  673. setTimeout(() => {
  674. this.msgSuccess("上传成功");
  675. loading.close();
  676. }, 2000);
  677. }
  678. })
  679. },
  680. /* 登录页背景图限制 */
  681. handleBackgroundImgExceed(files, imgList) {
  682. this.$message.warning(`当前限制选择 1 个文件`);
  683. },
  684. /* 限制登录页背景图片格式 */
  685. beforeUpload (file) {
  686. var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
  687. let _this = this;
  688. let imgWidth="";
  689. let imgHight="";
  690. const isSize = new Promise(function(resolve, reject){
  691. let width = 1536;
  692. let height = 752;
  693. let _URL = window.URL || window.webkitURL;
  694. let img = new Image();
  695. img.onload = function(){
  696. imgWidth = img.width;
  697. console.log(imgWidth)
  698. imgHight = img.height;
  699. let valid = img.width < width && img.height < height;
  700. valid ? resolve() : reject();
  701. }
  702. img.src = _URL.createObjectURL(file);
  703. }).then(()=>{
  704. return file;
  705. }, ()=>{
  706. _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于1536px,高需要小于752px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
  707. return Promise.reject()
  708. return false;//必须加上return false; 才能阻止
  709. })
  710. return isSize;
  711. //进行图片类型和大小的限制
  712. const isLt2M = file.size / 1024 / 1024 < 1;
  713. if(!isLt2M) {
  714. this.$message({
  715. message: '上传文件大小不能超过1MB!',
  716. type: 'warning'
  717. });
  718. return false;
  719. }return isLt2M;
  720. },
  721. /* 预览登录页背景图 */
  722. handlePictureCardPreview(file) {
  723. this.dialogImageUrl = file.url+'/'+getToken();
  724. this.dialogVisible = true;
  725. },
  726. //上传登录页背景图
  727. submitImgUpload(){
  728. this.$refs.BackgroundImg.submit();
  729. },
  730. /* 下载登录页背景图 */
  731. handleBackgroundImgDownload(file) {
  732. var a = document.createElement('a');
  733. var event = new MouseEvent('click');
  734. a.download = file.name;
  735. a.href = file.url+'/'+getToken();
  736. a.dispatchEvent(event);
  737. },
  738. //登录页背景图移除提示
  739. handleBackgroundImgRemove(file) {
  740. console.log(this.$refs.BackgroundImg.uploadFiles)
  741. for(let i = 0;i< this.imgList.length;i++){
  742. if(file.uid == this.imgList[i].uid){
  743. this.imgList.splice(i, 1);
  744. break;
  745. }
  746. }
  747. for(let i = 0;i< this.$refs.BackgroundImg.uploadFiles.length;i++){
  748. if(file.uid == this.$refs.BackgroundImg.uploadFiles[i].uid){
  749. this.$refs.BackgroundImg.uploadFiles.splice(i, 1);
  750. break;
  751. }
  752. }
  753. },
  754. /* 登录页logo */
  755. httpLogoRequest(param) {
  756. let fileObj = param.file // 相当于input里取得的files
  757. let fd = new FormData()// FormData 对象
  758. fd.append('file', fileObj)// 文件对象
  759. fd.append('fileType','00')//文件类型
  760. const loading = this.$loading({
  761. lock: true,
  762. text: 'Loading',
  763. spinner: 'el-icon-loading',
  764. background: 'rgba(0, 0, 0, 0.7)'
  765. });
  766. uploadFileNew(fd).then(response => {
  767. if(response){
  768. this.LogoList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
  769. setTimeout(() => {
  770. this.msgSuccess("上传成功");
  771. loading.close();
  772. }, 2000);
  773. }
  774. })
  775. },
  776. /* 登录页logo限制 */
  777. handleLogoExceed(files, LogoList) {
  778. this.$message.warning(`当前限制选择 1 个文件`);
  779. },
  780. /* 限制登录页logo图片格式 */
  781. beforeLogoUpload (file) {
  782. var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
  783. let _this = this;
  784. let imgWidth="";
  785. let imgHight="";
  786. const isSize = new Promise(function(resolve, reject){
  787. let width = 860;
  788. let height = 66;
  789. let _URL = window.URL || window.webkitURL;
  790. let img = new Image();
  791. img.onload = function(){
  792. imgWidth = img.width;
  793. console.log(imgWidth)
  794. imgHight = img.height;
  795. let valid = img.width < width && img.height < height;
  796. valid ? resolve() : reject();
  797. }
  798. img.src = _URL.createObjectURL(file);
  799. }).then(()=>{
  800. return file;
  801. }, ()=>{
  802. _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于860px,高需要小于66px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
  803. return Promise.reject()
  804. return false;//必须加上return false; 才能阻止
  805. })
  806. return isSize;
  807. //进行图片类型和大小的限制
  808. const isLt2M = file.size / 1024 / 1024 < 1;
  809. if(!isLt2M) {
  810. this.$message({
  811. message: '上传文件大小不能超过1MB!',
  812. type: 'warning'
  813. });
  814. return false;
  815. }return isLt2M;
  816. },
  817. /* 预览登录页logo */
  818. handleLogoPreview(file) {
  819. this.dialogImageUrl = file.url+'/'+getToken();
  820. this.dialogVisible = true;
  821. },
  822. /* 下载登录页logo */
  823. handleLogoDownload(file) {
  824. var a = document.createElement('a');
  825. var event = new MouseEvent('click');
  826. a.download = file.name;
  827. a.href = file.url+'/'+getToken();
  828. a.dispatchEvent(event);
  829. },
  830. //登录页logo移除提示
  831. handleLogoRemove(file) {
  832. console.log(this.$refs.Logo.uploadFiles)
  833. for(let i = 0;i< this.LogoList.length;i++){
  834. if(file.uid == this.LogoList[i].uid){
  835. this.LogoList.splice(i, 1);
  836. break;
  837. }
  838. }
  839. for(let i = 0;i< this.$refs.Logo.uploadFiles.length;i++){
  840. if(file.uid == this.$refs.Logo.uploadFiles[i].uid){
  841. this.$refs.Logo.uploadFiles.splice(i, 1);
  842. break;
  843. }
  844. }
  845. },
  846. //上传登录页logo
  847. submitLogoUpload(){
  848. this.$refs.Logo.submit();
  849. },
  850. /* 首页logo */
  851. httpIndexLogoRequest(param) {
  852. let fileObj = param.file // 相当于input里取得的files
  853. let fd = new FormData()// FormData 对象
  854. fd.append('file', fileObj)// 文件对象
  855. fd.append('fileType','00')//文件类型
  856. const loading = this.$loading({
  857. lock: true,
  858. text: 'Loading',
  859. spinner: 'el-icon-loading',
  860. background: 'rgba(0, 0, 0, 0.7)'
  861. });
  862. uploadFileNew(fd).then(response => {
  863. if(response){
  864. this.IndexLogoList.push({fileUrl:response.fileUrl,uid:response.fileId,url:response.url+'/'+getToken()})
  865. setTimeout(() => {
  866. this.msgSuccess("上传成功");
  867. loading.close();
  868. }, 2000);
  869. }
  870. })
  871. },
  872. /* 首页logo限制 */
  873. handleIndexLogoExceed(files, IndexLogoList) {
  874. this.$message.warning(`当前限制选择 1 个文件`);
  875. },
  876. /* 限制首页logo图片格式 */
  877. beforeIndexLogoUpload (file) {
  878. var testmsg=file.name.substring(file.name.lastIndexOf('.')+1)
  879. let _this = this;
  880. let imgWidth="";
  881. let imgHight="";
  882. const isSize = new Promise(function(resolve, reject){
  883. debugger
  884. console.log(isSize)
  885. let width = 155;
  886. let height = 32;
  887. let _URL = window.URL || window.webkitURL;
  888. let img = new Image();
  889. img.onload = function(){
  890. imgWidth = img.width;
  891. console.log(imgWidth)
  892. imgHight = img.height;
  893. let valid = img.width < width && img.height < height;
  894. valid ? resolve() : reject();
  895. }
  896. img.src = _URL.createObjectURL(file);
  897. }).then(()=>{
  898. return file;
  899. }, ()=>{
  900. _this.$message.warning({message: '上传文件的图片大小不合符标准,宽需要小于155px,高需要小于32px。当前上传图片的宽为:'+imgWidth+'px,高为:'+imgHight+'px', btn: false})
  901. return Promise.reject()
  902. return false;//必须加上return false; 才能阻止
  903. })
  904. return isSize;
  905. //进行图片类型和大小的限制
  906. const isLt2M = file.size / 1024 / 1024 < 1;
  907. if(!isLt2M) {
  908. this.$message({
  909. message: '上传文件大小不能超过1MB!',
  910. type: 'warning'
  911. });
  912. return false;
  913. }return isLt2M;
  914. },
  915. /* 预览首页logo */
  916. handleIndexLogoPreview(file) {
  917. this.dialogImageUrl = file.url+'/'+getToken();
  918. this.dialogVisible = true;
  919. },
  920. /* 下载首页logo */
  921. handleIndexLogoDownload(file) {
  922. var a = document.createElement('a');
  923. var event = new MouseEvent('click');
  924. a.download = file.name;
  925. a.href = file.url+'/'+getToken();
  926. a.dispatchEvent(event);
  927. },
  928. //首页logo移除提示
  929. handleIndexLogoRemove(file) {
  930. console.log(this.$refs.IndexLogo.uploadFiles)
  931. for(let i = 0;i< this.IndexLogoList.length;i++){
  932. if(file.uid == this.IndexLogoList[i].uid){
  933. this.LogoList.splice(i, 1);
  934. break;
  935. }
  936. }
  937. for(let i = 0;i< this.$refs.IndexLogo.uploadFiles.length;i++){
  938. if(file.uid == this.$refs.IndexLogo.uploadFiles[i].uid){
  939. this.$refs.IndexLogo.uploadFiles.splice(i, 1);
  940. break;
  941. }
  942. }
  943. },
  944. //上传首页logo
  945. submitIndexLogoUpload(){
  946. this.$refs.IndexLogo.submit();
  947. },
  948. handleStatusChange(row) {
  949. let text = row.scyStt === "00" ? "启用" : "停用";
  950. this.$confirm('确认要' + text + '"' + row.scyName + '"企业吗?', "警告", {
  951. confirmButtonText: "确定",
  952. cancelButtonText: "取消",
  953. type: "warning"
  954. }).then(function() {
  955. return updateCompanyStatus(row.scyId, row.scyStt);
  956. }).then(() => {
  957. this.msgSuccess(text + "成功");
  958. }).catch(function() {
  959. row.scyStt = row.scyStt === "00" ? "01" : "00";
  960. });
  961. },
  962. // 取消按钮
  963. cancel() {
  964. this.open = false;
  965. this.openProduct = false;
  966. this.openStyle = false;
  967. this.reset();
  968. },
  969. // 表单重置
  970. reset() {
  971. this.form = {
  972. scyId: null,
  973. scyName: null,
  974. scyAbridge: null,
  975. scyAddress: null,
  976. scyPhone: null,
  977. scySocialCode: null,
  978. scyLegal: null,
  979. scyLicense: null,
  980. scsStartTime: null,
  981. scsEndTime: null,
  982. scyDescribe: null,
  983. scyRemarks: null,
  984. createBy: null,
  985. createTime: null,
  986. updateBy: null,
  987. updateTime: null,
  988. scsTrial:'01',
  989. scyStt: '00'
  990. };
  991. this.isAttr = false,
  992. this.addMessage = false,
  993. this.productList = [],
  994. this.companyProduct = [],
  995. this.productAttrList = [],
  996. this.imgList = [],
  997. this.LogoList = [],
  998. this.IndexLogoList = [],
  999. this.productForm = {},
  1000. this.styleForm = {},
  1001. this.resetForm("form");
  1002. this.resetForm("productForm");
  1003. this.resetForm("styleForm");
  1004. },
  1005. /** 搜索按钮操作 */
  1006. handleQuery() {
  1007. this.queryParams.pageNum = 1;
  1008. this.getList();
  1009. },
  1010. /** 重置按钮操作 */
  1011. resetQuery() {
  1012. this.dateRange = [];
  1013. this.resetForm("queryForm");
  1014. this.handleQuery();
  1015. },
  1016. // 多选框选中数据
  1017. handleSelectionChange(selection) {
  1018. this.ids = selection.map(item => item.scyId)
  1019. this.single = selection.length!==1
  1020. this.multiple = !selection.length
  1021. },
  1022. /** 新增按钮操作 */
  1023. handleAdd() {
  1024. this.reset();
  1025. this.open = true;
  1026. this.addMessage = true,
  1027. this.title = "添加公司";
  1028. },
  1029. /** 修改按钮操作 */
  1030. handleUpdate(row) {
  1031. this.reset();
  1032. const scyId = row.scyId || this.ids
  1033. getCompany(scyId).then(response => {
  1034. this.form = response.data;
  1035. // console.log(this.form);
  1036. this.open = true;
  1037. this.title = "修改公司";
  1038. });
  1039. },
  1040. /** 产品配置按钮操作 */
  1041. handleProduct(row) {
  1042. const loading = this.$loading({
  1043. lock: true,
  1044. text: 'Loading',
  1045. spinner: 'el-icon-loading',
  1046. background: 'rgba(0, 0, 0, 0.7)'
  1047. });
  1048. this.reset();
  1049. const scyId = row.scyId || this.ids
  1050. this.companyId = scyId
  1051. getCompanyProduct(scyId).then(response => {
  1052. this.productForm = response.data
  1053. this.companyProduct = response.data.companyProduct
  1054. this.productAttrList = response.data.productAttrList
  1055. this.isAttr = response.data.productAttr
  1056. this.openProduct = true;
  1057. this.title = "产品配置";
  1058. loading.close()
  1059. }).catch((r) => {
  1060. loading.close();
  1061. });
  1062. this.getProductList();
  1063. },
  1064. /* 样式配置按钮操作 */
  1065. handleStyle(row) {
  1066. const loading = this.$loading({
  1067. lock: true,
  1068. text: 'Loading',
  1069. spinner: 'el-icon-loading',
  1070. background: 'rgba(0, 0, 0, 0.7)'
  1071. });
  1072. const sscCompanyId = row.scyId || this.ids
  1073. console.log(sscCompanyId)
  1074. this.companyId = sscCompanyId
  1075. getStyleConfig(sscCompanyId).then(response => {
  1076. debugger
  1077. this.openStyle = true;
  1078. this.isShowDomain = false;
  1079. if(response.data.length > 0){
  1080. this.styleForm = response.data[0];
  1081. if(response.data[0].sscDomain){
  1082. this.isShowDomain = true;
  1083. }
  1084. var json = response.data[0].sscConfig;
  1085. const imgForm = JSON.parse(json);
  1086. const BackgroundImg = imgForm.BackgroundImg;
  1087. const indexLogo = imgForm.indexLogo;
  1088. const logo = imgForm.logo;
  1089. if(BackgroundImg){
  1090. this.imgList.push({url:BackgroundImg});
  1091. }
  1092. if(indexLogo){
  1093. this.IndexLogoList.push({url:indexLogo});
  1094. }
  1095. if(logo){
  1096. this.LogoList.push({url:logo});
  1097. }
  1098. }
  1099. this.title = "样式配置";
  1100. loading.close()
  1101. }).catch((r) => {
  1102. loading.close();
  1103. });
  1104. this.getStyleList();
  1105. },
  1106. /** 提交按钮 */
  1107. submitForm() {
  1108. var self = this;
  1109. this.$refs["form"].validate(valid => {
  1110. let fd = new FormData();
  1111. for(var key in self.form){
  1112. fd.append(key, self.form[key]);
  1113. // console.log(self.form[key]);
  1114. }
  1115. // fd.append("fileBlod", self.fileBlod);
  1116. if (valid) {
  1117. if (this.form.scyId != null) {
  1118. const loading = this.$loading({
  1119. lock: true,
  1120. text: "Loading",
  1121. spinner: "el-icon-loading",
  1122. background: "rgba(0, 0, 0, 0.7)",
  1123. })
  1124. updateCompany(self.form).then(response => {
  1125. this.msgSuccess("修改成功");
  1126. this.open = false;
  1127. this.getList();
  1128. });
  1129. loading.close();
  1130. } else {
  1131. const loading = this.$loading({
  1132. lock: true,
  1133. text: "Loading",
  1134. spinner: "el-icon-loading",
  1135. background: "rgba(0, 0, 0, 0.7)",
  1136. })
  1137. addCompany(self.form).then(response => {
  1138. this.msgSuccess("新增成功");
  1139. this.open = false;
  1140. this.getList();
  1141. });
  1142. loading.close();
  1143. }
  1144. }
  1145. });
  1146. },
  1147. /** 产品配置提交按钮 */
  1148. submitProductForm() {
  1149. this.$refs["productForm"].validate(valid => {
  1150. this.productForm.companyProduct = this.companyProduct
  1151. this.productForm.companyId = this.companyId
  1152. var flag = true
  1153. this.companyProduct.forEach(element => {
  1154. if(!element.date){
  1155. this.$message({
  1156. message: '请选择使用时间',
  1157. type: 'warning'
  1158. });
  1159. flag = false;
  1160. }
  1161. });
  1162. // console.log(this.productForm)
  1163. if (valid) {
  1164. if(flag){
  1165. const loading = this.$loading({
  1166. lock: true,
  1167. text: 'Loading',
  1168. spinner: 'el-icon-loading',
  1169. background: 'rgba(0, 0, 0, 0.7)'
  1170. });
  1171. addCompanyProductAttr(this.productForm).then(response => {
  1172. this.msgSuccess("配置成功");
  1173. loading.close();
  1174. this.openProduct = false;
  1175. this.getList();
  1176. }).catch((r) => {
  1177. loading.close();
  1178. });
  1179. }
  1180. }
  1181. });
  1182. },
  1183. /** 样式配置提交按钮 */
  1184. submitStyleForm() {
  1185. this.$refs["styleForm"].validate(valid => {
  1186. debugger
  1187. if(this.imgList[0]){
  1188. if(this.imgList[0].fileUrl){
  1189. this.styleForm.BackgroundImg = this.imgList[0].fileUrl;
  1190. }else{
  1191. this.styleForm.BackgroundImg = this.imgList[0].url;
  1192. }
  1193. }
  1194. const BackgroundImg = this.styleForm.BackgroundImg;
  1195. console.log(BackgroundImg)
  1196. if(this.LogoList[0]){
  1197. if(this.LogoList[0].fileUrl){
  1198. this.styleForm.logo = this.LogoList[0].fileUrl;
  1199. }else{
  1200. this.styleForm.logo = this.LogoList[0].url;
  1201. }
  1202. }
  1203. const logo = this.styleForm.logo;
  1204. console.log(logo)
  1205. if(this.IndexLogoList[0]){
  1206. if(this.IndexLogoList[0].fileUrl){
  1207. this.styleForm.indexLogo = this.IndexLogoList[0].fileUrl;
  1208. }else{
  1209. this.styleForm.indexLogo = this.IndexLogoList[0].url;
  1210. }
  1211. }
  1212. const indexLogo = this.styleForm.indexLogo;
  1213. console.log(indexLogo)
  1214. if(this.companyId){
  1215. this.styleForm.sscCompanyId = this.companyId;
  1216. }else{
  1217. this.styleForm.sscCompanyId = '';
  1218. }
  1219. if (valid) {
  1220. const sscCompanyId = this.companyId;
  1221. console.log(sscCompanyId)
  1222. const sscDomain = this.styleForm.sscDomain;
  1223. getStyleConfig(sscCompanyId).then(response => {
  1224. if(response.data.length > 0){
  1225. const sscId = response.data[0].sscId;
  1226. const loading = this.$loading({
  1227. lock: true,
  1228. text: 'Loading',
  1229. spinner: 'el-icon-loading',
  1230. background: 'rgba(0, 0, 0, 0.7)'
  1231. });
  1232. updateStyleConfig(BackgroundImg,logo,indexLogo,sscCompanyId,sscDomain,sscId).then(response => {
  1233. this.msgSuccess("配置成功");
  1234. loading.close();
  1235. this.openStyle = false;
  1236. this.getList();
  1237. }).catch((r) => {
  1238. loading.close();
  1239. });
  1240. this.reset();
  1241. } else {
  1242. const loading = this.$loading({
  1243. lock: true,
  1244. text: 'Loading',
  1245. spinner: 'el-icon-loading',
  1246. background: 'rgba(0, 0, 0, 0.7)'
  1247. });
  1248. addStyleConfig(this.styleForm).then(response => {
  1249. this.msgSuccess("配置成功");
  1250. loading.close();
  1251. this.openStyle = false;
  1252. this.getList();
  1253. }).catch((r) => {
  1254. loading.close();
  1255. });
  1256. this.reset();
  1257. }
  1258. });
  1259. }
  1260. });
  1261. },
  1262. /** 删除按钮操作 */
  1263. handleDelete(row) {
  1264. const scyIds = row.scyId || this.ids;
  1265. const scyName = row.scyName;
  1266. this.$confirm('是否确认删除公司名称为"' + scyName + '"的数据项?', "警告", {
  1267. confirmButtonText: "确定",
  1268. cancelButtonText: "取消",
  1269. type: "warning"
  1270. }).then(function() {
  1271. return delCompany(scyIds);
  1272. }).then(() => {
  1273. this.getList();
  1274. this.msgSuccess("删除成功");
  1275. })
  1276. .catch(() => {
  1277. this.$message({
  1278. type: "warning",
  1279. message: "已取消删除",
  1280. });
  1281. });
  1282. },
  1283. /** change 触发事件 */
  1284. selectAttr(item) {
  1285. const loading = this.$loading({
  1286. lock: true,
  1287. text: 'Loading',
  1288. spinner: 'el-icon-loading',
  1289. background: 'rgba(0, 0, 0, 0.7)'
  1290. });
  1291. let companyProduct = [];
  1292. //循环判断选中选项是否存在
  1293. item.forEach(element => {
  1294. //是否没有标识
  1295. var flag = false
  1296. if(this.companyProduct){
  1297. for (let i = 0;i < this.companyProduct.length; i++){
  1298. if(this.companyProduct[i].scpProducId == element){
  1299. //原集合中存在则取原值并跳出循环
  1300. companyProduct.push(this.companyProduct[i])
  1301. flag = false
  1302. break;
  1303. }else{
  1304. flag = true
  1305. }
  1306. }
  1307. }else{
  1308. flag = true
  1309. }
  1310. //原集合中没有则新增
  1311. if(flag){
  1312. companyProduct.push({scpProducId:element})
  1313. }
  1314. });
  1315. this.companyProduct = companyProduct
  1316. // console.log(this.companyProduct)
  1317. // console.log(item)
  1318. productAttrList(item).then(response => {
  1319. this.productAttrList = response.data;
  1320. // console.log(response)
  1321. if(this.productAttrList&&this.productAttrList.length!='0'){
  1322. this.isAttr = true
  1323. }else{
  1324. this.isAttr = false
  1325. }
  1326. loading.close();
  1327. // console.log(response)
  1328. }).catch((r) => {
  1329. loading.close();
  1330. });
  1331. },
  1332. /** 产品名称格式化 */
  1333. spiProducIdFormat(row, column){
  1334. // console.log(row)
  1335. return this.selectProducName(this.productList, row.scpProducId);
  1336. },
  1337. /** 附加字段code字典 */
  1338. codeFormat(code){
  1339. return this.selectDictLabel(this.attrCodeOptions, code);
  1340. },
  1341. // 产品字典
  1342. selectProducName(datas, value) {
  1343. var actions = [];
  1344. Object.keys(datas).some((key) => {
  1345. if (datas[key].spiProducId == ('' + value)) {
  1346. actions.push(datas[key].spiProducName);
  1347. return true;
  1348. }
  1349. })
  1350. return actions.join('');
  1351. },
  1352. /** 导出按钮操作 */
  1353. handleExport() {
  1354. this.download('/system/company/export', {
  1355. ...this.queryParams
  1356. }, `system_company.xlsx`)
  1357. },
  1358. timing() {
  1359. this.isShowTaskTime = true;
  1360. },
  1361. // getFileBold(data) {
  1362. // debugger;
  1363. // this.fileBlod = data[0].raw;
  1364. // console.log(this.fileBlod);
  1365. // }
  1366. }
  1367. };
  1368. </script>